public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(this.txtI_Location.Text.Trim().Length==0) { strErr+="I_Location不能为空!\\n"; } if(!PageValidate.IsNumber(txtI_Type.Text)) { strErr+="I_Type格式错误!\\n"; } if(!PageValidate.IsDateTime(txtI_Date.Text)) { strErr+="巡查时间格式错误!\\n"; } if(!PageValidate.IsNumber(txtI_UserID.Text)) { strErr+="巡查人格式错误!\\n"; } if(this.txtI_Conent.Text.Trim().Length==0) { strErr+="寻常内容不能为空!\\n"; } if(this.txtI_MainProblem.Text.Trim().Length==0) { strErr+="发现的主要问题不能为空!\\n"; } if(this.txtI_Note.Text.Trim().Length==0) { strErr+="备注不能为空!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int InspectID=int.Parse(this.lblInspectID.Text); string I_Location=this.txtI_Location.Text; int I_Type=int.Parse(this.txtI_Type.Text); DateTime I_Date=DateTime.Parse(this.txtI_Date.Text); int I_UserID=int.Parse(this.txtI_UserID.Text); string I_Conent=this.txtI_Conent.Text; string I_MainProblem=this.txtI_MainProblem.Text; string I_Note=this.txtI_Note.Text; Maticsoft.Model.supervision_Inspect model=new Maticsoft.Model.supervision_Inspect(); model.InspectID=InspectID; model.I_Location=I_Location; model.I_Type=I_Type; model.I_Date=I_Date; model.I_UserID=I_UserID; model.I_Conent=I_Conent; model.I_MainProblem=I_MainProblem; model.I_Note=I_Note; Maticsoft.BLL.supervision_Inspect bll=new Maticsoft.BLL.supervision_Inspect(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtI_Location.Text.Trim().Length == 0) { strErr += "I_Location不能为空!\\n"; } if (!PageValidate.IsNumber(txtI_Type.Text)) { strErr += "I_Type格式错误!\\n"; } if (!PageValidate.IsDateTime(txtI_Date.Text)) { strErr += "巡查时间格式错误!\\n"; } if (!PageValidate.IsNumber(txtI_UserID.Text)) { strErr += "巡查人格式错误!\\n"; } if (this.txtI_Conent.Text.Trim().Length == 0) { strErr += "寻常内容不能为空!\\n"; } if (this.txtI_MainProblem.Text.Trim().Length == 0) { strErr += "发现的主要问题不能为空!\\n"; } if (this.txtI_Note.Text.Trim().Length == 0) { strErr += "备注不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string I_Location = this.txtI_Location.Text; int I_Type = int.Parse(this.txtI_Type.Text); DateTime I_Date = DateTime.Parse(this.txtI_Date.Text); int I_UserID = int.Parse(this.txtI_UserID.Text); string I_Conent = this.txtI_Conent.Text; string I_MainProblem = this.txtI_MainProblem.Text; string I_Note = this.txtI_Note.Text; Maticsoft.Model.supervision_Inspect model = new Maticsoft.Model.supervision_Inspect(); model.I_Location = I_Location; model.I_Type = I_Type; model.I_Date = I_Date; model.I_UserID = I_UserID; model.I_Conent = I_Conent; model.I_MainProblem = I_MainProblem; model.I_Note = I_Note; Maticsoft.BLL.supervision_Inspect bll = new Maticsoft.BLL.supervision_Inspect(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Maticsoft.BLL.supervision_Inspect bll = new Maticsoft.BLL.supervision_Inspect(); if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { int InspectID = (Convert.ToInt32(Request.Params["id"])); bll.Delete(InspectID); Response.Redirect("list.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Maticsoft.BLL.supervision_Inspect bll=new Maticsoft.BLL.supervision_Inspect(); if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { int InspectID=(Convert.ToInt32(Request.Params["id"])); bll.Delete(InspectID); Response.Redirect("list.aspx"); } } }
private void ShowInfo(int InspectID) { Maticsoft.BLL.supervision_Inspect bll=new Maticsoft.BLL.supervision_Inspect(); Maticsoft.Model.supervision_Inspect model=bll.GetModel(InspectID); this.lblInspectID.Text=model.InspectID.ToString(); this.lblI_Location.Text=model.I_Location; this.lblI_Type.Text=model.I_Type.ToString(); this.lblI_Date.Text=model.I_Date.ToString(); this.lblI_UserID.Text=model.I_UserID.ToString(); this.lblI_Conent.Text=model.I_Conent; this.lblI_MainProblem.Text=model.I_MainProblem; this.lblI_Note.Text=model.I_Note; }
private void ShowInfo(int InspectID) { Maticsoft.BLL.supervision_Inspect bll = new Maticsoft.BLL.supervision_Inspect(); Maticsoft.Model.supervision_Inspect model = bll.GetModel(InspectID); this.lblInspectID.Text = model.InspectID.ToString(); this.txtI_Location.Text = model.I_Location; this.txtI_Type.Text = model.I_Type.ToString(); this.txtI_Date.Text = model.I_Date.ToString(); this.txtI_UserID.Text = model.I_UserID.ToString(); this.txtI_Conent.Text = model.I_Conent; this.txtI_MainProblem.Text = model.I_MainProblem; this.txtI_Note.Text = model.I_Note; }
/// <summary> /// 点击确定按钮执行的方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { Maticsoft.BLL.supervision_Inspect supervision_bll = new Maticsoft.BLL.supervision_Inspect(); Maticsoft.Model.supervision_Inspect supervision_Inspect_model = supervision_bll.GetModel(InspectID); if (supervision_Inspect_model == null) { supervision_Inspect_model = new Maticsoft.Model.supervision_Inspect(); } //获取客户端通过Post方式传递过来的值的 supervision_Inspect_model.I_Date = (DateTime)Common.sink(this.I_Date.UniqueID, MethodType.Post, 255, 0, DataType.Dat); supervision_Inspect_model.I_Type = Convert.ToInt32(this.I_Type.SelectedValue); supervision_Inspect_model.I_Content = (string)Common.sink(this.I_Content.UniqueID, MethodType.Post, 0, 0, DataType.Str); supervision_Inspect_model.I_Location = (string)Common.sink(this.I_Location.UniqueID, MethodType.Post, 0, 0, DataType.Str); supervision_Inspect_model.I_MainProblem = (string)Common.sink(this.I_MainProblem.UniqueID, MethodType.Post, 0, 0, DataType.Str); supervision_Inspect_model.I_UserID = Convert.ToInt32(this.I_UserID.Value); switch (CMD) { case "New": CMD_Txt = "增加"; supervision_Inspect_model.I_InfoID = InfoID; //如果是增加操作,就调用Add方法 supervision_Inspect_model.InspectID = supervision_bll.Add(supervision_Inspect_model); if (supervision_Inspect_model.InspectID > 0) { Maticsoft.BLL.supervision_Info supervision_Info_bll = new Maticsoft.BLL.supervision_Info(); Maticsoft.Model.supervision_Info supervision_Info_model = supervision_Info_bll.GetModel(InfoID); supervision_Info_model.I_Status = 2; supervision_Info_bll.Update(supervision_Info_model); } break; case "Edit": CMD_Txt = "修改"; //如果是修改操作,就调用Update方法 supervision_bll.Update(supervision_Inspect_model); break; } All_Title_Txt = CMD_Txt + App_Txt; EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", supervision_Inspect_model.InspectID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx")); }
/// <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&InspectID={0}')", InspectID); HeadMenuWebControls1.ButtonList.Add(bi2); InputData(); } else if (CMD == "Delete") { Maticsoft.BLL.supervision_Inspect bll = new Maticsoft.BLL.supervision_Inspect(); Maticsoft.Model.supervision_Inspect model = bll.GetModel(InspectID); bll.Delete(model.InspectID); EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", InspectID, "删除信息"), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx")); } }
/// <summary> /// 在编辑的时候将对应的值绑定到Label上 /// </summary> private void InputData() { Maticsoft.BLL.supervision_Inspect bll = new Maticsoft.BLL.supervision_Inspect(); Maticsoft.Model.supervision_Inspect model = bll.GetModel(InspectID); I_Date.Text = model.I_Date.ToShortDateString(); I_Type.SelectedValue = model.I_Type+""; I_Content.Text = model.I_Content; Maticsoft.BLL.sys_User user_bll = new Maticsoft.BLL.sys_User(); Maticsoft.Model.sys_User user_model = user_bll.GetModel(model.I_UserID); I_UserID.Value = user_model.UserID + ""; I_UserID_input.Text = user_model.U_CName; }
/// <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.supervision_Inspect bll = new Maticsoft.BLL.supervision_Inspect(); //bll通过调用GetListByPage方法返回分页数据 DataSet datas = bll.GetListByPage(SearchTerms, orderby, startIndex, endIndex); GridView1.DataSource = datas; GridView1.DataBind(); //获取总记录数 this.AspNetPager1.RecordCount = bll.GetRecordCount(SearchTerms); }