示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cbValueColumn.TargetTableControl   = cbTableComboBox;
            cbDisplayColumn.TargetTableControl = cbTableComboBox;
            if (!X.IsAjaxRequest)
            {
                LoadColumnTable();
                //select cac truong trong bang hien thoi
                DataTable datatable = DataController.DataHandler.GetInstance()
                                      .ExecuteDataTable("select top 1 * from " + TableName);
                foreach (DataColumn column in datatable.Columns)
                {
                    Ext.Net.ListItem item = new Ext.Net.ListItem();
                    item.Text  = column.ColumnName;
                    item.Value = column.ColumnName;
                    cbColumnField.Items.Add(item);
                }

                CheckboxSelectionModel1.Listeners.RowSelect.Handler =
                    "SaveColumnName(" + GridPanel2.ClientID + "," + txtSelectedColumnName.ClientID + ");";

                InitComponent();
                InitUpdateTableWindow();
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //this.Window1.Visible = false;

            if (this.IsPostBack && ThemeSelector.SelectedItems.Count > 0)
            {
                Ext.Net.ListItem themeItem = ThemeSelector.SelectedItem;

                switch (themeItem.Value)
                {
                case "0":
                    this.ResourceManager1.Theme = Ext.Net.Theme.Default;
                    //this.Window1.Visible = true;
                    break;

                case "1":
                    this.ResourceManager1.Theme = Ext.Net.Theme.Gray;
                    //this.Window1.Visible = true;
                    break;
                }
            }

            if (!X.IsAjaxRequest)
            {
                this.Store1.DataSource = new object[]
                {
                    new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
                    new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
                    new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
                    new object[] { "American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
                    new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" },
                    new object[] { "AT&T Inc.", 31.61, -0.48, -1.54, "9/1 12:00am" },
                    new object[] { "Boeing Co.", 75.43, 0.53, 0.71, "9/1 12:00am" },
                    new object[] { "Caterpillar Inc.", 67.27, 0.92, 1.39, "9/1 12:00am" },
                    new object[] { "Citigroup, Inc.", 49.37, 0.02, 0.04, "9/1 12:00am" },
                    new object[] { "E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28, "9/1 12:00am" },
                    new object[] { "Exxon Mobil Corp", 68.1, -0.43, -0.64, "9/1 12:00am" },
                    new object[] { "General Electric Company", 34.14, -0.08, -0.23, "9/1 12:00am" },
                    new object[] { "General Motors Corporation", 30.27, 1.09, 3.74, "9/1 12:00am" },
                    new object[] { "Hewlett-Packard Co.", 36.53, -0.03, -0.08, "9/1 12:00am" },
                    new object[] { "Honeywell Intl Inc", 38.77, 0.05, 0.13, "9/1 12:00am" },
                    new object[] { "Intel Corporation", 19.88, 0.31, 1.58, "9/1 12:00am" },
                    new object[] { "International Business Machines", 81.41, 0.44, 0.54, "9/1 12:00am" },
                    new object[] { "Johnson & Johnson", 64.72, 0.06, 0.09, "9/1 12:00am" },
                    new object[] { "JP Morgan & Chase & Co", 45.73, 0.07, 0.15, "9/1 12:00am" },
                    new object[] { "McDonald\"s Corporation", 36.76, 0.86, 2.40, "9/1 12:00am" },
                    new object[] { "Merck & Co., Inc.", 40.96, 0.41, 1.01, "9/1 12:00am" },
                    new object[] { "Microsoft Corporation", 25.84, 0.14, 0.54, "9/1 12:00am" },
                    new object[] { "Pfizer Inc", 27.96, 0.4, 1.45, "9/1 12:00am" },
                    new object[] { "The Coca-Cola Company", 45.07, 0.26, 0.58, "9/1 12:00am" },
                    new object[] { "The Home Depot, Inc.", 34.64, 0.35, 1.02, "9/1 12:00am" },
                    new object[] { "The Procter & Gamble Company", 61.91, 0.01, 0.02, "9/1 12:00am" },
                    new object[] { "United Technologies Corporation", 63.26, 0.55, 0.88, "9/1 12:00am" },
                    new object[] { "Verizon Communications", 35.57, 0.39, 1.11, "9/1 12:00am" },
                    new object[] { "Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63, "9/1 12:00am" }
                };

                this.Store1.DataBind();
            }
        }
示例#3
0
        /// <summary>
        /// 调入项目绑定
        /// </summary>
        protected void ProjectInLoad()
        {
            List <object>    data          = new List <object>();
            List <XMProject> XMProjectList = base.XMOrderInfoAPIService.GetXMProjectClientId(HozestERPContext.Current.User.CustomerID);

            //项目名称绑定--选取自运营项目
            if (HozestERPContext.Current.User.CustomerID == 7 || HozestERPContext.Current.User.CustomerID == 84 || HozestERPContext.Current.User.CustomerID == 658)
            {
                this.ProjectIn.Items.Clear();
                XMProjectList = base.XMProjectService.GetXMProjectList();
            }
            else
            {
                this.ProjectIn.Items.Clear();
                XMProjectList = base.XMProjectService.GetXMProjectListSS(HozestERPContext.Current.User.CustomerID, 0);
            }
            foreach (var paramXMProject in XMProjectList)
            {
                string id   = paramXMProject.Id.ToString();
                string name = paramXMProject.ProjectName;

                Ext.Net.ListItem liSex = new Ext.Net.ListItem();
                //每次创建一个Ext.Net.ListItem的对象
                liSex.Value = id;
                liSex.Text  = name;
                ProjectIn.Items.Add(liSex);
            }
            Ext.Net.ListItem liSexall = new Ext.Net.ListItem();
            //每次创建一个Ext.Net.ListItem的对象
            liSexall.Value = "-1";
            liSexall.Text  = "---所有---";
            ProjectIn.Items.Insert(0, liSexall);
        }
        private void GetGroupName()
        {
            string sSQL;

            sSQL  = "SELECT drg_grp AS GROUP_NAME FROM drug_list ";
            sSQL += "GROUP BY drg_grp ";
            sSQL += "ORDER BY drg_grp ";
            DataTable dt = db.Query(sSQL);

            Common.SetComboBoxItem(Cb_Group, dt, false, "GROUP_NAME", "GROUP_NAME");

            Ext.Net.ListItem litem2;
            litem2 = new Ext.Net.ListItem("(全部)", "(全部)");
            ComboBoxGroup.Items.Add(litem2);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    litem2 = new Ext.Net.ListItem(dt.Rows[i]["GROUP_NAME"].ToString(), dt.Rows[i]["GROUP_NAME"].ToString());
                    ComboBoxGroup.Items.Add(litem2);
                }
                ComboBoxGroup.GetStore().DataBind();
                Common.SetComboBoxValue(ComboBoxGroup, "药品", false);
            }
        }
示例#5
0
        private void GetGroupName()
        {
            string sSQL;

            sSQL = "SELECT pck_code AS CODE, pck_name AS NAME FROM package_setup ";
            DataTable dt = db.Query(sSQL);

            Common.SetComboBoxItem(ComboBoxPck, dt, true, "NAME", "NAME");

            Ext.Net.ListItem litem1;
            litem1 = new Ext.Net.ListItem("(全部)", "(全部)");
            ComboBoxGroup.Items.Add(litem1);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    litem1 = new Ext.Net.ListItem(dt.Rows[i]["NAME"].ToString(), dt.Rows[i]["NAME"].ToString());
                    ComboBoxGroup.Items.Add(litem1);
                }
                ComboBoxGroup.GetStore().DataBind();
                Common.SetComboBoxValue(ComboBoxGroup, "自体内瘘", false);
            }

            sSQL = "SELECT genst_code AS CODE, genst_desc AS NAME FROM general_setup WHERE genst_ctg='drgfreq'";//用藥頻率
            DataTable dt1 = db.Query(sSQL);

            Common.SetComboBoxItem(cb_ordfreq, dt1, true, "NAME", "NAME");
            cb_ordfreq.Select(0);

            sSQL = "SELECT med_code AS CODE, med_name AS NAME FROM med_way";//給藥方式
            dt1  = db.Query(sSQL);
            Common.SetComboBoxItem(cb_medway, dt1, true, "NAME", "NAME");
        }
示例#6
0
 /// <summary>
 /// Lấy dữ liệu để phục vụ việc cấu hình
 /// </summary>
 private void LoadDataForConfig()
 {
     try
     {
         if (OneManyForm.formInfo == null)
         {
             OneManyForm.formInfo = FormController.GetInstance().GetForm(this.GridPanelName + "OneManyForm");
         }
         List <OneManyFormInfo> rs = OneManyFormController.GetInstance()
                                     .GetAll(this.GridPanelName + "OneManyForm", 1);
         List <string> table =
             (from t in SoftCore.Util.GetInstance().GetRelationTable(OneManyForm.formInfo.TableName)
              where rs.Where(p => p.TableName == t).Count() == 0
              select t).ToList();
         foreach (string item in table)
         {
             Ext.Net.ListItem list = new Ext.Net.ListItem(item, item);
             cbTable.Items.Add(list);
         }
     }
     catch (Exception ex)
     {
         Dialog.ShowNotification("OneManyForm / LoadDataForConfig() = " + ex.Message);
     }
 }
示例#7
0
        /// <summary>
        /// 初始化ComboBox控件  ComboBox
        /// </summary>
        /// <param name="paramField_Start"></param>
        /// <param name="field"></param>
        /// <param name="isReadonly"></param>
        /// <returns></returns>
        private Field IniParamComboBox(string paramField_Start, ParamField field, bool isReadonly)
        {
            if (field.Type != ParamFieldType.ComboBox)
            {
                return(null);
            }
            ComboBox result = new ComboBox();

            result.Editable = false;
            DataTable dt = manager.GetComboBoxData(uiHelper.Name, field.FieldName);

            // .GetDataTableByStatement("GetComboBoxData@Select@" + uiHelper.Name + "@" + field.FieldName, null);
            foreach (DataRow row in dt.Rows)
            {
                Ext.Net.ListItem item = new Ext.Net.ListItem();
                item.Text  = row["ssValue"].ToString();
                item.Value = row["ssKey"].ToString();
                result.Items.Add(item);
            }
            if ((!field.Nullable) && (result.Items.Count > 0))
            {
                result.Value = result.Items[0].Value;
            }
            if (field.Nullable)
            {
                result.Triggers.Add(new FieldTrigger()
                {
                    Icon = TriggerIcon.Clear, HideTrigger = false
                });
                result.Listeners.TriggerClick.Handler = "this.clearValue();";
            }
            return(result);
        }
        private void BindddXMProject2()
        {
            #region 项目名称绑定

            //项目名称绑定--选取自运营项目
            if (HozestERPContext.Current.User.CustomerID == 7 || HozestERPContext.Current.User.CustomerID == 84 || HozestERPContext.Current.User.CustomerID == 658 || HozestERPContext.Current.User.CustomerID == 682 || HozestERPContext.Current.User.CustomerID == 670)
            {
                ddXMProject2.Items.Clear();
                var           projectList = base.XMProjectService.GetXMProjectList();
                Ext.Net.Store Store       = ddXMProject2.GetStore();
                projectList.Add(new XMProject()
                {
                    ProjectName = "---所有---",
                    Id          = -1,
                });
                Store.DataSource = projectList.OrderBy(a => a.Id);
                Store.DataBind();
                ddXMProject2.SelectedIndex = 0;
                ddXMProject2.Value         = "-1";
            }
            else
            {
                ddXMProject2.Items.Clear();
                var projectList = base.XMProjectService.GetXMProjectListSS(HozestERPContext.Current.User.CustomerID, 0)
                                  .GroupBy(p => new { p.Id, p.ProjectName })
                                  .Select(p => new
                {
                    Id          = p.Key.Id,
                    ProjectName = p.Key.ProjectName
                });
                if (projectList.Count() == 0)
                {
                    Ext.Net.ListItem liProject = new Ext.Net.ListItem();
                    liProject.Text  = "---无项目权限---";
                    liProject.Value = "0";
                    ddXMProject2.Items.Add(liProject);
                    ddXMProject2.Value = 0;
                }
                else
                {
                    Ext.Net.Store Store = ddXMProject2.GetStore();
                    Store.DataSource = projectList;
                    Store.DataBind();
                    ddXMProject2.SelectedIndex = 0;
                    ddXMProject2.Value         = projectList.ToList()[0].Id;
                }
                Ext.Net.ListItem liProject1 = new Ext.Net.ListItem();
                liProject1.Text  = "---所有---";
                liProject1.Value = "99";
                ddXMProject2.Items.Add(liProject1);
                ddXMProject2.Value = 99;
            }
            #endregion

            this.ddXMProject2_SelectedIndexChanged(null, null);//店铺
        }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        public void ShowGridPanelInformationConfig()
        {
            if (gridPanel == null)
            {
                gridPanel = GridController.GetInstance().GetGridPanel(GridPanelName);
            }
            cbTable.Text  = gridPanel.TableName;
            txtTitle.Text = gridPanel.Title;
            if (gridPanel.Width.HasValue)
            {
                txtwidth.Text = gridPanel.Width.Value.ToString();
            }
            if (gridPanel.Height.HasValue)
            {
                txtheight.Text = gridPanel.Height.Value.ToString();
            }
            txtIcon.Text               = gridPanel.Icon;
            cbAutoExpandColumn.Text    = gridPanel.AutoExpandColumn;
            chkHeader.Checked          = gridPanel.Header;
            chkRowNumber.Checked       = gridPanel.DisplayRowNumber;
            chkFilter.Checked          = gridPanel.AllowFilter;
            chkCheckBox.Checked        = gridPanel.RowCheckBox;
            chkAllowEditOnGrid.Checked = gridPanel.AllowEditOnGrid;
            chkOneManyForm.Checked     = gridPanel.OneManyForm;
            wdUpdatePanelInfo.Show();
            cbPageSize.SelectedIndex = gridPanel.PageSize.Value / 5 - 1;
            txtWhereClause.Text      = gridPanel.WhereClause;
            txtOrderBy.Text          = gridPanel.OrderBy;
            int index = 0;

            cbInformationPanel.SelectedIndex = index;
            foreach (var item in cbInformationPanel.Items)
            {
                if (item.Value == gridPanel.InformationPanel)
                {
                    cbInformationPanel.SelectedIndex = index;
                    break;
                }

                index++;
            }
            //Load các trường dữ liệu của bảng hiện thời

            DataTable datatable = DataController.DataHandler.GetInstance()
                                  .ExecuteDataTable("select top 1 * from " + TableName);

            foreach (DataColumn column in datatable.Columns)
            {
                Ext.Net.ListItem item = new Ext.Net.ListItem();
                item.Text  = column.ColumnName;
                item.Value = column.ColumnName;
                cbColumnField.Items.Add(item);
                //cbbColumnField.Items.Add(item);
            }
        }
示例#10
0
        private void Show_FloorArea()
        {
            string sql = "SELECT distinct mac_flr, mac_sec FROM mac_setup WHERE 1=1 ORDER BY mac_flr, mac_sec";

            dt = db.Query(sql);
            if (dt.Rows.Count > 0)
            {
                if (Session["PAD_FLOOR"] == null)
                {
                    sFLOOR.Text = dt.Rows[0]["mac_flr"].ToString();
                }
                else
                {
                    if (Session["PAD_FLOOR"].ToString() != dt.Rows[0]["mac_flr"].ToString())
                    {
                        Session["PAD_FLOOR"] = dt.Rows[0]["mac_flr"].ToString();
                    }
                    sFLOOR.Text = Session["PAD_FLOOR"].ToString();
                }
                if (Session["PAD_AREA"] == null)
                {
                    sAREA.Text = dt.Rows[0]["mac_sec"].ToString();
                }
                else
                {
                    sAREA.Text = Session["PAD_AREA"].ToString();
                }
            }

            sql = "SELECT distinct mac_flr FROM mac_setup WHERE 1=1 ORDER BY mac_flr ";
            DataTable dt1 = db.Query(sql);

            for (int i = 0; i < dt1.Rows.Count; i++)
            {
                Ext.Net.ListItem litem;
                litem = new Ext.Net.ListItem(dt1.Rows[i]["mac_flr"].ToString() + "楼", dt1.Rows[i]["mac_flr"].ToString());
                this.cboFLOOR.Items.Add(litem);
            }
            this.cboFLOOR.GetStore().DataBind();

            if (dt1.Rows.Count > 0)
            {
                this.cboFLOOR.Disabled = false;
                this.cboFLOOR.Select(sFLOOR.Text);
                FILL_AREA(sFLOOR.Text, sAREA.Text);
                FILL_BED();
            }
            else
            {
                this.cboFLOOR.Disabled = true;
                this.cboAREA.Disabled  = true;
            }

            db.myConnection.Close();
        }
示例#11
0
 /// <summary>
 /// 输出MI
 /// </summary>
 /// <param name="comboBox"></param>
 /// <param name="grade"></param>
 private void setMino(ComboBox comboBox, PsbMino[] Mino)
 {
     comboBox.Items.Clear();
     foreach (var var in Mino)
     {
         var item = new Ext.Net.ListItem();
         item.Value = var.Mino;
         item.Text  = var.Midsc;
         comboBox.Items.Add(item);
     }
 }
示例#12
0
 /// <summary>
 /// 输出品级信息
 /// </summary>
 private void setgrade(ComboBox comboBox, PsbGrade[] grade)
 {
     comboBox.Items.Clear();
     foreach (var var in grade)
     {
         var item = new Ext.Net.ListItem();
         item.Value = var.GradeNo;
         item.Text  = var.GradeDesc;
         comboBox.Items.Add(item);
     }
 }
示例#13
0
        protected void FILL_AREA(string _floor, string _area)
        {
            Boolean bTEMP = false;
            string  sTEMP = "";

            if (Session["PAD_AREA"] != null)
            {
                sTEMP = Session["PAD_AREA"].ToString();
            }
            System.Data.DataView dv = new System.Data.DataView();
            dv = dtAREA.DefaultView;

            dv.RowFilter = "mac_flr='" + _floor + "' ";
            this.cboAREA.Items.Clear();
            Ext.Net.ListItem litem;
            litem = new Ext.Net.ListItem("全区", "全区");
            this.cboAREA.Items.Add(litem);
            for (int i = 0; i < dv.Count; i++)
            {
                litem = new Ext.Net.ListItem(dv[i]["mac_sec"].ToString() + "区", dv[i]["mac_sec"].ToString());
                this.cboAREA.Items.Add(litem);
                if (sTEMP == dv[i]["mac_sec"].ToString())
                {
                    bTEMP = true;
                }
            }
            this.cboAREA.GetStore().DataBind();
            if (dv.Count > 0)
            {
                if (bTEMP)
                {
                    _area = sTEMP;
                }
                else
                {
                    _area = "";
                }
                this.cboAREA.Disabled = false;
                if (_area == "")
                {
                    this.cboAREA.Select(0);
                    sAREA.Text = "全区";
                }
                else
                {
                    this.cboAREA.Select(_area);
                    sAREA.Text = _area;
                }
            }
            else
            {
                this.cboAREA.Disabled = true;
            }
        }
 private void GetGroupName()
 {
     string[]         typecode = { "DH", "HN", "NU", "DC", "SK", "AD" };
     string[]         typename = { "主任", "护理长", "护士", "医生", "行政", "系统管理员" };
     Ext.Net.ListItem litem1;
     for (int i = 0; i < typecode.Length; i++)
     {
         litem1 = new Ext.Net.ListItem(typename[i], typecode[i]);
         ComboBoxGroup.Items.Add(litem1);
         ComboBox1.Items.Add(litem1);
     }
 }
示例#15
0
        protected void FILL_DRGLIST(string _drggrp)
        {
            DBMysql db = new DBMysql();

            string sSQL = "SELECT drg_name FROM drug_list where drg_grp = '" + _drggrp + "'";

            System.Data.DataTable dtDRUGLIST = db.Query(sSQL);
            for (int k = 0; k < dtDRUGLIST.Rows.Count; k++)
            {
                Ext.Net.ListItem litem2;
                litem2 = new Ext.Net.ListItem(dtDRUGLIST.Rows[k]["drg_name"].ToString());
                this.cbo_druglist.Items.Add(litem2);
            }
            this.cbo_druglist.GetStore().DataBind();
        }
示例#16
0
        protected void SetComboBox()
        {
            Ext.Net.ListItem litem1;
            string[]         GroupName = new string[3] {
                "", "男", "女"
            };
            for (int i = 0; i < GroupName.Length; i++)
            {
                litem1 = new Ext.Net.ListItem(GroupName[i], GroupName[i]);
                cbo_Sex.Items.Add(litem1);
            }

            GroupName = new string[4] {
                "身分证", "军官证", "护照", "其他"
            };
            for (int i = 0; i < GroupName.Length; i++)
            {
                litem1 = new Ext.Net.ListItem(GroupName[i], GroupName[i]);
                cbo_idkind.Items.Add(litem1);
            }

            GroupName = new string[4] {
                "医生", "护士", "工勤人员", "技术人员"
            };
            for (int i = 0; i < GroupName.Length; i++)
            {
                litem1 = new Ext.Net.ListItem(GroupName[i], GroupName[i]);
                cbo_empkind.Items.Add(litem1);
            }

            GroupName = new string[5] {
                "博士", "硕士", "学士", "大专", "中专"
            };
            for (int i = 0; i < GroupName.Length; i++)
            {
                litem1 = new Ext.Net.ListItem(GroupName[i], GroupName[i]);
                cbo_eduLevel.Items.Add(litem1);
            }

            GroupName = new string[7] {
                "住院医师", "主治医师", "副主任医师", "主任医师", "护士", "护师", "主管护师"
            };
            for (int i = 0; i < GroupName.Length; i++)
            {
                litem1 = new Ext.Net.ListItem(GroupName[i], GroupName[i]);
                cbo_jobTitle.Items.Add(litem1);
            }
        }
        protected void Show_Area()
        {
            string    sSQL = "SELECT distinct mac_sec AS CODE, CONCAT(mac_sec,'区') AS NAME FROM mac_setup";
            DataTable dt1  = db.Query(sSQL);

            Ext.Net.ListItem items;
            items = new Ext.Net.ListItem("全区", "全区");
            cboArea.Items.Add(items);
            foreach (DataRow dr in dt1.Rows)
            {
                items = new Ext.Net.ListItem(dr["NAME"].ToString(), dr["CODE"].ToString());
                cboArea.Items.Add(items);
            }
            cboArea.Select(0);
            sAREA.Text = "全区";
        }
示例#18
0
 static public void SetComboBoxItem(ComboBox cc, DataTable dd, Boolean bb, string sNAME, string sCODE)
 {
     Ext.Net.ListItem litem;
     cc.Items.Clear();
     if (bb == true)
     {
         litem = new Ext.Net.ListItem(" ", " ");
         cc.Items.Add(litem);
     }
     for (int i = 0; i < dd.Rows.Count; i++)
     {
         litem = new Ext.Net.ListItem(dd.Rows[i][sNAME].ToString(), dd.Rows[i][sCODE].ToString());
         cc.Items.Add(litem);
     }
     cc.GetStore().DataBind();
 }
示例#19
0
        private void BindDepartment(int entID, ComboBox ddlDepartment, string parentString, List <Department> departments)
        {
            string newParentString = parentString;

            for (int i = 0; i < departments.Count; i++)
            {
                var  department = departments[i];
                bool isLast     = false;
                if ((i + 1) == departments.Count)
                {
                    isLast = true;
                }
                var  childDepartments = base.EnterpriseService.GetDepartmentByParentID(entID, department.DepartmentID);
                bool hasChild         = childDepartments.Count > 0 ? true : false;
                newParentString = GetPreFix(isLast, hasChild, parentString);
                Ext.Net.ListItem item = new Ext.Net.ListItem(newParentString + department.DepName, department.DepartmentID.ToString());
                ddlDepartment.Items.Add(item);
                if (hasChild)
                {
                    BindDepartment(entID, ddlDepartment, newParentString, childDepartments);
                }
            }
        }
示例#20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     cbValueColumn.TargetTableControl   = cbTableComboBox;
     cbDisplayColumn.TargetTableControl = cbTableComboBox;
     if (!X.IsAjaxRequest)
     {
         LoadColumnTable();
         //select cac truong trong bang hien thoi
         DataTable datatable = DataController.DataHandler.GetInstance().ExecuteDataTable("select top 1 * from " + TableName);
         foreach (DataColumn column in datatable.Columns)
         {
             Ext.Net.ListItem item = new Ext.Net.ListItem();
             item.Text  = column.ColumnName;
             item.Value = column.ColumnName;
             cbColumnField.Items.Add(item);
         }
     }
     if (!X.IsAjaxRequest)
     {
         InitComponent();
         btnReloadData.Listeners.Click.Handler = FieldStore.ClientID + ".reload();";
     }
 }
        /// <summary>
        /// 项目类型 关联项目名称
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cbXMProjectTypeId_Change(object sender, EventArgs e)
        {
            if (Convert.ToInt32(this.cbXMProjectTypeId.Value) > 0)
            {
                var ProjectTypeList = base.XMProjectService.GetXMProjectProjectTypeId(Convert.ToInt32(this.cbXMProjectTypeId.Value));

                #region 项目名称绑定

                //平台类型动态数据绑定
                this.cbXMProject.Items.Clear();
                //list 转 DateTable
                DataTable dtproject = new DataTable();
                dtproject.Columns.Add("Id");
                dtproject.Columns.Add("ProjectName");
                foreach (var project in ProjectTypeList)
                {
                    DataRow dr = dtproject.NewRow();
                    dr["Id"]          = project.Id;
                    dr["ProjectName"] = project.ProjectName;
                    dtproject.Rows.Add(dr);
                }
                //平台下拉框绑定数据源
                foreach (DataRow dr_Secret in dtproject.Rows)              //遍历获取两个值
                {
                    Ext.Net.ListItem Secretslist = new Ext.Net.ListItem(); //每次创建一个Ext.Net.ListItem的对象
                    Secretslist.Value = dr_Secret["Id"].ToString();
                    Secretslist.Text  = dr_Secret["ProjectName"].ToString();
                    this.cbXMProject.Items.Add(Secretslist);
                }
                this.cbXMProject.Items.Insert(0, new Ext.Net.ListItem("--所有--", "-1"));
                this.cbXMProject.Value = "-1";

                #endregion

                this.ComboBoxXMProjectPanel.UpdateContent();
            }
        }
        /// <summary>
        /// 项目名称 关联店铺
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cbXMProject_Change(object sender, EventArgs e)
        {
            if (Convert.ToInt32(this.cbXMProject.Value) > 0)
            {
                // this.cbNick.DataBind(); ;

                var nickList = base.XMOrderInfoAPIService.GetXMNickList("", Convert.ToInt32(true), Convert.ToInt32(this.cbXMProject.Value));

                #region 店铺名称绑定

                //list 转 DateTable
                DataTable dtNick1 = new DataTable();
                dtNick1.Columns.Add("nick_id");
                dtNick1.Columns.Add("nick");
                foreach (var nick in nickList)
                {
                    DataRow dr = dtNick1.NewRow();
                    dr["nick_id"] = nick.nick_id;
                    dr["nick"]    = nick.nick;
                    dtNick1.Rows.Add(dr);
                }
                //平台下拉框绑定数据源
                foreach (DataRow dr_Secret in dtNick1.Rows)                //遍历获取两个值
                {
                    Ext.Net.ListItem Secretslist = new Ext.Net.ListItem(); //每次创建一个Ext.Net.ListItem的对象
                    Secretslist.Value = dr_Secret["nick_id"].ToString();
                    Secretslist.Text  = dr_Secret["nick"].ToString();
                    this.cbNick.Items.Add(Secretslist);
                }
                this.cbNick.Items.Insert(0, new Ext.Net.ListItem("-所有-", "-1"));
                this.cbNick.Value = "-1";
                #endregion


                this.ComboBoxPanel1.UpdateContent();
            }
        }
示例#23
0
        protected void SetComboBox()
        {
            string    sSQL = "SELECT ins_name AS NAME, ins_code AS CODE FROM ins_setup";
            DataTable dt   = db.Query(sSQL);

            Common.SetComboBoxItem(ComboBox_ins, dt, true, "NAME", "CODE");

            sSQL = "SELECT pck_code AS CODE, pck_name AS NAME FROM package_setup WHERE pck_status='Y'"; //血管通路类型
            dt   = db.Query(sSQL);
            Common.SetComboBoxItem(cbo_h_type, dt, true, "NAME", "CODE");

            sSQL = "SELECT hp2_code AS CODE, hp2_name AS NAME FROM hpack2_setup WHERE hp2_status='Y'"; //透析器型號
            dt   = db.Query(sSQL);
            Common.SetComboBoxItem(cbo_machine_model, dt, true, "NAME", "CODE");

            sSQL = "SELECT hp3_code AS CODE, hp3_name AS NAME FROM hpack3_setup WHERE hp3_status='Y'"; //血管通路
            dt   = db.Query(sSQL);
            Common.SetComboBoxItem(cbo_hpack3, dt, true, "NAME", "CODE");

            sSQL  = "SELECT name AS NAME FROM access_level ";
            sSQL += "WHERE (type='DH' OR type='DC') AND active='A' ";
            dt    = db.Query(sSQL);
            Common.SetComboBoxItem(cbo_docname, dt, true, "NAME", "NAME");

            Ext.Net.ListItem litem1;
            litem1 = new Ext.Net.ListItem(" ", " ");
            ComboBox_grp.Items.Add(litem1);
            litem1 = new Ext.Net.ListItem("A", "A");
            ComboBox_grp.Items.Add(litem1);
            litem1 = new Ext.Net.ListItem("B", "B");
            ComboBox_grp.Items.Add(litem1);
            litem1 = new Ext.Net.ListItem("AB", "AB");
            ComboBox_grp.Items.Add(litem1);
            litem1 = new Ext.Net.ListItem("O", "O");
            ComboBox_grp.Items.Add(litem1);
        }
示例#24
0
        private void Show_TimeSec()
        {
            Ext.Net.ListItem litem1 = new Ext.Net.ListItem("上午", "001");
            cboTIME.Items.Add(litem1);
            litem1 = new Ext.Net.ListItem("下午", "002");
            cboTIME.Items.Add(litem1);
            litem1 = new Ext.Net.ListItem("晚班", "003");
            cboTIME.Items.Add(litem1);

            DateTime now = DateTime.Now;

            if (Session["PAD_TIME"] == null)
            {
                int Hm = int.Parse(now.ToString("HHmm"));
                if (1 <= Hm && Hm <= 1159)
                {
                    sTIME.Text = "001";
                    cboTIME.Select(sTIME.Text);
                }
                else if (1200 <= Hm && Hm <= 1759)
                {
                    sTIME.Text = "002";
                    cboTIME.Select(sTIME.Text);
                }
                else if (1800 <= Hm && Hm <= 2400)
                {
                    sTIME.Text = "003";
                    cboTIME.Select(sTIME.Text);
                }
            }
            else
            {
                sTIME.Text = Session["PAD_TIME"].ToString();
                cboTIME.Select(sTIME.Text);
            }
        }
示例#25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                System.Data.DataTable dtDRUGGRP = db.Query("SELECT distinct drg_grp FROM drug_list");
                for (int i = 0; i < dtDRUGGRP.Rows.Count; i++)
                {
                    Ext.Net.ListItem litem;
                    litem = new Ext.Net.ListItem(dtDRUGGRP.Rows[i]["drg_grp"].ToString());
                    this.cbo_druggrp.Items.Add(litem);
                }
                this.cbo_druggrp.GetStore().DataBind();

                System.Data.DataTable dtDRUGFREQ = db.Query("SELECT genst_desc FROM general_setup where genst_ctg = 'drgfreq'");
                for (int k = 0; k < dtDRUGFREQ.Rows.Count; k++)
                {
                    Ext.Net.ListItem litem2;
                    litem2 = new Ext.Net.ListItem(dtDRUGFREQ.Rows[k]["genst_desc"].ToString());
                    this.cmb_ordfreq.Items.Add(litem2);
                }
                this.cmb_ordfreq.GetStore().DataBind();

                //給藥方式
                System.Data.DataTable dtDRUGFRER = db.Query("SELECT med_name FROM med_way");
                for (int k = 0; k < dtDRUGFRER.Rows.Count; k++)
                {
                    Ext.Net.ListItem litem3;
                    litem3 = new Ext.Net.ListItem(dtDRUGFRER.Rows[k]["med_name"].ToString());
                    this.cmd_medway.Items.Add(litem3);
                }
                this.cmd_medway.GetStore().DataBind();


                patient_id.Text = Request.QueryString["person_id"];

                patient_name.Text = Request.QueryString["patient_name"];
                patient_sex.Text  = Request.QueryString["pat_sex"];
                txt_orddoc.Text   = Request.QueryString["pat_docname"];
                floor.Text        = Request.QueryString["floor"];
                area.Text         = Request.QueryString["area"];
                time.Text         = Request.QueryString["time"];
                bedno.Text        = Request.QueryString["bedno"];
                daytyp.Text       = Request.QueryString["daytyp"];
                if (patient_name.Text == null)
                {
                    patient_name.Text = Request.QueryString["amp;patient_name"];
                    patient_sex.Text  = Request.QueryString["amp;pat_sex"];
                    txt_orddoc.Text   = Request.QueryString["amp;pat_docname"];
                    floor.Text        = Request.QueryString["amp;floor"];
                    area.Text         = Request.QueryString["amp;area"];
                    time.Text         = Request.QueryString["amp;time"];
                    bedno.Text        = Request.QueryString["amp;bedno"];
                    daytyp.Text       = Request.QueryString["amp;daytyp"];
                }


                txt_orddate.Text = DateTime.Now.ToString("yyyy-MM-dd");
                txt_ordtime.Text = DateTime.Now.ToString("HH:mm");

                show();
                Show_shortdrughistory();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var countries = ObjectContext.Countries;
            foreach (var item in countries)
            {
                Ext.Net.ListItem listItem = new Ext.Net.ListItem();
                listItem.Text = item.Name;
                listItem.Value = item.Id.ToString();
                cmbCountry.Items.Add(listItem);
            }
            cmbCountry.SelectedItem.Text = "Philippines";
            txtCityOrMunicipality.Text = ApplicationSettings.DefaultCity;
            txtPostalCode.Text = ApplicationSettings.DefaultPostalCode;

            if (X.IsAjaxRequest == false && this.IsPostBack == false)
            {
                string mode = Request.QueryString["mode"].ToLower();
                this.ParentResourceGuid = Request.QueryString["ResourceGuid"];
                LoanApplicationForm form = this.Retrieve<LoanApplicationForm>(ParentResourceGuid);

                var landTypes = LandType.All();
                storeLandType.DataSource = landTypes;
                storeLandType.DataBind();

                var uom = UnitOfMeasure.All(UnitOfMeasureType.LengthUnitType);
                storeUnitOfMeasureType.DataSource = uom;
                storeUnitOfMeasureType.DataBind();

                hiddenMode.Value = mode;
                if (mode == "add")
                {
                    LandCollateral collateral = this.CreateOrRetrieveBOM<LandCollateral>();
                }
                else
                {
                    hiddenRandomKey.Value = Request.QueryString["RandomKey"];
                    LandCollateral collateral = (LandCollateral)form.RetrieveCollateral(hiddenRandomKey.Text);
                    this.Register(collateral);

                    Fill(collateral);
                }
            }
        }
 /// <summary>
 ///
 /// </summary>
 public ListItem.Builder ListItem(ListItem component)
 {
     return(new ListItem.Builder(component));
 }
示例#28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                cs.DBCommand dbc = new cs.DBCommand();
                //判断登录状态
                //string wr = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode("CRP");
                ////string newsql = "select distinct PersonID from Ecommon";
                //string newsql = "select distinct PersonID from ETravel";
                //DataTable newdt = dbc.GetData("eReimbursement", newsql);
                //for (int i = 0; i < newdt.Rows.Count; i++)
                //{
                //    DataSet dstest = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(newdt.Rows[i]["PersonID"].ToString());
                //    if (dstest.Tables[0].Rows.Count == 1)
                //    {
                //        DataTable dtnew = dstest.Tables[0];
                //        string odep = dtnew.Rows[0]["CRPDepartmentName"].ToString();
                //        //string upsqp = "update Ecommon set Department='" + odep + "' where PersonID='" + newdt.Rows[i]["PersonID"].ToString() + "'";
                //        string upsqp = "update ETravel set Department='" + odep + "' where PersonID='" + newdt.Rows[i]["PersonID"].ToString() + "'";
                //        string newid = dbc.UpdateData("eReimbursement", upsqp, "Update");
                //    }
                //}
                //DataSet dsuserinfo = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList("A0971");


                if (Request.Cookies.Get("eReimUserID") == null)
                {
                    X.AddScript("loginWindow.show();Panel1.disable();");
                    return;
                }
                else
                {
                    hdUser.Value = Request.Cookies.Get("eReimUserID").Value;
                    ScriptManager.RegisterStartupScript(this, GetType(), "", "$('div.gn_person ul.q-menubox li:eq(0) a').text('" + Request.Cookies.Get("eReimUserName").Value + "');", true);
                    X.AddScript("loginWindow.hide();Panel1.enable();");
                }

                
                ////取得对美元汇率
                //DataSet ds2 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(Request.Cookies.Get("eReimUserID").ToString());
                //string station = "";
                //if (ds2.Tables[0].Rows.Count == 1)
                //{
                //    DataTable dt1 = ds2.Tables[0];
                //    station = dt1.Rows[0]["stationCode"].ToString();
                //    DataTable dttemp = new DataTable();
                //    string sqltemp = "select * from ESUSER where Userid='" + Request.Cookies.Get("eReimUserID").ToString() + "'";
                //    dttemp = dbc.GetData("eReimbursement", sqltemp);
                //    if (dttemp.Rows.Count > 0)
                //    {
                //        station = dttemp.Rows[0]["Station"].ToString();
                //    }
                //}
                //hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(station), 3);


                hdSubStatus.Value = "0";

                if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                {
                    //PagingToolbar1.DisplayMsg = "显示 {0} - {1} of {2}";
                    ResourceManager1.Locale = "zh-CN";
                }
                else
                {
                    //PagingToolbar1.DisplayMsg = "Displaying items {0} - {1} of {2}";
                    ResourceManager1.Locale = "en-US";
                }

                //if (Request.Cookies["lang"] != null)
                //{
                //    string lang = Request.Cookies["lang"].Value;
                //    if (lang.ToLower() == "en-us")
                //    {
                        
                //        PagingToolbar1.DisplayMsg = "Displaying items {0} - {1} of {2}";
                //        ResourceManager1.Locale = "en-US";
                //    }
                //    else
                //    {
                        
                //        PagingToolbar1.DisplayMsg = "显示 {0} - {1} of {2}";
                //        ResourceManager1.Locale = "zh-CN";
                //    }
                //}
                //Panel3.Title = Resources.LocalText.GeneralExpenseApply + "-" + Resources.LocalText.TableNo + ":BJS1001";
                if (Request.QueryString["ID"] != null)
                {
                    string ID = Request.QueryString["ID"].ToString();
                    System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d*$");
                    if (reg1.IsMatch(ID))
                    {
                        string sql = "select * from V_Eflow_ETravel where RequestID='" + ID + "' and [Type]='G' and (Active=1 or Active=2)";
                        DataTable dt = new DataTable();
                        dt = dbc.GetData("eReimbursement", sql);
                        if (dt != null && dt.Rows.Count == 1)
                        {
                            if (Request.Cookies.Get("eReimUserID").Value == dt.Rows[0]["PersonID"].ToString())//本人
                            {
                                //准备下拉菜单内容
                                Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value);
                                cbxPerson.Items.Add(li);
                                string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'";
                                DataTable dtitem = dbc.GetData("eReimbursement", sqlitem);
                                int itemcount = 0;
                                for (int j = 0; j < dtitem.Rows.Count; j++)
                                {
                                    string sqlpara = sqlitem;
                                    if (dtitem.Rows[j][5].ToString() != "")
                                    {
                                        sqlpara += " and getdate()>='" + dtitem.Rows[j][5].ToString() + "' ";
                                    }
                                    if (dtitem.Rows[j][6].ToString() != "")
                                    {
                                        sqlpara += " and getdate()<='" + dtitem.Rows[j][6].ToString() + "' ";
                                    }
                                    DataTable dtitem1 = dbc.GetData("eReimbursement", sqlpara);
                                    for (int m = 0; m < dtitem1.Rows.Count; m++)
                                    {
                                        li = new Ext.Net.ListItem(dtitem.Rows[m][1].ToString(), dtitem.Rows[m][2].ToString());
                                        cbxPerson.Items.Add(li);
                                        itemcount++;
                                    }
                                }

                                //更改按钮状态
                                if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                {
                                    if (Request.QueryString["Copy"] != null)
                                    {
                                        if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                        {
                                            X.AddScript("btnSaveAndSend.enable();");
                                        }
                                        else
                                        {
                                            ErrorHandle("Data Error.");
                                        }
                                    }
                                    else//查看已申请数据
                                    {
                                        string app = "";
                                        if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                        {
                                            Panel3.Title = "通用申请单: " + dt.Rows[0]["No"].ToString();
                                            //读取当前状态,显示在下方文本框内

                                            if (dt.Rows[0]["Status"].ToString() == "1")
                                            {
                                                app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString();
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "2")
                                            {
                                                app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "3")
                                            {
                                                app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }

                                            if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                            {
                                                hdSubStatus.Value = "2";
                                                app += ". 完成.";
                                            }
                                            else
                                            {
                                                hdSubStatus.Value = "1";
                                            }
                                        }
                                        else
                                        {
                                            Panel3.Title = "General Expense Form: " + dt.Rows[0]["No"].ToString();
                                            //读取当前状态,显示在下方文本框内

                                            if (dt.Rows[0]["Status"].ToString() == "1")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "2")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "3")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }

                                            if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                            {
                                                hdSubStatus.Value = "2";
                                                app += ". Complete.";
                                            }
                                            else
                                            {
                                                hdSubStatus.Value = "1";
                                            }
                                        }

                                        X.AddScript("btnE.disable();btnT.disable();btnC.disable();btnO.disable();btnSaveDraft.disable();btnCC.disable();");
                                        labelInfo.Text = app;
                                    }
                                }
                                else//草稿
                                {
                                    if (Request.QueryString["Copy"] != null)
                                    {
                                        if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                        {
                                            X.AddScript("btnSaveAndSend.enable();");
                                        }
                                        else
                                        {
                                            ErrorHandle("Data Error.");
                                        }
                                    }
                                    else
                                    {
                                        if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                        {
                                            Panel3.Title = "通用申请单草稿: " + dt.Rows[0]["No"].ToString();
                                        }
                                        else
                                        {
                                            Panel3.Title = "General Expense Draft: " + dt.Rows[0]["No"].ToString();
                                        }
                                        X.AddScript("btnSaveAndSend.enable();");
                                    }
                                }
                                //载入通用数据
                                LoadData(dt, true);
                            }
                            else
                            {
                                //判断是否为代理人
                                bool isagent = false;//记录Session["UserID"]是否为代理人
                                string sqlagent = "select * from Eagent where [St]=1 and [OwnerID]='" + dt.Rows[0]["PersonID"].ToString() + "' and getdate()<=Edate and getdate()>=Bdate";
                                DataTable dtagent = dbc.GetData("eReimbursement", sqlagent);
                                for (int g = 0; g < dtagent.Rows.Count; g++)
                                {
                                    if (Request.Cookies.Get("eReimUserID").Value == dtagent.Rows[g]["PAgentID"].ToString())
                                    {
                                        isagent = true;
                                        break;
                                    }
                                }
                                if (isagent)//代理人访问
                                {
                                    Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString());
                                    cbxPerson.Items.Add(li);
                                    //更改按钮状态
                                    if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                    {
                                        if (Request.QueryString["Copy"] != null)
                                        {
                                            if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                            {
                                                X.AddScript("btnSaveAndSend.enable();");
                                            }
                                            else
                                            {
                                                ErrorHandle("Data Error.");
                                            }
                                        }
                                        else
                                        {
                                            string app = "";
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "通用申请单: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    hdSubStatus.Value = "2";
                                                    app += ". 完成.";
                                                }
                                                else
                                                {
                                                    hdSubStatus.Value = "1";
                                                }
                                            }
                                            else
                                            {
                                                Panel3.Title = "General Expense Form: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    hdSubStatus.Value = "2";
                                                    app += ". Complete.";
                                                }
                                                else
                                                {
                                                    hdSubStatus.Value = "1";
                                                }
                                            }

                                            X.AddScript("btnE.disable();btnT.disable();btnC.disable();btnO.disable();btnSaveDraft.disable();btnCC.disable();");
                                            labelInfo.Text = app;
                                        }
                                    }
                                    else//草稿
                                    {
                                        if (Request.QueryString["Copy"] != null)
                                        {
                                            if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                            {
                                                X.AddScript("btnSaveAndSend.enable();");
                                            }
                                            else
                                            {
                                                ErrorHandle("Data Error.");
                                            }
                                        }
                                        else
                                        {
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "通用申请单草稿: " + dt.Rows[0]["No"].ToString();
                                            }
                                            else
                                            {
                                                Panel3.Title = "General Expense Draft: " + dt.Rows[0]["No"].ToString();
                                            }


                                            X.AddScript("btnSaveAndSend.enable();");
                                        }
                                    }
                                    //载入通用数据
                                    LoadData(dt, true);
                                }
                                else//判断是否有跨站权限
                                {
                                    bool hasright = false;
                                    string getright = "select * from StationRole where UserID='" + Request.Cookies.Get("eReimUserID").Value + "'";
                                    DataTable dtright = dbc.GetData("eReimbursement", getright);
                                    for (int j = 0; j < dtright.Rows.Count; j++)
                                    {
                                        string[] dd = dtright.Rows[j]["Stations"].ToString().Split(',');
                                        for (int i = 0; i < dd.Length; i++)
                                        {
                                            if (dd[i] == dt.Rows[0]["Station"].ToString())//有权限
                                            {
                                                hasright = true;
                                                break;
                                            }
                                        }
                                    }
                                    if (hasright)
                                    {
                                        Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString());
                                        cbxPerson.Items.Add(li);
                                        //更改按钮状态
                                        if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                        {
                                            string app = "";
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "通用申请单: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    app += ". 完成.";
                                                }
                                            }
                                            else
                                            {
                                                Panel3.Title = "General Expense Form: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    app += ". Complete.";
                                                }
                                            }
                                            labelInfo.Text = app;
                                        }
                                        else//草稿
                                        {
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "通用申请单草稿: " + dt.Rows[0]["No"].ToString();
                                            }
                                            else
                                            {
                                                Panel3.Title = "General Expense Draft: " + dt.Rows[0]["No"].ToString();
                                            }
                                            
                                            //X.AddScript("btnSaveAndSend.enable();");
                                        }
                                        hdSubStatus.Value = "2";//不允许传递到子页面时修改或者上传
                                        X.AddScript("btnE.disable();btnT.disable();btnC.disable();btnO.disable();btnSaveDraft.disable();btnSaveAndSend.disable();btnCC.disable();");
                                        //无需判断Copy
                                        //载入通用数据
                                        LoadData(dt, false);
                                    }
                                    else
                                    {
                                        ErrorHandle("No right.");
                                    }
                                }
                            }
                        }
                        else
                        {
                            ErrorHandle("Data Error.");
                        }
                    }
                    else
                    {
                        ErrorHandle("Data Error.");
                    }
                }
                else//本人新增
                {
                    //准备下拉菜单内容
                    Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value);
                    cbxPerson.Items.Add(li);
                    string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'";
                    DataTable dtitem = dbc.GetData("eReimbursement", sqlitem);
                    int itemcount = 0;
                    for (int j = 0; j < dtitem.Rows.Count; j++)
                    {
                        string sqlpara = sqlitem;
                        bool d1 = true;
                        bool d2 = false;
                        if (dtitem.Rows[j][5].ToString() != "")
                        {
                            //sqlpara += " and getdate()>='" + dtitem.Rows[j]["Bdate"].ToString() + "' ";
                            if (DateTime.Now >= Convert.ToDateTime(dtitem.Rows[j][5].ToString()))
                            {
                                d1 = true;
                            }
                            else
                            {
                                d1 = false;
                            }
                        }
                        if (dtitem.Rows[j][6].ToString() != "")
                        {
                            //sqlpara += " and getdate()<='" + dtitem.Rows[j]["Edate"].ToString() + "' ";
                            if (DateTime.Now <= Convert.ToDateTime(dtitem.Rows[j][6].ToString()))
                            {
                                d2 = true;
                            }
                            else
                            {
                                d2 = false;
                            }
                        }
                        if (d1 && d2)
                        {
                            li = new Ext.Net.ListItem(dtitem.Rows[j][1].ToString(), dtitem.Rows[j][2].ToString());
                            cbxPerson.Items.Add(li);
                        }
                    }
                    //新增记录时,默认为登录用户
                    cbxPerson.SelectedItem.Value = Request.Cookies.Get("eReimUserID").Value;
                    cbxPerson.SelectedItem.Text = Request.Cookies.Get("eReimUserName").Value;
                    LabelStation.Text = Request.Cookies.Get("eReimStation").Value;
                    LabelDepartment.Text = Request.Cookies.Get("eReimDepartment").Value;

                    LabelMonth.Text = DateTime.Now.Month.ToString();
                    ////币种
                    //hdCur.Value = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(Request.Cookies.Get("eReimStation").Value);
                    //DataTable dttemp = new DataTable();
                    //string sqltemp = "select * from ESUSER where Userid='" + Request.Cookies.Get("eReimUserID").Value + "'";
                    //dttemp = dbc.GetData("eReimbursement", sqltemp);
                    //if (dttemp.Rows.Count > 0)
                    //{
                    //    hdCur.Value = dttemp.Rows[0]["Currency"].ToString();//如果单独设置了币种
                    //}
                    X.AddScript("btnSaveAndSend.enable();cbxPerson.enable();cbxOnBehalfName.enable();");

                    ////检查是否已经为该申请人设置过审批人
                    //string sqlCheckFlow = "select * from GroupFlow where GID=(select GID from GroupUsers where UserID='" + cbxPerson.Text + "')";
                    //DataTable dtCheckFlow = dbc.GetData("eReimbursement", sqlCheckFlow);
                    //if (dtCheckFlow.Rows.Count < 1)
                    //{
                    //    if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                    //    {
                    //        ErrorHandle("请联系Local MIS设置审批人.");
                    //    }
                    //    else
                    //    {
                    //        ErrorHandle("Not set Approve flow,please contact with Local MIS.");
                    //    }
                    //}
                }
                
            }
        }
        private void BindDateComboBox()
        {
            #region 平台类型绑定

            //平台类型动态数据绑定
            this.cbPlatformTypeId.Items.Clear();
            var codeLists = base.CodeService.GetCodeListInfoByCodeTypeID(182, false);
            //list 转 DateTable
            DataTable dt = new DataTable();
            dt.Columns.Add("CodeID");
            dt.Columns.Add("CodeName");
            foreach (var codeList in codeLists)
            {
                DataRow dr = dt.NewRow();
                dr["CodeID"]   = codeList.CodeID;
                dr["CodeName"] = codeList.CodeName;
                dt.Rows.Add(dr);
            }
            //平台下拉框绑定数据源
            foreach (DataRow dr_Secret in dt.Rows)                     //遍历获取两个值
            {
                Ext.Net.ListItem Secretslist = new Ext.Net.ListItem(); //每次创建一个Ext.Net.ListItem的对象
                Secretslist.Value = dr_Secret["CodeID"].ToString();
                Secretslist.Text  = dr_Secret["CodeName"].ToString();
                this.cbPlatformTypeId.Items.Add(Secretslist);
            }
            this.cbPlatformTypeId.Items.Insert(0, new Ext.Net.ListItem("--所有--", "-1"));
            this.cbPlatformTypeId.Value = "-1";

            #endregion

            #region 项目类型绑定

            //平台类型动态数据绑定
            this.cbXMProjectTypeId.Items.Clear();
            var codeProjectTypeLists = base.CodeService.GetCodeListInfoByCodeTypeID(189, false);
            //list 转 DateTable
            DataTable dtProjectType = new DataTable();
            dtProjectType.Columns.Add("CodeID");
            dtProjectType.Columns.Add("CodeName");
            foreach (var codeList in codeProjectTypeLists)
            {
                DataRow dr = dtProjectType.NewRow();
                dr["CodeID"]   = codeList.CodeID;
                dr["CodeName"] = codeList.CodeName;
                dtProjectType.Rows.Add(dr);
            }
            //平台下拉框绑定数据源
            foreach (DataRow dr_Secret in dtProjectType.Rows)          //遍历获取两个值
            {
                Ext.Net.ListItem Secretslist = new Ext.Net.ListItem(); //每次创建一个Ext.Net.ListItem的对象
                Secretslist.Value = dr_Secret["CodeID"].ToString();
                Secretslist.Text  = dr_Secret["CodeName"].ToString();
                this.cbXMProjectTypeId.Items.Add(Secretslist);
            }
            this.cbXMProjectTypeId.Items.Insert(0, new Ext.Net.ListItem("--所有--", "-1"));
            this.cbXMProjectTypeId.Value = "-1";

            #endregion

            #region 项目名称绑定

            //平台类型动态数据绑定
            this.cbXMProject.Items.Clear();
            var projectList = base.XMProjectService.GetXMProjectList();
            //list 转 DateTable
            DataTable dtproject = new DataTable();
            dtproject.Columns.Add("Id");
            dtproject.Columns.Add("ProjectName");
            foreach (var project in projectList)
            {
                DataRow dr = dtproject.NewRow();
                dr["Id"]          = project.Id;
                dr["ProjectName"] = project.ProjectName;
                dtproject.Rows.Add(dr);
            }
            //平台下拉框绑定数据源
            foreach (DataRow dr_Secret in dtproject.Rows)              //遍历获取两个值
            {
                Ext.Net.ListItem Secretslist = new Ext.Net.ListItem(); //每次创建一个Ext.Net.ListItem的对象
                Secretslist.Value = dr_Secret["Id"].ToString();
                Secretslist.Text  = dr_Secret["ProjectName"].ToString();
                this.cbXMProject.Items.Add(Secretslist);
            }
            this.cbXMProject.Items.Insert(0, new Ext.Net.ListItem("--所有--", "-1"));
            this.cbXMProject.Value = "-1";

            #endregion

            #region 店铺名称绑定


            this.cbNick.Items.Clear();
            var NickList    = base.XMNickService.GetXMNickList();
            var NickListNew = NickList.Where(p => p.nick_id != 16 && p.nick_id != 17 && p.nick_id != 18).ToList();
            //list 转 DateTable
            DataTable dtNick = new DataTable();
            dtNick.Columns.Add("nick_id");
            dtNick.Columns.Add("nick");
            foreach (var nick in NickListNew)
            {
                DataRow dr = dtNick.NewRow();
                dr["nick_id"] = nick.nick_id;
                dr["nick"]    = nick.nick;
                dtNick.Rows.Add(dr);
            }
            //平台下拉框绑定数据源
            foreach (DataRow dr_Secret in dtNick.Rows)                 //遍历获取两个值
            {
                Ext.Net.ListItem Secretslist = new Ext.Net.ListItem(); //每次创建一个Ext.Net.ListItem的对象
                Secretslist.Value = dr_Secret["nick_id"].ToString();
                Secretslist.Text  = dr_Secret["nick"].ToString();
                this.cbNick.Items.Add(Secretslist);
            }
            this.cbNick.Items.Insert(0, new Ext.Net.ListItem("---所有---", "-1"));
            this.cbNick.Value = "-1";

            #endregion

            #region 时间类型

            DataTable status = new DataTable();
            status.Columns.Add("ValueId");
            status.Columns.Add("ValueNsme");
            DataRow dr4 = status.NewRow();
            dr4["ValueId"]   = "1";
            dr4["ValueNsme"] = "创单时间";
            status.Rows.Add(dr4);
            DataRow dr1 = status.NewRow();
            dr1["ValueId"]   = "2";//"WAIT_SELLER_SEND_GOODS,SELLER_CONSIGNED_PART,WAIT_SELLER_STOCK_OUT,WAIT_SELLER_DELIVERY,ORDER_TRUNED_TO_DO,10";
            dr1["ValueNsme"] = "付款时间";
            status.Rows.Add(dr1);
            DataRow dr2 = status.NewRow();
            dr2["ValueId"]   = "3";//"WAIT_BUYER_CONFIRM_GOODS,WAIT_GOODS_RECEIVE_CONFIRM,STATUS_1,STATUS_10,STATUS_11,STATUS_22,STATUS_97,ORDER_OUT_OF_WH,新,以接受,已发货,已取消,20,21,SEND_TO_DISTRIBUTION_CENER,DISTRIBUTION_CENTER_RECEIVED,ORDER_RECEIVED";
            dr2["ValueNsme"] = "发货时间";
            status.Rows.Add(dr2);
            DataRow dr3 = status.NewRow();
            dr3["ValueId"]   = "4";//"TRADE_BUYER_SIGNED,TRADE_FINISHED,FINISHED_L,RECEIPTS_CONFIRM,STATUS_1,STATUS_10,STATUS_11,STATUS_22,STATUS_97,ORDER_FINISH,新,以接受,已发货,已取消,30";
            dr3["ValueNsme"] = "交易成功时间";
            status.Rows.Add(dr3);
            //DataRow dr4 = status.NewRow();
            //dr4["ValueId"] = "TRADE_CLOSED,TRADE_CANCELED,ORDER_CANCEL,40";
            //dr4["ValueNsme"] = "交易关闭";
            //status.Rows.Add(dr4);
            //DataRow dr5 = status.NewRow();
            //dr5["ValueId"] = "LOCKED";
            //dr5["ValueNsme"] = "已锁定";
            //status.Rows.Add(dr5);

            this.cbOrderStatus.Items.Clear();
            foreach (DataRow dr_Secret in status.Rows)                 //遍历获取两个值
            {
                Ext.Net.ListItem Secretslist = new Ext.Net.ListItem(); //每次创建一个Ext.Net.ListItem的对象
                Secretslist.Value = dr_Secret["ValueId"].ToString();
                Secretslist.Text  = dr_Secret["ValueNsme"].ToString();
                this.cbOrderStatus.Items.Add(Secretslist);
            }
            //this.cbOrderStatus.Items.Insert(0, new Ext.Net.ListItem("---所有---", "-1"));
            this.cbOrderStatus.Value = "1";

            #endregion
        }
示例#30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //DataSet GetCityInfo = DIMERCO.SDK.Utilities.LSDK.GetCityInfo("BJS", 20);
            //int sd = GetCityInfo.Tables[0].Rows.Count;
            //bool isValidCity = DIMERCO.SDK.Utilities.LSDK.isValidCity("BJS");
            //DataSet GetCustomerInfo = DIMERCO.SDK.Utilities.LSDK.GetCustomerInfo("TSOE");
            //DataSet getUserDataBYStationCode = DIMERCO.SDK.Utilities.LSDK.getUserDataBYStationCode("TSOE");
            //DataSet getCostCenterBYStationCode = DIMERCO.SDK.Utilities.LSDK.getCostCenterBYStationCode("BJS",20);
            //DataSet getCRPDepartment = DIMERCO.SDK.Utilities.LSDK.getCRPDepartment();
            //BudgetApplicationSoapClient ds = new BudgetApplicationSoapClient();
            //ServiceReference1.BudgetApplicationSoapClient objService = new ServiceReference1.BudgetApplicationSoapClient("BudgetApplicationSoap", "http://www.baidu.com");
            //DataSet dsss = objService.GetBudgetPackage("ZJDTSN", 2013, "BudgetPackageToken");
            if (!X.IsAjaxRequest)
            {
                //判断登录状态
                cs.DBCommand dbc = new cs.DBCommand();
                if (Session["UserID"] == null)
                {
                    X.AddScript("loginWindow.show();Panel1.disable();");
                    return;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "", "$('div.gn_person ul.q-menubox li:eq(0) a').text('" + Session["UserName"].ToString() + "');", true); X.AddScript("loginWindow.hide();Panel1.enable();");
                    
                }


                if (Request.QueryString["ID"] != null)//判断链接地址是否正确
                {
                    string ID = Request.QueryString["ID"].ToString();
                    System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d*$");
                    if (reg1.IsMatch(ID))
                    {
                        string sql = "select * from V_Eflow_ETravel where RequestID='" + ID + "' and [Type]='T' and (Active=1 or Active=2)";

                        DataTable dt = new DataTable();
                        dt = dbc.GetData("eReimbursement", sql);

                        if (dt != null && dt.Rows.Count == 1)
                        {
                            
                            if (Session["UserID"].ToString() == dt.Rows[0]["PersonID"].ToString())//本人
                            {
                                //准备下拉菜单内容
                                Ext.Net.ListItem li = new Ext.Net.ListItem(Session["UserName"].ToString(), Session["UserID"].ToString());
                                cbxOwner.Items.Add(li);
                                string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Session["UserID"].ToString() + "'";
                                DataTable dtitem = dbc.GetData("eReimbursement", sqlitem);
                                int itemcount = 0;
                                for (int j = 0; j < dtitem.Rows.Count; j++)
                                {
                                    string sqlpara = sqlitem;
                                    if (dtitem.Rows[j]["Bdate"].ToString() != "")
                                    {
                                        sqlpara += " and getdate()>='" + dtitem.Rows[j]["Bdate"].ToString() + "' ";
                                    }
                                    if (dtitem.Rows[j]["Edate"].ToString() != "")
                                    {
                                        sqlpara += " and getdate()<='" + dtitem.Rows[j]["Edate"].ToString() + "' ";
                                    }
                                    DataTable dtitem1 = dbc.GetData("eReimbursement", sqlpara);
                                    for (int m = 0; m < dtitem1.Rows.Count; m++)
                                    {
                                        li = new Ext.Net.ListItem(dtitem.Rows[m]["Owner"].ToString(), dtitem.Rows[m]["OwnerID"].ToString());
                                        cbxOwner.Items.Add(li);
                                        itemcount++;
                                    }
                                }
                                //更改按钮状态
                                if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                {
                                    if (Request.QueryString["Copy"] != null)
                                    {
                                        if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                        {
                                            X.AddScript("btnSaveAndSend.enable();");
                                        }
                                        else
                                        {
                                            ErrorHandle("Data Error.");
                                        }
                                    }
                                    else//已申请数据
                                    {
                                        Panel3.Title = "差旅费申请单:" + dt.Rows[0]["No"].ToString();
                                        //读取当前状态,显示在下方文本框内
                                        string app = "";
                                        if (dt.Rows[0]["Status"].ToString() == "1")
                                        {
                                            app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                            app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                        }
                                        else if (dt.Rows[0]["Status"].ToString() == "2")
                                        {
                                            app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                            app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                        }
                                        else if (dt.Rows[0]["Status"].ToString() == "3")
                                        {
                                            app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                            app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                        }

                                        if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                        {
                                            app += ". Complete.";
                                            X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();");
                                        }
                                        else//待审批
                                        {
                                            X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();");
                                        }
                                        labelInfo.Text = app;
                                    }
                                }
                                else//草稿
                                {
                                    if (Request.QueryString["Copy"] != null)
                                    {
                                        if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                        {
                                            X.AddScript("btnSaveAndSend.enable();");
                                        }
                                        else
                                        {
                                            ErrorHandle("Data Error.");
                                        }
                                    }
                                    else
                                    {
                                        Panel3.Title = "差旅费申请单草稿:" + dt.Rows[0]["No"].ToString();
                                        X.AddScript("btnSaveAndSend.enable();");
                                    }
                                }
                                //载入通用数据
                                LoadData(dt, true);
                            }
                            else
                            {
                                //判断是否为代理人
                                bool isagent = false;//记录Session["UserID"]是否为代理人
                                string sqlagent = "select * from Eagent where [St]=1 and [OwnerID]='" + dt.Rows[0]["PersonID"].ToString() + "' and getdate()<=Edate and getdate()>=Bdate";
                                DataTable dtagent = dbc.GetData("eReimbursement", sqlagent);
                                for (int g = 0; g < dtagent.Rows.Count; g++)
                                {
                                    if (Session["UserID"].ToString() == dtagent.Rows[g]["PAgentID"].ToString())
                                    {
                                        isagent = true;
                                        break;
                                    }
                                }
                                if (isagent)//代理人访问
                                {
                                    Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString());
                                    cbxOwner.Items.Add(li);
                                    //更改按钮状态
                                    if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                    {
                                        if (Request.QueryString["Copy"] != null)
                                        {
                                            if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                            {
                                                X.AddScript("btnSaveAndSend.enable();");
                                            }
                                            else
                                            {
                                                ErrorHandle("Data Error.");
                                            }
                                        }
                                        else
                                        {
                                            Panel3.Title = "差旅费申请单:" + dt.Rows[0]["No"].ToString();
                                            //读取当前状态,显示在下方文本框内
                                            string app = "";
                                            if (dt.Rows[0]["Status"].ToString() == "1")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                                app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "2")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                                app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "3")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                                app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                            }

                                            if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                            {
                                                app += ". Complete.";
                                                X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();");
                                            }
                                            else//待审批
                                            {
                                                X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();");
                                            }
                                            labelInfo.Text = app;
                                        }
                                    }
                                    else//草稿
                                    {
                                        if (Request.QueryString["Copy"] != null)
                                        {
                                            if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                            {
                                                X.AddScript("btnSaveAndSend.enable();");
                                            }
                                            else
                                            {
                                                ErrorHandle("Data Error.");
                                            }
                                        }
                                        else
                                        {
                                            Panel3.Title = "差旅费申请单草稿:" + dt.Rows[0]["No"].ToString();
                                            X.AddScript("btnSaveAndSend.enable();");
                                        }
                                    }
                                    //载入通用数据
                                    LoadData(dt, true);
                                }
                                else//判断是否有跨站权限
                                {

                                    bool hasright = false;
                                    string getright = "select * from StationRole where UserID='" + Session["UserID"].ToString() + "'";
                                    DataTable dtright = dbc.GetData("eReimbursement", getright);
                                    for (int j = 0; j < dtright.Rows.Count; j++)
                                    {
                                        string[] dd = dtright.Rows[j]["Stations"].ToString().Split(',');
                                        for (int i = 0; i < dd.Length; i++)
                                        {
                                            if (dd[i] == dt.Rows[0]["Station"].ToString())//有权限
                                            {
                                                hasright = true;
                                                break;
                                            }
                                        }
                                    }
                                    if (hasright)
                                    {
                                        Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString());
                                        cbxOwner.Items.Add(li);
                                        //更改按钮状态
                                        if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                        {
                                            Panel3.Title = "差旅费申请单:" + dt.Rows[0]["No"].ToString();
                                            //读取当前状态,显示在下方文本框内
                                            string app = "";
                                            if (dt.Rows[0]["Status"].ToString() == "1")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                                app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "2")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                                app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "3")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                                app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd h:m");
                                            }

                                            if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                            {
                                                app += ". Complete.";
                                                X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();");
                                            }
                                            else//待审批
                                            {
                                                X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();");
                                            }
                                            labelInfo.Text = app;
                                        }
                                        else//草稿
                                        {
                                            Panel3.Title = "差旅费申请单草稿:" + dt.Rows[0]["No"].ToString();
                                            X.AddScript("btnSaveAndSend.enable();");
                                        }
                                        //无需判断Copy
                                        //载入通用数据
                                        LoadData(dt, false);
                                    }
                                    else
                                    {
                                        ErrorHandle("无权查看.");
                                    }
                                }
                            }
                        }
                        else
                        {
                            ErrorHandle("Data Error.");
                        }
                    }
                    else
                    {
                        ErrorHandle("Data Error.");
                    }
                }
                else
                {
                    //准备下拉菜单内容
                    Ext.Net.ListItem li = new Ext.Net.ListItem(Session["UserName"].ToString(), Session["UserID"].ToString());
                    cbxOwner.Items.Add(li);
                    string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Session["UserID"].ToString() + "'";
                    DataTable dtitem = dbc.GetData("eReimbursement", sqlitem);
                    int itemcount = 0;
                    for (int j = 0; j < dtitem.Rows.Count; j++)
                    {
                        string sqlpara = sqlitem;
                        if (dtitem.Rows[j]["Bdate"].ToString() != "")
                        {
                            sqlpara += " and getdate()>='" + dtitem.Rows[j]["Bdate"].ToString() + "' ";
                        }
                        if (dtitem.Rows[j]["Edate"].ToString() != "")
                        {
                            sqlpara += " and getdate()<='" + dtitem.Rows[j]["Edate"].ToString() + "' ";
                        }
                        DataTable dtitem1 = dbc.GetData("eReimbursement", sqlpara);
                        for (int m = 0; m < dtitem1.Rows.Count; m++)
                        {
                            li = new Ext.Net.ListItem(dtitem.Rows[m]["Owner"].ToString(), dtitem.Rows[m]["OwnerID"].ToString());
                            cbxOwner.Items.Add(li);
                            itemcount++;
                        }
                    }
                    //新增记录时,默认为登录用户
                    cbxOwner.SelectedItem.Value = Session["UserID"].ToString();
                    cbxOwner.SelectedItem.Text = Session["UserName"].ToString();
                    labelStation.Text = Session["Station"].ToString();
                    labelDepartment.Text = Session["Department"].ToString();
                    LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(labelStation.Text);
                    X.AddScript("btnSaveAndSend.enable();");
                }
                this.Store2.DataSource = new object[]
                {
                    new object[] { "差旅費-駐廠人員", "62012001", "Traveling - In House" },
                    new object[] { "差旅費-國內差旅費", "62012010", "Traveling - Domestic" },
                    new object[] { "差旅費-國外差旅費", "62012020", "Traveling - Overseas" },
                    new object[] { "差旅費-機票", "62012023", "Traveling - Overseas - Air ticket" },
                    new object[] { "差旅費-國內住宿費", "62012011", "Traveling - Domestic - Hotel" },
                    new object[] { "差旅費-國外住宿费", "62012021", "Traveling - Overseas - Hotel" },
                    new object[] { "差旅費-他國外差旅費", "62012024", "Traveling - Overseas - others" },
                    new object[] { "差旅費-其他差旅費", "62012014", "Traveling - Domestic - Others" },
                    new object[] { "交際費-駐廠人員", "62010901", "Entertainment - In House" },
                    new object[] { "交際費-國內交際費", "62010910", "Entertainment - Domestic" },
                    new object[] { "交際費-國外交際費", "62010920", "Entertainment - Overseas" },
                    new object[] { "交通費-駐場人員", "62011901", "Transportation - In House" },
                    new object[] { "交通費-汽油費", "62011910", "Transportation - Gasoline" },
                    new object[] { "交通費-車票", "62011920", "Transportation - Ticket" },
                    new object[] { "交通費-計程車資", "62011930", "Transportation - Taxi" },
                    new object[] { "交通費-停車費", "62011940", "Transportation - Parking" },
                    new object[] { "國內出差車票", "62012013", "Domestic - Ticket" },
                    new object[] { "通訊費-駐廠人員電話費", "62010501", "Communication - In House" },
                    new object[] { "通訊費-電話費", "62010510", "Communication - Telephone" },
                    new object[] { "通訊費-傳真費", "62010520", "Communication - Fax" },
                    new object[] { "交際費-行動電話費", "62010530", "Communication - Mobile" },
                    new object[] { "通訊費-網路費", "62010540", "Communication - Internet" },
                    new object[] { "郵資", "62010550", "Postage" },
                    new object[] { "快遞費", "62010560", "Courier" },
                    new object[] { "差旅費-國內日支費", "62012012", "Traveling - Domestic - Daily allowance" },
                    new object[] { "差旅費-國外日支額", "62012022", "Traveling - Overseas - Daily allowance" },
                    new object[] { "旅行保險費", "62020630", "Travel Insurance" },
                };

                this.Store2.DataBind();

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                //TextField1.Hidden = true;
                //TextField2.Hidden = true;

                DBMysql db = new DBMysql();

                try
                {
                    string sPAD_HEAD = "Styles/mark1.png";
                    //string sPAD_HEAD = "";
                    DataTable dtPAD_HEAD = db.Query("SELECT *  FROM general_setup WHERE  genst_code='IPAD_HEAD'");
                    if (dtPAD_HEAD.Rows.Count > 0)
                    {
                        sPAD_HEAD = dtPAD_HEAD.Rows[0]["genst_desc"].ToString();
                        //sPAD_HEAD = Server.MapPath(sPAD_HEAD);
                        Image2.ImageUrl = sPAD_HEAD;
                    }
                }
                catch (Exception ex)
                {
                    //_ErrorMsgShow(ex.Message.ToString());
                }

                DateTime now = DateTime.Now;
                //this.txtDATE.Text = now.ToString("yyyy-MM-dd");

                this.txtTIME.Text  = now.ToString("yyyy-MM-dd HH:mm:ss");
                this.txtTIME1.Text = now.ToString("yyyy-MM-dd");

                //sDATE.Text = this.txtDATE.Text;
                sDATE.Text = this.txtTIME.Text.Substring(0, 10);
                //this.txtWEEK.Text = now.ToString("ddd");
                if (Session["PAD_TIME"] == null)
                {
                    int Hm = int.Parse(now.ToString("HHmm"));
                    if (1 <= Hm && Hm <= 1159)
                    {
                        sTIME.Text = "001";
                        cboTIME.Select(sTIME.Text);
                    }
                    else if (1200 <= Hm && Hm <= 1759)
                    {
                        sTIME.Text = "002";
                        cboTIME.Select(sTIME.Text);
                    }
                    else if (1800 <= Hm && Hm <= 2400)
                    {
                        sTIME.Text = "003";
                        cboTIME.Select(sTIME.Text);
                    }
                }
                else
                {
                    sTIME.Text = Session["PAD_TIME"].ToString();
                    cboTIME.Select(sTIME.Text);
                }

                GET_WEEK();


                this.WYEAR.Text       = now.ToString("yyyy");
                this.WMON.Text        = now.ToString("MM");
                this.cboYEAR.Disabled = false;
                YEAR_CHECK(this.WYEAR.Text);
                MON_CHECK(this.WMON.Text);


                if (dtAREA == null)
                {
                    dtAREA = db.Query("SELECT distinct mac_flr, mac_sec FROM mac_setup WHERE 1=1 ORDER BY mac_flr, mac_sec ");
                }
                if (dtAREA.Rows.Count > 0)
                {
                    if (Session["PAD_FLOOR"] == null)
                    {
                        sFLOOR.Text = dtAREA.Rows[0]["mac_flr"].ToString();
                    }
                    else
                    {
                        sFLOOR.Text = Session["PAD_FLOOR"].ToString();
                    }
                    if (Session["PAD_AREA"] == null)
                    {
                        sAREA.Text = dtAREA.Rows[0]["mac_sec"].ToString();
                    }
                    else
                    {
                        sAREA.Text = Session["PAD_AREA"].ToString();
                    }
                }
                System.Data.DataTable dtFLOOR = db.Query("SELECT distinct mac_flr FROM mac_setup WHERE 1=1 ORDER BY mac_flr ");
                for (int i = 0; i < dtFLOOR.Rows.Count; i++)
                {
                    Ext.Net.ListItem litem;
                    litem = new Ext.Net.ListItem(dtFLOOR.Rows[i]["mac_flr"].ToString() + "楼", dtFLOOR.Rows[i]["mac_flr"].ToString());
                    this.cboFLOOR.Items.Add(litem);
                }
                this.cboFLOOR.GetStore().DataBind();
                if (dtFLOOR.Rows.Count > 0)
                {
                    this.cboFLOOR.Disabled = false;
                    this.cboFLOOR.Select(sFLOOR.Text);
                    //SetComboBoxValue(this.cboFLOOR, "05楼", false);
                    FILL_AREA(sFLOOR.Text, sAREA.Text);
                    WFLOOR.Text = sFLOOR.Text;
                    WAREA.Text  = sAREA.Text;

                    //Column9.Text = WFLOOR.Text + "楼";
                    //Column11.Text = WAREA.Text + "區";
                    //FILL_BED();
                    //FILL_BEDN();
                }
                else
                {
                    this.cboFLOOR.Disabled = true;
                    this.cboAREA.Disabled  = true;
                }
                //Timer1.Enabled = true;
                //TaskManager1.Enabled = true;
                TaskManager1.StopTask("servertime");


                //2015.03.25 姓名 Andy
                System.Data.DataTable dtName = db.Query("select DISTINCT apptst_patrefid from appointment_setup order by apptst_patrefid");
                for (int i = 0; i < dtName.Rows.Count; i++)
                {
                    Ext.Net.ListItem litem1;
                    litem1 = new Ext.Net.ListItem(dtName.Rows[i]["apptst_patrefid"].ToString(), dtName.Rows[i]["apptst_patrefid"].ToString());
                    this.SelectBox1.Items.Add(litem1);
                }
                this.SelectBox1.GetStore().DataBind();
                if (dtName.Rows.Count > 0)
                {
                    this.SelectBox1.Disabled = false;
                    this.SelectBox1.Select(sNAME.Text);
                    //FILL_AREA(sFLOOR.Text, sAREA.Text);
                    //FILL_BED();
                }
                else
                {
                    //this.cboFLOOR.Disabled = true;
                    //this.cboAREA.Disabled = true;
                }
                //

                //2015.03.25 GP 身分證號 Andy
                System.Data.DataTable dtpatic = db.Query("select DISTINCT apptst_patic from appointment_setup order by apptst_patic");
                for (int i = 0; i < dtpatic.Rows.Count; i++)
                {
                    Ext.Net.ListItem litem2;
                    litem2 = new Ext.Net.ListItem(dtpatic.Rows[i]["apptst_patic"].ToString(), dtpatic.Rows[i]["apptst_patic"].ToString());
                    this.SelectBox2.Items.Add(litem2);
                }
                this.SelectBox2.GetStore().DataBind();
                if (dtpatic.Rows.Count > 0)
                {
                    this.SelectBox2.Disabled = false;
                    this.SelectBox2.Select(spatic.Text);
                }
                else
                {
                }
                //
            }
        }
示例#32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                //if (Request.Cookies["eReimUserID"] != null)
                //{
                //    Response.Cookies["eReimUserID"].Value = "A0300";  //将值写入到客户端硬盘Cookie
                //    Response.Cookies["eReimUserID"].Expires = DateTime.Now.AddHours(12);//设置Cookie过期时间
                //}
                //else
                //{
                //    HttpCookie cookie = new HttpCookie("eReimUserID", "A0300");
                //    cookie.Expires = DateTime.Now.AddHours(12);
                //    Response.Cookies.Add(cookie);
                //}
                //if (Request.Cookies["eReimUserName"] != null)
                //{
                //    Response.Cookies["eReimUserName"].Value = "Kevin Zhang";  //将值写入到客户端硬盘Cookie
                //    Response.Cookies["eReimUserName"].Expires = DateTime.Now.AddHours(12);//设置Cookie过期时间
                //}
                //else
                //{
                //    HttpCookie cookie = new HttpCookie("eReimUserName", "Kevin Zhang");
                //    cookie.Expires = DateTime.Now.AddHours(12);
                //    Response.Cookies.Add(cookie);
                //}
                //判断登录状态
                cs.DBCommand dbc = new cs.DBCommand();
                if (Request.Cookies.Get("eReimUserID") == null)
                {
                    X.AddScript("loginWindow.show();Panel1.disable();");
                    return;
                }
                else
                {
                    //Session["UserID"] = "A1231";
                    ScriptManager.RegisterStartupScript(this, GetType(), "", "$('div.gn_person ul.q-menubox li:eq(0) a').text('" + Request.Cookies.Get("eReimUserName").Value + "');", true); X.AddScript("loginWindow.hide();Panel1.enable();");
                }
                string sqltype = "";
                if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                {
                    PagingToolbar1.DisplayMsg = "显示 {0} - {1} of {2}";
                    ResourceManager1.Locale = "zh-CN";
                    sqltype += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='MainType'";
                }
                else
                {
                    PagingToolbar1.DisplayMsg = "Displaying items {0} - {1} of {2}";
                    ResourceManager1.Locale = "en-US";
                    sqltype += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='MainType'";
                }
                DataTable dttype = dbc.GetData("eReimbursement", sqltype);
                StoreType.DataSource = dttype;
                StoreType.DataBind();

                string sql = "";//报销单状态
                if (Request.QueryString["Status"] != null)
                {
                    string Status = Request.QueryString["Status"].ToString();
                    System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d*$");
                    if (reg1.IsMatch(Status))
                    {
                        if (Request.QueryString["Status"].ToString() == "1")
                        {
                            sql += "and Active=1 ";
                        }
                        else
                        {
                            sql += "and Status=" + Request.QueryString["Status"].ToString() + " ";
                        }
                    }
                    else
                    {
                        ErrorHandle();
                    }
                }
                else
                {
                    sql += "and Active=1 ";
                }
                //准备申请人下拉菜单内容
                string sqlitem = "select distinct Person,PersonID from V_Eflow_ETravel where Step!=0 and [ApproverID]='" + Request.Cookies.Get("eReimUserID").Value + "' " + sql;
                DataTable dtitem = dbc.GetData("eReimbursement", sqlitem);
                for (int j = 0; j < dtitem.Rows.Count; j++)
                {
                    Ext.Net.ListItem li = new Ext.Net.ListItem(dtitem.Rows[j]["Person"].ToString(), dtitem.Rows[j]["PersonID"].ToString());
                    cbxPerson.Items.Add(li);
                }
                //准备提单人下拉菜单内容
                string sqlitem1 = "select distinct CreadedBy,CreadedByID from V_Eflow_ETravel where Step!=0 and [ApproverID]='" + Request.Cookies.Get("eReimUserID").Value + "' " + sql;
                DataTable dtitem1 = dbc.GetData("eReimbursement", sqlitem1);
                for (int j = 0; j < dtitem1.Rows.Count; j++)
                {
                    Ext.Net.ListItem li = new Ext.Net.ListItem(dtitem1.Rows[j]["CreadedBy"].ToString(), dtitem1.Rows[j]["CreadedByID"].ToString());
                    cbxCreatedBy.Items.Add(li);
                }
                //准备站点下拉菜单内容
                string sqlitem2 = "select distinct Station from V_Eflow_ETravel where Step!=0 and [ApproverID]='" + Request.Cookies.Get("eReimUserID").Value + "' " + sql;
                DataTable dtitem2 = dbc.GetData("eReimbursement", sqlitem2);
                for (int j = 0; j < dtitem2.Rows.Count; j++)
                {
                    Ext.Net.ListItem li = new Ext.Net.ListItem(dtitem2.Rows[j]["Station"].ToString(), dtitem2.Rows[j]["Station"].ToString());
                    cbxTstation.Items.Add(li);
                }
                BindData(sql);
                //从邮件链接进入打开详细信息
                if (Request.QueryString["FlowID"] != null)
                {
                    string Status = Request.QueryString["FlowID"].ToString();
                    System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d*$");
                    if (reg1.IsMatch(Status))
                    {
                        string lingsql = "select * from V_Eflow_ETravel where FlowID=" + Status;
                        DataTable dtlink = new DataTable();
                        dtlink = dbc.GetData("eReimbursement", lingsql);
                        if (dtlink != null && dtlink.Rows.Count == 1)
                        {
                            string budget = dtlink.Rows[0]["Budget"].ToString() == "1" ? "(Budget)" : "(UnBudget)";
                            if (Request.Cookies.Get("eReimUserID").Value!=dtlink.Rows[0]["ApproverID"].ToString())
                            {
                                //ErrorHandle("No right."); return;
                                //151029,Shanshan要求修改,历史审批人可以继续查看.
                                string RequestID = dtlink.Rows[0]["RequestID"].ToString();
                                string Type = dtlink.Rows[0]["Type"].ToString();
                                string mainsql = "select * from V_Eflow_ETravel where RequestID=" + RequestID + " and Type='" + Type + "'";
                                DataTable dtmain = new DataTable();
                                dtmain = dbc.GetData("eReimbursement", mainsql);

                                if (dtmain.Select("ApproverID='"+Request.Cookies.Get("eReimUserID").Value+"'").Count()>0)
                                {
                                    
                                    if (dtlink.Rows[0]["Type"].ToString() == "T")
                                    {
                                        string url = "ApplyTravelT.aspx?RequestID=" + dtlink.Rows[0]["RequestID"].ToString() + "&ID=" + Status + "&Step=" + dtlink.Rows[0]["Step"].ToString() + "&Type=" + dtlink.Rows[0]["Type"].ToString() + "&Status=" + dtlink.Rows[0]["Status"].ToString();
                                        X.AddScript("Window1.setTitle('差旅费申请单:" + dtlink.Rows[0]["No"].ToString() + budget + "');Window1.loadContent({ url: '" + url + "', mode: 'iframe' });Window1.show();");
                                        //Window1.LoadContent(url);
                                        //Window1.Show();
                                    }
                                    else
                                    {
                                        string url = "ApproveG.aspx?RequestID=" + dtlink.Rows[0]["RequestID"].ToString() + "&ID=" + Status + "&Step=" + dtlink.Rows[0]["Step"].ToString() + "&Type=" + dtlink.Rows[0]["Type"].ToString() + "&Status=" + dtlink.Rows[0]["Status"].ToString();
                                        X.AddScript("Window1.setTitle('通用费用申请单:" + dtlink.Rows[0]["No"].ToString() + budget + "');Window1.loadContent({ url: '" + url + "', mode: 'iframe' });Window1.show();");
                                    }

                                    //DataRow dr = dtmain.Select("ApproverID='" + Request.Cookies.Get("eReimUserID").Value + "'")[0];
                                    //string st = dr["Status"] == "2" ? "approved" : "rejected";
                                    //string msg1 = "This applied item " + dtlink.Rows[0]["No"].ToString() + " has been " + st + " by approver " + Request.Cookies.Get("eReimUserID").Value + " on " + Convert.ToDateTime(dr["ApproveDate"]).ToString("yyyy/MM/dd");

                                    //if (dtlink.Rows[0]["Type"].ToString()=="T")
                                    //{
                                    //    string url = "ApplyTravelT.aspx?RequestID=" + RequestID + "&ID=" + Status + "&Step=" + dtlink.Rows[0]["Step"].ToString() + "&Type=" + dtlink.Rows[0]["Type"].ToString() + "&Status=" + dtlink.Rows[0]["Status"].ToString();
                                    //    X.AddScript("Ext.Msg.show({ title: '提示', msg: '" + msg1 + "', buttons: { ok: 'Ok' }, fn: function (btn) { Window1.setTitle('差旅费申请单:" + dtlink.Rows[0]["No"].ToString() + "');Window1.loadContent({ url: '" + url + "', mode: 'iframe' });Window1.show(); } });");

                                    //    //X.AddScript("Window1.setTitle('差旅费申请单:" + dtlink.Rows[0]["No"].ToString() + "');Window1.loadContent({ url: '" + url + "', mode: 'iframe' });Window1.show();");

                                    //}
                                    //else
                                    //{
                                    //    string url = "ApproveG.aspx?RequestID=" + RequestID + "&ID=" + Status + "&Step=" + dtlink.Rows[0]["Step"].ToString() + "&Type=" + dtlink.Rows[0]["Type"].ToString() + "&Status=" + dtlink.Rows[0]["Status"].ToString();
                                    //    X.AddScript("Ext.Msg.show({ title: '提示', msg: '" + msg1 + "', buttons: { ok: 'Ok' }, fn: function (btn) { Window1.setTitle('通用费用申请单:" + dtlink.Rows[0]["No"].ToString() + "');Window1.loadContent({ url: '" + url + "', mode: 'iframe' });Window1.show(); } });");
                                    //    //X.AddScript("Window1.setTitle('通用费用申请单:" + dtlink.Rows[0]["No"].ToString() + "');Window1.loadContent({ url: '" + url + "', mode: 'iframe' });Window1.show();");
                                    //}
                                }
                                else
                                {
                                    ErrorHandle("No right.");
                                    return;
                                }
                            }
                            else
                            {
                                if (dtlink.Rows[0]["Type"].ToString() == "T")
                                {
                                    string url = "ApplyTravelT.aspx?RequestID=" + dtlink.Rows[0]["RequestID"].ToString() + "&ID=" + Status + "&Step=" + dtlink.Rows[0]["Step"].ToString() + "&Type=" + dtlink.Rows[0]["Type"].ToString() + "&Status=" + dtlink.Rows[0]["Status"].ToString();
                                    X.AddScript("Window1.setTitle('差旅费申请单:" + dtlink.Rows[0]["No"].ToString() + budget + "');Window1.loadContent({ url: '" + url + "', mode: 'iframe' });Window1.show();");
                                    //Window1.LoadContent(url);
                                    //Window1.Show();
                                }
                                else
                                {
                                    string url = "ApproveG.aspx?RequestID=" + dtlink.Rows[0]["RequestID"].ToString() + "&ID=" + Status + "&Step=" + dtlink.Rows[0]["Step"].ToString() + "&Type=" + dtlink.Rows[0]["Type"].ToString() + "&Status=" + dtlink.Rows[0]["Status"].ToString();
                                    X.AddScript("Window1.setTitle('通用费用申请单:" + dtlink.Rows[0]["No"].ToString() + budget + "');Window1.loadContent({ url: '" + url + "', mode: 'iframe' });Window1.show();");
                                }
                            }
                            
                        }
                    }
                }
            }
        }
示例#33
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                //DataSet dsuser = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList("A0703");
                //if (dsuser.Tables[0].Rows.Count == 1)
                //{
                //    DataTable dt1 = dsuser.Tables[0];
                //    dt1 = null;
                //}

                //DataTable newr = Comm.RtnEB("A0703", "Administration", "DIMYVR", "DIMYVR", "62010910", "2014", "1");
                //DataSet ds3 = DIMERCO.SDK.Utilities.LSDK.getStationHierarchy();
                //for (int i = 0; i < ds3.Tables[0].Rows.Count; i++)
                //{
                //    if (ds3.Tables[0].Rows[i][0].ToString()=="GCRSHA")
                //    {
                //        string sw = ds3.Tables[0].Rows[i][0].ToString();
                //    }
                //}
                //DataTable dttt = ds3.Tables[0];
                //判断登录状态
                //Session["UserID"] = "A5236"; Session["UserName"] = "******";
                //if (Request.Cookies["eReimUserID"] != null)
                //{
                //    Response.Cookies["eReimUserID"].Value = "A5236";  //将值写入到客户端硬盘Cookie
                //    Response.Cookies["eReimUserID"].Expires = DateTime.Now.AddHours(12);//设置Cookie过期时间
                //}
                //else
                //{
                //    HttpCookie cookie = new HttpCookie("eReimUserID", "A5236");
                //    cookie.Expires = DateTime.Now.AddHours(12);
                //    Response.Cookies.Add(cookie);
                //}
                //if (Request.Cookies["eReimUserName"] != null)
                //{
                //    Response.Cookies["eReimUserName"].Value = "Angel Chen";  //将值写入到客户端硬盘Cookie
                //    Response.Cookies["eReimUserName"].Expires = DateTime.Now.AddHours(12);//设置Cookie过期时间
                //}
                //else
                //{
                //    HttpCookie cookie = new HttpCookie("eReimUserName", "Angel Chen");
                //    cookie.Expires = DateTime.Now.AddHours(12);
                //    Response.Cookies.Add(cookie);
                //}

                cs.DBCommand dbc = new cs.DBCommand();
                if (Request.Cookies.Get("eReimUserID") == null)
                {
                    X.AddScript("loginWindow.show();Panel1.disable();");
                    return;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "", "$('div.gn_person ul.q-menubox li:eq(0) a').text('" + Request.Cookies.Get("eReimUserName").Value + "');", true); X.AddScript("loginWindow.hide();Panel1.enable();");
                }
                //准备下拉菜单内容
                Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value);
                cbxPerson.Items.Add(li);
                string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'";

                try
                {
                    DataTable dtitem = new DataTable();
                    dtitem = dbc.GetData("eReimbursement", sqlitem);
                    int itemcount = 0;
                    if (dtitem != null)
                    {
                        for (int j = 0; j < dtitem.Rows.Count; j++)
                        {
                            string sqlpara = sqlitem;
                            bool   d1      = true;
                            bool   d2      = false;
                            if (dtitem.Rows[j][5].ToString() != "")
                            {
                                //sqlpara += " and getdate()>='" + dtitem.Rows[j]["Bdate"].ToString() + "' ";
                                if (DateTime.Now >= Convert.ToDateTime(dtitem.Rows[j][5].ToString()))
                                {
                                    d1 = true;
                                }
                                else
                                {
                                    d1 = false;
                                }
                            }
                            if (dtitem.Rows[j][6].ToString() != "")
                            {
                                //sqlpara += " and getdate()<='" + dtitem.Rows[j]["Edate"].ToString() + "' ";
                                if (DateTime.Now <= Convert.ToDateTime(dtitem.Rows[j][6].ToString()))
                                {
                                    d2 = true;
                                }
                                else
                                {
                                    d2 = false;
                                }
                            }
                            if (d1 && d2)
                            {
                                li = new Ext.Net.ListItem(dtitem.Rows[j][1].ToString(), dtitem.Rows[j][2].ToString());
                                cbxPerson.Items.Add(li);
                                itemcount++;
                            }
                        }
                        if (itemcount < 1)
                        {
                            cbxPerson.SelectedIndex = 0;
                        }
                    }
                    else
                    {
                        DIMERCO.SDK.MailMsg mail = new DIMERCO.SDK.MailMsg();

                        mail.FromDispName = "eReimbursement";
                        mail.From         = "*****@*****.**";
                        mail.To           = "*****@*****.**";
                        mail.Title        = "eReimbursement Bug" + DateTime.Now.ToString("yyyy/MM/dd hh:mm:dd");
                        mail.Body         = "<div>Error<br/>" + sqlitem + "</div>";
                        mail.Send();
                    }
                }
                catch (Exception ex)
                {
                    DIMERCO.SDK.MailMsg mail = new DIMERCO.SDK.MailMsg();

                    mail.FromDispName = "eReimbursement";
                    mail.From         = "*****@*****.**";
                    mail.To           = "*****@*****.**";
                    mail.Title        = "eReimbursement Bug" + DateTime.Now.ToString("yyyy/MM/dd hh:mm:dd");
                    mail.Body         = ex.Message + "<br/>" + ex.InnerException.ToString() + sqlitem + "</div>";
                    mail.Send();
                }

                string sqltype  = "";
                string sqldraft = "";
                if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                {
                    PagingToolbar1.DisplayMsg = "显示 {0} - {1} of {2}";
                    ResourceManager1.Locale   = "zh-CN";
                    sqltype  += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='MainType'";
                    sqldraft += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='Type'";
                }
                else
                {
                    PagingToolbar1.DisplayMsg = "Displaying items {0} - {1} of {2}";
                    ResourceManager1.Locale   = "en-US";
                    sqltype  += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='MainType'";
                    sqldraft += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='Type'";
                }
                //if (Request.Cookies["lang"] != null)
                //{
                //    string lang = Request.Cookies["lang"].Value;
                //    if (lang.ToLower() == "en-us")
                //    {
                //        PagingToolbar1.DisplayMsg = "Displaying items {0} - {1} of {2}";
                //        ResourceManager1.Locale = "en-US";
                //        sqltype += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='MainType'";
                //        sqldraft += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='Type'";
                //    }
                //    else
                //    {
                //        PagingToolbar1.DisplayMsg = "显示 {0} - {1} of {2}";
                //        ResourceManager1.Locale = "zh-CN";
                //        sqltype += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='MainType'";
                //        sqldraft += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='Type'";
                //    }
                //}
                //else
                //{
                //    sqltype += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='MainType'";
                //    sqldraft += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='Type'";
                //}
                DataTable dttype = dbc.GetData("eReimbursement", sqltype);
                StoreType.DataSource = dttype;
                StoreType.DataBind();
                DataTable dtdraft = dbc.GetData("eReimbursement", sqldraft);
                StoreDraft.DataSource = dtdraft;
                StoreDraft.DataBind();

                //载入半年内申请
                string sqldate = " and ApplyDate >='" + DateTime.Now.AddMonths(-6).Date.ToString() + "' and ApplyDate <='" + DateTime.Now.AddDays(1).Date.ToString() + "'";
                BindData(sqldate);
            }
        }
示例#34
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                //判断登录状态
                cs.DBCommand dbc = new cs.DBCommand();
                //string ssw = dbc.ConvertString(txtRemark.Text);
                //string newstr = "select * from ETravel where [Remark] like '%" + ssw + @"%' escape '\'";
                //DataTable dttt = dbc.GetData("eReimbursement", newstr);

                if (Request.Cookies.Get("eReimUserID") == null)
                {
                    X.AddScript("loginWindow.show();Panel1.disable();");
                    return;
                }
                else
                {
                    hdUser.Value = Request.Cookies.Get("eReimUserID").Value;
                    ScriptManager.RegisterStartupScript(this, GetType(), "", "$('div.gn_person ul.q-menubox li:eq(0) a').text('" + Request.Cookies.Get("eReimUserName").Value + "');", true); 
                    X.AddScript("loginWindow.hide();Panel1.enable();");

                    

                    string sql = "select";
                    if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                    {
                        //PagingToolbar1.DisplayMsg = "显示 {0} - {1} of {2}";
                        //PagingToolbar2.DisplayMsg = "显示 {0} - {1} of {2}";
                        ResourceManager1.Locale = "zh-CN";
                        sql += " ADes as [COAName]";
                    }
                    else
                    {
                        //PagingToolbar1.DisplayMsg = "Displaying items {0} - {1} of {2}";
                        //PagingToolbar2.DisplayMsg = "Displaying items {0} - {1} of {2}";
                        ResourceManager1.Locale = "en-US";
                        sql += " SAccountName as [COAName]";
                    }
                    sql += ",SAccountCode as [COACode] from AccoundCode where Remark like '%差旅費%'";
                    DataTable dt = new DataTable();
                    dt = dbc.GetData("eReimbursement", sql);
                    StoreCOA.DataSource = dt;
                    StoreCOA.DataBind();
                }
                
                hdStatus.Value = "0";

                if (Request.QueryString["ID"] != null)//判断链接地址是否正确
                {
                    string ID = Request.QueryString["ID"].ToString();
                    System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d*$");
                    if (reg1.IsMatch(ID))
                    {
                        string sql = "select * from V_Eflow_ETravel where RequestID='" + ID + "' and [Type]='T' and (Active=1 or Active=2)";

                        DataTable dt = new DataTable();
                        dt = dbc.GetData("eReimbursement", sql);

                        if (dt != null && dt.Rows.Count == 1)
                        {

                            if (Request.Cookies.Get("eReimUserID").Value == dt.Rows[0]["PersonID"].ToString())//本人
                            {
                                //准备下拉菜单内容
                                Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value);
                                cbxOwner.Items.Add(li);
                                string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'";
                                DataTable dtitem = dbc.GetData("eReimbursement", sqlitem);
                                int itemcount = 0;
                                for (int j = 0; j < dtitem.Rows.Count; j++)
                                {
                                    string sqlpara = sqlitem;
                                    if (dtitem.Rows[j][5].ToString() != "")
                                    {
                                        sqlpara += " and getdate()>='" + dtitem.Rows[j][5].ToString() + "' ";
                                    }
                                    if (dtitem.Rows[j][6].ToString() != "")
                                    {
                                        sqlpara += " and getdate()<='" + dtitem.Rows[j][6].ToString() + "' ";
                                    }
                                    DataTable dtitem1 = dbc.GetData("eReimbursement", sqlpara);
                                    for (int m = 0; m < dtitem1.Rows.Count; m++)
                                    {
                                        li = new Ext.Net.ListItem(dtitem.Rows[m][1].ToString(), dtitem.Rows[m][2].ToString());
                                        cbxOwner.Items.Add(li);
                                        itemcount++;
                                    }
                                }
                                //更改按钮状态
                                if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                {
                                    if (Request.QueryString["Copy"] != null)
                                    {
                                        if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                        {
                                            X.AddScript("btnSaveAndSend.enable();cbxBudget.setReadOnly(false);");
                                        }
                                        else
                                        {
                                            ErrorHandle("Data Error.");
                                        }
                                    }
                                    else//已申请数据
                                    {
                                        string app = "";
                                        if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                        {
                                            Panel3.Title = "差旅费申请单: " + dt.Rows[0]["No"].ToString();
                                            //读取当前状态,显示在下方文本框内
                                            
                                            if (dt.Rows[0]["Status"].ToString() == "1")
                                            {
                                                app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString();
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "2")
                                            {
                                                app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "3")
                                            {
                                                app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }

                                            if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                            {
                                                hdStatus.Value = "2";
                                                app += ". 完成.";
                                                X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                            }
                                            else//待审批
                                            {
                                                hdStatus.Value = "1";
                                                X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnCC.disable();");
                                            }
                                            
                                        }
                                        else
                                        {
                                            Panel3.Title = "Travel Expense Form: " + dt.Rows[0]["No"].ToString();
                                            //读取当前状态,显示在下方文本框内

                                            if (dt.Rows[0]["Status"].ToString() == "1")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "2")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "3")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }

                                            if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                            {
                                                hdStatus.Value = "2";
                                                app += ". Complete.";
                                                X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                            }
                                            else//待审批
                                            {
                                                hdStatus.Value = "1";
                                                X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnCC.disable();");
                                            }
                                        }
                                        labelInfo.Text = app;
                                    }
                                }
                                else//草稿
                                {
                                    if (Request.QueryString["Copy"] != null)
                                    {
                                        if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                        {
                                            X.AddScript("btnSaveAndSend.enable();cbxBudget.setReadOnly(false);");
                                        }
                                        else
                                        {
                                            ErrorHandle("Data Error.");
                                        }
                                    }
                                    else
                                    {
                                        if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                        {
                                            Panel3.Title = "差旅费申请单草稿: " + dt.Rows[0]["No"].ToString();
                                        }
                                        else
                                        {
                                            Panel3.Title = "Travel Expense Draft: " + dt.Rows[0]["No"].ToString();
                                        }

                                        X.AddScript("btnSaveAndSend.enable();cbxBudget.setReadOnly(false);");
                                    }
                                }
                                //载入通用数据
                                LoadData(dt, true);
                            }
                            else
                            {
                                //判断是否为代理人
                                bool isagent = false;//记录Session["UserID"]是否为代理人
                                string sqlagent = "select * from Eagent where [St]=1 and [OwnerID]='" + dt.Rows[0]["PersonID"].ToString() + "' and getdate()<=Edate and getdate()>=Bdate";
                                DataTable dtagent = dbc.GetData("eReimbursement", sqlagent);
                                for (int g = 0; g < dtagent.Rows.Count; g++)
                                {
                                    if (Request.Cookies.Get("eReimUserID").Value == dtagent.Rows[g]["PAgentID"].ToString())
                                    {
                                        isagent = true;
                                        break;
                                    }
                                }
                                if (isagent)//代理人访问
                                {
                                    Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString());
                                    cbxOwner.Items.Add(li);
                                    //更改按钮状态
                                    if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                    {
                                        if (Request.QueryString["Copy"] != null)
                                        {
                                            if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                            {
                                                X.AddScript("btnSaveAndSend.enable();cbxBudget.setReadOnly(false);");
                                            }
                                            else
                                            {
                                                ErrorHandle("Data Error.");
                                            }
                                        }
                                        else
                                        {
                                            string app = "";
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "差旅费申请单: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    hdStatus.Value = "2";
                                                    app += ". 完成.";
                                                    X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                                }
                                                else//待审批
                                                {
                                                    hdStatus.Value = "1";
                                                    X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnCC.disable();");
                                                }

                                            }
                                            else
                                            {
                                                Panel3.Title = "Travel Expense Form: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    hdStatus.Value = "2";
                                                    app += ". Complete.";
                                                    X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                                }
                                                else//待审批
                                                {
                                                    hdStatus.Value = "1";
                                                    X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnCC.disable();");
                                                }
                                            }
                                            labelInfo.Text = app;
                                        }
                                    }
                                    else//草稿
                                    {
                                        if (Request.QueryString["Copy"] != null)
                                        {
                                            if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                            {
                                                X.AddScript("btnSaveAndSend.enable();cbxBudget.setReadOnly(false);");
                                            }
                                            else
                                            {
                                                ErrorHandle("Data Error.");
                                            }
                                        }
                                        else
                                        {
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "差旅费申请单草稿: " + dt.Rows[0]["No"].ToString();
                                            }
                                            else
                                            {
                                                Panel3.Title = "Travel Expense Draft: " + dt.Rows[0]["No"].ToString();
                                            }
                                            X.AddScript("btnSaveAndSend.enable();cbxBudget.setReadOnly(false);");
                                        }
                                    }
                                    //载入通用数据
                                    LoadData(dt, true);
                                }
                                else//判断是否有跨站权限
                                {

                                    bool hasright = false;
                                    string getright = "select * from StationRole where UserID='" + Request.Cookies.Get("eReimUserID").Value + "'";
                                    DataTable dtright = dbc.GetData("eReimbursement", getright);
                                    for (int j = 0; j < dtright.Rows.Count; j++)
                                    {
                                        string[] dd = dtright.Rows[j]["Stations"].ToString().Split(',');
                                        for (int i = 0; i < dd.Length; i++)
                                        {
                                            if (dd[i] == dt.Rows[0]["Station"].ToString())//有权限
                                            {
                                                hasright = true;
                                                break;
                                            }
                                        }
                                    }
                                    if (hasright)
                                    {
                                        Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString());
                                        cbxOwner.Items.Add(li);
                                        //更改按钮状态
                                        if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                        {
                                            string app = "";
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "差旅费申请单: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    hdStatus.Value = "2";
                                                    app += ". 完成.";
                                                    X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                                }
                                                else//待审批
                                                {
                                                    hdStatus.Value = "1";
                                                    X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnCC.disable();");
                                                }

                                            }
                                            else
                                            {
                                                Panel3.Title = "Travel Expense Form: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    hdStatus.Value = "2";
                                                    app += ". Complete.";
                                                    X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                                }
                                                else//待审批
                                                {
                                                    hdStatus.Value = "1";
                                                    X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnCC.disable();");
                                                }
                                            }
                                            labelInfo.Text = app;
                                        }
                                        else//草稿
                                        {
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "差旅费申请单草稿: " + dt.Rows[0]["No"].ToString();
                                            }
                                            else
                                            {
                                                Panel3.Title = "Travel Expense Draft: " + dt.Rows[0]["No"].ToString();
                                            }
                                            
                                            //X.AddScript("btnSaveAndSend.enable();");
                                        }
                                        hdStatus.Value = "2";//不允许传递到子页面时修改或者上传
                                        X.AddScript("btnGeteLeave.disable();btnEditDetail.disable();btnNewDetail.disable();btnSaveDraft.disable();btnCC.disable();");
                                        //无需判断Copy
                                        //载入通用数据
                                        LoadData(dt, false);
                                    }
                                    else
                                    {
                                        ErrorHandle("No right.");
                                    }
                                }
                            }
                        }
                        else
                        {
                            ErrorHandle("Data Error.");
                        }
                    }
                    else
                    {
                        ErrorHandle("Data Error.");
                    }
                }
                else
                {
                    //准备下拉菜单内容
                    Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value);
                    cbxOwner.Items.Add(li);
                    string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'";
                    DataTable dtitem = dbc.GetData("eReimbursement", sqlitem);
                    int itemcount = 0;
                    for (int j = 0; j < dtitem.Rows.Count; j++)
                    {
                        string sqlpara = sqlitem;
                        bool d1 = true;
                        bool d2 = false;
                        if (dtitem.Rows[j][5].ToString() != "")
                        {
                            //sqlpara += " and getdate()>='" + dtitem.Rows[j]["Bdate"].ToString() + "' ";
                            if (DateTime.Now >= Convert.ToDateTime(dtitem.Rows[j][5].ToString()))
                            {
                                d1 = true;
                            }
                            else
                            {
                                d1 = false;
                            }
                        }
                        if (dtitem.Rows[j][6].ToString() != "")
                        {
                            //sqlpara += " and getdate()<='" + dtitem.Rows[j]["Edate"].ToString() + "' ";
                            if (DateTime.Now <= Convert.ToDateTime(dtitem.Rows[j][6].ToString()))
                            {
                                d2 = true;
                            }
                            else
                            {
                                d2 = false;
                            }
                        }
                        if (d1 && d2)
                        {
                            li = new Ext.Net.ListItem(dtitem.Rows[j]["Owner"].ToString(), dtitem.Rows[j]["OwnerID"].ToString());
                            cbxOwner.Items.Add(li);
                        }
                    }
                    //新增记录时,默认为登录用户
                    cbxOwner.SelectedItem.Value = Request.Cookies.Get("eReimUserID").Value;
                    cbxOwner.SelectedItem.Text = Request.Cookies.Get("eReimUserName").Value;
                    labelStation.Text = Request.Cookies.Get("eReimStation").Value;
                    labelDepartment.Text = Request.Cookies.Get("eReimDepartment").Value;
                    LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(Request.Cookies.Get("eReimStation").Value);
                    X.AddScript("btnSaveAndSend.enable();cbxBudget.setReadOnly(false);");

                    //检查是否已经为该申请人设置过审批人
                    string sqlCheckFlow = "";
                    sqlCheckFlow = "select * from GroupFlow where [Type]!=2 and GID=(select GID from GroupUsers where UserID='" + cbxOwner.Value.ToString() + "')";
                    DataTable dtGroupFlowData = dbc.GetData("eReimbursement", sqlCheckFlow);
                    if (dtGroupFlowData.Rows.Count < 1)
                    {
                        if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                        {
                            ErrorHandle("请先设置审批人.");
                        }
                        else
                        {
                            ErrorHandle("Not set Approve flow,please contact with Local MIS.");
                        }
                        return;
                    }
                }
                DataSet dsdep = DIMERCO.SDK.Utilities.LSDK.getCRPDepartment();
                DataTable dtdep = new DataTable();
                dtdep.Columns.Add(new DataColumn("Depart", typeof(String)));
                for (int i = 0; i < dsdep.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = dtdep.NewRow();
                    dr[0] = dsdep.Tables[0].Rows[i][2].ToString();
                    dtdep.Rows.Add(dr);
                }
                StoreDepartment.DataSource = dtdep;
                StoreDepartment.DataBind();
            }
        }
示例#35
0
    /// <summary>
    /// 页面初始化方法
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack || X.IsAjaxRequest)
        {
            return;
        }

        #region  拉列表 - 性别
        Ext.Net.ListItem item = new Ext.Net.ListItem("男", "1");
        add_sex.Items.Add(item);
        modify_sex.Items.Add(item);

        item = new Ext.Net.ListItem("女", "2");
        add_sex.Items.Add(item);
        modify_sex.Items.Add(item);

        if (add_sex.Items.Count > 0)
        {
            add_sex.Value    = add_sex.Items[0].Value;
            modify_sex.Value = modify_sex.Items[0].Value;
        }
        #endregion

        #region  拉列表 - 班组
        item = new Ext.Net.ListItem("甲", "1");
        add_class.Items.Add(item);
        modify_class.Items.Add(item);

        item = new Ext.Net.ListItem("乙", "2");
        add_class.Items.Add(item);
        modify_class.Items.Add(item);

        item = new Ext.Net.ListItem("丙", "3");
        add_class.Items.Add(item);
        modify_class.Items.Add(item);

        if (add_class.Items.Count > 0)
        {
            add_class.Value    = add_class.Items[0].Value;
            modify_class.Value = modify_class.Items[0].Value;
        }
        #endregion

        #region  拉列表 - 班次
        item = new Ext.Net.ListItem("早", "1");
        add_shift.Items.Add(item);
        modify_shift.Items.Add(item);

        item = new Ext.Net.ListItem("中", "2");
        add_shift.Items.Add(item);
        modify_shift.Items.Add(item);

        item = new Ext.Net.ListItem("夜", "3");
        add_shift.Items.Add(item);
        modify_shift.Items.Add(item);

        if (add_shift.Items.Count > 0)
        {
            add_shift.Value    = add_shift.Items[0].Value;
            modify_shift.Value = modify_shift.Items[0].Value;
        }
        #endregion
    }
示例#36
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                //DataSet dsuser = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList("A0703");
                //if (dsuser.Tables[0].Rows.Count == 1)
                //{
                //    DataTable dt1 = dsuser.Tables[0];
                //    dt1 = null;
                //}

                //DataTable newr = Comm.RtnEB("A0703", "Administration", "DIMYVR", "DIMYVR", "62010910", "2014", "1");
                //DataSet ds3 = DIMERCO.SDK.Utilities.LSDK.getStationHierarchy();
                //for (int i = 0; i < ds3.Tables[0].Rows.Count; i++)
                //{
                //    if (ds3.Tables[0].Rows[i][0].ToString()=="GCRSHA")
                //    {
                //        string sw = ds3.Tables[0].Rows[i][0].ToString();
                //    }
                //}
                //DataTable dttt = ds3.Tables[0];
                //判断登录状态
                //Session["UserID"] = "A5236"; Session["UserName"] = "******";
                //if (Request.Cookies["eReimUserID"] != null)
                //{
                //    Response.Cookies["eReimUserID"].Value = "A5236";  //将值写入到客户端硬盘Cookie
                //    Response.Cookies["eReimUserID"].Expires = DateTime.Now.AddHours(12);//设置Cookie过期时间
                //}
                //else
                //{
                //    HttpCookie cookie = new HttpCookie("eReimUserID", "A5236");
                //    cookie.Expires = DateTime.Now.AddHours(12);
                //    Response.Cookies.Add(cookie);
                //}
                //if (Request.Cookies["eReimUserName"] != null)
                //{
                //    Response.Cookies["eReimUserName"].Value = "Angel Chen";  //将值写入到客户端硬盘Cookie
                //    Response.Cookies["eReimUserName"].Expires = DateTime.Now.AddHours(12);//设置Cookie过期时间
                //}
                //else
                //{
                //    HttpCookie cookie = new HttpCookie("eReimUserName", "Angel Chen");
                //    cookie.Expires = DateTime.Now.AddHours(12);
                //    Response.Cookies.Add(cookie);
                //}

                cs.DBCommand dbc = new cs.DBCommand();
                if (Request.Cookies.Get("eReimUserID") == null)
                {
                    X.AddScript("loginWindow.show();Panel1.disable();");
                    return;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "", "$('div.gn_person ul.q-menubox li:eq(0) a').text('" + Request.Cookies.Get("eReimUserName").Value + "');", true); X.AddScript("loginWindow.hide();Panel1.enable();");
                }
                //准备下拉菜单内容
                Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value);
                cbxPerson.Items.Add(li);
                string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'";

                try
                {
                    DataTable dtitem = new DataTable();
                    dtitem = dbc.GetData("eReimbursement", sqlitem);
                    int itemcount = 0;
                    if (dtitem!=null)
                    {
                        for (int j = 0; j < dtitem.Rows.Count; j++)
                        {
                            string sqlpara = sqlitem;
                            bool d1 = true;
                            bool d2 = false;
                            if (dtitem.Rows[j][5].ToString() != "")
                            {
                                //sqlpara += " and getdate()>='" + dtitem.Rows[j]["Bdate"].ToString() + "' ";
                                if (DateTime.Now >= Convert.ToDateTime(dtitem.Rows[j][5].ToString()))
                                {
                                    d1 = true;
                                }
                                else
                                {
                                    d1 = false;
                                }
                            }
                            if (dtitem.Rows[j][6].ToString() != "")
                            {
                                //sqlpara += " and getdate()<='" + dtitem.Rows[j]["Edate"].ToString() + "' ";
                                if (DateTime.Now <= Convert.ToDateTime(dtitem.Rows[j][6].ToString()))
                                {
                                    d2 = true;
                                }
                                else
                                {
                                    d2 = false;
                                }
                            }
                            if (d1 && d2)
                            {
                                li = new Ext.Net.ListItem(dtitem.Rows[j][1].ToString(), dtitem.Rows[j][2].ToString());
                                cbxPerson.Items.Add(li);
                                itemcount++;
                            }
                        }
                        if (itemcount < 1)
                        {
                            cbxPerson.SelectedIndex = 0;
                        }
                    }
                    else
                    {
                        DIMERCO.SDK.MailMsg mail = new DIMERCO.SDK.MailMsg();

                        mail.FromDispName = "eReimbursement";
                        mail.From = "*****@*****.**";
                        mail.To = "*****@*****.**";
                        mail.Title = "eReimbursement Bug" + DateTime.Now.ToString("yyyy/MM/dd hh:mm:dd");
                        mail.Body = "<div>Error<br/>" + sqlitem + "</div>";
                        mail.Send();
                    }
                    
                }
                catch (Exception ex)
                {
                    DIMERCO.SDK.MailMsg mail = new DIMERCO.SDK.MailMsg();

                    mail.FromDispName = "eReimbursement";
                    mail.From = "*****@*****.**";
                    mail.To = "*****@*****.**";
                    mail.Title = "eReimbursement Bug" + DateTime.Now.ToString("yyyy/MM/dd hh:mm:dd");
                    mail.Body = ex.Message + "<br/>" + ex.InnerException.ToString() + sqlitem + "</div>";
                    mail.Send();
                }
                
                string sqltype = "";
                string sqldraft = "";
                if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                {
                    PagingToolbar1.DisplayMsg = "显示 {0} - {1} of {2}";
                    ResourceManager1.Locale = "zh-CN";
                    sqltype += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='MainType'";
                    sqldraft += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='Type'";
                }
                else
                {
                    PagingToolbar1.DisplayMsg = "Displaying items {0} - {1} of {2}";
                    ResourceManager1.Locale = "en-US";
                    sqltype += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='MainType'";
                    sqldraft += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='Type'";
                }
                //if (Request.Cookies["lang"] != null)
                //{
                //    string lang = Request.Cookies["lang"].Value;
                //    if (lang.ToLower() == "en-us")
                //    {
                //        PagingToolbar1.DisplayMsg = "Displaying items {0} - {1} of {2}";
                //        ResourceManager1.Locale = "en-US";
                //        sqltype += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='MainType'";
                //        sqldraft += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='Type'";
                //    }
                //    else
                //    {
                //        PagingToolbar1.DisplayMsg = "显示 {0} - {1} of {2}";
                //        ResourceManager1.Locale = "zh-CN";
                //        sqltype += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='MainType'";
                //        sqldraft += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='Type'";
                //    }
                //}
                //else
                //{
                //    sqltype += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='MainType'";
                //    sqldraft += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='Type'";
                //}
                DataTable dttype = dbc.GetData("eReimbursement", sqltype);
                StoreType.DataSource = dttype;
                StoreType.DataBind();
                DataTable dtdraft = dbc.GetData("eReimbursement", sqldraft);
                StoreDraft.DataSource = dtdraft;
                StoreDraft.DataBind();

                //载入半年内申请
                string sqldate = " and ApplyDate >='" + DateTime.Now.AddMonths(-6).Date.ToString() + "' and ApplyDate <='" + DateTime.Now.AddDays(1).Date.ToString() + "'";
                BindData(sqldate);
            }
        }