/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.FuWuTypeInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update FuWuTypeInfo set "); strSql.Append("FuwuTypeName=@FuwuTypeName"); strSql.Append(" where FuwuTypeID=@FuwuTypeID"); SqlParameter[] parameters = { new SqlParameter("@FuwuTypeID", SqlDbType.Int, 4), new SqlParameter("@FuwuTypeName", SqlDbType.VarChar, 200) }; parameters[0].Value = model.FuwuTypeID; parameters[1].Value = model.FuwuTypeName; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
private void ShowInfo(int FuwuTypeID) { Maticsoft.BLL.FuWuTypeInfo bll = new Maticsoft.BLL.FuWuTypeInfo(); Maticsoft.Model.FuWuTypeInfo model = bll.GetModel(FuwuTypeID); this.lblFuwuTypeID.Text = model.FuwuTypeID.ToString(); this.lblFuwuTypeName.Text = model.FuwuTypeName; }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtFuwuTypeName.Text.Trim().Length == 0) { strErr += "FuwuTypeName不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int FuwuTypeID = int.Parse(this.lblFuwuTypeID.Text); string FuwuTypeName = this.txtFuwuTypeName.Text; Maticsoft.Model.FuWuTypeInfo model = new Maticsoft.Model.FuWuTypeInfo(); model.FuwuTypeID = FuwuTypeID; model.FuwuTypeName = FuwuTypeName; Maticsoft.BLL.FuWuTypeInfo bll = new Maticsoft.BLL.FuWuTypeInfo(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Maticsoft.Model.FuWuTypeInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into FuWuTypeInfo("); strSql.Append("FuwuTypeName)"); strSql.Append(" values ("); strSql.Append("@FuwuTypeName)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@FuwuTypeName", SqlDbType.VarChar, 200) }; parameters[0].Value = model.FuwuTypeName; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.FuWuTypeInfo GetModel(int FuwuTypeID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 FuwuTypeID,FuwuTypeName from FuWuTypeInfo "); strSql.Append(" where FuwuTypeID=@FuwuTypeID"); SqlParameter[] parameters = { new SqlParameter("@FuwuTypeID", SqlDbType.Int, 4) }; parameters[0].Value = FuwuTypeID; Maticsoft.Model.FuWuTypeInfo model = new Maticsoft.Model.FuWuTypeInfo(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["FuwuTypeID"].ToString() != "") { model.FuwuTypeID = int.Parse(ds.Tables[0].Rows[0]["FuwuTypeID"].ToString()); } model.FuwuTypeName = ds.Tables[0].Rows[0]["FuwuTypeName"].ToString(); return(model); } else { return(null); } }
protected void datading_ItemDataBound(object sender, DataListItemEventArgs e) { int index = int.Parse(datafuwu.DataKeys[e.Item.ItemIndex].ToString()); Maticsoft.BLL.FuWuInfo fuwubll = new Maticsoft.BLL.FuWuInfo(); Maticsoft.Model.FuWuInfo fuwumodel = fuwubll.GetModel(index); Maticsoft.BLL.FuWuTypeInfo typebll = new Maticsoft.BLL.FuWuTypeInfo(); Maticsoft.Model.FuWuTypeInfo typemodel = typebll.GetModel(int.Parse(fuwumodel.FuwuTypeID.ToString())); ((Label)e.Item.FindControl("lnltype")).Text = typemodel.FuwuTypeName; }
private void bind(int fuwuID) { Maticsoft.BLL.FuWuInfo fuwubll = new Maticsoft.BLL.FuWuInfo(); Maticsoft.Model.FuWuInfo fuwumodel = fuwubll.GetModel(fuwuID); Maticsoft.BLL.FuWuTypeInfo typebll = new Maticsoft.BLL.FuWuTypeInfo(); Maticsoft.Model.FuWuTypeInfo typemodel = typebll.GetModel(int.Parse(fuwumodel.FuwuTypeID.ToString())); lblFatime.Text = Convert.ToDateTime(fuwumodel.Fatime.ToString()).ToString("yyyy-MM-dd"); lblFuwucontent.Text = fuwumodel.Fuwucontent; lblWrite.Text = fuwumodel.Write; lblFuwuTypeName.Text = typemodel.FuwuTypeName; lbltitle.Text = fuwumodel.fuwuTitle; }
protected void btntype_Click(object sender, EventArgs e) { if (txtaddtype.Text.Trim() == "") { lbladdtype.Text = "请填写服务类型"; return; } Maticsoft.BLL.FuWuTypeInfo typebll = new Maticsoft.BLL.FuWuTypeInfo(); Maticsoft.Model.FuWuTypeInfo typemodel = new Maticsoft.Model.FuWuTypeInfo(); typemodel.FuwuTypeName = txtaddtype.Text.Trim(); typebll.Add(typemodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<SCRIPT>alert('信息提交成功)</SCRIPT>"); }
protected void btnfuwu_Click(object sender, EventArgs e) { Maticsoft.BLL.FuWuTypeInfo bll = new Maticsoft.BLL.FuWuTypeInfo(); Maticsoft.Model.FuWuTypeInfo model = new Maticsoft.Model.FuWuTypeInfo(); if (TextBox1.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请将填写完整!')</script>"); return; } model.FuwuTypeName = TextBox1.Text.Trim(); bll.Add(model); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>"); TextBox1.Text = string.Empty; }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtFuwuTypeName.Text.Trim().Length == 0) { strErr += "FuwuTypeName不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string FuwuTypeName = this.txtFuwuTypeName.Text; Maticsoft.Model.FuWuTypeInfo model = new Maticsoft.Model.FuWuTypeInfo(); model.FuwuTypeName = FuwuTypeName; Maticsoft.BLL.FuWuTypeInfo bll = new Maticsoft.BLL.FuWuTypeInfo(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }