/// <summary> /// 点击确定按钮执行的方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { Maticsoft.BLL.AR_Announcement AR_Announcement_bll = new Maticsoft.BLL.AR_Announcement(); Maticsoft.Model.AR_Announcement AR_Announcement_model = AR_Announcement_bll.GetModel(AnnouncementID); if (AR_Announcement_model == null) { AR_Announcement_model = new Maticsoft.Model.AR_Announcement(); } AR_Announcement_model.A_Type = Convert.ToInt32(A_Type.SelectedValue); AR_Announcement_model.A_Title = A_Title.Text; AR_Announcement_model.A_Content = A_Content.Text; AR_Announcement_model.A_DateTime = DateTime.Now; AR_Announcement_model.A_ResponsibilityUserID = UserData.GetUserDate.UserID; //获取当前用户ID AR_Announcement_model.A_GroupID = UserData.GetUserDate.U_GroupID; switch (CMD) { case "New": CMD_Txt = "增加"; //如果是增加操作,就调用Add方法 AR_Announcement_model.AnnouncementID = AR_Announcement_bll.Add(AR_Announcement_model); break; case "Edit": CMD_Txt = "修改"; //如果是修改操作,就调用Update方法 AR_Announcement_bll.Update(AR_Announcement_model); break; } All_Title_Txt = CMD_Txt + App_Txt; //以下方法的第4个参数需要更改 EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", AR_Announcement_model.AnnouncementID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx")); }
private void ShowInfo(int AnnouncementID) { Maticsoft.BLL.AR_Announcement bll=new Maticsoft.BLL.AR_Announcement(); Maticsoft.Model.AR_Announcement model=bll.GetModel(AnnouncementID); this.lblAnnouncementID.Text=model.AnnouncementID.ToString(); this.lblA_Title.Text=model.A_Title; this.lblA_Content.Text=model.A_Content; this.lblA_DateTime.Text=model.A_DateTime.ToString(); this.lblA_ResponsibilityUserID.Text=model.A_ResponsibilityUserID.ToString(); this.lblA_Type.Text=model.A_Type.ToString(); }
private void ShowInfo(int AnnouncementID) { Maticsoft.BLL.AR_Announcement bll = new Maticsoft.BLL.AR_Announcement(); Maticsoft.Model.AR_Announcement model = bll.GetModel(AnnouncementID); this.lblAnnouncementID.Text = model.AnnouncementID.ToString(); this.lblA_Title.Text = model.A_Title; this.lblA_Content.Text = model.A_Content; this.lblA_DateTime.Text = model.A_DateTime.ToString(); this.lblA_ResponsibilityUserID.Text = model.A_ResponsibilityUserID.ToString(); this.lblA_Type.Text = model.A_Type.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Maticsoft.BLL.AR_Announcement bll=new Maticsoft.BLL.AR_Announcement(); if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { int AnnouncementID=(Convert.ToInt32(Request.Params["id"])); bll.Delete(AnnouncementID); Response.Redirect("list.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Maticsoft.BLL.AR_Announcement bll = new Maticsoft.BLL.AR_Announcement(); if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { int AnnouncementID = (Convert.ToInt32(Request.Params["id"])); bll.Delete(AnnouncementID); Response.Redirect("list.aspx"); } } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtA_Title.Text.Trim().Length == 0) { strErr += "公告标题不能为空!\\n"; } if (this.txtA_Content.Text.Trim().Length == 0) { strErr += "公告内容不能为空!\\n"; } if (!PageValidate.IsDateTime(txtA_DateTime.Text)) { strErr += "公告时间格式错误!\\n"; } if (!PageValidate.IsNumber(txtA_ResponsibilityUserID.Text)) { strErr += "责任人格式错误!\\n"; } if (!PageValidate.IsNumber(txtA_Type.Text)) { strErr += "公告类型格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int AnnouncementID = int.Parse(this.lblAnnouncementID.Text); string A_Title = this.txtA_Title.Text; string A_Content = this.txtA_Content.Text; DateTime A_DateTime = DateTime.Parse(this.txtA_DateTime.Text); int A_ResponsibilityUserID = int.Parse(this.txtA_ResponsibilityUserID.Text); int A_Type = int.Parse(this.txtA_Type.Text); Maticsoft.Model.AR_Announcement model = new Maticsoft.Model.AR_Announcement(); model.AnnouncementID = AnnouncementID; model.A_Title = A_Title; model.A_Content = A_Content; model.A_DateTime = A_DateTime; model.A_ResponsibilityUserID = A_ResponsibilityUserID; model.A_Type = A_Type; Maticsoft.BLL.AR_Announcement bll = new Maticsoft.BLL.AR_Announcement(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(this.txtA_Title.Text.Trim().Length==0) { strErr+="公告标题不能为空!\\n"; } if(this.txtA_Content.Text.Trim().Length==0) { strErr+="公告内容不能为空!\\n"; } if(!PageValidate.IsDateTime(txtA_DateTime.Text)) { strErr+="公告时间格式错误!\\n"; } if(!PageValidate.IsNumber(txtA_ResponsibilityUserID.Text)) { strErr+="责任人格式错误!\\n"; } if(!PageValidate.IsNumber(txtA_Type.Text)) { strErr+="公告类型格式错误!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int AnnouncementID=int.Parse(this.lblAnnouncementID.Text); string A_Title=this.txtA_Title.Text; string A_Content=this.txtA_Content.Text; DateTime A_DateTime=DateTime.Parse(this.txtA_DateTime.Text); int A_ResponsibilityUserID=int.Parse(this.txtA_ResponsibilityUserID.Text); int A_Type=int.Parse(this.txtA_Type.Text); Maticsoft.Model.AR_Announcement model=new Maticsoft.Model.AR_Announcement(); model.AnnouncementID=AnnouncementID; model.A_Title=A_Title; model.A_Content=A_Content; model.A_DateTime=A_DateTime; model.A_ResponsibilityUserID=A_ResponsibilityUserID; model.A_Type=A_Type; Maticsoft.BLL.AR_Announcement bll=new Maticsoft.BLL.AR_Announcement(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }
/// <summary> /// 在编辑的时候将对应的值绑定到Label上 /// </summary> private void InputData() { Maticsoft.BLL.AR_Announcement AR_Announcement_bll = new Maticsoft.BLL.AR_Announcement(); Maticsoft.Model.AR_Announcement AR_Announcement_model = AR_Announcement_bll.GetModel(AnnouncementID); if (AR_Announcement_model != null) { A_Type.SelectedValue = AR_Announcement_model.A_Type + ""; A_Title.Text = AR_Announcement_model.A_Title; A_Content.Text = AR_Announcement_model.A_Content; } }
/// <summary> /// 初始化 /// </summary> private void OnStart() { if (CMD == "New") { } else if (CMD == "Edit") { HeadMenuButtonItem bi2 = new HeadMenuButtonItem(); bi2.ButtonPopedom = PopedomType.Delete; bi2.ButtonName = "活动"; bi2.ButtonUrlType = UrlType.JavaScript; bi2.ButtonUrl = string.Format("DelData('?CMD=Delete&AnnouncementID={0}')", AnnouncementID); HeadMenuWebControls1.ButtonList.Add(bi2); InputData(); } else if (CMD == "Delete") { Maticsoft.BLL.AR_Announcement bll = new Maticsoft.BLL.AR_Announcement(); Maticsoft.Model.AR_Announcement model = bll.GetModel(AnnouncementID); bll.Delete(model.AnnouncementID); EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", AnnouncementID, "删除信息"), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx")); } }
/// <summary> /// 绑定列表数据 /// </summary> private void BindData() { string orderby = OrderType == 0 ? Orderfld + " asc" : Orderfld + " desc"; int startIndex = (this.AspNetPager1.CurrentPageIndex - 1) * this.AspNetPager1.PageSize + 1; int endIndex = this.AspNetPager1.CurrentPageIndex * this.AspNetPager1.PageSize; Maticsoft.BLL.AR_Announcement bll = new Maticsoft.BLL.AR_Announcement(); DataSet datas = bll.GetListByPage(SearchTerms, orderby, startIndex, endIndex); GridView1.DataSource = datas; GridView1.DataBind(); this.AspNetPager1.RecordCount = bll.GetRecordCount(SearchTerms); }