Example #1
0
    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        STMModel.MaintainStoreUnique BCO = new STMModel.MaintainStoreUnique(ConntionDB);
        DataTable Dt = BCO.QueryBusiness();

        if (Dt.Rows.Count != 0)
        {
            string buso = "";
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                buso = GridView1.Rows[i].Cells[7].Text.ToString();

                for (int j = 0; j < Dt.Rows.Count; j++)
                {
                    if (Dt.Rows[j]["SCODE"].ToString() == buso)
                    {
                        GridView1.Rows[i].Cells[7].Text = Dt.Rows[j]["EXPLAIN"].ToString();
                    }
                }
            }

        }
    }
Example #2
0
        /// <summary>
        ///1.目的:將上傳檔案內容,存入暫存檔

        ///2.傳入參數:@處理檔名、@使用者
        ///  回傳參數:@處理筆數、@正確筆數、@錯誤筆數、@錯誤訊息

        ///3.處理表格:VDS_MKT_STOREGIFT_TMP(T)

        ///4.處理邏輯:

        ///  4.1) 先清除前一次,同一使用者執行的匯入暫存資訊與錯誤資訊。
        ///       相關Table:VDS_MKT_STOREGIFT_TMP
        ///  4.2) 讀取匯入檔案到暫存資料集。
        ///  4.3) 檢查匯入檔案格式內容是否正確,如有任何錯誤,則停止上傳流程,並回傳錯誤訊息。
        ///       『XX檔案,檔案內容錯誤:@錯誤說明』 (格式請參考資料庫Table Shcema)
        ///         * 日期:檢查日期格式。
        ///         * 數字:檢查內容是否為數字。
        ///         * 文字:檢查長度是否溢位。
        ///         * 檔案欄位數是否不足。
        ///         * 檢查必填欄位是否有值
        ///         * 工作表匯入內容有任一筆錯,皆視為錯誤,整批放棄。
        ///         * 匯入表格細節說明請參考:Excel文件
        ///  4.4) 格式檢查正確無誤後
        ///       a) 暫存檔中的[狀態]欄位調整為1:FILE TO TMP
        ///       b) 呼叫 [CheckData] ,檢查資料內容邏輯正確性 
        ///  4.5) 無論CheckData()檢查結果是否為True,
        ///       皆將上傳檔案內容新增到資料庫Tmp Table:,
        ///       並記錄錯誤原因、匯入者、匯入日期、處理檔案名稱=上傳檔名。

        ///5. 回傳處理結果(@處理筆數、@正確筆數、@錯誤筆數、@錯誤訊息(無錯誤時=null) )   
        /// </summary>
        public ArrayList FileToTmp(DataSet ds_Excel, DateTime d_CreateDate, string s_LoginUser, string s_AP_FileName,bool bCheckDis)
        {
            #region

            int iErrCounts = 0;
            int i_newTable_Count = 0;
            ArrayList arl_Return = new ArrayList();
            int i_FileToTemp_Total_count = 0;
            int i_FileToTemp_Right_count = 0;
            int i_FileToTemp_Wrong_count = 0;
            bool b_Check_Logic = true;
            ArrayList paramTemp = new ArrayList();
            Hashtable htTemp = new Hashtable();

            DataTable dtTemp = new DataTable();
            string strErrMsg = "";
            string strErrMsgDataFormat = "";

            Int32 iErrCount = 0;
            try
            {
                ParameterList.Clear();
                MaintainStoreGiftTmp BCO = new MaintainStoreGiftTmp(ConnectionDB);
                MaintainGift BCO_ChkDis = new MaintainGift(ConnectionDB);
                DataTable dt_MKT_IMPORT_TMP = BCO.GetStoreGift_TmpSchema();

                //刪除VDS_MKT_STOREGIFT_TMP資料 BY CREATEUID
                ParameterList.Clear();
                ParameterList.Add(s_LoginUser);
                BCO.DeleteStoreGiftTmp(ParameterList, null);

                foreach (System.Data.DataRow dRow in ds_Excel.Tables[0].Rows)
                {
                    iErrCount = 0;
                    strErrMsg = "";
                    if (!CheckRequiredField(dRow, iAryRequiredColumnsCheck, out strErrMsgDataFormat))//檢查必填欄位
                    {
                        #region 檢查資料格式正確性
                        arl_Return.Add("FALSE");
                        arl_Return.Add(strErrMsgDataFormat);
                        return arl_Return;
                    }
                    else
                    {
                        string strCHAN_NO = dRow[0].ToString().Trim();
                        string strSTORE = dRow[2].ToString().Trim();
                        string strITEM = dRow[4].ToString().Trim();
                        string strPERIOD = dRow[6].ToString().Trim();
                        string strVIRTUAL_CODE = dRow[7].ToString().Trim();

                        #region 檢查資料邏輯正確性

                        #region 將資料寫入 TEMP TABLE

                        DataRow dRow_Temp = dt_MKT_IMPORT_TMP.NewRow();

                        dRow_Temp["CREATEDATE"] = d_CreateDate;
                        dRow_Temp["CREATEUID"] = s_LoginUser;
                        dRow_Temp["CHAN_NO"] = strCHAN_NO;
                        dRow_Temp["CHAIN_NAME"] = dRow[1].ToString().Trim();
                        dRow_Temp["STORE"] = strSTORE;
                        dRow_Temp["STORE_NAME"] = dRow[3].ToString().Trim();
                        dRow_Temp["ITEM"] = strITEM;
                        dRow_Temp["ITEM_NAME"] = dRow[5].ToString().Trim();
                        dRow_Temp["PERIOD"] = strPERIOD;
                        dRow_Temp["VIRTUAL_CODE"] = strVIRTUAL_CODE;
                        dRow_Temp["VIRTUAL_NAME"] = dRow[8].ToString().Trim();
                        dRow_Temp["STATUS"] = 1; //1:FILE TO TMP  2:TMP TO DB
                        dRow_Temp["DATASOURCE"] = s_AP_FileName;

                        #endregion                    

                        #region 判斷是否可新增
                        ParameterList.Clear();
                        ParameterList.Add(strCHAN_NO);
                        ParameterList.Add(strSTORE);
                        ParameterList.Add(strITEM);
                        ParameterList.Add(strPERIOD);
                        ParameterList.Add(strVIRTUAL_CODE);

                        DataTable dtImportCheck = BCO.CheckImportStoreGiftTmp(ParameterList);

                        #region

                        ArrayList arrList = new ArrayList();
                        STMModel.MaintainStoreUnique STM_BCO = new STMModel.MaintainStoreUnique(ConnectionDB);
                        arrList.Clear();
                        arrList.Add(strSTORE);
                        arrList.Add(strCHAN_NO);
                        DataTable dt = STM_BCO.QueryForSLP(arrList);
                        if(dt.Rows.Count==0)
                        {
                            strErrMsg += "此門市不屬於此通路,";
                            iErrCounts++;
                        }
                        if (dtImportCheck != null && dtImportCheck.Rows.Count > 0)
                        {
                            //是否存在於通路主檔
                            if (dtImportCheck.Rows[0][0].ToString().Trim() == "0")
                            {
                                strErrMsg += "通路不存在,";
                                iErrCounts++;
                            }
                            //是否存在於門市主檔
                            if (dtImportCheck.Rows[0][1].ToString().Trim() == "0")
                            {
                                strErrMsg += "門市不存在,";
                                iErrCounts++;
                            }
                            //是否存在於品號主檔
                            if (dtImportCheck.Rows[0][2].ToString().Trim() == "0")
                            {
                                strErrMsg += "品號不存在,";
                                iErrCounts++;
                            }
                            else if (dtImportCheck.Rows[0][3].ToString().Trim() == "0") //是否存在於期別主檔
                            {
                                strErrMsg += "期別不存在,";
                                iErrCounts++;
                            }
                            else if (dtImportCheck.Rows[0][4].ToString().Trim() == "0") //是否存在於贈品主檔
                            {
                                strErrMsg += "虛擬品號不存在,";
                                iErrCounts++;
                            }
                            else
                            {
                                if (bCheckDis == false) //是否檢查配本已確認
                                {
                                    ParameterList.Clear();
                                    ParameterList.Add(strITEM);
                                    ParameterList.Add(strVIRTUAL_CODE);
                                    ParameterList.Add(strPERIOD);
                                    if (BCO_ChkDis.ChkDis(ParameterList) == 1)
                                    {
                                        strErrMsg += "配本以確認,";
                                        iErrCounts++;
                                    }
                                }
                            }
                            //是否存在於通路門市贈品檔
                            //取消此項檢核,若資料已存在通路門市贈品檔,則改成Update寫入 2009/11/4
                            //if (strErrMsg == "" && dtImportCheck.Rows[0][5].ToString().Trim() == "1")
                            //{
                            //    strErrMsg += "資料已存在通路門市贈品檔,";
                            //    iErrCounts++;
                            //}
                        }
                        #endregion

                        #endregion

                        #region 針對ERROR_MEMO是否為空字串做檢查

                        if (strErrMsg.Trim() == string.Empty)
                        {
                            dRow_Temp["ERROR_MEMO"] = System.DBNull.Value;
                        }
                        else
                        {
                            if (strErrMsg.Trim().Length > 0)
                            {
                                if (strErrMsg.Trim().Substring(strErrMsg.Trim().Length - 1) == ",")
                                {
                                    strErrMsg = strErrMsg.Trim().Substring(0, strErrMsg.Trim().Length - 1);
                                }
                            }
                            dRow_Temp["ERROR_MEMO"] = strErrMsg;
                            iErrCount++;
                        }

                        if (iErrCount != 0)
                        {
                            i_FileToTemp_Wrong_count += 1;
                            dRow_Temp["DATATYPE"] = 2;
                            b_Check_Logic = false;
                        }
                        else
                        {
                            i_FileToTemp_Right_count += 1;
                            dRow_Temp["DATATYPE"] = 1;
                        }

                        #endregion

                        dt_MKT_IMPORT_TMP.Rows.Add(dRow_Temp);
                        i_newTable_Count += 1;

                        #endregion
                    }

                    i_FileToTemp_Total_count += 1;
                        #endregion
                }

                #region 先清除前一次,同一使用者執行的匯入暫存資訊與錯誤資訊,並將 Excel 資料匯入 TEMP TABLE

                ParameterList.Clear();
                ParameterList.Add(s_LoginUser);
                INSERT_TEMP_TABLE(ParameterList, null, dt_MKT_IMPORT_TMP);

                #endregion

                arl_Return.Add("TRUE");
                arl_Return.Add(b_Check_Logic);
                arl_Return.Add(i_FileToTemp_Total_count);
                arl_Return.Add(i_FileToTemp_Right_count);
                arl_Return.Add(i_FileToTemp_Wrong_count);
            }
            catch (Exception ex)
            {
                arl_Return.Add("FALSE");
                arl_Return.Add(ex.Message);
            }
            return arl_Return;
            #endregion
        }
Example #3
0
    /// <summary>
    /// databind 繫結查詢資料到GridView1
    /// </summary>
    private void databind()
    {
        //抓取本頁初次登記的時間

        string SessionIDName = "STM041_" + PageTimeStamp.Value;

        STMModel.MaintainStoreUnique BCO = new STMModel.MaintainStoreUnique(ConntionDB);

        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(SLP_TEL_AREA.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(SLP_TEL_NO.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(SLP_FAX_AREA.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(SLP_FAX_NO.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.rdo_DIS_SW.FindControl("R1");
        RadioButtonList rdo_MARKET_RESEARCH = (RadioButtonList)this.rdo_MARKET_RESEARCH.FindControl("R1");
        RadioButtonList rdo_SING_VEN = (RadioButtonList)this.rdo_SING_VEN.FindControl("R1");
        RadioButtonList rdo_MDC_TAXABLE = (RadioButtonList)this.rdo_MDC_TAXABLE.FindControl("R1");
        RadioButtonList rdo_MDC_TAXFREE = (RadioButtonList)this.rdo_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);

        //屬性16
        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);

        DataTable Dt = BCO.QuerySwitch(STMModel.MaintainStoreUnique.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();
        }

        if (Dt.Rows.Count == 0)
        {
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "STM041.aspx", "alert(' 查無資料 ');", true);
        }

        #region 使用XML放置到前端資料


        MasterOLDData.InnerHtml = Dt.DataSet.GetXml();

        #endregion

        Session[SessionIDName] = Dt;
        GridView1.DataSource = Dt;
        //設定分頁大小
        // GridView1.PageIndex = int.Parse(TextBoxPagesize.Text);
        // GridView1.DataBind();

        ArrayList NOList = new ArrayList();
        for (int i = 0; i < Dt.Rows.Count; i++)
        {
            string[] strNO = new string[3];
            strNO[0] = Dt.Rows[i]["ID"].ToString();
            strNO[1] = Dt.Rows[i]["STORE"].ToString();
            strNO[2] = Dt.Rows[i]["CHAN_NO"].ToString();
            NOList.Add(strNO);
        }

        Session["STM04Query"] = NOList;

        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();
    }
Example #4
0
    /// <summary>
    /// 查詢資料庫取得資料


    /// </summary>
    private void databind()
    {
        //抓取本頁初次登記的時間


        string SessionIDName = "STM_STORE_" + PageTimeStamp.Value;
        STMModel.MaintainStoreUnique BCO = new STMModel.MaintainStoreUnique(ConntionDB);

        ParameterList.Clear();
        ParameterList.Add(SLP_STORE_ST.Text.Trim());
        ParameterList.Add(SLP_STORE_ED.Text.Trim());
        ParameterList.Add(SLP_MDC_START_DATE.StartDate.Trim());
        ParameterList.Add(SLP_MDC_START_DATE.EndDate.Trim());
        ParameterList.Add(SLP_MDC_END_DATE.StartDate.Trim());
        ParameterList.Add(SLP_MDC_END_DATE.EndDate.Trim());
        ParameterList.Add(SLP_CHAN_NO_ST.Text.Trim());
        ParameterList.Add(SLP_CHAN_NO_ED.Text.Trim());
        ParameterList.Add(SLP_StoreGroup_ST.Text.Trim());
        ParameterList.Add(SLP_StoreGroup_ED.Text.Trim());
        ParameterList.Add(TextBoxRowCountLimit.Text.Trim());
        ParameterList.Add(txtStore.Text.Trim() + "%");

        DataTable Dt = BCO.QueryByLikeForSLP(ParameterList);

        Session[SessionIDName] = Dt;
        GridView1.DataSource = Dt;
        //設定分頁大小
        if (TextBoxPagesize.Text == "0")
        {
            GridView1.PageSize = 1;
        }
        else
        {
            GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        }
        GridView1.PageIndex = 0;
        GridView1.DataBind();
        GridView1.SelectedIndex = -1;
    }
    public string StoreName(string Code,
                            string CHANNO,
                            string GROUPNO
                            )
    {
        string Name = "";
        string ConnectionDBStr = ((DatabaseSettings)ConfigurationManager.GetSection("dataConfiguration")).DefaultDatabase;
        MaintainStoreUnique BCO = new MaintainStoreUnique(ConnectionDBStr);

        if (Code != "")
        {
            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            ParameterList.Add(Code);
            ParameterList.Add(CHANNO);
            ParameterList.Add(GROUPNO);

            DataTable Dt = BCO.QueryForSLP2(ParameterList);

            if (Dt.Rows.Count > 0)
            {
                Name = Dt.Rows[0]["STORE_NAME"].ToString().Trim();
            }
            else
            {
                Name = "查無資料";
            }
        }

        return Name;
    }
Example #6
0
        }//Initiziatoin_Component        

        private void dataget()
        {
            if (_Code != "")
            {
                STMModel.MaintainStoreUnique BCO = new STMModel.MaintainStoreUnique(ConntionDB);
                //DataTable Dt = BCO.QuerySwitch(STMModel.MaintainStoreBase.QueryType.CODE,
                //                          ParameterList
                //                          );
                DataTable Dt = BCO.QueryForSLP2(ParameterList);

                if (Dt.Rows.Count > 0)
                {
                    _Name = Dt.Rows[0]["STORE_NAME"].ToString().Trim();
                }
                else
                {
                    _Name = "查無資料";
                }
            }
            HiddenField1.Value = _Name;
            TextBoxName.Text = _Name;
            //this.Text = _Name;
            //Trace.Warn("SLP_Store.Text=", this.Text);

        }//dataget             
