Example #1
0
    public static string GetChanByStore(string StoreNo)
    {
        CGRModel.MaintainSorterExceptoin BCO = new CGRModel.MaintainSorterExceptoin(ConntionDB);

        ArrayList ParameterList = new ArrayList();
        ParameterList.Add(StoreNo);

        return BCO.GetChanNoByStore(ParameterList);

    }
Example #2
0
    /// <summary>
    /// 查詢鈕
    /// </summary>
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        if (VerifyFormData() == true)
        {
            try
            {
                string strStep = string.Empty;
                if (txtStep.Text.Trim().Length != 0)
                {
                    strStep = txtStep.Text;
                }
                //抓取本頁初次登記的時間
                string SessionIDName = "CGR031_" + PageTimeStamp.Value;

                CGRModel.MaintainSorterExceptoin BCO = new CGRModel.MaintainSorterExceptoin(ConntionDB);

                DataTable Dt;

                ParameterList.Clear();

                ParameterList.Add(SLP_StoreChain.Text);//通路
                ParameterList.Add(SLP_Store.Text);//門市
                ParameterList.Add(SLP_Route.Text);//路線
                ParameterList.Add(strStep);//路順
                ParameterList.Add(txtChan_Source_No.Text);//通路單號
                ParameterList.Add(SLP_Sign_Date.Text);//簽收日
                ParameterList.Add(SLP_P_Date.Text);//處理日
                ParameterList.Add(SLP_Item.Text);//品號
                ParameterList.Add(SLP_Period.Text);//期別
                ParameterList.Add(SLP_ST_Accept_Date.Text);//門市進貨日
                ParameterList.Add(Int16.Parse(TextBoxRowCountLimit.Text));

                Dt = BCO.QueryMainByFind(ParameterList);


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

                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();

                #region 將Key值存到Session中

                ArrayList arl_Key = new ArrayList();
                foreach (DataRow drRow in Dt.Rows)
                { arl_Key.Add(drRow["ID"].ToString()); }

                Session["CGR031_SortKey" + this.PageTimeStamp.Value] = arl_Key;

                #endregion

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

    }
Example #3
0
    /// <summary>
    /// 刪除鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        //抓取本頁初次登記的時間
        string SessionIDName = "CGR031_" + PageTimeStamp.Value;
        DataTable Dt = (DataTable)Session[SessionIDName];

        int result;

        LinkButton lbt = sender as LinkButton;
        rowid_mst = Convert.ToInt16(lbt.Attributes["rowid_mst"].ToString()) - (int.Parse(TextBoxPagesize.Text) * GridView1.PageIndex);

        string strID = ((Label)GridView1.Rows[rowid_mst].Cells[8].Controls[1]).Text;

        CGRModel.MaintainSorterExceptoin BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterExceptoin(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(strID);

        result = BCO.DelSorterException(ParameterList, DBT);

        if (result == 0)
        {
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR031.aspx", "alert(' 此筆再退單已指定門市進貨日,不可刪除! ');", true);
        }
        else
        {
            DataRow dr = Dt.Select("ID = " + strID)[0];
            dr.Delete();

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

        ArrayList AL = (ArrayList)Session["CGR031_SortKey" + this.PageTimeStamp.Value];
        AL.Remove(strID);
        Session["CGR031_SortKey" + this.PageTimeStamp.Value] = AL;

    }
Example #4
0
    private DataTable BindDDL()
    {
        DataTable Dt;

        CGRModel.MaintainSorterExceptoin BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterExceptoin(ConntionDB);

        Dt = BCO.FindP_Class();

        return Dt;
    }
Example #5
0
    private void BindGrid()
    {
        //抓取本頁初次登記的時間
        string SessionIDName = "CGR031_" + PageTimeStamp.Value;

        CGRModel.MaintainSorterExceptoin BCO = new CGRModel.MaintainSorterExceptoin(ConntionDB);

        DataTable Dt;

        ArrayList AL_Rule = (ArrayList)Session["Rule"];

        Dt = BCO.QueryMainByFind(AL_Rule);

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

        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();

        SLP_StoreChain.Text = AL_Rule[0].ToString();
        SLP_Store.Text = AL_Rule[1].ToString();
        SLP_Route.Text = AL_Rule[2].ToString();
        txtStep.Text = AL_Rule[3].ToString();
        txtChan_Source_No.Text = AL_Rule[4].ToString();
        SLP_Sign_Date.Text = AL_Rule[5].ToString();
        SLP_P_Date.Text = AL_Rule[6].ToString();
        SLP_Item.Text = AL_Rule[7].ToString();
        SLP_Period.Text = AL_Rule[8].ToString();
        SLP_ST_Accept_Date.Text = AL_Rule[9].ToString();
        TextBoxRowCountLimit.Text = AL_Rule[10].ToString();

        #region 將Key值存到Session中

        ArrayList arl_Key = new ArrayList();
        foreach (DataRow drRow in Dt.Rows)
        { arl_Key.Add(drRow["ID"].ToString()); }

        Session["CGR031_SortKey" + this.PageTimeStamp.Value] = arl_Key;

        #endregion
    }
Example #6
0
    //刪除按鈕
    protected void V_btnDel_Click(object sender, EventArgs e)
    {
        //抓取本頁初次登記的時間
        string SessionName = "CGR031_" + Request.QueryString["TimeStamp"];

        DataTable Dt = (DataTable)Session[SessionName];

        int result;

        string strID = V_ID.Text;

        CGRModel.MaintainSorterExceptoin BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterExceptoin(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(strID);

        result = BCO.DelSorterException(ParameterList, DBT);

        if (result == 0)
        {
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR031.aspx?Code=CGR03", "alert(' 此筆再退單已指定門市進貨日,不可刪除! ');", true);
        }
        else
        {
            if (Dt != null)
            {
                DataRow dr = Dt.Select("ID = " + strID)[0];
                dr.Delete();

                Session[SessionName] = Dt;

                ArrayList AL = (ArrayList)Session["CGR031_SortKey" + Request.QueryString["TimeStamp"]];
                string strNewID = string.Empty;

                int intIndex = GetALIndex(strID);

                AL.Remove(strID);
                Session["CGR031_SortKey" + Request.QueryString["TimeStamp"]] = AL;

                //刪除一筆資料後,顯示下一筆,若連最後一筆都刪除了,則回到查詢頁
                if (AL.Count > 0)
                {
                    if (intIndex < AL.Count - 1)
                    {
                        strNewID = AL[intIndex].ToString();
                    }
                    else
                    {
                        strNewID = AL[AL.Count - 1].ToString();
                    }


                    //顯示資料
                    ForToolBarShow(strNewID);
                    //設定控制項預設狀態
                    SetControlStatus(1);
                    SetGridEdit();
                }
                else
                {
                    Response.Redirect("CGR031.aspx?FromPage=CGR0321&TimeStamp=" + Request.QueryString["TimeStamp"]);
                }
            }
            else
            {
                Response.Redirect("CGR031.aspx?FromPage=CGR0321&TimeStamp=" + Request.QueryString["TimeStamp"]);
            }
        }
    }
Example #7
0
    //儲存鈕
    //按下後,將變動過的資料寫入資料庫中
    protected void V_btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            int intM_ID = 0;

            if (VerifyFormData(int.Parse(Session["PageMode" + PageTimeStamp.Value].ToString())))
            {
                SaveP_Qty();

                //新增表單資料至資料庫
                string SessionMain = "CGR0321_M_" + PageTimeStamp.Value;
                string SessionDetail = "CGR0321_D_" + PageTimeStamp.Value;

                CGRModel.MaintainSorterExceptoin BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterExceptoin(ConntionDB);

                DataTable Dt_Main = MakeMainTable();
                DataTable Dt_Detail = MakeDetailTable();

                if (((DataTable)Session[SessionMain]).Rows.Count > 0)
                {
                    DateTime dtDate = DateTime.MinValue;

                    Dt_Main = (DataTable)Session[SessionMain];

                    Dt_Main.Rows[0]["Chan_No"] = V_CHAN_NO.Text;
                    Dt_Main.Rows[0]["Store"] = V_STORE.Text;
                    Dt_Main.Rows[0]["Route"] = SLP_Route.Text;
                    Dt_Main.Rows[0]["Step"] = V_STEP.Text;
                    Dt_Main.Rows[0]["Chan_Source_No"] = V_CHAN_SOURCE_NO.Text;
                    Dt_Main.Rows[0]["Sign_Date"] = DateTime.Parse(V_SIGN_DATE.Text);
                    Dt_Main.Rows[0]["P_Date"] = DateTime.Parse(V_P_DATE.Text);
                    if (DateTime.TryParse(V_ST_ACCEPT_DATE.Text, out dtDate))
                    {
                        Dt_Main.Rows[0]["ST_Accept_Date"] = dtDate;
                    }
                    //Dt_Main.Rows[0]["ID"] = Request.QueryString["CGR03"];
                    Dt_Main.Rows[0]["UPDATEUID"] = Session["UID"].ToString();
                    Dt_Main.Rows[0]["UPDATEDATE"] = DateTime.Now;
                }
                else
                {
                    DataRow dr_Main = Dt_Main.NewRow();

                    dr_Main["Chan_No"] = V_CHAN_NO.Text;
                    dr_Main["Store"] = V_STORE.Text;
                    dr_Main["Route"] = "";
                    dr_Main["Step"] = "";
                    dr_Main["Chan_Source_No"] = V_CHAN_SOURCE_NO.Text;
                    dr_Main["Sign_Date"] = DateTime.Parse(V_SIGN_DATE.Text);
                    dr_Main["P_Date"] = DateTime.Parse(V_P_DATE.Text);
                    if (V_ST_ACCEPT_DATE.Text.Length != 0)
                    {
                        dr_Main["ST_Accept_Date"] = DateTime.Parse(V_ST_ACCEPT_DATE.Text);
                    }

                    dr_Main["ID"] = 1;
                    dr_Main["UPDATEUID"] = Session["UID"].ToString();
                    dr_Main["UPDATEDATE"] = DateTime.Now;

                    Dt_Main.Rows.Add(dr_Main);

                }

                if (Session[SessionDetail] != null)
                {
                    Dt_Detail = (DataTable)Session[SessionDetail];

                    for (int i = 0; i < GridView1.Rows.Count; i++)
                    {
                        DataRow dr = Dt_Detail.Select("ID = " + ((Label)GridView1.Rows[i].FindControl("V_ID")).Text)[0];
                        dr["P_QTY"] = int.Parse(((TextBox)GridView1.Rows[i].FindControl("V_P_QTY")).Text);
                        dr["P_NOTES"] = ((TextBox)GridView1.Rows[i].FindControl("V_P_NOTES")).Text;
                        dr["P_CLASS"] = ((DropDownList)GridView1.Rows[i].FindControl("DropDownList2")).SelectedValue;
                        dr["UPDATEDATE"] = DateTime.Now;
                    }
                }

                BCO.UpdateMainDetail(Dt_Main, Dt_Detail, Session["UID"].ToString(), DBT, out intM_ID);

                Dt_Main.AcceptChanges();
                Dt_Detail.AcceptChanges();

                Session[SessionMain] = Dt_Main;
                Session[SessionDetail] = Dt_Detail;

                if (Session["PageMode" + PageTimeStamp.Value].ToString() == "3")
                {
                    ArrayList AL = new ArrayList();
                    //AL = (ArrayList)Session["CGR031_SortKey" + Request.QueryString["TimeStamp"]];
                    V_ID.Text = intM_ID.ToString();
                    AL.Add(intM_ID);
                    Session["CGR031_SortKey" + Request.QueryString["TimeStamp"]] = AL;
                }

                Session["PageMode" + PageTimeStamp.Value] = 1;

                SetControlStatus(1);

                SetGridEdit();

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

    }
Example #8
0
    //使用者修改原因後,將資料同步至DataTable
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        #region 變數宣告(for CheckPClass)

        string strP_Class = string.Empty;
        string strRTN_DDL = string.Empty;
        string strBarcode = string.Empty;
        string strPeriodBarcode = string.Empty;
        string strItemMap = string.Empty;
        string strItem = string.Empty;
        string strItemName = string.Empty;
        string strPeriod = string.Empty;

        #endregion

        DropDownList ddl = sender as DropDownList;
        rowid_mst = Convert.ToInt16(ddl.Attributes["rowid_mst"].ToString()) - GridView1.PageIndex * GridView1.PageSize;

        string SessionDetail = "CGR0321_D_" + PageTimeStamp.Value;
        DataTable Dt_Detail = (DataTable)Session[SessionDetail];

        DataRow Dr_Detail = Dt_Detail.Select("ID = " + ((Label)GridView1.Rows[rowid_mst].FindControl("V_ID")).Text)[0];

        Dr_Detail["P_CLASS"] = ((DropDownList)GridView1.Rows[rowid_mst].FindControl("DropDownList2")).SelectedValue;
        Dr_Detail["UPDATEDATE"] = DateTime.Now;

        if (ddl.SelectedValue == "01")
        {
            CGRModel.MaintainSorterExceptoin BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterExceptoin(ConntionDB);

            ParameterList.Clear();

            ParameterList.Add(((Label)GridView1.Rows[rowid_mst].FindControl("V_FULLBARCODE")).Text);
            ParameterList.Add(V_CHAN_NO.Text);
            ParameterList.Add(V_STORE.Text);

            strP_Class = BCO.CheckPClass(ParameterList, out strRTN_DDL, out strBarcode, out strPeriodBarcode, out strItemMap, out strItem, out strItemName, out strPeriod);


            ((TextBox)GridView1.Rows[rowid_mst].FindControl("V_P_NOTES")).Text = "退書截止日" + strRTN_DDL;
            Dr_Detail["P_NOTES"] = "退書截止日" + strRTN_DDL;

        }
        else
        {
            ((TextBox)GridView1.Rows[rowid_mst].FindControl("V_P_NOTES")).Text = "";
            Dr_Detail["P_NOTES"] = "";
        }


    }
Example #9
0
    private void ForToolBarShow(string strID)
    {
        string SessionMain = "CGR0321_M_" + PageTimeStamp.Value;
        string SessionDetail = "CGR0321_D_" + PageTimeStamp.Value;
        DataTable Dt_Main = MakeMainTable();
        DataTable Dt_Detail = MakeDetailTable();

        ArrayList AL_Temp = new ArrayList();

        CGRModel.MaintainSorterExceptoin BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterExceptoin(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(strID);

        //main data
        Dt_Main = BCO.QueryMainByID(ParameterList);
        //detail data
        Dt_Detail = BCO.QueryDetailByID(ParameterList);

        SetControlValue(Dt_Main, Dt_Detail, AL_Temp);

        Session[SessionMain] = Dt_Main;
        Session[SessionDetail] = Dt_Detail;
    }
Example #10
0
    private void GetRouteStep(string strStore, string strSignDate, out string strRoute, out string strStep)
    {
        strRoute = string.Empty;
        strStep = string.Empty;

        try
        {
            DataTable Dt;
            CGRModel.MaintainSorterExceptoin BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterExceptoin(ConntionDB);

            ParameterList.Clear();

            ParameterList.Add(strStore);
            ParameterList.Add(strSignDate);

            Dt = BCO.GetRouteStep(ParameterList);

            if (Dt.Rows.Count > 0)
            {
                strRoute = Dt.Rows[0]["ROUTE"].ToString();
                strStep = Dt.Rows[0]["STEP"].ToString();
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #11
0
    //查詢資料,並將查詢回來的資料和控制項繫結
    private void ShowEditData(string strID)
    {
        try
        {
            //抓取本頁初次登記的時間
            string SessionMain = "CGR0321_M_" + PageTimeStamp.Value;
            string SessionDetail = "CGR0321_D_" + PageTimeStamp.Value;

            DataTable Dt_Main = MakeMainTable();
            DataTable Dt_Detail = MakeDetailTable();
            ArrayList AL_Temp = new ArrayList();

            if (Session["PageMode" + PageTimeStamp.Value].ToString() == "1" || Session["PageMode" + PageTimeStamp.Value].ToString() == "2")
            {
                //string strID = Request.QueryString["CGR03"];

                CGRModel.MaintainSorterExceptoin BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterExceptoin(ConntionDB);

                ParameterList.Clear();

                ParameterList.Add(strID);

                //main data
                Dt_Main = BCO.QueryMainByID(ParameterList);
                //detail data
                Dt_Detail = BCO.QueryDetailByID(ParameterList);
            }
            else //Session["PageMode"+PageTimeStamp.Value].ToString() == "3"
            {
                //Dt_Main = (DataTable)Session["CGR0321_M_" + Request.QueryString["PageTimeStamp"]];
                //Dt_Detail = (DataTable)Session["CGR0321_D_" + Request.QueryString["PageTimeStamp"]];
                //AL_Temp = (ArrayList)Session["CGR0321_T_" + Request.QueryString["PageTimeStamp"]];
                Dt_Main = (DataTable)Session[SessionMain];
                Dt_Detail = (DataTable)Session[SessionDetail];
            }

            SetControlValue(Dt_Main, Dt_Detail, AL_Temp);

            Session[SessionMain] = Dt_Main;
            Session[SessionDetail] = Dt_Detail;

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #12
0
    private void AddBarcode()
    {
        try
        {
            if (CheckSIGN_DATE())
            {
                string strP_Class = string.Empty;
                string strRTN_DDL = string.Empty;
                string strBarcode = string.Empty;
                string strPeriodBarcode = string.Empty;
                string strItemMap = string.Empty;
                string strItem = string.Empty;
                string strItemName = string.Empty;
                string strPeriod = string.Empty;

                CGRModel.MaintainSorterExceptoin BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterExceptoin(ConntionDB);

                ParameterList.Clear();

                ParameterList.Add(E_FullBarCode.Text);
                ParameterList.Add(V_CHAN_NO.Text);
                ParameterList.Add(V_STORE.Text);

                strP_Class = BCO.CheckPClass(ParameterList, out strRTN_DDL, out strBarcode, out strPeriodBarcode, out strItemMap, out strItem, out strItemName, out strPeriod);

                E_BarCode.Text = strBarcode;
                E_Period_BarCode.Text = strPeriodBarcode;
                E_Item_Map.Text = strItemMap;
                E_Item.Text = strItem;
                E_Item_Name.Text = strItemName;
                E_Period.Text = strPeriod;
                E_RTN_DDL.Text = strRTN_DDL;

                if (strP_Class != "OK")
                {
                    DropDownList1.SelectedValue = strP_Class;
                }
                else
                {
                    DropDownList1.SelectedValue = "07";
                }

                if (strP_Class == "02")
                {
                    //將畫面上的資訊寫入session中
                    SavePageStatus();
                    //將畫面資料帶到CGR033
                    //Response.Redirect("CGR033.aspx?PageTimeStamp=" + PageTimeStamp.Value);
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "GetItemName", "POP_GerItemName();__doPostBack('ReBind','');", true);
                }
                else if (strP_Class == "01")
                {
                    E_P_Notes.Text = "退書截止日" + strRTN_DDL;
                }
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "E_P_QTYFocus", string.Format("$get('{0}').select();$get('{0}').focus();", this.E_P_Qty.ClientID), true);
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }