protected void btn_AddGift_Click(object sender, EventArgs e) { IList<CAT_GiftApplyDetail> _giftListdetail = (IList<CAT_GiftApplyDetail>)ViewState["GiftListDetails"]; CAT_GiftApplyDetail _m = new CAT_GiftApplyDetail(); int product = 0; if (int.TryParse(select_GiftProduct.SelectValue, out product)) { _m.Product = product; } else { MessageBox.Show(this, "产品必填!"); return; } _m.ApplyQuantity = int.Parse(txt_ApplyCount.Text.Trim()); _m.Remark = txt_GiftRemark.Text.Trim(); _m.Activity = (int)ViewState["ID"]; if (_giftListdetail.Where(p => p.Product == product).Count() == 0) { _giftListdetail.Add(_m); if (_m.Activity > 0) { CAT_GiftApplyDetailBLL _bll = new CAT_GiftApplyDetailBLL(); _bll.Model = _m; _bll.Add(); } BindGrid(); } }
protected void bt_Adjust_Click(object sender, EventArgs e) { Button bt_Adjust = (Button)sender; GridViewRow drv = (GridViewRow)bt_Adjust.NamingContainer; int rowIndex = drv.RowIndex; int ID = int.Parse(gv_GiftListDetail.DataKeys[rowIndex]["ID"].ToString()); TextBox txt_AdjustQuantity = (TextBox)drv.FindControl("txt_AdjustQuantity"); TextBox txt_UsedQuantity = (TextBox)drv.FindControl("txt_UsedQuantity"); TextBox txt_BalanceQuantity = (TextBox)drv.FindControl("txt_BalanceQuantity"); TextBox tbx_Remark = (TextBox)drv.FindControl("tbx_Remark"); if ((int)ViewState["ID"] > 0) { CAT_ActivityBLL catbll = new CAT_ActivityBLL((int)ViewState["ID"]); CAT_GiftApplyDetailBLL _gitfbll = new CAT_GiftApplyDetailBLL(ID); switch (catbll.Model.State) { case 12: _gitfbll.Model.AdjustQuantity = int.Parse(txt_AdjustQuantity.Text.Trim()); break; case 1: _gitfbll.Model.UsedQuantity = int.Parse(txt_UsedQuantity.Text.Trim()); _gitfbll.Model.BalanceQuantity = int.Parse(txt_BalanceQuantity.Text.Trim()); txt_AdjustQuantity.Text = "0"; break; } _gitfbll.Update(); } }
protected void btn_AddGift_Click(object sender, EventArgs e) { IList <CAT_GiftApplyDetail> _giftListdetail = (IList <CAT_GiftApplyDetail>)ViewState["GiftListDetails"]; CAT_GiftApplyDetail _m = new CAT_GiftApplyDetail(); int product = 0; if (int.TryParse(select_GiftProduct.SelectValue, out product)) { _m.Product = product; } else { MessageBox.Show(this, "产品必填!"); return; } _m.ApplyQuantity = int.Parse(txt_ApplyCount.Text.Trim()); _m.Remark = txt_GiftRemark.Text.Trim(); _m.Activity = (int)ViewState["ID"]; if (_giftListdetail.Where(p => p.Product == product).Count() == 0) { _giftListdetail.Add(_m); if (_m.Activity > 0) { CAT_GiftApplyDetailBLL _bll = new CAT_GiftApplyDetailBLL(); _bll.Model = _m; _bll.Add(); } BindGrid(); } }
protected void gv_GiftListDetail_RowDeleting(object sender, GridViewDeleteEventArgs e) { IList <CAT_GiftApplyDetail> _giftListdetail = (IList <CAT_GiftApplyDetail>)ViewState["GiftListDetails"]; int ID = 0; if (int.TryParse(gv_GiftListDetail.DataKeys[e.RowIndex]["ID"].ToString(), out ID) && ID > 0) { CAT_GiftApplyDetailBLL _bll = new CAT_GiftApplyDetailBLL(ID); _bll.Delete(); } _giftListdetail.RemoveAt(e.RowIndex); BindGrid(); }
protected void gv_GiftListDetail_RowDeleting(object sender, GridViewDeleteEventArgs e) { IList<CAT_GiftApplyDetail> _giftListdetail = (IList<CAT_GiftApplyDetail>)ViewState["GiftListDetails"]; int ID = 0; if (int.TryParse(gv_GiftListDetail.DataKeys[e.RowIndex]["ID"].ToString(), out ID) && ID > 0) { CAT_GiftApplyDetailBLL _bll = new CAT_GiftApplyDetailBLL(ID); _bll.Delete(); } _giftListdetail.RemoveAt(e.RowIndex); BindGrid(); }
protected void bt_OK_Click(object sender, EventArgs e) { CAT_ActivityBLL _bll; if ((int)ViewState["ID"] != 0) { //修改 _bll = new CAT_ActivityBLL((int)ViewState["ID"]); } else { //新增 _bll = new CAT_ActivityBLL(); } pl_detail.GetData(_bll.Model); #region 判断必填项 if (_bll.Model.OrganizeCity == 0) { MessageBox.Show(this, "请选择活动举办的管理片区!"); return; } if (_bll.Model.Officialcity == 0) { MessageBox.Show(this, "请选择活动所属城市!"); return; } if (_bll.Model.Topic == "") { MessageBox.Show(this, "活动主题不能为空!"); return; } if (_bll.Model.Address == "") { MessageBox.Show(this, "举办地址不能为空!"); return; } if (_bll.Model.Classify == 0) { MessageBox.Show(this, "请选择活动的分类!"); return; } #endregion if ((int)ViewState["ID"] != 0) { //修改 _bll.Model.UpdateStaff = (int)Session["UserID"]; if (_bll.Update() == 0 && sender != null) MessageBox.ShowAndRedirect(this, "修改成功!", "CAT_ActivityList.aspx"); } else { //新增 _bll.Model.InsertStaff = (int)Session["UserID"]; _bll.Model.ApproveFlag = 2; ViewState["ID"] = _bll.Add(); if ((int)ViewState["ID"] > 0) { IList<CAT_FeeApplyDetail> _details = (IList<CAT_FeeApplyDetail>)ViewState["FeeListDetails"]; IList<CAT_GiftApplyDetail> _giftdetail = (IList<CAT_GiftApplyDetail>)ViewState["GiftListDetails"]; CAT_FeeApplyDetailBLL _feebll = new CAT_FeeApplyDetailBLL(); CAT_GiftApplyDetailBLL _giftbll = new CAT_GiftApplyDetailBLL(); foreach (CAT_GiftApplyDetail _m in _giftdetail) { _m.Activity = (int)ViewState["ID"]; _giftbll.Model = _m; _giftbll.Add(); } foreach (CAT_FeeApplyDetail _m in _details) { _m.Activity = (int)ViewState["ID"]; _feebll.Model = _m; _feebll.Add(); } MessageBox.ShowAndRedirect(this, "新增成功!", "CAT_ActivityDetail.aspx?ID=" + ViewState["ID"].ToString()); } } }
protected void bt_OK_Click(object sender, EventArgs e) { CAT_ActivityBLL _bll; if ((int)ViewState["ID"] != 0) { //修改 _bll = new CAT_ActivityBLL((int)ViewState["ID"]); } else { //新增 _bll = new CAT_ActivityBLL(); } pl_detail.GetData(_bll.Model); #region 判断必填项 if (_bll.Model.OrganizeCity == 0) { MessageBox.Show(this, "请选择活动举办的管理片区!"); return; } if (_bll.Model.Officialcity == 0) { MessageBox.Show(this, "请选择活动所属城市!"); return; } if (_bll.Model.Topic == "") { MessageBox.Show(this, "活动主题不能为空!"); return; } if (_bll.Model.Address == "") { MessageBox.Show(this, "举办地址不能为空!"); return; } if (_bll.Model.Classify == 0) { MessageBox.Show(this, "请选择活动的分类!"); return; } #endregion if ((int)ViewState["ID"] != 0) { //修改 _bll.Model.UpdateStaff = (int)Session["UserID"]; if (_bll.Update() == 0 && sender != null) { MessageBox.ShowAndRedirect(this, "修改成功!", "CAT_ActivityList.aspx"); } } else { //新增 _bll.Model.InsertStaff = (int)Session["UserID"]; _bll.Model.ApproveFlag = 2; ViewState["ID"] = _bll.Add(); if ((int)ViewState["ID"] > 0) { IList <CAT_FeeApplyDetail> _details = (IList <CAT_FeeApplyDetail>)ViewState["FeeListDetails"]; IList <CAT_GiftApplyDetail> _giftdetail = (IList <CAT_GiftApplyDetail>)ViewState["GiftListDetails"]; CAT_FeeApplyDetailBLL _feebll = new CAT_FeeApplyDetailBLL(); CAT_GiftApplyDetailBLL _giftbll = new CAT_GiftApplyDetailBLL(); foreach (CAT_GiftApplyDetail _m in _giftdetail) { _m.Activity = (int)ViewState["ID"]; _giftbll.Model = _m; _giftbll.Add(); } foreach (CAT_FeeApplyDetail _m in _details) { _m.Activity = (int)ViewState["ID"]; _feebll.Model = _m; _feebll.Add(); } MessageBox.ShowAndRedirect(this, "新增成功!", "CAT_ActivityDetail.aspx?ID=" + ViewState["ID"].ToString()); } } }
protected void Page_Load(object sender, System.EventArgs e) { #region 获取举办医院控件 MCSSelectControl select_StageClient = (MCSSelectControl)pl_detail.FindControl("CAT_Activity_StageClient"); if (select_StageClient != null) { select_StageClient.SelectChange += new SelectChangeEventHandler(select_StageClient_SelectChange); } DropDownList ddl_classify = pl_detail.FindControl("CAT_Activity_Classify") != null ? (DropDownList)pl_detail.FindControl("CAT_Activity_Classify") : null; if (ddl_classify != null) { } #endregion // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 ViewState["ID"] = Request.QueryString["ID"] != null?int.Parse(Request.QueryString["ID"]) : 0; ViewState["Classify"] = Request.QueryString["Classify"] != null?int.Parse(Request.QueryString["Classify"]) : 0; #endregion BindDropDown(); ViewState["FeeListDetails"] = CAT_FeeApplyDetailBLL.GetModelList("Activity=" + ViewState["ID"].ToString()); ViewState["GiftListDetails"] = CAT_GiftApplyDetailBLL.GetModelList("Activity=" + ViewState["ID"].ToString()); ViewState["SalesListDetails"] = CAT_SalesVolumeDetailBLL.GetModelList("Activity=" + ViewState["ID"].ToString()); ViewState["EditAdjust"] = false; if ((int)ViewState["ID"] != 0) { //修改 BindData(); BindGrid(); } else { //新增 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); ((MCSTreeControl)pl_detail.FindControl("CAT_Activity_Officialcity")).SelectValue = staff.Model.OfficialCity.ToString(); ((MCSTreeControl)pl_detail.FindControl("CAT_Activity_OrganizeCity")).SelectValue = staff.Model.OrganizeCity.ToString(); string state = Request.QueryString["State"] != null ? Request.QueryString["State"] : "11"; //默认为排期中的活动 ((DropDownList)pl_detail.FindControl("CAT_Activity_State")).SelectedValue = state; bt_Stage.Visible = false; bt_Submit.Visible = false; bt_Approve.Visible = false; bt_Complete.Visible = false; bt_Cancel.Visible = false; UploadFile001.Visible = false; gv_FeeListDetail.Columns[gv_FeeListDetail.Columns.Count - 2].Visible = false; //调整按钮 gv_FeeListDetail.Columns[gv_FeeListDetail.Columns.Count - 3].Visible = false; //批复金额 gv_FeeListDetail.Columns[gv_FeeListDetail.Columns.Count - 4].Visible = false; //扣减额原因 gv_FeeListDetail.Columns[gv_FeeListDetail.Columns.Count - 5].Visible = false; //扣减额 gv_GiftListDetail.Columns[2].Visible = false; //调整数量 gv_GiftListDetail.Columns[3].Visible = false; //使用数量 gv_GiftListDetail.Columns[4].Visible = false; //剩余数量 pl_detail.SetPanelVisible("Panel_CAT_ActivityDetail_02", false); } } if (ViewState["ApproveFlag"] == null || (int)ViewState["ApproveFlag"] != 1) { MCSTabControl1.Items[2].Visible = false; } }