//保存修改 protected void imgbtnsave_Click(object sender, ImageClickEventArgs e) { int id = int.Parse(this.hidval.Value); EtNet_Models.InitializeUserSet model = EtNet_BLL.InitializeUserSetManager.GetModel(id); if (this.chkdata.Checked) { model.pagecount = int.Parse(this.iptpagecount.Value); model.pageitem = int.Parse(this.iptpageitem.Value); ModifyDataList(model.siftopen, model.pagecount, model.pageitem); } if (this.chkinformation.Checked) { model.newinforemind = int.Parse(this.ddlnewinforemind.SelectedValue); model.infocycle = int.Parse(this.iptinfocycle.Value); } if (this.chkpanel.Checked) { model.panelcount = this.iptpanelcount.Value; //model.panelcols = int.Parse(this.ddlpanelcols.SelectedValue); } if (EtNet_BLL.InitializeUserSetManager.Update(model)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "modify", "<script>alert('保存成功!')</script>", false); } }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(EtNet_Models.InitializeUserSet model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into InitializeUserSet("); strSql.Append("cname,siftopen,pagecount,pageitem,inforemind,newinforemind,infocycle,createtime,panellistall,panellist,panelcount,panelcols,createrid)"); strSql.Append(" values ("); strSql.Append("@cname,@siftopen,@pagecount,@pageitem,@inforemind,@newinforemind,@infocycle,@createtime,@panellistall,@panellist,@panelcount,@panelcols,@createrid)"); strSql.Append(";select SCOPE_IDENTITY() "); SqlParameter[] parameters = { new SqlParameter("@cname", SqlDbType.VarChar, 50), new SqlParameter("@siftopen", SqlDbType.Int, 4), new SqlParameter("@pagecount", SqlDbType.Int, 4), new SqlParameter("@pageitem", SqlDbType.Int, 4), new SqlParameter("@inforemind", SqlDbType.Int, 4), new SqlParameter("@newinforemind", SqlDbType.Int, 4), new SqlParameter("@infocycle", SqlDbType.Int, 4), new SqlParameter("@createtime", SqlDbType.DateTime), new SqlParameter("@panellistall", SqlDbType.VarChar, 100), new SqlParameter("@panellist", SqlDbType.VarChar, 100), new SqlParameter("@panelcount", SqlDbType.VarChar, 100), new SqlParameter("@panelcols", SqlDbType.Int, 4), new SqlParameter("@createrid", SqlDbType.Int, 4) }; parameters[0].Value = model.cname; parameters[1].Value = model.siftopen; parameters[2].Value = model.pagecount; parameters[3].Value = model.pageitem; parameters[4].Value = model.inforemind; parameters[5].Value = model.newinforemind; parameters[6].Value = model.infocycle; parameters[7].Value = model.createtime; parameters[8].Value = model.panellistall; parameters[9].Value = model.panellist; parameters[10].Value = model.panelcount; parameters[11].Value = model.panelcols; parameters[12].Value = model.createrid; int result = 0; SqlDataReader rad = EtNet_DAL.DBHelper.ExecuteReader(strSql.ToString(), parameters); if (rad.Read()) { result = Convert.ToInt32(rad[0]); rad.Close(); } return(result); }
/// <summary> /// 修改用户参数设置 /// </summary> private void ResetUserSet() { SaveInitializeSet(); //保存参数设置 int id = int.Parse(this.hidval.Value); EtNet_Models.InitializeSet model = EtNet_BLL.InitializeSetManager.GetModel(id); string[] list = null; //用户的id值列表 if (this.hiduserlist.Value.IndexOf(',') != -1) { list = this.hiduserlist.Value.Split(','); } else { list = new string[1] { this.hiduserlist.Value }; } int founderid = 0; //用户的id值 for (int i = 0; i < list.Length; i++) { founderid = int.Parse(list[i]); string strdel = " createrid=" + founderid; EtNet_BLL.InitializeUserSetManager.Del(strdel); //删除用户参数设置 EtNet_Models.InitializeUserSet user = new EtNet_Models.InitializeUserSet(); user.cname = model.cname; user.createrid = founderid; user.createtime = DateTime.Now; user.infocycle = model.infocycle; user.inforemind = model.inforemind; user.newinforemind = model.newinforemind; user.pagecount = model.pagecount; user.pageitem = model.pageitem; user.panelcols = model.panelcols; user.panelcount = model.panelcount; user.panellist = model.panellist; user.panellistall = model.panellistall; user.siftopen = model.siftopen; EtNet_BLL.InitializeUserSetManager.Add(user); ModifyDataList(founderid, model.siftopen, model.pagecount, model.pageitem); ModifyPanelMenuRecord(founderid, model.panelcols); ModifyPanelItem(founderid, model.panellist); } }
/// <summary> /// 创建用户的初始化参数 /// </summary> /// <param name="ownersid">用户的id值</param> private void CreateInitializeData(int ownersid) { DataTable tbl = EtNet_BLL.InitializeSetManager.GetList(1, "", "id"); if (tbl.Rows.Count == 1) { string strpagenum = "001,002,003,004,008,011,013,014,019,020,021,022,024,025,030,"; strpagenum += "100,101,102,105,111,140,201"; string[] list = strpagenum.Split(','); EtNet_Models.SearchPageSet model = null; for (int i = 0; i < list.Length; i++) { model = new EtNet_Models.SearchPageSet(); model.Ownersid = ownersid; model.Pagenum = list[i]; model.Pagecount = int.Parse(tbl.Rows[0]["pagecount"].ToString()); model.Pageitem = int.Parse(tbl.Rows[0]["pageitem"].ToString()); EtNet_BLL.SearchPageSetManager.addSearchPageSet(model); } EtNet_Models.InitializeUserSet usermodel = new EtNet_Models.InitializeUserSet(); usermodel.cname = tbl.Rows[0]["cname"].ToString(); usermodel.createtime = DateTime.Now; usermodel.infocycle = int.Parse(tbl.Rows[0]["infocycle"].ToString()); usermodel.inforemind = int.Parse(tbl.Rows[0]["inforemind"].ToString()); usermodel.newinforemind = int.Parse(tbl.Rows[0]["newinforemind"].ToString()); usermodel.pagecount = int.Parse(tbl.Rows[0]["pagecount"].ToString()); usermodel.pageitem = int.Parse(tbl.Rows[0]["pageitem"].ToString()); usermodel.panelcols = int.Parse(tbl.Rows[0]["panelcols"].ToString()); usermodel.panelcount = tbl.Rows[0]["panelcount"].ToString(); usermodel.panellist = tbl.Rows[0]["panellist"].ToString(); usermodel.panellistall = tbl.Rows[0]["panellistall"].ToString(); usermodel.createrid = ownersid; EtNet_BLL.InitializeUserSetManager.Add(usermodel); PanelMenuRecord(ownersid, usermodel.panelcols); FirstPanelItem(ownersid, usermodel.panellist); } }
/// <summary> /// 得到一个对象实体 /// </summary> public static EtNet_Models.InitializeUserSet GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from InitializeUserSet "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; EtNet_Models.InitializeUserSet model = new EtNet_Models.InitializeUserSet(); DataTable tbl = EtNet_DAL.DBHelper.GetDataSet(strSql.ToString(), parameters); if (tbl.Rows.Count > 0) { model.id = int.Parse(tbl.Rows[0]["id"].ToString()); model.cname = tbl.Rows[0]["cname"].ToString(); model.siftopen = int.Parse(tbl.Rows[0]["siftopen"].ToString()); model.pagecount = int.Parse(tbl.Rows[0]["pagecount"].ToString()); model.pageitem = int.Parse(tbl.Rows[0]["pageitem"].ToString()); model.inforemind = int.Parse(tbl.Rows[0]["inforemind"].ToString()); model.newinforemind = int.Parse(tbl.Rows[0]["newinforemind"].ToString()); model.infocycle = int.Parse(tbl.Rows[0]["infocycle"].ToString()); model.createtime = DateTime.Parse(tbl.Rows[0]["createtime"].ToString()); model.panellistall = tbl.Rows[0]["panellistall"].ToString(); model.panellist = tbl.Rows[0]["panellist"].ToString(); model.panelcount = tbl.Rows[0]["panelcount"].ToString(); model.panelcols = int.Parse(tbl.Rows[0]["panelcols"].ToString()); model.createrid = int.Parse(tbl.Rows[0]["createrid"].ToString()); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(EtNet_Models.InitializeUserSet model) { return(EtNet_DAL.InitializeUserSetService.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(EtNet_Models.InitializeUserSet model) { return(EtNet_DAL.InitializeUserSetService.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(EtNet_Models.InitializeUserSet model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update InitializeUserSet set "); strSql.Append("cname=@cname,"); strSql.Append("siftopen=@siftopen,"); strSql.Append("pagecount=@pagecount,"); strSql.Append("pageitem=@pageitem,"); strSql.Append("inforemind=@inforemind,"); strSql.Append("newinforemind=@newinforemind,"); strSql.Append("infocycle=@infocycle,"); strSql.Append("createtime=@createtime,"); strSql.Append("panellistall=@panellistall,"); strSql.Append("panellist=@panellist,"); strSql.Append("panelcount=@panelcount,"); strSql.Append("panelcols=@panelcols,"); strSql.Append("createrid=@createrid"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@cname", SqlDbType.VarChar, 50), new SqlParameter("@siftopen", SqlDbType.Int, 4), new SqlParameter("@pagecount", SqlDbType.Int, 4), new SqlParameter("@pageitem", SqlDbType.Int, 4), new SqlParameter("@inforemind", SqlDbType.Int, 4), new SqlParameter("@newinforemind", SqlDbType.Int, 4), new SqlParameter("@infocycle", SqlDbType.Int, 4), new SqlParameter("@createtime", SqlDbType.DateTime), new SqlParameter("@panellistall", SqlDbType.VarChar, 100), new SqlParameter("@panellist", SqlDbType.VarChar, 100), new SqlParameter("@panelcount", SqlDbType.VarChar, 100), new SqlParameter("@panelcols", SqlDbType.Int, 4), new SqlParameter("@createrid", SqlDbType.Int, 4), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.cname; parameters[1].Value = model.siftopen; parameters[2].Value = model.pagecount; parameters[3].Value = model.pageitem; parameters[4].Value = model.inforemind; parameters[5].Value = model.newinforemind; parameters[6].Value = model.infocycle; parameters[7].Value = model.createtime; parameters[8].Value = model.panellistall; parameters[9].Value = model.panellist; parameters[10].Value = model.panelcount; parameters[11].Value = model.panelcols; parameters[12].Value = model.createrid; parameters[13].Value = model.id; int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }