コード例 #1
0
ファイル: STM181.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
 protected void btnDel_Click(object sender, EventArgs e)
 {
     try
     {
         string SessionIDName = "STM181_gv_ItemInfo" + PageTimeStamp.Value;
         DataTable dtA = new DataTable();
         dtA = (DataTable)Session[SessionIDName];
         LinkButton btn = sender as LinkButton;
         GridViewRow gr = (btn.BindingContainer as GridViewRow);
         int i = gr.RowIndex;
         DataRow drA = dtA.Select("ID=" + ((Label)this.GridView1.Rows[i].FindControl("Label3")).Text.Trim())[0];
         drA.Delete();
         BCO.MaintainStoreGroupDiscount bco = new BCO.MaintainStoreGroupDiscount(ConnectionDB);
         DataTable dtB = new DataTable();
         DataTable dtC = new DataTable();
         bco.UpdateStoreGroupDiscount(dtA, dtB, dtC, Session["UID"].ToString(), null);
         Session[SessionIDName] = dtA;
         this.GridView1.DataSource = dtA;
         this.GridView1.DataBind();
     }
     catch (Exception ex)
     {
         ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
     }
     finally { }
 }
コード例 #2
0
ファイル: STM181.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    protected void btnExport_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage(sender);

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }

            #endregion

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_B.Text.Trim(), "string", false)); //0
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_E.Text.Trim(), "string", false)); //1
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_START.StartDate.ToString(), "date", false));//2
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_START.EndDate.ToString(), "date", false));//3
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_END.StartDate.ToString(), "date", false));//4
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_END.EndDate.ToString(), "date", false));//5
            if (this.ddlDISCOUNT_KIND.SelectedValue == "0") //6
                ParameterList.Add(GetValueSetParameter("", "int", false));
            else
                ParameterList.Add(GetValueSetParameter(this.ddlDISCOUNT_KIND.SelectedValue, "int", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_RootNo1.Text.Trim(), "string", false)); //7
            ParameterList.Add(GetValueSetParameter(this.SLP_PMA_B.Text.Trim(), "string", false)); //8
            ParameterList.Add(GetValueSetParameter(this.SLP_PMA_E.Text.Trim(), "string", false)); //9
            ParameterList.Add(GetValueSetParameter(this.SLP_Category_B.Text.Trim(), "string", false)); //10
            ParameterList.Add(GetValueSetParameter(this.SLP_Category_E.Text.Trim(), "string", false)); //11
            ParameterList.Add(GetValueSetParameter(this.SLP_SKU_B.Text.Trim(), "string", false)); //12
            ParameterList.Add(GetValueSetParameter(this.SLP_SKU_E.Text.Trim(), "string", false)); //13
            ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_B.Text.Trim(), "string", false)); //14
            ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_E.Text.Trim(), "string", false)); //15
            if (SLP_SLPNumber_PRICE_DIS.Text.Trim() == "") //16
            {
                ParameterList.Add(GetValueSetParameter(SLP_SLPNumber_PRICE_DIS.Text.Trim(), "Decimal", false));
            }
            else
            {
                ParameterList.Add(GetValueSetParameter(Convert.ToString(Convert.ToDecimal(this.SLP_SLPNumber_PRICE_DIS.Text.Trim()) / 100), "Decimal", false));
            }
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber_FIX_DIS.Text.Trim(), "Decimal", false)); //17
            if (this.rdoCONFIRM1.Checked) //18
                ParameterList.Add(GetValueSetParameter("", "int", false));
            else if (this.rdoCONFIRM2.Checked)
                ParameterList.Add(GetValueSetParameter("1", "int", false));
            else
                ParameterList.Add(GetValueSetParameter("0", "int", false));

            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_CREATE_S.Text.Trim(), "date", false)); //19
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_CREATE_E.Text.Trim(), "date", false)); //20
            ParameterList.Add(GetValueSetParameter(this.SLP_User_CREATE.Text.Trim(), "string", false)); //21
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_UPDATE_S.Text.Trim(), "date", false)); //22
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_UPDATE_E.Text.Trim(), "date", false)); //23
            ParameterList.Add(GetValueSetParameter(this.SLP_User_UPDATE.Text.Trim(), "string", false)); //24
            ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text.Trim(), "Decimal", false)); //25
            ParameterList.Add(GetValueSetParameter(this.txtItemPeriod_END_B.Text.Trim(), "string", false)); //26
            ParameterList.Add(GetValueSetParameter(this.txtItemPeriod_END_E.Text.Trim(), "string", false)); //27

            #endregion

            #region 取得資料

            DataTable dt_Return = new DataTable();

            BCO.MaintainStoreGroupDiscount bco = new BCO.MaintainStoreGroupDiscount(ConnectionDB);
            dt_Return = bco.QueryStoreGroupDiscount(ParameterList);

            #endregion

            if (dt_Return.Rows.Count > 0)
            {
                Export_Excel(dt_Return);
            }
            else
            {
                this.ErrorMsgLabel.Text = "查無資料";
            }

        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }

    }
コード例 #3
0
ファイル: STM181.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    }//ButtonNew_Click

    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage(sender);

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }

            #endregion

            #region 傳入參數
            
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_StoreGroup_E.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_START.StartDate.ToString(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_START.EndDate.ToString(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_END.StartDate.ToString(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EFF_END.EndDate.ToString(), "date", false));
            if (this.ddlDISCOUNT_KIND.SelectedValue=="0")
                ParameterList.Add(GetValueSetParameter("", "int", false));
            else
                ParameterList.Add(GetValueSetParameter(this.ddlDISCOUNT_KIND.SelectedValue, "int", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_RootNo1.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_PMA_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_PMA_E.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_Category_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_Category_E.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SKU_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SKU_E.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_ItemPeriod_E.Text.Trim(), "string", false));
            if (SLP_SLPNumber_PRICE_DIS.Text.Trim() == "")
            {
                ParameterList.Add(GetValueSetParameter(SLP_SLPNumber_PRICE_DIS.Text.Trim(), "Decimal", false));
            }
            else
            {
                ParameterList.Add(GetValueSetParameter(Convert.ToString(Convert.ToDecimal(this.SLP_SLPNumber_PRICE_DIS.Text.Trim()) / 100), "Decimal", false));
            }
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber_FIX_DIS.Text.Trim(), "Decimal", false));
            if (this.rdoCONFIRM1.Checked)
                ParameterList.Add(GetValueSetParameter("", "int", false));
            else if (this.rdoCONFIRM2.Checked)
                ParameterList.Add(GetValueSetParameter("1", "int", false));
            else 
                ParameterList.Add(GetValueSetParameter("0", "int", false));

            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_CREATE_S.Text.Trim(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_CREATE_E.Text.Trim(), "date", false)); 
            ParameterList.Add(GetValueSetParameter(this.SLP_User_CREATE.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_UPDATE_S.Text.Trim(), "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDate_UPDATE_E.Text.Trim(), "date", false));                      
            ParameterList.Add(GetValueSetParameter(this.SLP_User_UPDATE.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text.Trim(), "Decimal", false));
            ParameterList.Add(GetValueSetParameter(this.txtItemPeriod_END_B.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.txtItemPeriod_END_E.Text.Trim(), "string", false));
            
            #endregion

            #region 取得資料

            DataTable dt_Return = new DataTable();

            BCO.MaintainStoreGroupDiscount bco = new BCO.MaintainStoreGroupDiscount(ConnectionDB);
            dt_Return = bco.QueryStoreGroupDiscount(ParameterList);

            #endregion

            #region 資料與GridView繫結

            //抓取本頁初次登記的時間
            if (dt_Return.Rows.Count == 0)
            {
                this.GridView1.Visible = false;
                ErrorMsgLabel.Text = "查無資料!";

            }
            else
            {
                string SessionIDName = "STM181_gv_ItemInfo" + PageTimeStamp.Value;

                this.GridView1.Visible = true;
                Session["SessionID"] = SessionIDName;
                Session[SessionIDName] = dt_Return;
                this.GridView1.DataSource = dt_Return;
                if (this.TextBoxPagesize.Text == "")
                    this.GridView1.PageSize = 10;
                else
                    this.GridView1.PageSize = Convert.ToInt32(this.TextBoxPagesize.Text);
                this.GridView1.PageIndex = 0;
                this.GridView1.DataBind();
            }

            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        #endregion
    }//ButtonQuery_Click
コード例 #4
0
ファイル: STM193.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    //帶入分類名稱取得該筆資料
    private DataTable GetPmaCategory_NM(string V_ROOT_NO, string V_PMA, string V_CATEGORY, string V_ITEM)
    {
        #region 取得資料

        DataTable dt_Return = new DataTable();

        BCO.MaintainStoreGroupDiscount bco = new BCO.MaintainStoreGroupDiscount(ConnectionDB);
        dt_Return = bco.QueryPmaCategory_NM(V_ROOT_NO, V_PMA, V_CATEGORY, V_ITEM);
        return dt_Return;

        #endregion

    }
コード例 #5
0
ファイル: STM193.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    public static string GetEffictiveRange(string txtItem, string txtPeriod)
    {
        BCO.MaintainStoreGroupDiscount bco = new BCO.MaintainStoreGroupDiscount(ConnectionDB);
        DataTable dt = bco.GetPeriodDate(txtItem, txtPeriod);
        if (dt.Rows.Count == 0)
        {
            throw new Exception("品號期別不存在!!");
        }
        return dt.Rows[0]["StartDate"].ToString() + "," + dt.Rows[0]["EndDate"].ToString();


    }
コード例 #6
0
ファイル: STM272.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    protected void btnConfirmItem_Click(object sender, EventArgs e)
    {

        try
        {

            string txtItem = SLP_ITEM.Text.Trim();
            string txtPeriod = SLP_PERIOD2.Text.Trim();
            if (txtItem.Length == 0 || txtPeriod.Length == 0)
            {
                throw new Exception("商品或期別不能為空值 !! ");
            }
            if (SLP_ACCEPT_DATE_START.Text.Trim() == string.Empty)
            {
                throw new Exception("進貨開始日未設定 !! ");
            }
            if (SLP_ACCEPT_FIRST_DATE.Text.Trim() == string.Empty)
            {
                throw new Exception("首次出貨日未設定 !! ");
            }

            DataSet ds = (DataSet)Session["STM272_" + PageTimeStamp.Value];

            DataRow[] dritem = (DataRow[])ds.Tables[0].Select("STORE='" + txtITEM_STORE.Text + "' AND ITEM='" + SLP_ITEM.Text + "' AND PERIOD='" + SLP_PERIOD2.Text + "'");

            if (dritem.Length > 0)
            {
                throw new Exception("品號期別不能重複 ");
            }

            if (this.SLP_COST_SUBSIDY_PERCENT2.Text.Length > 0)
            {
                if (Convert.ToDecimal(this.SLP_COST_SUBSIDY_PERCENT2.Text.Trim()) > 100 || Convert.ToDecimal(this.SLP_COST_SUBSIDY_PERCENT2.Text.Trim()) < 0)
                {
                    throw new Exception("[出版社補貼%]欄位請輸入100>出版社補貼>0值<br/>");
                }
                else
                {
                    String[] strCOST_SUBSIDY_PERCENT2 = SLP_COST_SUBSIDY_PERCENT2.Text.Trim().Split('.');
                    if (strCOST_SUBSIDY_PERCENT2.Length == 2)
                    {
                        if (Convert.ToDecimal(strCOST_SUBSIDY_PERCENT2[1]) > 99)
                        {
                            throw new Exception("[出版社補貼%]欄位小數只能二位<br/>");
                        }
                    }
                }
            }

            #region 檢查品號期別是否存在
            STMModel.MaintainStoreGroupDiscount bco = new STMModel.MaintainStoreGroupDiscount(ConnectionDB);
            DataTable dtk = bco.GetPeriodDate(txtItem, txtPeriod);
            if (dtk.Rows.Count == 0)
            {
                throw new Exception("品號期別不存在!! ");
            }
            #endregion

            DataRow[] drNoItem = (DataRow[])ds.Tables[0].Select("STORE='" + txtITEM_STORE.Text + "' AND ITEM='NOITEM'");

            if (drNoItem.Length > 0)
            {
                drNoItem[0].Delete();
            }

            DataRow dr = ds.Tables[0].NewRow();

            dr["PROMOTE_CODE"] = txtPROMOTE_ID.Text;
            dr["GROUP_NO"] = lblITEM_GROUP_NO.Text;
            dr["STORE"] = txtITEM_STORE.Text;
            dr["ITEM"] = SLP_ITEM.Text;
            dr["PERIOD"] = SLP_PERIOD2.Text;
            dr["COST_SUBSIDY_PERCENT"] = Decimal.Parse(SLP_COST_SUBSIDY_PERCENT2.Text);
            if (lblITEM_COST.Text == "" || lblITEM_COST.Text == null)
                dr["PRICE_SUBSIDY_PERCENT"] = 0;
            else
                dr["PRICE_SUBSIDY_PERCENT"] = Decimal.Parse(lblITEM_COST.Text.ToString());
            dr["COST_DIS_RATE"] = 0;
            dr["LIST_DIS_RATE"] = 0;
            dr["NEW_COST_DIS_RATE"] = Decimal.Parse(dr["COST_DIS_RATE"].ToString()) - Decimal.Parse(SLP_COST_SUBSIDY_PERCENT2.Text);
            dr["NEW_LIST_DIS_RATE"] = Decimal.Parse(dr["LIST_DIS_RATE"].ToString()) - Decimal.Parse(SLP_COST_SUBSIDY_PERCENT2.Text);

            ds.Tables[0].Rows.Add(dr);
            Session["STM272_" + PageTimeStamp.Value] = ds;
            DataView dv_Item = new DataView(ds.Tables[0]);
            dv_Item.RowFilter = "STORE = '" + this.txtITEM_STORE.Text + "'";
            GridView2.DataSource = dv_Item;
            string SessionIDName2 = string.Format("{0}_{1}", PAGE_DT_02, PageTimeStamp.Value);
            Session[SessionIDName2] = dv_Item;
            GridView2.DataBind();


            //筆數加1
            int count_item = 0;
            if (txtCount_Item.Value.Length == 0)
                count_item = 1;
            else
                count_item = int.Parse(this.txtCount_Item.Value) + 1;
            txtCount_Item.Value = count_item.ToString();

            //取得商品Table
            DataSet ds_item = new DataSet();
            DataTable Dt_Item = new DataTable();
            ds_item = (DataSet)Session["STM272_" + PageTimeStamp.Value];
            Dt_Item = ds_item.Tables[0];

            //自動展開門市
            Store_Open(txtITEM_STORE.Text, SLP_ITEM.Text, SLP_PERIOD2.Text, SLP_COST_SUBSIDY_PERCENT2.Text, Dt_Item);

            //UPDATE折扣價格
            Price_Into(txtITEM_STORE.Text, Dt_Item);

            btnConfirmItem.Visible = true;
            btnCancleItem.Visible = true;
            btnUpdateItem.Visible = false;
            btnItemCancel.Visible = true;

            btnItemCancel_Click(sender, e);//清除商品的所有欄位

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally
        {
            ScriptManager.RegisterStartupScript(
             this.UpdatePanel2,
              typeof(UpdatePanel),
              "js",
              "window.setTimeout(function set_focus(){bConfirmState = true ;},1);", true);

        }
    }