Example #7
0
    protected void btn_Confirm_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            if (GetStringLen(txt_Memo.Text.Trim()) > 200)
            {
                hiddenFocusCtrlID.Value = txt_Memo.ClientID;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", "alert('備註限制100中文字');", true);
            }
            else
            {
                #region
                DateTime dtProcessing = DateTime.Now;
                string strUID = Session["UID"].ToString();

                string strChan = SLP_StoreChain3.Text.Trim();
                string strStore = SLP_Store3.Text.Trim();
                string strPattern = SLP_Pattern3.Text.Trim();
                string strChanName = "";
                string strStoreName = "";
                string strPatternName = "";

                ArrayList ParameterList = new ArrayList();//20091112

                int iRowIndex = 0;


                ALOModel.MaintainStoreRank BCO = new ALOModel.MaintainStoreRank(ConnectionDB);
                ParameterList.Clear();
                ParameterList.Add(strChan);
                ParameterList.Add(strStore);
                ParameterList.Add(strPattern);
                ParameterList.Add(dtProcessing);
                ParameterList.Add(strUID);
                ParameterList.Add(dtProcessing);
                ParameterList.Add(strUID);
                ParameterList.Add(null);
                ParameterList.Add(strRankCode2);
                ParameterList.Add(SLP_SLPNumber1.Text.Trim());
                ParameterList.Add(txt_RankLevel.Text.Trim());
                ParameterList.Add(txt_Memo.Text.Trim());
                ParameterList.Add(s_PROCNO);
                BCO.ADD_STORERANK_AFTERQUERY(ParameterList, null);

                //todo gridview binding


                #region
                //chan_name
                ParameterList.Clear();
                ParameterList.Add(strChan);
                STMModel.MaintainStoreChain BCO_STM1 = new STMModel.MaintainStoreChain(ConnectionDB);
                DataTable dt_stm1 = BCO_STM1.QueryStoreChainByCode(ParameterList);
                strChanName = ((dt_stm1 != null &&  dt_stm1.Rows.Count > 0) ? dt_stm1.Rows[0]["NAME"].ToString() : "查無資料");

                //store_name
                ParameterList.Clear();
                ParameterList.Add(strStore);
                ParameterList.Add(strChan);
                ParameterList.Add(null);

                STMModel.MaintainStoreUnique BCO_STM2 = new STMModel.MaintainStoreUnique(ConnectionDB);
                DataTable dt_stm2 = BCO_STM2.QueryForSLP2(ParameterList);
                strStoreName = ((dt_stm2 != null && dt_stm2.Rows.Count > 0) ? dt_stm2.Rows[0]["STORE_NAME"].ToString() : "查無資料");

                //pattern_name
                ParameterList.Clear();
                ParameterList.Add(strPattern);
                ParameterList.Add(null);
                ParameterList.Add(null);
                ParameterList.Add(null);
                ParameterList.Add(null);

                ITMModel.MaintainItemClassify BCO_ITM1 = new ITMModel.MaintainItemClassify(ConnectionDB);
                DataTable dt_itm1 = BCO_ITM1.QueryPatternForSLP(ParameterList);
                strPatternName = ((dt_itm1 != null && dt_itm1.Rows.Count > 0) ? dt_itm1.Rows[0]["PATTERN_NAME"].ToString() : "查無資料");

                #endregion

                #region Insert New Row
                string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

                DataTable dt1 = (DataTable)Session[SessionIDName];
                DataView dv = dt1.DefaultView;

                if (ViewState["SortingCondition"] != null)
                {
                    dv.Sort = ViewState["SortingCondition"].ToString();
                }

                DataTable dt2 = dv.ToTable();

                //判斷是否已存在目前DataTable中
                if (CheckDataIsExistedInCurrentDataTable(strChan, strStore, strPattern, dt2, out iRowIndex))
                {
                    #region 如存在則刪除畫面上舊資料
                    dt2.Rows.RemoveAt(iRowIndex);
                    #endregion
                }

                #region 新增一筆
                DataRow dr = dt2.NewRow();
                dr["PATTERN_NO"] = strPattern;
                dr["PATTERN_NAME"] = strPatternName;
                dr["CHAN_NO"] = strChan;
                dr["CHAN_NAME"] = strChanName;
                dr["STORE"] = strStore;
                dr["STORE_NAME"] = strStoreName;
                dr["RANK_CODE"] = ((DropDownList)SLP_Rank2.FindControl("D1")).SelectedItem.Value;
                dr["RANK_NAME"] = ((DropDownList)SLP_Rank2.FindControl("D1")).SelectedItem.Text;
                dr["RANK_VALUE"] = SLP_SLPNumber1.Text.Trim();
                dr["RANK_LEVEL"] = txt_RankLevel.Text.Trim();
                dr["MEMO"] = txt_Memo.Text.Trim();

                //2010/09/20 added 
                //dr["c_start_date"] = SLP_SLPDate1.Text.Trim();//暫不顯示
                //dr["c_end_date"] = SLP_SLPDate2.Text.Trim();//暫不顯示
                dr["update_date"] = DateTime.Now.ToString("yyyy/MM/dd");
                dr["user_name"] = ((DataTable)Session["UserInfo"]).Rows[0]["Name"].ToString();


                
                dt2.Rows.InsertAt(dr, 0);
                #endregion

                Session[SessionIDName] = dt2;
                GridView1.DataSource = dt2;
                GridView1.DataBind();

                #endregion

                PanelG3.Visible = false;
                hiddenFocusCtrlID.Value = "";


                ResultMsgLabel.Text = "新增成功";
                #endregion
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }