private void LoadData() { InitCaptchaCode(); Maticsoft.BLL.tSet bll = new Maticsoft.BLL.tSet(); Maticsoft.Model.tSet model = bll.GetModel(1); Window1.Title = model == null ? "" : model.WebName; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Maticsoft.BLL.tSet bll = new Maticsoft.BLL.tSet(); model = bll.GetModel(1); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.tSet model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tSet set "); strSql.Append("WebName=@WebName,"); strSql.Append("Copyright=@Copyright,"); strSql.Append("KeyWords=@KeyWords,"); strSql.Append("Description=@Description,"); strSql.Append("Tel=@Tel,"); strSql.Append("Email=@Email,"); strSql.Append("Address=@Address,"); strSql.Append("BeiAn=@BeiAn,"); strSql.Append("Remark=@Remark,"); strSql.Append("PostCpde=@PostCpde,"); strSql.Append("WeChart=@WeChart"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@WebName", SqlDbType.NVarChar, 150), new SqlParameter("@Copyright", SqlDbType.NVarChar, 150), new SqlParameter("@KeyWords", SqlDbType.NVarChar, 150), new SqlParameter("@Description", SqlDbType.NVarChar, 550), new SqlParameter("@Tel", SqlDbType.NVarChar, 150), new SqlParameter("@Email", SqlDbType.NVarChar, 350), new SqlParameter("@Address", SqlDbType.NVarChar, 350), new SqlParameter("@BeiAn", SqlDbType.NVarChar, 350), new SqlParameter("@Remark", SqlDbType.NVarChar, 350), new SqlParameter("@PostCpde", SqlDbType.NVarChar, 350), new SqlParameter("@WeChart", SqlDbType.NVarChar, 350), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.WebName; parameters[1].Value = model.Copyright; parameters[2].Value = model.KeyWords; parameters[3].Value = model.Description; parameters[4].Value = model.Tel; parameters[5].Value = model.Email; parameters[6].Value = model.Address; parameters[7].Value = model.BeiAn; parameters[8].Value = model.Remark; parameters[9].Value = model.PostCpde; parameters[10].Value = model.WeChart; parameters[11].Value = model.Id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.tSet DataRowToModel(DataRow row) { Maticsoft.Model.tSet model = new Maticsoft.Model.tSet(); if (row != null) { if (row["Id"] != null && row["Id"].ToString() != "") { model.Id = int.Parse(row["Id"].ToString()); } if (row["WebName"] != null) { model.WebName = row["WebName"].ToString(); } if (row["Copyright"] != null) { model.Copyright = row["Copyright"].ToString(); } if (row["KeyWords"] != null) { model.KeyWords = row["KeyWords"].ToString(); } if (row["Description"] != null) { model.Description = row["Description"].ToString(); } if (row["Tel"] != null) { model.Tel = row["Tel"].ToString(); } if (row["Email"] != null) { model.Email = row["Email"].ToString(); } if (row["Address"] != null) { model.Address = row["Address"].ToString(); } if (row["BeiAn"] != null) { model.BeiAn = row["BeiAn"].ToString(); } if (row["Remark"] != null) { model.Remark = row["Remark"].ToString(); } if (row["PostCpde"] != null) { model.PostCpde = row["PostCpde"].ToString(); } if (row["WeChart"] != null) { model.WeChart = row["WeChart"].ToString(); } } return(model); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadData(); Maticsoft.Model.tUsers user = GetIdentityUser(); btnUserName.Text = user.usersName; btnUserName.ToolTip = dptbll.GetModel(user.dptId).dptName; Maticsoft.BLL.tSet bll = new Maticsoft.BLL.tSet(); model = bll.GetModel(1); GetTask(user.dptId); } }
protected void btnSave_Click(object sender, EventArgs e) { Maticsoft.BLL.tSet bll = new Maticsoft.BLL.tSet(); Maticsoft.Model.tSet model = bll.GetModel(1); if (model == null) { Maticsoft.Model.tSet newm = new Maticsoft.Model.tSet(); newm.Address = Address.Text; newm.BeiAn = BeiAn.Text; newm.Copyright = Copyright.Text; newm.Description = Description.Text; newm.Email = Email.Text; newm.KeyWords = KeyWords.Text; newm.Tel = Tel.Text; newm.WebName = WebName.Text; model.PostCpde = YouBian.Text; model.WeChart = WeiXin.Text; if (bll.Add(newm) > 0) { Alert.ShowInTop("保存成功!"); } else { Alert.ShowInTop("保存失败!"); } } else { model.Address = Address.Text; model.BeiAn = BeiAn.Text; model.Copyright = Copyright.Text; model.Description = Description.Text; model.Email = Email.Text; model.KeyWords = KeyWords.Text; model.Tel = Tel.Text; model.WebName = WebName.Text; model.PostCpde = YouBian.Text; model.WeChart = WeiXin.Text; if (bll.Update(model)) { Alert.ShowInTop("保存成功!"); } else { Alert.ShowInTop("保存失败!"); } } }
public void SetWebHeader(Page page) { Maticsoft.BLL.tSet bll = new Maticsoft.BLL.tSet(); Maticsoft.Model.tSet model = bll.GetModel(1); HtmlMeta keywords = new HtmlMeta(); keywords.Name = "keywords"; keywords.Content = model.KeyWords; page.Header.Controls.Add(keywords); HtmlMeta description = new HtmlMeta(); description.Name = "description"; description.Content = model.Description; page.Header.Controls.Add(description); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadData(); Maticsoft.Model.tUsers user = GetIdentityUser(); btnUserName.Text = user.usersName; Maticsoft.BLL.tSet bll = new Maticsoft.BLL.tSet(); model = bll.GetModel(1); Maticsoft.BLL.S_Onlines bllOn = new Maticsoft.BLL.S_Onlines(); Maticsoft.Model.S_Onlines online = bllOn.GetModelByUseId(user.userId); CreateNotify("您上次登陆时间是:" + online.UpdateTime, "Self", "登录提示", 0, false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Maticsoft.BLL.tSet bll = new Maticsoft.BLL.tSet(); model = bll.GetModel(1); HtmlMeta keywords = new HtmlMeta(); keywords.Name = "keywords"; keywords.Content = model.KeyWords; this.Page.Header.Controls.Add(keywords); HtmlMeta description = new HtmlMeta(); description.Name = "description"; description.Content = model.Description; this.Page.Header.Controls.Add(description); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Maticsoft.Model.tSet model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tSet("); strSql.Append("WebName,Copyright,KeyWords,Description,Tel,Email,Address,BeiAn,Remark,PostCpde,WeChart)"); strSql.Append(" values ("); strSql.Append("@WebName,@Copyright,@KeyWords,@Description,@Tel,@Email,@Address,@BeiAn,@Remark,@PostCpde,@WeChart)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@WebName", SqlDbType.NVarChar, 150), new SqlParameter("@Copyright", SqlDbType.NVarChar, 150), new SqlParameter("@KeyWords", SqlDbType.NVarChar, 150), new SqlParameter("@Description", SqlDbType.NVarChar, 550), new SqlParameter("@Tel", SqlDbType.NVarChar, 150), new SqlParameter("@Email", SqlDbType.NVarChar, 350), new SqlParameter("@Address", SqlDbType.NVarChar, 350), new SqlParameter("@BeiAn", SqlDbType.NVarChar, 350), new SqlParameter("@Remark", SqlDbType.NVarChar, 350), new SqlParameter("@PostCpde", SqlDbType.NVarChar, 350), new SqlParameter("@WeChart", SqlDbType.NVarChar, 350) }; parameters[0].Value = model.WebName; parameters[1].Value = model.Copyright; parameters[2].Value = model.KeyWords; parameters[3].Value = model.Description; parameters[4].Value = model.Tel; parameters[5].Value = model.Email; parameters[6].Value = model.Address; parameters[7].Value = model.BeiAn; parameters[8].Value = model.Remark; parameters[9].Value = model.PostCpde; parameters[10].Value = model.WeChart; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Maticsoft.BLL.tSet bll = new Maticsoft.BLL.tSet(); Maticsoft.Model.tSet model = bll.GetModel(1); if (model != null) { Address.Text = model.Address; BeiAn.Text = model.BeiAn; Copyright.Text = model.Copyright; Description.Text = model.Description; Email.Text = model.Email; KeyWords.Text = model.KeyWords; Tel.Text = model.Tel; WebName.Text = model.WebName; } } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.tSet GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Id,WebName,Copyright,KeyWords,Description,Tel,Email,Address,BeiAn,Remark,PostCpde,WeChart from tSet "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; Maticsoft.Model.tSet model = new Maticsoft.Model.tSet(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }