public static StoreDraft DefaultStoreDraftWithKey(StoreDraft draft, string key)
        {
            var storeDraft = DefaultStoreDraft(draft);

            storeDraft.Key = key;
            return(storeDraft);
        }
        public static StoreDraft DefaultStoreDraft(StoreDraft storeDraft)
        {
            var randomInt = TestingUtility.RandomInt();

            storeDraft.Key  = $"Key{randomInt}";
            storeDraft.Name = new LocalizedString()
            {
                { "en", $"Store_Name_{randomInt}" }
            };
            return(storeDraft);
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                //判断登录状态
                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();");
                }
                string sqltype    = "";
                string sqldraft   = "";
                string sqlProcess = "";
                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'";
                    sqlProcess += "select [Text]=CText,[Value]=CValue from Edic where KeyValue='Status'";
                }
                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'";
                    sqlProcess += "select [Text]=EText,[Value]=CValue from Edic where KeyValue='Status'";
                }

                DataTable dttype = dbc.GetData("eReimbursement", sqltype);
                StoreType.DataSource = dttype;
                StoreType.DataBind();
                DataTable dtdraft = dbc.GetData("eReimbursement", sqldraft);
                StoreDraft.DataSource = dtdraft;
                StoreDraft.DataBind();
                DataTable dtProcess = dbc.GetData("eReimbursement", sqlProcess);
                StoreProcess.DataSource = dtProcess;
                StoreProcess.DataBind();
                //获取被授权站点
                string    getright  = "select * from StationRole where UserID='" + Request.Cookies.Get("eReimUserID").Value + "'";
                DataTable dtright   = dbc.GetData("eReimbursement", getright);
                DataTable dtStation = new DataTable();
                dtStation.Columns.Add("Text", System.Type.GetType("System.String"));
                dtStation.Columns.Add("Value", System.Type.GetType("System.String"));
                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 (!string.IsNullOrEmpty(dd[i].Trim()))
                        {
                            bool have = false;
                            for (int g = 0; g < dtStation.Rows.Count; g++)
                            {
                                if (dtStation.Rows[g]["Text"].ToString() == dd[i].Trim())
                                {
                                    have = true;
                                    break;
                                }
                            }
                            if (!have)
                            {
                                DataRow dr1 = dtStation.NewRow();
                                dr1["Text"]  = dd[i];
                                dr1["Value"] = dd[i];
                                dtStation.Rows.Add(dr1);
                            }
                        }
                    }
                }
                dtStation.DefaultView.Sort = "Text ASC";
                StoreStation.DataSource    = dtStation.DefaultView.ToTable();
                StoreStation.DataBind();
                //获取被授权站点下的所有申请人
                string station = "";
                for (int i = 0; i < dtStation.Rows.Count; i++)
                {
                    station += "'" + dtStation.Rows[i]["Text"].ToString() + "',";
                }
                if (!string.IsNullOrEmpty(station))
                {
                    station = " and Station in (" + station.Substring(0, station.Length - 1) + ") ";
                }
                string sqlgetPerson = "";
                if (station.Length > 0)
                {
                    sqlgetPerson = "select distinct [Text]=Person,[Value]=PersonID from V_Eflow_ETravel where (Active=1 or Active=2) and Person!='' " + station;
                }
                else
                {
                    sqlgetPerson = "select distinct [Text]=Person,[Value]=PersonID from V_Eflow_ETravel where (Active=1 or Active=2) and Person!='' and FlowID is null";
                }
                DataTable dtperson = dbc.GetData("eReimbursement", sqlgetPerson);
                dtperson.DefaultView.Sort = "Text ASC";
                StorePerson.DataSource    = dtperson.DefaultView.ToTable();
                StorePerson.DataBind();
                //获取被授权站点下的所有提单人
                string sqlgetCreatedBy = "";
                if (station.Length > 0)
                {
                    sqlgetCreatedBy = "select distinct [Text]=CreadedBy,[Value]=CreadedByID from V_Eflow_ETravel where (Active=1 or Active=2) and CreadedBy!='' " + station;
                }
                else
                {
                    sqlgetCreatedBy = "select distinct [Text]=CreadedBy,[Value]=CreadedByID from V_Eflow_ETravel where (Active=1 or Active=2) and CreadedBy!='' and FlowID is null";
                }
                DataTable dtcreatedby = dbc.GetData("eReimbursement", sqlgetCreatedBy);
                dtcreatedby.DefaultView.Sort = "Text ASC";
                StoreCreatedBy.DataSource    = dtcreatedby.DefaultView.ToTable();
                StoreCreatedBy.DataBind();
            }
        }
Exemplo n.º 4
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);
            }
        }