예제 #1
0
        /// <summary>
        /// 刪除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            logmodel.ProcessFlag = "delete";
            string alert = "";
            model = new AttKQParamsOrgModel();
            string orgCode = (base.Request.QueryString["OrgCode"] == null) ? "" : base.Request.QueryString["OrgCode"].ToString();
            //orgCode = "test004";
            model.OrgCode = orgCode;

            if (ParamsEditBll.DeleteKQMParamsOrgData(model,logmodel) > 0)
            {
                alert = "alert('" + Message.DeleteSuccess + "')";
            }
            else
            {
                alert = "alert('" + Message.DeleteFailed + "')";
            }

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "show", alert, true);
            model = new AttKQParamsOrgModel();
            this.Query(orgCode);
            this.hidOperate.Value = "";
        }
예제 #2
0
        /// <summary>
        /// 頁面UI數據綁定
        /// </summary>
        /// <param name="orgCode"></param>
        private void DataUIBind(string orgCode)
        {
            ParamsOrgInfo = new DataTable();
            if (orgCode != "")
            {
                model = new AttKQParamsOrgModel();
                model.OrgCode = orgCode;
                ParamsOrgInfo = ParamsEditBll.GetKQMParamsOrgData(model);
            }
            //WebGrid綁定數據
            this.UltraWebGrid.DataSource = ParamsOrgInfo.DefaultView;
            this.UltraWebGrid.DataBind();

            //下拉列表綁定數據
            if (ParamsOrgInfo.Rows.Count > 0)
            {
                if (this.UltraWebGrid.DisplayLayout.SelectedRows.Count == 0)
                {
                    this.UltraWebGrid.Rows[0].Selected = true;
                }
                int intSelect = this.UltraWebGrid.DisplayLayout.SelectedRows[0].Index;
                this.ddlIsNotKaoQin.SelectedValue = (this.UltraWebGrid.Rows[intSelect].Cells[2].Text == null) ? "" : this.UltraWebGrid.Rows[intSelect].Cells[2].Text.Trim();
                string[] temVal = null;
                temVal = (this.UltraWebGrid.Rows[intSelect].Cells[1].Text == null) ? null : this.UltraWebGrid.Rows[intSelect].Cells[1].Text.Split(new char[] { ',' });
                if (temVal != null)
                {
                    for (int iLoop = 0; iLoop < temVal.Length; iLoop++)
                    {
                        for (int j = 0; j < this.ddlBellNo.Items.Count; j++)
                        {
                            if (object.Equals(this.ddlBellNo.Items[j].Value.Trim(), temVal[iLoop].Trim()))
                            {
                                this.ddlBellNo.Items[j].Selected = true;
                            }
                        }
                    }
                }
                this.HiddenIsNotKaoQin.Value = (this.UltraWebGrid.Rows[intSelect].Cells[2].Text == null) ? "" : this.UltraWebGrid.Rows[intSelect].Cells[2].Text.Trim();
                this.HiddenBellNo.Value = (this.UltraWebGrid.Rows[intSelect].Cells[1].Text == null) ? null : this.UltraWebGrid.Rows[intSelect].Cells[1].Text;
            }
            else
            {
                this.ddlIsNotKaoQin.SelectedValue = "";
                this.ddlBellNo.ClearSelection();
            }
        }
예제 #3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string actionFlag = this.hidOperate.Value.ToString().Trim();
            bool result = false;
            string alert = "";
            string orgCode = (base.Request.QueryString["OrgCode"] == null) ? "" : base.Request.QueryString["OrgCode"].ToString();
            // orgCode = "test004";
            model = new AttKQParamsOrgModel();
            model.OrgCode = orgCode;
            model.BellNo = this.ddlBellNo.SelectedValuesToString().Replace(", ", ",");
            model.IsNotKaoQin = this.ddlIsNotKaoQin.SelectedValue.ToString();

            if (ParamsEditBll.GetValue("IsAllowNotKaoQin",null).Equals("N") && this.ddlIsNotKaoQin.SelectedValue.Equals("Y"))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "show", "alert('" + Message.NotAllowNotKaoQin + "')", true);
            }
            else
            {

                //新增
                if (actionFlag == "add")
                {
                    logmodel.ProcessFlag = "insert";
                    model.CreateUser = CurrentUserInfo.Personcode;
                    model.UpdateUser = CurrentUserInfo.Personcode;
                    model.UpdateDate = System.DateTime.Now;
                    model.CreateDate = System.DateTime.Now;
                    result = ParamsEditBll.AddKQMParamsOrgData(model,logmodel);
                    if (result == true)
                    {
                        alert = "alert('" + Message.AddSuccess + "')";
                    }
                    else
                    {
                        alert = "alert('" + Message.AddFailed + "')";
                    }
                    this.hidOperate.Value = "";

                }
                //修改
                if (actionFlag == "modify")
                {
                    logmodel.ProcessFlag = "update";
                    model.UpdateUser = CurrentUserInfo.Personcode;
                    model.UpdateDate = System.DateTime.Now;
                    result = ParamsEditBll.UpdateKQMParamsOrgByKey(model,logmodel);
                    if (result == true)
                    {
                        alert = "alert('" + Message.UpdateSuccess + "')";
                    }
                    else
                    {
                        alert = "alert('" + Message.UpdateFailed + "')";
                    }

                    this.hidOperate.Value = "";

                }
            }
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "show", alert, true);
            model = new AttKQParamsOrgModel();
            this.Query(orgCode);
            this.hidOperate.Value = "";
        }