private void Show() { IList all = Bas_Com.Init().GetAll(null, "order by id asc"); if (all.Count > 0) { Bas_ComInfo bas_ComInfo = all[0] as Bas_ComInfo; this.ViewState["Bas_Com"] = bas_ComInfo; this.TypeID.Value = string.Concat(bas_ComInfo.MsgState); this.et3.Value = string.Concat(bas_ComInfo.et3); this.ComName.Value = bas_ComInfo.ComName; this.Notes.Value = bas_ComInfo.Notes; this.BBSState.Checked = Convert.ToBoolean(bas_ComInfo.BBSState); this.TipsState.Checked = Convert.ToBoolean(bas_ComInfo.TipsState); this.ValidCodeState.Checked = Convert.ToBoolean(bas_ComInfo.ValidCodeState); this.WebUrl.Value = bas_ComInfo.WebUrl; this.Logo.Value = bas_ComInfo.Logo; this.et4.Value = bas_ComInfo.et4; this.nums = 1; this.ViewState["nums"] = this.nums; } }
protected void Save_Btn(object sender, EventArgs e) { this.nums = Convert.ToInt32(this.ViewState["nums"]); if (this.nums == 0) { Bas_ComInfo bas_ComInfo = new Bas_ComInfo(); bas_ComInfo.MsgState = Convert.ToInt32(this.TypeID.Value); bas_ComInfo.et3 = Convert.ToInt32(this.et3.Value); bas_ComInfo.ComName = this.ComName.Value.Replace("#", "").Replace(",", ""); bas_ComInfo.Notes = this.Notes.Value; bas_ComInfo.AddTime = DateTime.Now; bas_ComInfo.BBSState = Convert.ToInt32(this.BBSState.Checked); bas_ComInfo.ValidCodeState = Convert.ToInt32(this.ValidCodeState.Checked); bas_ComInfo.TipsState = Convert.ToInt32(this.TipsState.Checked); bas_ComInfo.WebUrl = "http://" + this.WebUrl.Value.ToLower().Replace("http://", ""); bas_ComInfo.Logo = this.Logo.Value; bas_ComInfo.et4 = this.et4.Value; Bas_Com.Init().Add(bas_ComInfo); Sys_DepInfo sys_DepInfo = new Sys_DepInfo(); sys_DepInfo.DepName = bas_ComInfo.ComName.Replace("#", "").Replace(",", ""); sys_DepInfo.Notes = bas_ComInfo.Notes; sys_DepInfo.ParentID = 0; sys_DepInfo.Orders = 0; sys_DepInfo.ComID = bas_ComInfo.id; sys_DepInfo.ComGUID = bas_ComInfo.guid; Sys_Dep.Init().Add(sys_DepInfo); HttpContext.Current.Application["cominfo"] = bas_ComInfo; try { // this.Sendcom(bas_ComInfo); } catch { } string str = HttpContext.Current.Server.HtmlEncode("您好!企业信息已成功保存!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str); } else { Bas_ComInfo bas_ComInfo = this.ViewState["Bas_Com"] as Bas_ComInfo; bas_ComInfo.MsgState = Convert.ToInt32(this.TypeID.Value); bas_ComInfo.et3 = Convert.ToInt32(this.et3.Value); bas_ComInfo.ComName = this.ComName.Value.Replace("#", "").Replace(",", ""); bas_ComInfo.Notes = this.Notes.Value; bas_ComInfo.BBSState = Convert.ToInt32(this.BBSState.Checked); bas_ComInfo.ValidCodeState = Convert.ToInt32(this.ValidCodeState.Checked); bas_ComInfo.TipsState = Convert.ToInt32(this.TipsState.Checked); bas_ComInfo.WebUrl = "http://" + this.WebUrl.Value.ToLower().Replace("http://", ""); bas_ComInfo.Logo = this.Logo.Value; bas_ComInfo.et4 = this.et4.Value; Bas_Com.Init().Update(bas_ComInfo); HttpContext.Current.Application["cominfo"] = bas_ComInfo; IList all = Sys_Dep.Init().GetAll("ComID=" + bas_ComInfo.id, null); if (all.Count != 0) { Sys_DepInfo sys_DepInfo = all[0] as Sys_DepInfo; sys_DepInfo.DepName = bas_ComInfo.ComName.Replace("#", "").Replace(",", ""); sys_DepInfo.Notes = bas_ComInfo.Notes; sys_DepInfo.ParentID = 0; sys_DepInfo.Orders = 0; sys_DepInfo.ComID = bas_ComInfo.id; sys_DepInfo.ComGUID = bas_ComInfo.guid; Sys_Dep.Init().Update(sys_DepInfo); IList all2 = Sys_User.Init().GetAll("depid=" + sys_DepInfo.id, null); foreach (object current in all2) { Sys_UserInfo sys_UserInfo = current as Sys_UserInfo; sys_UserInfo.DepName = sys_DepInfo.DepName.Replace("#", "").Replace(",", ""); Sys_User.Init().Update(sys_UserInfo); } } try { // this.Sendcom(bas_ComInfo); } catch { } string str = HttpContext.Current.Server.HtmlEncode("您好!企业信息已成功保存!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str); } }