Example #1
0
    }//設定各種模式預設值

    /// <summary>
    /// 繫結資料 MST
    /// </summary>
    private void databind_Mst()
    {
        #region
        try
        {
            DataTable Dt = new DataTable();
            BCO.MaintainMarketSurveyRecords bco = new MaintainMarketSurveyRecords(ConnectionDB);

            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.SLP_CodeFile1.Text, "string")); //營業所
            ParameterList.Add(GetValueSetParameter(this.dSurveyDate.Text, "date")); //市調日期
            ParameterList.Add(GetValueSetParameter("", "string")); //市調人員 不納入查詢條件
            //if (Request.QueryString["Z_O_SUB"] != null)
            //{
            //    ParameterList.Add(GetValueSetParameter((SLP_CodeFile1.Text != "") ? "" : SLP_CodeFile2.Text, "string")); //營業所2
            //    Dt = bco.QuerySurveyRecMain_1(ParameterList);
            //}
            //else
            //    Dt = bco.QuerySurveyRecMain(ParameterList);

            ParameterList.Add(GetValueSetParameter(SLP_CodeFile2.Text, "string")); //營業所(迄)
            Dt = bco.QuerySurveyRecMain_1(ParameterList);


            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
                ErrorMsgLabel.Text = "查無資料";
            else
                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["MKT132_MAIN_" + PageTimeStamp.Value] = Dt;

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

        #endregion
    }//databind_Mst
Example #2
0
    protected void Btn_Maintain_Click(object sender, EventArgs e)
    {
        try
        {
            ErrorMsgLabel.Text = "";

            #region 資料檢查

            if (string.Compare(SLP_CodeFile1.Text, SLP_CodeFile2.Text) > 0)
            {
                ErrorMsgLabel.Text = "營業所(起)不可大於營業所(迄)";
                return;
            }
            
            if (dSurveyDate.Text == "")
            {
                ErrorMsgLabel.Text = "市調日期不可空白";
                return;
            }

            #endregion

            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(txtInvestigator.Text.Trim(), "string")); //市調人員 2010/09/29 modified
            //ParameterList.Add(GetValueSetParameter((SLP_CodeFile1.Text != "") ? "" : SLP_CodeFile2.Text, "string")); //營業所2
            ParameterList.Add(GetValueSetParameter(SLP_CodeFile2.Text, "string")); //營業所(迄)
            BCO.MaintainMarketSurveyRecords bco = new MaintainMarketSurveyRecords(ConnectionDB);
            Dt = bco.QuerySurveyRecMain_1(ParameterList);

            #endregion

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                //若不存在市調情報資料
                ErrorMsgLabel.Text = "不存在市調情報資料,請新增市調情報";
                return;
            }
            else
            {
                //若已存在市調情報資料,至編輯檢視市調情報維護畫面
                Response.Redirect(string.Format("MKT132.aspx?Mode=VIEW&Code=MKT13&Z_O={0}&SURVEY_DATE={1}&INVESTIGATOR={2}&Z_O_SUB={3}", SLP_CodeFile1.Text, dSurveyDate.Text, txtInvestigator.Text, SLP_CodeFile2.Text), false);
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }