public SLP_Store() { co_main = new STMModel.MaintainStoreBase(ConntionDB); }
/// <summary> /// 繫結資料到控制項 /// </summary> /// <param name="vdb"></param> private void databind(string strFLAG) { #region //抓取本頁初次登記的時間 string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); STMModel.MaintainStoreBase BCO = new STMModel.MaintainStoreBase(ConnectionDB); ParameterList.Clear(); //門市基本31 TextBox txt_TELAREA = (TextBox)this.SLP_TEL_NO.FindControl("T1"); TextBox txt_TELNO = (TextBox)this.SLP_TEL_NO.FindControl("T2"); TextBox txt_FAXAREA = (TextBox)this.SLP_FAX_NO.FindControl("T1"); TextBox txt_FAXNO = (TextBox)this.SLP_FAX_NO.FindControl("T2"); ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text.Trim(),"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_MDC_START_DATE.StartDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_MDC_START_DATE.EndDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_MDC_END_DATE.StartDate, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_MDC_END_DATE.EndDate, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_CHAN_NO.Text,"string",CheckBoxLikeSearch.Checked));; ParameterList.Add(GetValueSetParameter(this.SLP_GROUP_NO.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.txtOLD_STORE.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_OPEN_DATE.StartDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_OPEN_DATE.EndDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_CLOSE_DATE.StartDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_CLOSE_DATE.EndDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_REOPEN_DATE.StartDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_REOPEN_DATE.EndDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_REMODEL_DATE.StartDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_REMODEL_DATE.EndDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_Z_O.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_D_O.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_TYPE.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.txtSTORE_ZIP.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(txt_TELAREA.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(txt_TELNO.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(txt_FAXAREA.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(txt_FAXNO.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.txtSTORE_ADDRESS.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_DATE.StartDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_DATE.EndDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_UID.Text,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_DATE.StartDate,"string",CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_DATE.EndDate, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_UID.Text, "string", CheckBoxLikeSearch.Checked)); //配送屬性17 RadioButtonList rdo_DIS_SW = (RadioButtonList)this.SLP_DIS_SW.FindControl("R1"); RadioButtonList rdo_MARKET_RESEARCH = (RadioButtonList)this.SLP_MARKET_RESEARCH.FindControl("R1"); RadioButtonList rdo_SING_VEN = (RadioButtonList)this.SLP_SING_VEN.FindControl("R1"); RadioButtonList rdo_MDC_TAXABLE = (RadioButtonList)this.SLP_MDC_TAXABLE.FindControl("R1"); RadioButtonList rdo_MDC_TAXFREE = (RadioButtonList)this.SLP_MDC_TAXFREE.FindControl("R1"); ParameterList.Add(GetValueSetParameter(this.SLP_AREA_NO.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_AREA_CODE.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_SHELVE_CM3.Text, "int", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_ROUTE.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.txtSTEP.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.txtARRIVE_TIME.Text, "string", CheckBoxLikeSearch.Checked)); if (rdo_DIS_SW.SelectedValue == "") ParameterList.Add(DBNull.Value); if (rdo_DIS_SW.SelectedValue == "1") ParameterList.Add(1); if (rdo_DIS_SW.SelectedValue == "0") ParameterList.Add(0); ParameterList.Add(this.ddlALLOCATION_TIMES.Text); ParameterList.Add(GetValueSetParameter(this.SLP_ALLOCATION_TIMES.Text, "int", CheckBoxLikeSearch.Checked)); if (rdo_MARKET_RESEARCH.SelectedValue == "") ParameterList.Add(DBNull.Value); if (rdo_MARKET_RESEARCH.SelectedValue == "1") ParameterList.Add(1); if (rdo_MARKET_RESEARCH.SelectedValue == "0") ParameterList.Add(0); ParameterList.Add(GetValueSetParameter(this.SLP_AC_UID.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_SAL_ID.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_FEAT_GRADE.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text, "string", CheckBoxLikeSearch.Checked)); if (rdo_SING_VEN.SelectedValue == "") ParameterList.Add(DBNull.Value); if (rdo_SING_VEN.SelectedValue == "1") ParameterList.Add(1); if (rdo_SING_VEN.SelectedValue == "0") ParameterList.Add(0); if (rdo_MDC_TAXABLE.SelectedValue == "") ParameterList.Add(DBNull.Value); if (rdo_MDC_TAXABLE.SelectedValue == "1") ParameterList.Add(1); if (rdo_MDC_TAXABLE.SelectedValue == "0") ParameterList.Add(0); if (rdo_MDC_TAXFREE.SelectedValue == "") ParameterList.Add(DBNull.Value); if (rdo_MDC_TAXFREE.SelectedValue == "1") ParameterList.Add(1); if (rdo_MDC_TAXFREE.SelectedValue == "0") ParameterList.Add(0); //屬性19 CheckBox chk_W1 = (CheckBox)this.SLP_Boolean_W1.FindControl("C1"); CheckBox chk_W2 = (CheckBox)this.SLP_Boolean_W2.FindControl("C1"); CheckBox chk_W3 = (CheckBox)this.SLP_Boolean_W3.FindControl("C1"); CheckBox chk_W4 = (CheckBox)this.SLP_Boolean_W4.FindControl("C1"); CheckBox chk_W5 = (CheckBox)this.SLP_Boolean_W5.FindControl("C1"); CheckBox chk_W6 = (CheckBox)this.SLP_Boolean_W6.FindControl("C1"); CheckBox chk_W7 = (CheckBox)this.SLP_Boolean_W7.FindControl("C1"); ParameterList.Add(GetValueSetParameter(this.txtCOPY_SOURCE.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(this.ddlPSM.Text); ParameterList.Add(GetValueSetParameter(this.SLP_PSM.Text, "int", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_BUSINESS_NO.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_OPEN_TIME.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_CLOSE_TIME.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_COMPETITION.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_REMARK.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_SPE.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(chk_W1.Checked ? "1" : null); ParameterList.Add(chk_W2.Checked ? "1" : null); ParameterList.Add(chk_W3.Checked ? "1" : null); ParameterList.Add(chk_W4.Checked ? "1" : null); ParameterList.Add(chk_W5.Checked ? "1" : null); ParameterList.Add(chk_W6.Checked ? "1" : null); ParameterList.Add(chk_W7.Checked ? "1" : null); ParameterList.Add(GetValueSetParameter(this.SLP_SHELF_NO.Text, "string", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_DISPLAY_NUM.Text, "int", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.SLP_SHELVE_CM3_2.Text, "int", CheckBoxLikeSearch.Checked)); ParameterList.Add(GetValueSetParameter(this.txtStoreName.Text, "string", CheckBoxLikeSearch.Checked)); //2010/06/14新增店名查詢欄位 if (strFLAG != "EXCEL") { DataTable Dt = BCO.QuerySwitch(STMModel.MaintainStoreBase.QueryType.QueryByLike, ParameterList); int iRowCount = (this.TextBoxRowCountLimit.Text.Trim() == string.Empty) ? 9999 : int.Parse(TextBoxRowCountLimit.Text); while (Dt.Rows.Count > iRowCount) { DataRow dr = Dt.Rows[Dt.Rows.Count - 1]; dr.Delete(); Dt.AcceptChanges(); } Session[SessionIDName] = Dt; GridView1.DataSource = Dt; //設定分頁大小 GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); LabelQueryRecordCount.Text = string.Format(" {0} Rows ", Dt.Rows.Count.ToString()); if (Dt == null || (Dt != null && Dt.Rows.Count <= 0)) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('查無資料');", true); } #region 將Key值存到Session中 ArrayList arl_Key = new ArrayList(); foreach (DataRow drRow in Dt.Rows) { arl_Key.Add("store=" + drRow["STORE"].ToString() + "&date=" + drRow["MDC_START_DATE"].ToString()); } Session["STM012_SortKey" + this.PageTimeStamp.Value] = arl_Key; } else { DataTable Dt1 = BCO.QuerySwitch(STMModel.MaintainStoreBase.QueryType.Excel, ParameterList); int iRowCount = (this.TextBoxRowCountLimit.Text.Trim() == string.Empty) ? 9999 : int.Parse(TextBoxRowCountLimit.Text); while (Dt1.Rows.Count > iRowCount) { DataRow dr = Dt1.Rows[Dt1.Rows.Count - 1]; dr.Delete(); Dt1.AcceptChanges(); } for (int j = 0; j < Dt1.Rows.Count; j++) { LogHelper LOG = new LogHelper(ConnectionDB); ParameterList.Clear(); ParameterList.Add("STM01門市主檔");//0 ParameterList.Add(Session["UID"].ToString());//1 ParameterList.Add("O");//2 ParameterList.Add(Dt1.Rows[j]["STORE"].ToString());//3 ParameterList.Add(Request.ServerVariables["Server_Name"]);//4 LOG.AddSafeLog(ParameterList); } Session[SessionIDName] = Dt1; } #endregion #endregion }//databind
private void QueryData(string v_store, string v_date) { try { #region 將變數資料清空 ds_Data.Tables.Clear(); //ds_Data.Clear(); #endregion #region 門市基本、配送屬性 STMModel.MaintainStoreBase BCO = new STMModel.MaintainStoreBase(ConnectionDB); DataTable Dt; ParameterList.Clear(); ParameterList.Add(v_store); ParameterList.Add(DateTime.Parse(v_date.Trim()).ToString("yyyy/MM/dd")); ParameterList.Add(DateTime.Parse(v_date.Trim()).ToString("yyyy/MM/dd")); for (int i = 0; i <= 34; i++) { ParameterList.Add(null); } ParameterList.Add(">="); for (int i = 0; i <= 9; i++) { ParameterList.Add(null); } ParameterList.Add(">="); for (int i = 0; i <= 16; i++) { ParameterList.Add(null); } ParameterList.Add(null); Dt = BCO.QuerySwitch(STMModel.MaintainStoreBase.QueryType.QueryByLike, ParameterList); if (Dt == null || (Dt != null && Dt.Rows.Count <= 0)) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('查無資料');", true); return; } #region 取得畫面元件的值 TextBox txt_TELAREA = (TextBox)this.SLP_TEL_NO.FindControl("T1"); TextBox txt_TELNO = (TextBox)this.SLP_TEL_NO.FindControl("T2"); TextBox txt_FAXAREA = (TextBox)this.SLP_FAX_NO.FindControl("T1"); TextBox txt_FAXNO = (TextBox)this.SLP_FAX_NO.FindControl("T2"); CheckBox rdo_DIS_SW = (CheckBox)this.SLP_DIS_SW.FindControl("C1"); CheckBox rdo_MARKET_RESEARCH = (CheckBox)this.SLP_MARKET_RESEARCH.FindControl("C1"); CheckBox rdo_SING_VEN = (CheckBox)this.SLP_SING_VEN.FindControl("C1"); RadioButtonList rdo_MDC_TAXABLE = (RadioButtonList)this.SLP_MDC_TAXABLE.FindControl("R1"); RadioButtonList rdo_MDC_TAXFREE = (RadioButtonList)this.SLP_MDC_TAXFREE.FindControl("R1"); CheckBox chk_W1 = (CheckBox)this.SLP_Boolean1.FindControl("C1"); CheckBox chk_W2 = (CheckBox)this.SLP_Boolean2.FindControl("C1"); CheckBox chk_W3 = (CheckBox)this.SLP_Boolean3.FindControl("C1"); CheckBox chk_W4 = (CheckBox)this.SLP_Boolean4.FindControl("C1"); CheckBox chk_W5 = (CheckBox)this.SLP_Boolean5.FindControl("C1"); CheckBox chk_W6 = (CheckBox)this.SLP_Boolean6.FindControl("C1"); CheckBox chk_W7 = (CheckBox)this.SLP_Boolean7.FindControl("C1"); #endregion this.txtSTORE.Text = Dt.Rows[0]["STORE"].ToString(); this.txtSTORE_NAME.Text = Dt.Rows[0]["STORE_NAME"].ToString(); this.SLP_MDC_START_DATE.Text = Dt.Rows[0]["MDC_START_DATE"].ToString(); this.SLP_MDC_END_DATE.Text = Dt.Rows[0]["MDC_END_DATE"].ToString(); this.SLP_CHAN_NO.Text = Dt.Rows[0]["CHAN_NO"].ToString(); this.SLP_GROUP_NO.Text = Dt.Rows[0]["GROUP_NO"].ToString(); this.txtOLD_STORE.Text = Dt.Rows[0]["OLD_STORE"].ToString(); this.SLP_STORE_OPEN_DATE.Text = Dt.Rows[0]["STORE_OPEN_DATE"].ToString(); this.SLP_STORE_CLOSE_DATE.Text = Dt.Rows[0]["STORE_CLOSE_DATE"].ToString(); this.SLP_REOPEN_DATE.Text = Dt.Rows[0]["REOPEN_DATE"].ToString(); this.SLP_REMODEL_DATE.Text = Dt.Rows[0]["REMODEL_DATE"].ToString(); this.SLP_Z_O.Text = Dt.Rows[0]["Z_O"].ToString(); this.SLP_D_O.Text = Dt.Rows[0]["D_O"].ToString(); this.SLP_STORE_TYPE.Text = Dt.Rows[0]["STORE_TYPE"].ToString(); this.txtSTORE_ZIP.Text = Dt.Rows[0]["STORE_ZIP"].ToString(); txt_TELAREA.Text = Dt.Rows[0]["STORE_TEL_AREA"].ToString(); txt_TELNO.Text = Dt.Rows[0]["STORE_TEL_NO"].ToString(); txt_FAXAREA.Text = Dt.Rows[0]["STORE_FAX_AREA"].ToString(); txt_FAXNO.Text = Dt.Rows[0]["STORE_FAX_NO"].ToString(); this.txtSTORE_ADDRESS.Text = Dt.Rows[0]["STORE_ADDRESS"].ToString(); this.txtVIRTUAL_FLAG.Text = Dt.Rows[0]["VIRTUAL_FLAG"].ToString(); this.SLP_AREA_NO.Text = Dt.Rows[0]["AREA_NO"].ToString(); this.SLP_AREA_CODE.Text = Dt.Rows[0]["AREA_CODE"].ToString(); this.SLP_SHELVE_CM3.Text = Dt.Rows[0]["SHELVE_CM3"].ToString(); if (Dt.Rows[0]["DIS_SW"].ToString() == "1") this.SLP_DIS_SW.Text = "1"; //rdo_DIS_SW.Checked = true; else this.SLP_DIS_SW.Text = "0"; //rdo_DIS_SW.Checked = false; this.SLP_ALLOCATION_TIMES.Text = Dt.Rows[0]["ALLOCATION_TIMES"].ToString(); if (Dt.Rows[0]["MARKET_RESEARCH"].ToString() == "1") this.SLP_MARKET_RESEARCH.Text = "1"; //rdo_MARKET_RESEARCH.Checked = true; else this.SLP_MARKET_RESEARCH.Text = "0"; //rdo_MARKET_RESEARCH.Checked = false; this.SLP_AC_UID.Text = Dt.Rows[0]["AC_UID"].ToString(); this.SLP_SAL_ID.Text = Dt.Rows[0]["SAL_ID"].ToString(); this.SLP_FEAT_GRADE.Text = Dt.Rows[0]["FEAT_GRADE"].ToString(); this.txtPAY_RFNO.Text = Dt.Rows[0]["PAY_RFNO"].ToString(); if (Dt.Rows[0]["SING_VEN"].ToString() == "1") //rdo_SING_VEN.Checked = true; this.SLP_SING_VEN.Text = "1"; else //rdo_SING_VEN.Checked = false; this.SLP_SING_VEN.Text = "0"; MDC_TAXABLE_ID = Dt.Rows[0]["MDC_TAXABLE"].ToString(); MDC_TAXFREE_ID = Dt.Rows[0]["MDC_TAXFREE"].ToString(); SLP_CREATE_DATE.Text = Dt.Rows[0]["CREATEDATE"].ToString(); SLP_CREATE_UID.Text = Dt.Rows[0]["CREATEUID"].ToString(); SLP_UPDATE_DATE.Text = Dt.Rows[0]["UPDATEDATE"].ToString(); SLP_UPDATE_UID.Text = Dt.Rows[0]["UPDATEUID"].ToString(); txtEFF_DATE_TO.Text = Dt.Rows[0].IsNull("EFF_DATE_TO") ? "" : Convert.ToDateTime(Dt.Rows[0]["EFF_DATE_TO"]).ToShortDateString(); #endregion #region 屬性 STMModel.MaintainStoreProperty BCO_Property = new STMModel.MaintainStoreProperty(ConnectionDB); DataTable Dt_Property; ParameterList.Clear(); ParameterList.Add(v_store); Dt_Property = BCO_Property.QuerySwitch(STMModel.MaintainStoreProperty.QueryType.CODE, ParameterList); if (Dt_Property != null && Dt_Property.Rows.Count > 0) { this.txtCOPY_SOURCE.Text = Dt_Property.Rows[0]["COPY_SOURCE"].ToString(); this.SLP_PSM.Text = Dt_Property.Rows[0]["PSM"].ToString(); this.SLP_BUSINESS_NO.Text = Dt_Property.Rows[0]["BUSINESS_NO"].ToString(); this.SLP_OPEN_TIME.Text = Dt_Property.Rows[0]["OPEN_TIME"].ToString(); this.SLP_CLOSE_TIME.Text = Dt_Property.Rows[0]["CLOSE_TIME"].ToString(); this.SLP_COMPETITION.Text = Dt_Property.Rows[0]["COMPETITION"].ToString(); this.SLP_REMARK.Text = Dt_Property.Rows[0]["REMARK"].ToString(); this.SLP_STORE_SPE.Text = Dt_Property.Rows[0]["STORE_SPE"].ToString(); if (Dt_Property.Rows[0]["BUSINESS_W1"].ToString() == "1") this.SLP_Boolean1.Text = "1"; //chk_W1.Checked = true; else //chk_W1.Checked = false; this.SLP_Boolean1.Text = "0"; if (Dt_Property.Rows[0]["BUSINESS_W2"].ToString() == "1") this.SLP_Boolean2.Text = "1"; //chk_W2.Checked = true; else this.SLP_Boolean2.Text = "0"; //chk_W2.Checked = false; if (Dt_Property.Rows[0]["BUSINESS_W3"].ToString() == "1") this.SLP_Boolean3.Text = "1"; // chk_W3.Checked = true; else this.SLP_Boolean3.Text = "0"; //chk_W3.Checked = false; if (Dt_Property.Rows[0]["BUSINESS_W4"].ToString() == "1") this.SLP_Boolean4.Text = "1"; //chk_W4.Checked = true; else this.SLP_Boolean4.Text = "0"; //chk_W4.Checked = false; if (Dt_Property.Rows[0]["BUSINESS_W5"].ToString() == "1") this.SLP_Boolean5.Text = "1"; //chk_W5.Checked = true; else this.SLP_Boolean5.Text = "0"; //chk_W5.Checked = false; if (Dt_Property.Rows[0]["BUSINESS_W6"].ToString() == "1") this.SLP_Boolean6.Text = "1"; //chk_W6.Checked = true; else this.SLP_Boolean6.Text = "0"; //chk_W6.Checked = false; if (Dt_Property.Rows[0]["BUSINESS_W7"].ToString() == "1") this.SLP_Boolean7.Text = "1"; // chk_W7.Checked = true; else this.SLP_Boolean7.Text = "0"; //chk_W7.Checked = false; } #endregion #region 貨架設置 STMModel.MaintainStoreShelf BCO_Shelf = new STMModel.MaintainStoreShelf(ConnectionDB); DataTable Dt_Shelf; ParameterList.Clear(); ParameterList.Add(v_store); Dt_Shelf = BCO_Shelf.QuerySwitch(STMModel.MaintainStoreShelf.QueryType.STORE, ParameterList); GridView1.DataSource = Dt_Shelf; //設定分頁大小 // GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); GridView1.Visible = true; if (Dt == null || (Dt != null && Dt.Rows.Count <= 0)) { return; } #endregion #region 路線、路順、到店時間 STMModel.MaintainStoreBase STM = new STMModel.MaintainStoreBase(ConntionDB); ParameterList.Clear(); ParameterList.Add(SLP_CHAN_NO.Text.Trim());//通路 ParameterList.Add(txtSTORE.Text.Trim());//門市 DataTable dt = STM.GetRouteInfo(ParameterList); if (dt.Rows.Count == 1) { SLP_ROUTE_ID.Text = dt.Rows[0]["ROUTE"].ToString(); SLP_ROUTE_STEP.Text = dt.Rows[0]["STEP"].ToString(); SLP_ROUTE_ARRIVE_TIME.Text = dt.Rows[0]["ARRIVE_TIME"].ToString(); } #endregion #region 取得審核狀態 lblARMK.Text = Dt.Rows[0]["STORE_ARMK"].ToString(); #endregion #region 將資料寫入變數 Dt.TableName = "VDS_STM_STORE"; Dt_Property.TableName = "VDS_STM_STORE_PROPERTY"; Dt_Shelf.TableName = "VDS_STM_STORE_SHELF"; ds_Data.Tables.Add(Dt.Copy()); ds_Data.Tables.Add(Dt_Property.Copy()); ds_Data.Tables.Add(Dt_Shelf.Copy()); DataSet ds = new DataSet(); ds.Tables.Add(Dt_Shelf.Copy()); DataColumn[] keys = new DataColumn[2]; keys[0] = ds.Tables[0].Columns["STORE"]; keys[1] = ds.Tables[0].Columns["SHELF_NO"]; ds.Tables[0].PrimaryKey = keys; Session["STM012_" + PageTimeStamp.Value] = ds; Session["Report_" + PageTimeStamp.Value] = ds.Tables["VDS_STM_STORE"]; #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { } }
/// <summary> /// 列印鈕 /// </summary> protected void btnStorePrint_Click(object sender, EventArgs e) { if (VerifyFormData() == true) { try { STMModel.MaintainStoreBase BCO = new STMModel.MaintainStoreBase(ConnectionDB); DataTable Dt; ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(this.txtSTORE.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(DateTime.Parse(this.SLP_MDC_START_DATE.Text).ToString("yyyy/MM/dd"), "string", false)); ParameterList.Add(GetValueSetParameter(DateTime.Parse(this.SLP_MDC_START_DATE.Text).ToString("yyyy/MM/dd"), "string", false)); for (int i = 0; i <= 34; i++) { ParameterList.Add(null); } ParameterList.Add(">="); for (int i = 0; i <= 9; i++) { ParameterList.Add(null); } ParameterList.Add(">="); for (int i = 0; i <= 16; i++) { ParameterList.Add(null); } ParameterList.Add(null); Dt = BCO.QuerySwitch(STMModel.MaintainStoreBase.QueryType.QueryByLike, ParameterList); if (Dt.Rows.Count == 0) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "STM012.aspx", "alert(' 查無資料 ');", true); return; } ShowReport(Dt); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { } } }
protected void btnDelete_Click(object sender, EventArgs e) { //預設欄位Focus #region try { DateTime processtime = DateTime.Now; #region 門市基本,配送屬性 ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["CREATEDATE"].ToString(), "datetime", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["CREATEUID"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["UPDATEDATE"].ToString(), "datetime", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["UPDATEUID"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["STORE"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["MDC_START_DATE"].ToString(), "date", false)); ParameterList.Add(processtime); ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false)); #endregion STMModel.MaintainStoreBase BCO = new STMModel.MaintainStoreBase(ConnectionDB); BCO.DeleteStoreBase(ParameterList, null); ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('刪除完成');location.replace('STM011.aspx?Code=STM01');", true); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } #endregion }
protected void TabContainer1_ActiveTabChanged(object sender, EventArgs e) { try { if (TabContainer1.ActiveTabIndex == 1) { #region 取得路線、路順、到店時間、屬性,貨架設置資料 if (txtSTORE.Text.Trim().Length != 0 && SLP_CHAN_NO.Text.Trim().Length != 0) { if (SLP_ROUTE_ID.Text.Trim().Length == 0 || SLP_ROUTE_STEP.Text.Trim().Length == 0 || SLP_ROUTE_ARRIVE_TIME.Text.Trim().Length == 0) { STMModel.MaintainStoreBase STM = new STMModel.MaintainStoreBase(ConntionDB); ParameterList.Clear(); ParameterList.Add(SLP_CHAN_NO.Text.Trim());//通路 ParameterList.Add(txtSTORE.Text.Trim());//門市 DataTable dt = STM.GetRouteInfo(ParameterList); if (dt.Rows.Count == 1) { SLP_ROUTE_ID.Text = dt.Rows[0]["ROUTE"].ToString(); SLP_ROUTE_STEP.Text = dt.Rows[0]["STEP"].ToString(); SLP_ROUTE_ARRIVE_TIME.Text = dt.Rows[0]["ARRIVE_TIME"].ToString(); } else { SLP_ROUTE_ID.Text = ""; SLP_ROUTE_STEP.Text = ""; SLP_ROUTE_ARRIVE_TIME.Text = ""; } } } else { SLP_ROUTE_ID.Text = ""; SLP_ROUTE_STEP.Text = ""; SLP_ROUTE_ARRIVE_TIME.Text = ""; } #endregion } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { } }
protected void btnSave_Click(object sender, EventArgs e) { STMModel.MaintainStoreBase STM = new STMModel.MaintainStoreBase(ConntionDB); #region 檢核 //檢核必輸入欄位 TextBox start_date = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_MDC_START_DATE).FindControl("TextBoxCode")); TextBox StoreChain = ((TextBox)SLP_CHAN_NO.FindControl("TextBoxCode")); TextBox StoreGroup = ((TextBox)SLP_GROUP_NO.FindControl("TextBoxCode")); TextBox tel_area = ((TextBox)((ASP.wui_slp_slp_telfax_ascx)SLP_TEL_NO).FindControl("T1")); TextBox tel_no = ((TextBox)((ASP.wui_slp_slp_telfax_ascx)SLP_TEL_NO).FindControl("T2")); TextBox fax_area = ((TextBox)((ASP.wui_slp_slp_telfax_ascx)SLP_FAX_NO).FindControl("T1")); TextBox fax_no = ((TextBox)((ASP.wui_slp_slp_telfax_ascx)SLP_FAX_NO).FindControl("T2")); TextBox AC_UID = ((TextBox)((ASP.sys_slp_slp_user_ascx)SLP_AC_UID).FindControl("TextBoxCode")); TextBox SAL_ID = ((TextBox)((ASP.sys_slp_slp_user_ascx)SLP_SAL_ID).FindControl("TextBoxCode")); TextBox[] FieldIDs ={ txtSTORE, txtSTORE_NAME, start_date, StoreChain, StoreGroup, txtSTORE_ZIP, tel_area, tel_no, fax_area, fax_no, txtSTORE_ADDRESS, AC_UID, SAL_ID }; string[] FieldNames ={ "店號", "店名", "DC適用開始日", "配本通路", "店群", "郵遞區號", "電話區碼", "電話號碼", "傳真區碼", "傳真號碼", "地址", "帳務人員", "營業人員" }; int i = 0; foreach (TextBox FieldName in FieldIDs) { if (FieldName.Text.Trim().Length == 0) { ErrorMsgLabel.Text = "必須輸入「" + FieldNames[i] + "」欄位"; return; } i++; } //20130828 純萍 異動判斷=>特定店群不判斷店號規則 //判斷店群 ParameterList.Clear(); ParameterList.Add(StoreGroup.Text.Trim()); if (STM.ExceptionStoreGroup(ParameterList) == "0") { if (!IsNumber(txtSTORE.Text.Substring(1)) || !IsWord(txtSTORE.Text.Substring(0, 1))) { ErrorMsgLabel.Text = "店號第一碼是英文字或數字,第二碼後都要是數字 !!"; return; } } //檢核長度 if (GetStringLen(txtSTORE.Text.Trim()) > 10) { ErrorMsgLabel.Text = "店號長度限制10位 !!"; return; } if (GetStringLen(txtSTORE_NAME.Text.Trim()) > 12) { ErrorMsgLabel.Text = "店名長度限制12位 !!"; return; } if (GetStringLen(txtSTORE_ADDRESS.Text.Trim()) > 50) { ErrorMsgLabel.Text = "地址長度限制50位 !!"; return; } if (GetStringLen(txtOLD_STORE.Text.Trim()) > 10) { ErrorMsgLabel.Text = "舊店號長度限制10位 !!"; return; } //DC適用開始日檢核 if (SLP_MDC_END_DATE.Text.Trim().Length > 0) { if (DateTime.Parse(SLP_MDC_START_DATE.Text) >= DateTime.Parse(SLP_MDC_END_DATE.Text)) { ErrorMsgLabel.Text = "DC適用開始日須小於DC適用結束日 !!"; return; } if ((SLP_MDC_END_DATE.Text.Trim().Length == 0 ? DateTime.Parse("9999/12/31") : DateTime.Parse(SLP_MDC_END_DATE.Text)) <= DateTime.Today) { ErrorMsgLabel.Text = "DC適用結束日須大於系統日 !!"; return; } } //開店日期須小於關店日期 if ((SLP_STORE_OPEN_DATE.Text != "") && (SLP_STORE_CLOSE_DATE.Text != "")) { if (DateTime.Parse(SLP_STORE_OPEN_DATE.Text) >= DateTime.Parse(SLP_STORE_CLOSE_DATE.Text)) { ErrorMsgLabel.Text = "開店日期須小於關店日期 !!"; return; } } //判斷配本通路 ParameterList.Clear(); ParameterList.Add(StoreChain.Text.Trim()); if (STM.ValidateStoreChan(ParameterList) == "0") { ErrorMsgLabel.Text = "配本通路錯誤 !!"; return; } //判斷店群 ParameterList.Clear(); ParameterList.Add(StoreGroup.Text.Trim()); if (STM.ValidateStoreGroup(ParameterList) == "0") { ErrorMsgLabel.Text = "店群錯誤 !!"; return; } //取得結帳統編 if (txtPAY_RFNO.Text.Trim().Length == 0) txtPAY_RFNO.Text = STM.GetViutualPayRFNO(); //取得舊店號 if (txtOLD_STORE.Text.Trim().Length != 0) { ParameterList.Clear(); ParameterList.Add(txtOLD_STORE.Text.Trim());//舊門市 ParameterList.Add(txtSTORE.Text.Trim());//門市 if (STM.GetChargestore(ParameterList) == "0") { ErrorMsgLabel.Text = "舊店號錯誤 !!"; return; } } //取得審核狀態 if (txtPAY_RFNO.Text.Trim().Length != 0) { ParameterList.Clear(); ParameterList.Add(txtSTORE.Text.Trim());//門市 lblARMK.Text = "未審核"; if (STM.GetStoreAccountInfo(ParameterList) == "1") lblARMK.Text = "已審核"; } #endregion #region 新增儲存 if (Request.QueryString["mode"] == "insert") { //判斷DC適用開始日與門市的DC適用開始日是否重疊 ParameterList.Clear(); ParameterList.Add(txtSTORE.Text.Trim());//門市 ParameterList.Add(SLP_MDC_START_DATE.Text.Trim());//DC適用開始日 if (STM.CheckDcStartData(ParameterList) == "0") { ErrorMsgLabel.Text = "門市的DC生效區間重疊 !!"; return; } //儲存作業 int res = 0; int v_ID = 0; #region try { #region 取得畫面元件的值 TextBox txt_TELAREA = (TextBox)this.SLP_TEL_NO.FindControl("T1"); TextBox txt_TELNO = (TextBox)this.SLP_TEL_NO.FindControl("T2"); TextBox txt_FAXAREA = (TextBox)this.SLP_FAX_NO.FindControl("T1"); TextBox txt_FAXNO = (TextBox)this.SLP_FAX_NO.FindControl("T2"); CheckBox chk_DIS_SW = (CheckBox)this.SLP_DIS_SW.FindControl("C1"); CheckBox chk_MARKET_RESEARCH = (CheckBox)this.SLP_MARKET_RESEARCH.FindControl("C1"); CheckBox chk_SING_VEN = (CheckBox)this.SLP_SING_VEN.FindControl("C1"); RadioButtonList rdo_MDC_TAXABLE = (RadioButtonList)this.SLP_MDC_TAXABLE.FindControl("R1"); RadioButtonList rdo_MDC_TAXFREE = (RadioButtonList)this.SLP_MDC_TAXFREE.FindControl("R1"); CheckBox chk_W1 = (CheckBox)this.SLP_Boolean1.FindControl("C1"); CheckBox chk_W2 = (CheckBox)this.SLP_Boolean2.FindControl("C1"); CheckBox chk_W3 = (CheckBox)this.SLP_Boolean3.FindControl("C1"); CheckBox chk_W4 = (CheckBox)this.SLP_Boolean4.FindControl("C1"); CheckBox chk_W5 = (CheckBox)this.SLP_Boolean5.FindControl("C1"); CheckBox chk_W6 = (CheckBox)this.SLP_Boolean6.FindControl("C1"); CheckBox chk_W7 = (CheckBox)this.SLP_Boolean7.FindControl("C1"); DateTime processtime = DateTime.Now; #endregion #region 門市基本,配送屬性 ParameterList.Clear(); ParameterList.Add(string.Format("{0}{1}", this.txtSTORE.Text.Trim(), Convert.ToDateTime(this.SLP_MDC_START_DATE.Text).Year.ToString() + Convert.ToDateTime(this.SLP_MDC_START_DATE.Text).Month.ToString().PadLeft(2, '0') + Convert.ToDateTime(this.SLP_MDC_START_DATE.Text).Day.ToString().PadLeft(2, '0'))); ParameterList.Add(GetValueSetParameter(this.txtSTORE_NAME.Text.Trim(), "string", false)); ParameterList.Add(processtime); ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(processtime); ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(this.txtSTORE.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_MDC_START_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_MDC_END_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.txtSTORE_NAME.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_CHAN_NO.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_GROUP_NO.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.txtOLD_STORE.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_OPEN_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_CLOSE_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_REOPEN_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_REMODEL_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_Z_O.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_D_O.Text.Trim(), "string", false)); ; ParameterList.Add(GetValueSetParameter(this.SLP_STORE_TYPE.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.txtSTORE_ZIP.Text.Trim(), "string", false)); ParameterList.Add(txt_TELAREA.Text.Trim()); ParameterList.Add(txt_TELNO.Text.Trim()); ParameterList.Add(txt_FAXAREA.Text.Trim()); ParameterList.Add(txt_FAXNO.Text.Trim()); ParameterList.Add(GetValueSetParameter(this.txtSTORE_ADDRESS.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_AREA_NO.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_AREA_CODE.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_SHELVE_CM3.Text, "int", false)); ParameterList.Add(chk_DIS_SW.Checked ? 1 : 0); ParameterList.Add(GetValueSetParameter(this.SLP_ALLOCATION_TIMES.Text, "int", false)); ParameterList.Add(chk_MARKET_RESEARCH.Checked ? 1 : 0); ParameterList.Add(this.SLP_AC_UID.Text.Trim()); ParameterList.Add(this.SLP_SAL_ID.Text.Trim()); ParameterList.Add(this.SLP_FEAT_GRADE.Text.Trim()); ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text.Trim(), "string", false)); ParameterList.Add(chk_SING_VEN.Checked ? 1 : 0); if (rdo_MDC_TAXABLE.SelectedValue == "1") ParameterList.Add(1); else ParameterList.Add(0); if (rdo_MDC_TAXFREE.SelectedValue == "1") ParameterList.Add(1); else ParameterList.Add(0); ParameterList.Add(this.txtVIRTUAL_FLAG.Text.Trim()); #endregion #region 屬性 ParameterList.Add(this.txtSTORE.Text.Trim()); ParameterList.Add(this.txtSTORE_NAME.Text.Trim()); ParameterList.Add(processtime); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(processtime); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(this.txtSTORE.Text.Trim()); ParameterList.Add(this.txtCOPY_SOURCE.Text.Trim()); ParameterList.Add(GetValueSetParameter(this.SLP_PSM.Text, "int", false)); ParameterList.Add(this.SLP_BUSINESS_NO.Text.Trim()); ParameterList.Add(this.SLP_OPEN_TIME.Text.Trim()); ParameterList.Add(this.SLP_CLOSE_TIME.Text.Trim()); ParameterList.Add(this.SLP_COMPETITION.Text.Trim()); ParameterList.Add(this.SLP_REMARK.Text.Trim()); ParameterList.Add(this.SLP_STORE_SPE.Text.Trim()); ParameterList.Add(chk_W1.Checked ? 1 : 0); ParameterList.Add(chk_W2.Checked ? 1 : 0); ParameterList.Add(chk_W3.Checked ? 1 : 0); ParameterList.Add(chk_W4.Checked ? 1 : 0); ParameterList.Add(chk_W5.Checked ? 1 : 0); ParameterList.Add(chk_W6.Checked ? 1 : 0); ParameterList.Add(chk_W7.Checked ? 1 : 0); #endregion #region 貨架設置 DataSet ds = (DataSet)Session["STM012_" + PageTimeStamp.Value]; foreach (DataRow dr in ds.Tables[0].Rows) { if (dr.RowState != DataRowState.Deleted) { dr.BeginEdit(); dr["CODE"] = txtSTORE.Text + dr["SHELF_NO"].ToString(); dr["NAME"] = txtSTORE_NAME.Text; dr["STORE"] = txtSTORE.Text; dr.EndEdit(); } } #endregion STMModel.MaintainStoreBase BCO = new STMModel.MaintainStoreBase(ConnectionDB); v_ID = BCO.CreateStoreBase(ParameterList, null, ds.Tables[0]); LogHelper LOG = new LogHelper(ConnectionDB); ParameterList.Clear(); ParameterList.Add("STM01門市主檔");//0 ParameterList.Add(Session["UID"].ToString());//1 ParameterList.Add("I");//2 ParameterList.Add(txtSTORE.Text.Trim());//3 ParameterList.Add(Request.ServerVariables["Server_Name"]);//4 LOG.AddSafeLog(ParameterList); if (v_ID == 0) { throw new Exception("新增0筆資料!"); } else { ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('新增完成');location.replace('STM012.aspx?mode=view&store=" + txtSTORE.Text + "&date=" + SLP_MDC_START_DATE.Text + "&Code=STM01');", true); } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } #endregion } #endregion #region 更新儲存 else if (Request.QueryString["mode"] == "view") { //儲存作業 int res = 0; int v_ID = 0; int v_Code = 0; //0:nothing 1:insert 2:update #region try { #region 取得畫面元件的值 TextBox txt_TELAREA = (TextBox)this.SLP_TEL_NO.FindControl("T1"); TextBox txt_TELNO = (TextBox)this.SLP_TEL_NO.FindControl("T2"); TextBox txt_FAXAREA = (TextBox)this.SLP_FAX_NO.FindControl("T1"); TextBox txt_FAXNO = (TextBox)this.SLP_FAX_NO.FindControl("T2"); CheckBox chk_DIS_SW = (CheckBox)this.SLP_DIS_SW.FindControl("C1"); CheckBox chk_MARKET_RESEARCH = (CheckBox)this.SLP_MARKET_RESEARCH.FindControl("C1"); CheckBox chk_SING_VEN = (CheckBox)this.SLP_SING_VEN.FindControl("C1"); RadioButtonList rdo_MDC_TAXABLE = (RadioButtonList)this.SLP_MDC_TAXABLE.FindControl("R1"); RadioButtonList rdo_MDC_TAXFREE = (RadioButtonList)this.SLP_MDC_TAXFREE.FindControl("R1"); CheckBox chk_W1 = (CheckBox)this.SLP_Boolean1.FindControl("C1"); CheckBox chk_W2 = (CheckBox)this.SLP_Boolean2.FindControl("C1"); CheckBox chk_W3 = (CheckBox)this.SLP_Boolean3.FindControl("C1"); CheckBox chk_W4 = (CheckBox)this.SLP_Boolean4.FindControl("C1"); CheckBox chk_W5 = (CheckBox)this.SLP_Boolean5.FindControl("C1"); CheckBox chk_W6 = (CheckBox)this.SLP_Boolean6.FindControl("C1"); CheckBox chk_W7 = (CheckBox)this.SLP_Boolean7.FindControl("C1"); DateTime processtime = DateTime.Now; #endregion #region 門市基本,配送屬性 ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["CREATEDATE"].ToString(), "datetime", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["CREATEUID"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["UPDATEDATE"].ToString(), "datetime", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["UPDATEUID"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["STORE"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["MDC_START_DATE"].ToString(), "date", false)); ParameterList.Add(string.Format("{0}{1}", this.txtSTORE.Text.Trim(), Convert.ToDateTime(this.SLP_MDC_START_DATE.Text).Year.ToString() + Convert.ToDateTime(this.SLP_MDC_START_DATE.Text).Month.ToString().PadLeft(2, '0') + Convert.ToDateTime(this.SLP_MDC_START_DATE.Text).Day.ToString().PadLeft(2, '0'))); ParameterList.Add(GetValueSetParameter(this.txtSTORE_NAME.Text.Trim(), "string", false)); ParameterList.Add(processtime); ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(this.txtSTORE.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_MDC_START_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_MDC_END_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.txtSTORE_NAME.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_CHAN_NO.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_GROUP_NO.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.txtOLD_STORE.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_OPEN_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_STORE_CLOSE_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_REOPEN_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_REMODEL_DATE.Text, "date", false)); ParameterList.Add(GetValueSetParameter(this.SLP_Z_O.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_D_O.Text.Trim(), "string", false)); ; ParameterList.Add(GetValueSetParameter(this.SLP_STORE_TYPE.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.txtSTORE_ZIP.Text.Trim(), "string", false)); ParameterList.Add(txt_TELAREA.Text.Trim()); ParameterList.Add(txt_TELNO.Text.Trim()); ParameterList.Add(txt_FAXAREA.Text.Trim()); ParameterList.Add(txt_FAXNO.Text.Trim()); ParameterList.Add(GetValueSetParameter(this.txtSTORE_ADDRESS.Text.Trim(), "string", false)); ParameterList.Add(this.txtVIRTUAL_FLAG.Text.Trim()); ParameterList.Add(GetValueSetParameter(this.SLP_AREA_NO.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_AREA_CODE.Text.Trim(), "string", false)); ParameterList.Add(GetValueSetParameter(this.SLP_SHELVE_CM3.Text, "int", false)); ParameterList.Add(chk_DIS_SW.Checked ? 1 : 0); ParameterList.Add(GetValueSetParameter(this.SLP_ALLOCATION_TIMES.Text, "int", false)); ParameterList.Add(chk_MARKET_RESEARCH.Checked ? 1 : 0); ParameterList.Add(this.SLP_AC_UID.Text.Trim()); ParameterList.Add(this.SLP_SAL_ID.Text.Trim()); ParameterList.Add(this.SLP_FEAT_GRADE.Text.Trim()); ParameterList.Add(GetValueSetParameter(this.txtPAY_RFNO.Text.Trim(), "string", false)); ParameterList.Add(chk_SING_VEN.Checked ? 1 : 0); if (rdo_MDC_TAXABLE.SelectedValue == "1") ParameterList.Add(1); else ParameterList.Add(0); if (rdo_MDC_TAXFREE.SelectedValue == "1") ParameterList.Add(1); else ParameterList.Add(0); #endregion #region 屬性 //判斷屬性是否有資料 if (ds_Data.Tables["VDS_STM_STORE_PROPERTY"].Rows.Count == 0) { //判斷是否有輸入資料 if (this.txtCOPY_SOURCE.Text.Trim() != "" || this.SLP_PSM.Text != "" || this.SLP_BUSINESS_NO.Text != "" || this.SLP_OPEN_TIME.Text != "" || this.SLP_CLOSE_TIME.Text != "" || this.SLP_COMPETITION.Text != "" || this.SLP_REMARK.Text != "" || this.SLP_STORE_SPE.Text != "" || chk_W1.Checked || chk_W2.Checked || chk_W3.Checked || chk_W4.Checked || chk_W5.Checked || chk_W6.Checked || chk_W7.Checked) { //新增資料 v_Code = 1; ParameterList.Add(this.txtSTORE.Text.Trim()); ParameterList.Add(this.txtSTORE_NAME.Text.Trim()); ParameterList.Add(processtime); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(processtime); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(this.txtSTORE.Text.Trim()); ParameterList.Add(this.txtCOPY_SOURCE.Text.Trim()); ParameterList.Add(GetValueSetParameter(this.SLP_PSM.Text, "int", false)); ParameterList.Add(this.SLP_BUSINESS_NO.Text.Trim()); ParameterList.Add(this.SLP_OPEN_TIME.Text.Trim()); ParameterList.Add(this.SLP_CLOSE_TIME.Text.Trim()); ParameterList.Add(this.SLP_COMPETITION.Text.Trim()); ParameterList.Add(this.SLP_REMARK.Text.Trim()); ParameterList.Add(this.SLP_STORE_SPE.Text.Trim()); ParameterList.Add(chk_W1.Checked ? 1 : 0); ParameterList.Add(chk_W2.Checked ? 1 : 0); ParameterList.Add(chk_W3.Checked ? 1 : 0); ParameterList.Add(chk_W4.Checked ? 1 : 0); ParameterList.Add(chk_W5.Checked ? 1 : 0); ParameterList.Add(chk_W6.Checked ? 1 : 0); ParameterList.Add(chk_W7.Checked ? 1 : 0); } } else { //更新資料 v_Code = 2; ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE_PROPERTY"].Rows[0]["CREATEDATE"].ToString(), "datetime", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE_PROPERTY"].Rows[0]["CREATEUID"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE_PROPERTY"].Rows[0]["UPDATEDATE"].ToString(), "datetime", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE_PROPERTY"].Rows[0]["UPDATEUID"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE_PROPERTY"].Rows[0]["STORE"].ToString(), "string", false)); ParameterList.Add(this.txtSTORE_NAME.Text.Trim()); ParameterList.Add(processtime); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(this.txtSTORE.Text.Trim()); ParameterList.Add(this.txtCOPY_SOURCE.Text.Trim()); ParameterList.Add(GetValueSetParameter(this.SLP_PSM.Text, "int", false)); ParameterList.Add(this.SLP_BUSINESS_NO.Text.Trim()); ParameterList.Add(this.SLP_OPEN_TIME.Text.Trim()); ParameterList.Add(this.SLP_CLOSE_TIME.Text.Trim()); ParameterList.Add(this.SLP_COMPETITION.Text.Trim()); ParameterList.Add(this.SLP_REMARK.Text.Trim()); ParameterList.Add(this.SLP_STORE_SPE.Text.Trim()); ParameterList.Add(chk_W1.Checked ? 1 : 0); ParameterList.Add(chk_W2.Checked ? 1 : 0); ParameterList.Add(chk_W3.Checked ? 1 : 0); ParameterList.Add(chk_W4.Checked ? 1 : 0); ParameterList.Add(chk_W5.Checked ? 1 : 0); ParameterList.Add(chk_W6.Checked ? 1 : 0); ParameterList.Add(chk_W7.Checked ? 1 : 0); } #endregion #region 貨架設置 DataSet ds = (DataSet)Session["STM012_" + PageTimeStamp.Value]; foreach (DataRow dr in ds.Tables[0].Rows) { if (dr.RowState != DataRowState.Deleted) { dr.BeginEdit(); dr["NAME"] = txtSTORE_NAME.Text; dr.EndEdit(); } } #endregion STMModel.MaintainStoreBase BCO = new STMModel.MaintainStoreBase(ConnectionDB); BCO.UpdateStoreBase(ParameterList, null, ds.Tables[0], v_Code); LogHelper LOG = new LogHelper(ConnectionDB); ParameterList.Clear(); ParameterList.Add("STM01門市主檔");//0 ParameterList.Add(Session["UID"].ToString());//1 ParameterList.Add("U");//2 ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_STORE"].Rows[0]["STORE"].ToString(), "string", false));//3 ParameterList.Add(Request.ServerVariables["Server_Name"]);//4 LOG.AddSafeLog(ParameterList); int i_Count = 0; string s_Request_Key = ""; if (Request.QueryString["STM012_COUNT"] != null) { i_Count = int.Parse(Request.QueryString["STM012_COUNT"]); s_Request_Key = Request.QueryString["STM012_PageTimeStamp"]; } ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('更新完成');location.replace('STM012.aspx?mode=view&store=" + txtSTORE.Text + "&date=" + SLP_MDC_START_DATE.Text + "&Code=STM01&STM012_COUNT=" + i_Count.ToString() + "&STM012_PageTimeStamp=" + s_Request_Key + "');", true); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } #endregion } #endregion //儲存完成後變成檢視模式 ReadOnlyMode(false); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, true, "STM011.aspx?Code=STM01", null, WUI_GMToolbarV.ClickAction.LinkURL); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, true, "", this.btnStorePrint, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.New, false, string.Empty, this.btnEdt, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, string.Empty, this.btnSave, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Edit, true, string.Empty, this.btnEdt, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, true, string.Empty, this.btnDelete, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Copy, true, string.Empty, this.btnCopy, WUI_GMToolbarV.ClickAction.ButtonClick); }