protected void btnSave_Click(object sender, EventArgs e) { if (themesname.Text.Trim() != null && themesname.Text.Trim() != "") { SysThemes model = new SysThemes(); SysThemesDAL dal = new SysThemesDAL(); if (themesvalue.Text.Trim() != null && themesvalue.Text.Trim() != "") { model.Value = themesvalue.Text; } model.Name = themesname.Text; model.ID = Guid.NewGuid().ToString("N").ToUpper(); model.IsState = isstateyes.Checked ? 1 : 0; if (dal.AddSysTemes(model)) { MessageBox.Show(this, "操作成功!"); } else { MessageBox.Show(this, "操作失败!"); } } else { MessageBox.Show(this, "名称不能为空!"); return; } }
protected void Page_Load(object sender, EventArgs e) { if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } SysThemesDAL dal = new SysThemesDAL(); int statein = 0; try { statein = Convert.ToInt32(dal.GetThemesvaluesById("IsState", strID)); } catch (Exception) { statein = 0; } switch (statein) { case 0: statein = 1; break; default: statein = 0; break; } SysThemes model = new SysThemes(); model.ID = strID; model.IsState = statein; switch (strAction) { case "del": if (dal.UpdateSysThemes(model)) { strMessage = "操作成功!"; } else { strMessage = "操作失败!"; } break; default: break; } Response.Write(strMessage); Response.End(); }
public void ShowActivityInfo(string strID) { SysThemesDAL dal = new SysThemesDAL(); DataSet ds = dal.GetSysThemesds(strID); SysThemes model = DataConvert.DataRowToModel <SysThemes>(ds.Tables[0].Rows[0]); themesname.Text = model.Name; themesvalue.Text = model.Value; if (model.IsState == 0) { isstateyes.Checked = true; } else { isstateno.Checked = true; } }
/// <summary> /// 加载数据 /// </summary> /// <param name="strWhere">条件</param> void LoadData(string strWhere) { txtTitle.Text = ""; SysThemesDAL dal = new SysThemesDAL(); DataSet ds = dal.GetSysThemesList(strWhere); DataView dv = ds.Tables[0].DefaultView; AspNetPager1.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; Repeater1.DataSource = pds; Repeater1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(GlobalSession.strAccountID) || string.IsNullOrEmpty(GlobalSession.strRoleCode)) { Response.Write("<script language=JavaScript>;parent.parent.parent.location.href='../Index.aspx';</script>"); Response.End(); } if (!IsPostBack) { #region 初始化界面 //代理商 DAL.SYS.AccountDAL dalAccount = new DAL.SYS.AccountDAL(); DataSet dsAccount = null; switch (GlobalSession.strRoleCode) { case "ADMIN": dsAccount = dalAccount.GetAllAccount(" RoleID = 'AGENT' "); break; case "AGENT": DataRow drAccount = dsAccount.Tables[0].NewRow(); drAccount["ID"] = GlobalSession.strAccountID; drAccount["Name"] = GlobalSession.strName; dsAccount.Tables[0].Rows.InsertAt(drAccount, 0); break; default: break; } this.ddlAgent.DataSource = dsAccount.Tables[0].DefaultView; this.ddlAgent.DataTextField = "Name"; this.ddlAgent.DataValueField = "ID"; this.ddlAgent.DataBind(); //账户状态 DAL.SYS.SYSDictionaryDAL dalState = new DAL.SYS.SYSDictionaryDAL(); DataSet dsState = dalState.GetDictionaryData("ZHZT"); this.ddlState.DataSource = dsState.Tables[0].DefaultView; this.ddlState.DataTextField = "Remark"; this.ddlState.DataValueField = "ID"; this.ddlState.DataBind(); //角色 DAL.SYS.MenuRoleDAL dalRole = new DAL.SYS.MenuRoleDAL(); DataSet dsRole = null; switch (GlobalSession.strRoleCode) { case "ADMIN": dsRole = dalRole.GetRoleList(); break; case "AGENT": DataRow drRole = dsRole.Tables[0].NewRow(); drRole["No"] = "PTKH"; drRole["Name"] = "普通客户"; dsRole.Tables[0].Rows.InsertAt(drRole, 0); break; default: break; } this.ddlRole.DataSource = dsRole.Tables[0].DefaultView; this.ddlRole.DataTextField = "Name"; this.ddlRole.DataValueField = "No"; this.ddlRole.DataBind(); //站点类别 ddlsitecategory.Items.Clear(); SysCategoryDAL sitecategoryDal = new SysCategoryDAL(); DataSet sitecategoryDs = sitecategoryDal.GetNoDelSysCateGoryLsit(""); ddlsitecategory.DataSource = sitecategoryDs.Tables[0].DefaultView; ddlsitecategory.DataTextField = "SiteName"; ddlsitecategory.DataValueField = "Id"; ddlsitecategory.DataBind(); //主题 ddlthemeslist.Items.Clear(); SysThemesDAL themesdal = new SysThemesDAL(); DataSet themesds = themesdal.GetSysThemesListByState(""); this.ddlthemeslist.DataSource = themesds.Tables[0].DefaultView; this.ddlthemeslist.DataTextField = "Name"; this.ddlthemeslist.DataValueField = "value"; this.ddlthemeslist.DataBind(); //设置主题的可见性 if (GlobalSession.strRoleCode == "ADMIN" || GlobalSession.strRoleCode == "AGENT" || GlobalSession.strRoleCode.ToLower() == "admin" || GlobalSession.strRoleCode.ToLower() == "agent") { SummaryTb.Visible = true; } else { SummaryTb.Visible = false; } #endregion if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); ShowAccountInfo(strID); } } }