222
schangxiang@126.com
2025-09-29 f782248da68c035aae12f902f29d828e9867abb0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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<string, object> { { "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();
 
            }
        }
 
 
 
    }
}