using FineUIPro; using FineUIPro.iWareWms; using iWareCommon.Common.Entity; using iWareCommon.Common.EnumType; using iWareExcel.EXCEL.Entity; using iWareExcel.EXCEL.Service; using System; using System.Collections.Generic; namespace iWareWms.View.EXCEL.WorkBook { public partial class WorkBookDetail : PageBase { protected override void Save(out string msg) { WorkBookService.GetInstance().Save(GetWorkBook(), out msg); } protected override void Update(out string msg) { var workBook = GetWorkBook(); workBook.Id = Convert.ToInt32(Request.QueryString["Id"]); WorkBookService.GetInstance().Update(workBook, out msg); } private WorkBookEntity GetWorkBook() { return new WorkBookEntity { Name = Name.Text.Trim(), TemplatePath = TemplatePath.Text.Trim(), NeedTemplate = Convert.ToInt32(NeedTemplate.SelectedValue), ServerPath = ServerPath.Text.Trim(), ServerFileName = ServerFileName.Text.Trim(), Remark = Remark.Text.Trim(), HeadStartLine = Convert.ToInt32(HeadStartLine.Text.Trim()), DataStartLine = Convert.ToInt32(DataStartLine.Text.Trim()) }; } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { foreach (var label in Enum.GetValues(typeof(EYesOrNo))) { NeedTemplate.Items.Add(label.ToString(), ((int)label).ToString()); }; if (string.IsNullOrEmpty(Request.QueryString["IsEdit"])) { DataStartLine.Text = "0"; HeadStartLine.Text = "0"; return; } string msg; var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary { { "Id", Request.QueryString["Id"] } } }, out msg); if (!string.IsNullOrEmpty(msg)) { Alert.ShowInTop(msg); return; } Name.Text = workBooks.Count > 0 ? workBooks[0].Name : ""; TemplatePath.Text = workBooks.Count > 0 ? workBooks[0].TemplatePath : ""; NeedTemplate.SelectedValue = workBooks[0].NeedTemplate.ToString(); ServerPath.Text = workBooks.Count > 0 ? workBooks[0].ServerPath : ""; ServerFileName.Text = workBooks.Count > 0 ? workBooks[0].ServerFileName : ""; Remark.Text = workBooks.Count > 0 ? workBooks[0].Remark : ""; DataStartLine.Text = workBooks[0].DataStartLine.ToString(); HeadStartLine.Text = workBooks[0].HeadStartLine.ToString(); } } } }