Пример #1
0
    protected void Btn_Cancel_Click(object sender, EventArgs e)
    {
        try
        {
            switch (this.hid_PageStatus.Value)
            {
                case "EDIT":

                    #region 設定頁面狀態

                    this.hid_PageStatus.Value = "VIEW";
                    this.txt_PageStatus.Text = "VIEW";

                    #endregion

                    #region 檢視市調商品

                    try
                    {
                        BCO.MaintainMarketSurveyRecordsDtl bco = new BCO.MaintainMarketSurveyRecordsDtl(ConnectionDB);
                        ParameterList.Clear();
                        ParameterList.Add(this.hiddenID.Value);
                        DataTable dt = bco.QuerySurveyRecDetlByPID(ParameterList);

                        this.gvDtl.DataSource = dt;
                        this.gvDtl.DataBind();

                        Session["MKT132_DTL_" + PageTimeStamp.Value] = dt;
                    }
                    catch (Exception ex)
                    {
                        ErrorMsgLabel.Text = ex.Message;
                    }

                    #endregion

                    break;
                case "VIEW":
                    Response.Redirect("MKT131.aspx?&Code=MKT13");

                    break;
                default:
                    break;
            }
        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.ToString(); }
        finally
        {
            if (this.ErrorMsgLabel.Text == "")
            {
                SetPageStatus();
            }
        }
    }
Пример #2
0
    }//databind_Mst

    /// <summary>
    /// 繫結資料 Dtl
    /// </summary>
    private void databind_Dtl()
    {
        #region
        try
        {
            #region 檢視市調商品

            try
            {
                BCO.MaintainMarketSurveyRecordsDtl bco = new BCO.MaintainMarketSurveyRecordsDtl(ConnectionDB);
                ParameterList.Clear();
                ParameterList.Add(this.hiddenID.Value);
                DataTable dt = bco.QuerySurveyRecDetlByPID(ParameterList);

                this.gvDtl.DataSource = dt;
                this.gvDtl.DataBind();

                Session["MKT132_DTL_" + PageTimeStamp.Value] = dt;
            }
            catch (Exception ex)
            {
                ErrorMsgLabel.Text = ex.Message;
            }

            #endregion
        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.ToString(); }
        finally { }

        #endregion
    }//databind_Dtl
Пример #3
0
    public static string GetItemMaxPeriod(string s_ItemValue, string s_Item_Client_Id, string s_Period_Client_Id, string s_PublishDate_Client_Id, string s_SurveyTime_Client_Id)
    {
        #region 取得Item最大期別

        String rtnValue = "";

        if (s_ItemValue.Trim() != "")
        {

            BCO.MaintainMarketSurveyRecordsDtl bco = new BCO.MaintainMarketSurveyRecordsDtl(ConnectionDB);

            ParameterList.Clear();
            ParameterList.Add(s_ItemValue);

            //取得Item最大期別
            DataTable dt = bco.GetItemMaxPeriod(ParameterList);
            if (dt.Rows.Count > 0)
            {
                rtnValue = dt.Rows[0][0].ToString() + ";" + s_Item_Client_Id + ";" + s_Period_Client_Id + ";" + s_PublishDate_Client_Id + ";" + s_SurveyTime_Client_Id;
            }
            else
            {
                rtnValue = rtnValue = "" + ";" + s_Item_Client_Id + ";" + s_Period_Client_Id + ";" + s_PublishDate_Client_Id + ";" + s_SurveyTime_Client_Id;
            }

        }

        return rtnValue;

        #endregion
    }
Пример #4
0
    public static string GetPeriodRelated(string s_ItemValue, string s_PeriodValue, string s_Item_Client_Id, string s_Period_Client_Id, string s_PublishDate_Client_Id, string s_SurveyTime_Client_Id, string s_Z_OValue, string s_SurveyDateValue)
    {
        #region

        String rtnValue = "";
        String strPeriodStartDate = "";

        if (s_PeriodValue.Trim() != "")
        {

            #region 根據[@品號]、[@期別],自動帶入[@上市日期]=[期別主檔].[期別開始日]
            BCO.MaintainMarketSurveyRecordsDtl bco = new BCO.MaintainMarketSurveyRecordsDtl(ConnectionDB);

            ParameterList.Clear();
            ParameterList.Add(s_ItemValue);
            ParameterList.Add(s_PeriodValue);

            DataTable dt = bco.GetPeriodStartDate(ParameterList);
            if (dt.Rows.Count > 0)
            {
                strPeriodStartDate = (dt.Rows[0][0].ToString() == "") ? "" : ((DateTime)dt.Rows[0][0]).ToString("yyyy/MM/dd");
            }
            else
            {
                return "ErrorPeriod" + ";" + "0" + ";" + s_Item_Client_Id + ";" + s_Period_Client_Id + ";" + s_PublishDate_Client_Id + ";" + s_SurveyTime_Client_Id; ;
            }

            #endregion

            #region 自動算出〔市調次數〕-->=該品項歷史次數合計+1
            

            BCO.MaintainMarketSurveyRecordsDtl bco2 = new BCO.MaintainMarketSurveyRecordsDtl(ConnectionDB);

            ParameterList.Clear();
            ParameterList.Add(s_Z_OValue);
            ParameterList.Add(s_SurveyDateValue);
            ParameterList.Add(s_ItemValue);
            ParameterList.Add(s_PeriodValue);

            DataTable dt2 = bco2.GetItemSurveyTime(ParameterList);
            if (dt2.Rows.Count > 0)
            {
                rtnValue = strPeriodStartDate +";" + dt2.Rows[0][0].ToString() + ";" + s_Item_Client_Id + ";" + s_Period_Client_Id + ";" + s_PublishDate_Client_Id + ";" + s_SurveyTime_Client_Id;
            }

            #endregion

        }

        return rtnValue;

        #endregion
    }
Пример #5
0
    /// <summary>
    /// 繫結舊有營業所,市調日期資料 
    /// </summary>
    private void databind_Old()
    {
        #region
        try
        {
            DataTable Dt = new DataTable();

            #region 取得查詢參數: 營業所,市調日期

            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_CodeFile1.Text, "string")); //營業所
            ParameterList.Add(GetValueSetParameter(this.dSurveyDate.Text, "date")); //市調日期
            ParameterList.Add(GetValueSetParameter("", "string")); //市調人員 不納入查詢條件

            #endregion

            #region 處理查詢

            BCO.MaintainMarketSurveyRecords bcoMain = new MaintainMarketSurveyRecords(ConnectionDB);

            Dt = bcoMain.QuerySurveyRecMain(ParameterList);

            #endregion

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                Session["MKT133_MAIN_OLD" + PageTimeStamp.Value] = null;
                return;
            }

            this.txtInvestigator.Text = Dt.Rows[0]["INVESTIGATOR"].ToString();

            #region 設定查詢結果

            this.GridView1.DataSource = Dt;
            this.GridView1.PageSize = 20;// (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
            this.GridView1.PageIndex = 0;
            this.GridView1.DataBind();

            Session["MKT133_MAIN_" + PageTimeStamp.Value] = Dt.Copy();
            Session["MKT133_MAIN_OLD" + PageTimeStamp.Value] = Dt.Copy();

            #endregion


            BCO.MaintainMarketSurveyRecordsDtl bco = new BCO.MaintainMarketSurveyRecordsDtl(ConnectionDB);

            ParameterList.Clear();

            ParameterList.Add(Dt.Rows[0]["ID"].ToString());

            DataTable dtDtl = bco.QuerySurveyRecDetlByPID(ParameterList);


            //設定市調商品 column
            DataTable dt = new DataTable();
            DataColumn dcNew;
            dcNew = new DataColumn("ITEM", Type.GetType("System.String"));
            dt.Columns.Add(dcNew);
            dcNew = new DataColumn("PERIOD", Type.GetType("System.String"));
            dt.Columns.Add(dcNew);
            dcNew = new DataColumn("PUBLISH_DATE", Type.GetType("System.String"));
            dt.Columns.Add(dcNew);
            dcNew = new DataColumn("SURVEY_TIME", Type.GetType("System.Int32"));
            dt.Columns.Add(dcNew);

            //產生20筆資料供編輯
            for (int i = 0; i < 20; i++)
            {

                DataRow drNew;
                drNew = dt.NewRow();

                if (i < dtDtl.Rows.Count)
                {

                    drNew["ITEM"] = dtDtl.Rows[i]["ITEM"].ToString();
                    drNew["PERIOD"] = dtDtl.Rows[i]["PERIOD"].ToString();
                    //drNew["PUBLISH_DATE"] = ((DateTime)dtDtl.Rows[i]["PUBLISH_DATE"]).ToString("yyyy/MM/dd");
                    drNew["SURVEY_TIME"] = GetValueSetParameter(dtDtl.Rows[i]["SURVEY_TIME"].ToString(), "int");
                }
                else
                {
                    drNew["ITEM"] = "";
                    drNew["PERIOD"] = "";
                    drNew["PUBLISH_DATE"] = DBNull.Value;
                    drNew["SURVEY_TIME"] = DBNull.Value;
                }

                dt.Rows.Add(drNew);
            }

            dt.AcceptChanges();

            this.gvDtl.DataSource = dt;
            this.gvDtl.DataBind();

        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.ToString(); }
        finally { }

        #endregion
    }//databind_Old