public static bool IsLogin() { T_Admin model = new T_Admin(); AdminBll bll = new AdminBll(); CookieHelper mycookie = new CookieHelper(); string token = mycookie.getCookie("caketoken"); bool res = false; if (!string.IsNullOrEmpty(token)) { model = bll.GetAdminByToken(token); if (model == null) { // return "没有权限,非法访问!"; res = false; } else { res = true; } } else { res = false; // return "未登陆,非法访问!"; // Response.End(); } return(res); }
protected void Page_Load(object sender, EventArgs e) { int userid = BasePage.GetRequestId(Cookies.GetCookie("User_Id")); if (userid == 1 || userid == 2) { if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<span class=\"home\">管理员管理</span><a href=\"AdminAdd.aspx\" class=\"add\">添加管理员</a>"; string checklogin = new AdminBll().CheckLogin("no"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } string strwhere = ""; if (Cookies.GetCookie("User_Id") == "2")//屏蔽超级管理 { strwhere = "id>1"; } DataSet ds = new DataSet(); //ds = new AdminBll().GetList(strwhere); ds = new CommonBll().GetList("", "gl_admin", strwhere, "LastLoginTime desc"); Repeater1.DataSource = ds; Repeater1.DataBind(); } } else { //BasePage.Alertback("您还没登录或没有管理此内容权限!"); //Response.End(); //其它管理员直接跳到修改页面 Response.Redirect("AdminAdd.aspx?id=" + userid); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<span class=\"home\">数据库字段替换</span>"; string checklogin = new AdminBll().CheckLogin("10"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } string[] ss = DbHelperSQL.connectionString.Split(';')[1].Split('='); DataSet ds = TabelName(ss[1]); ddlTable.DataSource = ds; ddlTable.DataTextField = "Name"; ddlTable.DataValueField = "Name"; ddlTable.DataBind(); ddlTable.Items.Insert(0, new ListItem("请选择表名", "")); ddlTable.SelectedValue = Request.QueryString["tablename"]; if (!String.IsNullOrEmpty(Request.QueryString["tablename"])) { DataSet ds2 = tableColumns(Request.QueryString["tablename"]); ddltableColumns.DataSource = ds2; ddltableColumns.DataTextField = "Name"; ddltableColumns.DataValueField = "Name"; ddltableColumns.DataBind(); ddltableColumns.Items.Insert(0, new ListItem("请选择字段", "")); // DropDownList2.SelectedValue = Request.QueryString["tableColumns"]; } HiddenField1.Value = DbHelperSQL.connectionString.ToString(); } }
protected void Button1_Click(object sender, EventArgs e) { string UserName = txtUserName.Text.Trim(); string PassWord = txtPassWord.Text.Trim(); if (UserName == "" || PassWord == "") { BasePage.Alertback(Page, "请输入用户名和密码"); return; } PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(PassWord + "fan<>?", "MD5"); bool b = new AdminBll().ExistName(UserName, PassWord); if (b) { string LastLoginIP = BasePage.GetClientIP(); string LastLoginTime = DateTime.Now.ToString(); Cookies.SaveCookie("User_Name", UserName, 0); AdminBll ad = new AdminBll(); ad.UpdateLogin(LastLoginIP, UserName); AdminModel model = ad.Getid(UserName); Cookies.SaveCookie("ModelPower", model.ModelPower.ToString(), 0); Cookies.SaveCookie("LoginTime", model.LoginTime.ToString(), 0); Cookies.SaveCookie("User_Id", model.id.ToString(), 0); string MD5UserName = FormsAuthentication.HashPasswordForStoringInConfigFile(model.id.ToString() + UserName + "Cookies?", "MD5"); Cookies.SaveCookie("MD5Name", MD5UserName, 0); Response.Redirect("default.aspx"); } else { BasePage.AlertAndRedirect(Page, "用户名或密码错误!", "Login.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { id = BasePage.GetRequestId(Request.QueryString["id"]); if (!Page.IsPostBack) { string btxt = "<a href=\"block.aspx\" class=\"home\">方块碎片</a>"; if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "23")) { btxt += "<a href=\"block.aspx?Ac=add\" class=\"add\">添加方块碎片</a>"; } ((Literal)Master.FindControl("breadcrumbs")).Text = btxt; string checklogin = new AdminBll().CheckLogin("17"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } if (!String.IsNullOrEmpty(Request.QueryString["Ac"])) { action = Request.QueryString["Ac"]; } else { action = "show"; } //txtModelName.ReadOnly = true; if (id != 0) { BlockModel model = new BlockBll().GetModel(id); txtPageName.Text = model.Title; txtPageName.Enabled = false; txtcontents.Text = model.Contents; Button1.Text = "确认修改"; } else { string strwhere = ""; DataSet ds = new DataSet(); int PageSize = 25; int PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页 ds = new CommonBll().GetListPage("", datatable, strwhere, "id desc", PageSize, PageIndex); Repeater1.DataSource = ds; Repeater1.DataBind(); int totalrecord = new CommonBll().GetRecordCount(datatable, strwhere);//总记录数 if (totalrecord == 0) { txtpage.Text = "<p align=\"center\" class=\"red\">暂无相关数据</p>"; } else if (totalrecord > PageSize) { txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<a class=\"home\" href=\"UserGroup.aspx\">会员组管理</a><a class=\"add\" href=\"?action=Add\">添加新组</a>"; string checklogin = new AdminBll().CheckLogin("14"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } if (!String.IsNullOrEmpty(Request.QueryString["action"])) { action = Request.QueryString["action"]; } else { action = "show"; } id = BasePage.GetRequestId(Request.QueryString["id"]); if (!String.IsNullOrEmpty(Request.QueryString["id"])) { UserGroupModel model = new UserGroupBll().GetModel(id); bool b = new CommonBll().Exists(datatable, id); if (b) { Literal1.Text = "修改会员组"; Button3.Text = "确认修改"; txtGroupName.Text = model.GroupName; txtShowOnReg.Text = model.ShowOnReg.ToString(); txtDescript.Text = model.Descript; SetChecked(this.PowerList, model.PowerList, ","); } } else { DataSet ds = new DataSet(); int PageSize = 25; int PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页 ds = new CommonBll().GetListPage("", datatable, "", "id desc", PageSize, PageIndex); Repeater1.DataSource = ds; Repeater1.DataBind(); int totalrecord = new CommonBll().GetRecordCount(datatable, "");//总记录数 if (totalrecord == 0) { txtpage.Text = "<p align=\"center\">无相关信息</p>"; } else if (totalrecord > PageSize) { txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex); } } } }
public string Del(Admin model) { var rst = new ReturnResult <bool>(); var bll = new AdminBll(); rst = bll.Delete(model); return(JsonHelper.Instance.Serialize(rst)); }
public string Login(Admin model) { var rst = new ReturnResult <Admin>(); var bll = new AdminBll(); rst = bll.Login(model); return(JsonHelper.Instance.Serialize(rst)); }
public string GetList(Admin model) { var rst = new ReturnResult <List <Admin> >(); var bll = new AdminBll(); rst = bll.GetList(model); return(JsonHelper.Instance.Serialize(rst)); }
protected void Page_Load(object sender, EventArgs e) { string checklogin = new AdminBll().CheckLogin("2"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"Seoall.aspx\" class=\"home\">SEO批量设置</a><a class=\"add\" href=\"?action=class\">栏目批量设置</a><a href=\"?action=diypage\" class=\"add\">单页批量设置</a>"; DataSet ds = new DataSet(); int PageSize = 20; int PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页 string ac = Request.QueryString["action"]; if (ac == "class") { string strwhere = "ClassType=0"; ds = new CommonBll().GetListPage("", "GL_Class", strwhere, "ModelId asc,px desc,id desc", PageSize, PageIndex); Repeater1.DataSource = ds; Repeater1.DataBind(); int totalrecord = new CommonBll().GetRecordCount("GL_Class", strwhere);//总记录数 txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex); if (totalrecord > PageSize) { txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex); } else { txtpage.Text = ""; } } if (Request.QueryString["action"] == "diypage") { string strwhere = "PageType=0"; ds = new CommonBll().GetListPage("", "GL_DIYPage", strwhere, "id desc", PageSize, PageIndex); Repeater2.DataSource = ds; Repeater2.DataBind(); int totalrecord = new CommonBll().GetRecordCount("GL_DIYPage", strwhere);//总记录数 txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex); if (totalrecord > PageSize) { txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex); } else { txtpage.Text = ""; } } } }
public string GetUserInfo(string token) { var rst = new ReturnResult <Admin>(); var bll = new AdminBll(); rst = bll.GetOne(new Admin() { Token = token }); return(JsonHelper.Instance.Serialize(rst)); }
public string Logout(string token) { var rst = new ReturnResult <bool>(); var bll = new AdminBll(); rst = bll.Delete(new Admin() { Token = token }); return(JsonHelper.Instance.Serialize(rst)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string checklogin = new AdminBll().CheckLogin("no"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } ((Literal)Master.FindControl("breadcrumbs")).Text = Cookies.GetCookie("User_Name") + " 您好!欢迎使用" + new CommonBll().GetTitle("GL_WebConfig", "SiteName", 1) + "网站管理后台。"; } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (txtpwd.Text == "") { MessageBox.Alert("原密码不能为空!", Page); txtpwd.Focus(); } else if (txtNewPwd.Text == "") { MessageBox.Alert("请输入新密码!", Page); txtNewPwd.Focus(); } else if (txtNewPwd.Text.Trim() != txtPwd1.Text.Trim()) { MessageBox.Alert("新密码不一致!", Page); txtNewPwd.Focus(); } else if (txtNewPwd.Text.Length < 6) { MessageBox.Alert("密码长度不能小于6个字符!", Page); txtNewPwd.Focus(); } else { int adminId = Convert.ToInt32(Session["AdminId"]); string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtpwd.Text.Trim(), "md5"); string newPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtNewPwd.Text.Trim(), "md5"); List <Model.Admin> list = AdminBll.GetAdmin(adminId); if (list.Count > 0) { if (pwd != list[0].Password) { MessageBox.Alert("原密码错误!", Page); txtpwd.Focus(); } else { try { AdminBll.UpdatePwd(adminId, newPwd); MessageBox.Alert("修改成功!", Page); } catch (Exception) { MessageBox.Alert("修改失败!", Page); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"model.aspx\" class=\"home\">模型管理</a><a href=\"ModelAdd.aspx\" class=\"add\">添加新模型</a>"; string checklogin = new AdminBll().CheckLogin("1"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } DataSet ds = new DataSet(); ds = new CommonBll().GetList("", "GL_Model", "", "id asc"); Repeater1.DataSource = ds; Repeater1.DataBind(); } }
public string Add(Admin model) { var rst = new ReturnResult <bool>(); var bll = new AdminBll(); if (model.Id == 0) { model.CreateTime = DateTime.Now; rst = bll.Add(model); } else { rst = bll.Update(model); } return(JsonHelper.Instance.Serialize(rst)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<a class=\"home\" href=\"error.aspx\">运行错误记录</a>"; string checklogin = new AdminBll().CheckLogin("20"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } string t = GreateFiles.Read_File(Server.MapPath("~/error.txt")); if (!String.IsNullOrEmpty(t)) { txtcon.Text = t.Replace("\r", "<br/>"); } } }
private void Login(HttpContext context) { T_Admin model = new T_Admin(); AdminBll bll = new AdminBll(); string username = context.Request["username"]; string pwd = context.Request["pwd"]; if (bll.GetAdminModeByName(username, pwd)) { CookieHelper mycookie = new CookieHelper(); mycookie.setCookie("caketoken", username + pwd, 1); context.Response.Write("true"); } else { context.Response.Write("false"); } }
protected void Page_Load(object sender, EventArgs e) { ac = Request.QueryString["ac"]; id = BasePage.GetRequestId(Request.QueryString["id"]); if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"searchkey.aspx\" class=\"home\">搜索关键词</a>"; string checklogin = new AdminBll().CheckLogin("no"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } if (id != 0) { SearchModel s = new SearchBll().GetModel(id); txtkey.Text = s.keyword; txtnum.Text = s.num.ToString(); txtpx.Text = s.px.ToString(); } else { int PageSize = 30; int PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); string strwhere = ""; int all = new CommonBll().GetRecordCount(datatable, strwhere); if (all > 0) { Repeater1.DataSource = new CommonBll().GetListPage("", datatable, strwhere, "px desc,num desc", PageSize, PageIndex); Repeater1.DataBind(); if (all > PageSize) { fy.InnerHtml = GetPage.GetAspxPager(all, PageSize, PageIndex); } } } } }
protected void btnLogin_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPwd.Text.Trim(), "md5"); string checkCode = txtCodeImage.Text.Trim(); if (userName == "") { MessageBox.Alert("用户名不能为空!", Page); txtUserName.Focus(); } else if (pwd == "") { MessageBox.Alert("密码不能为空!", Page); txtPwd.Focus(); } else if (checkCode.ToLower() != Session["CheckCode"].ToString().ToLower()) { MessageBox.Alert("验证码错误!", Page); txtCodeImage.Text = ""; txtCodeImage.Focus(); } else { List <Model.Admin> list = AdminBll.AdminLogin(userName, pwd); if (list.Count > 0) { Session["AdminName"] = userName; Session["AdminId"] = list[0].AdminId; Session["Admin"] = list[0]; Response.Redirect("Main.aspx"); } else { MessageBox.Alert("用户名或密码错误!", Page); } } }
protected void Button1_Click(object sender, EventArgs e) { T_Admin admin = new T_Admin(); AdminBll bll = new AdminBll(); string username = this.txtuser.Value; string pwd = this.txtpwd.Value; string realname = this.txtreal.Value; admin.CreateDate = DateTime.Now; admin.UserName = username; admin.Pwd = pwd; admin.RealName = realname; admin.admintoken = MD5Helper.MD5JM(username + pwd); if (bll.AddAdmin(admin)) { this.msg.InnerText = "添加成功!"; } else { this.msg.InnerText = "添加失败!"; } }
protected void Page_Load(object sender, EventArgs e) { userid = BasePage.GetRequestId(Cookies.GetCookie("User_Id").ToString()); if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"AdminAdd.aspx\" class=\"home\">添加管理员</a>"; string checklogin = new AdminBll().CheckLogin("no"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } txtadmin1.Visible = false;//模型权限勾选,只允许两个用户可设置 txtadmin.Visible = false; if (userid == 1) { txtadmin.Visible = true;//设置其它管理员默认权限 txtadmin1.Visible = true; } else if (userid == 2) { txtadmin1.Visible = true; } int id = BasePage.GetRequestId(Request.QueryString["id"]); ActionName.Text = "添加网站管理员"; //动态模型,其它管理员不显示这个 if (userid == 1) { DataSet ds = new DataSet(); ds = new CommonBll().GetList("", "GL_Model", "ModelLock=0", "id asc"); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { ListItem ListItem1 = new ListItem(dr["ModelName"].ToString() + "内容管理", "m" + dr["id"].ToString()); string[] a = dr["ModeContent"].ToString().Split('`'); if (a[5] == "1")//需要审核时显示 { ListItem ListItem2 = new ListItem(dr["ModelName"].ToString() + "发表审核", "ms" + dr["id"].ToString()); txtModelPower.Items.Add(ListItem2); } ListItem ListItem3 = new ListItem(dr["ModelName"].ToString() + "内容删除", "md" + dr["id"].ToString()); ListItem ListItem4 = new ListItem(dr["ModelName"].ToString() + "栏目添加", "ca" + dr["id"].ToString()); ListItem ListItem5 = new ListItem(dr["ModelName"].ToString() + "栏目编辑", "ce" + dr["id"].ToString()); ListItem ListItem6 = new ListItem(dr["ModelName"].ToString() + "栏目删除", "cd" + dr["id"].ToString()); ListItem ListItem7 = new ListItem(dr["ModelName"].ToString() + "字段管理", "z" + dr["id"].ToString()); txtModelPower.Items.Add(ListItem1); txtModelPower.Items.Add(ListItem3); txtModelPower.Items.Add(ListItem4); txtModelPower.Items.Add(ListItem5); txtModelPower.Items.Add(ListItem6); txtModelPower.Items.Add(ListItem7); } } } if (id != 0)//编辑 { if (userid == 2)//二管理员 { string adminpur = new CommonBll().GetTitle("GL_Webconfig", "adminpur", 1); if (!String.IsNullOrEmpty(adminpur)) { string[] ap = adminpur.Split('|'); for (int i = 0; i < ap.Length; i++) { string[] ap2 = ap[i].Split(','); ListItem ListItem1 = new ListItem(ap2[0], ap2[1]); txtModelPower2.Items.Add(ListItem1); } } } AdminModel model = new AdminBll().GetModel(id); txtUserName.Text = model.UserName; txtEmail.Text = model.Email; txtPassWordOld.Value = model.PassWord; txtTTelPhone.Text = model.TelPhone; if (model.Sex == 0) { TxtSex.Checked = true; } else { TxtSex1.Checked = true; } if (model.Locked == 1) { txtLocked.Checked = true; } if (Request.QueryString["id"] == "1") { txtLocked.Enabled = false;//管理员时锁定 } if (userid == 1) { SetChecked(this.txtModelPower, model.ModelPower, ","); } else if (userid == 2) { SetChecked(this.txtModelPower2, model.ModelPower, ","); } Literal1.Text = " 不修改密码请留空!"; ActionName.Text = "修改" + txtUserName.Text + "资料"; string other = ""; other += "<tr><td class=\"align-right\">添加时间:</td><td class=\"align-left\">" +BasePage.formatDateTime(model.AddDate.ToString()) + "</td></tr>"; other += "<tr><td class=\"align-right\">登录次数:</td><td class=\"align-left\">" + model.LoginTime + "</td></tr>"; other += "<tr><td class=\"align-right\">最后登录:</td><td class=\"align-left\">" + BasePage.formatDateTime(model.LastLoginTime.ToString()) + "</td></tr>"; other += "<tr><td class=\"align-right\">最后登录IP:</td><td class=\"align-left\">" + model.LastLoginIP + "</td></tr>"; Literal2.Text = other; Button1.Text = "确认修改"; HiddenFieldmp.Value = model.ModelPower; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string txtAction = ""; string checklogin = new AdminBll().CheckLogin("1"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } int id = BasePage.GetRequestId(Request.QueryString["id"]); string type = Request.QueryString["type"]; DrModelType.SelectedValue = type; if (type == "1") { modeltype = true;//产品模型 } if (id != 0) { txtAction = "修改模型信息"; txtAction2.Text = "修改模型信息"; Button1.Text = "确认修改"; ModelModel model = new ModelBll().GetModel(id); txtModelName.Text = model.ModelName; txtModelTable.Text = model.ModelTable; txtModelTable.Enabled = false; txtItemName.Text = model.ItemName; txtItemUnit.Text = model.ItemUnit; RaModelLock.SelectedValue = model.ModelLock.ToString(); DrModelType.SelectedValue = model.ModelType.ToString(); txtclassnum.Text = model.ModelClassLayer.ToString(); if (model.ModelType == 1)//0文章1产品 { modeltype = true; } DrModelType.Enabled = false; if (!String.IsNullOrEmpty(model.ModeContent)) { //0模型内容可选字段`1模型栏目可选字段`2内容字段名称`3模型列表可选字段`4提示语`5发表审核选择 string[] aa = model.ModeContent.Split('`'); string[] tips = aa[4].Split('|'); txt0.Text = tips[0]; txt1.Text = tips[1]; txt2.Text = tips[2]; txt3.Text = tips[3]; txt4.Text = tips[4]; txt5.Text = tips[5]; txt6.Text = tips[6]; txt7.Text = tips[7]; txt8.Text = tips[8]; txt9.Text = tips[9]; txt10.Text = tips[10]; if (!modeltype) //文章模型 { SetCheckedBox.SetChecked(this.txtModeContent, aa[0], ","); //模型内容可选 SetCheckedBox.SetChecked(this.txtmodelcheckclass, aa[1], ","); //栏目可选 txt25.Text = aa[2]; SetCheckedBox.SetChecked(this.txtchecklist, aa[3], ","); //模型列表可选 txta11.Text = tips[11]; ddlsendsh.SelectedValue = aa[5].ToString(); } else { //0模型内容可选字段`1模型栏目可选字段`2内容字段名称`3模型列表可选字段`4提示语`5发表审核选择 SetCheckedBox.SetChecked(this.txtModeContent2, aa[0], ","); //模型内容可选 SetCheckedBox.SetChecked(this.txtmodelcheckclass, aa[1], ","); //栏目可选 txt26.Text = aa[2]; SetCheckedBox.SetChecked(this.txtchecklist, aa[3], ","); //模型列表可选 txtp11.Text = tips[11]; txtp12.Text = tips[12]; txtp13.Text = tips[13]; txtp14.Text = tips[14]; txtp15.Text = tips[15]; ddlsendsh.SelectedValue = aa[5].ToString(); } } } else { txtAction = "添加新模型"; txtAction2.Text = "添加新模型"; } ((Literal)Master.FindControl("breadcrumbs")).Text = "<span class=\"home\"></span>" + txtAction; } }
protected int tid; //广告位id protected void Page_Load(object sender, EventArgs e) { action = Request.QueryString["ac"]; id = BasePage.GetRequestId(Request.QueryString["id"]); string checklogin = new AdminBll().CheckLogin("15"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } if (!Page.IsPostBack) { string bread = "<a href=\"AD.aspx\" class=\"home\">广告列表</a>"; if (showhide("22")) { bread += "<a href=\"AD.aspx?ac=add1\" class=\"add\">添加广告位</a>"; } if (showhide("18")) { bread += "<a class=\"add\" href=\"AD.aspx?ac=add&tid =" + tid + "\">添加新广告</a>"; } ((Literal)Master.FindControl("breadcrumbs")).Text = bread; tid = BasePage.GetRequestId(Request.QueryString["tid"]); if (String.IsNullOrEmpty(action)) //取得列表 { string strwhere = "Tid=0"; //显示广告位和单条广告Tid都为0 if (tid != 0) { strwhere = "Tid=" + tid; txttxt.Text = "<span class=\"red\">查看广告位下的广告</span>"; } int pagesize = 20; int pageindex = BasePage.GetRequestId(Request.QueryString["Page"]); Repeater1.DataSource = new CommonBll().GetListPage("", datatable, strwhere, "ADShowHide asc,isad desc,px desc,id desc", pagesize, pageindex); Repeater1.DataBind(); int all = new CommonBll().GetRecordCount(datatable, strwhere); if (all > pagesize) { txtfy.Text = GetPage.GetAspxPager(all, pagesize, pageindex); } else if (all <= 0) { txtfy.Text = "<p class=\"red\" align=\"center\">无记录</p>"; } } else if (action == "add")//添加广告 { //已有广告列表 ddltid.DataSource = new CommonBll().GetList("", datatable, "IsAD=1", "px desc,id desc"); ddltid.DataTextField = "ADtitle"; ddltid.DataValueField = "id"; ddltid.DataBind(); ddltid.Items.Insert(0, new ListItem("无广告位", "0")); ddltid.SelectedValue = tid.ToString(); if (id != 0)//修改广告时 { ADModel ad = new ADBll().GetModel(id); txtttile.Text = ad.ADtitle; ddltid.SelectedValue = ad.Tid.ToString(); rashowhide.SelectedValue = ad.ADShowHide.ToString(); Rdtype.SelectedValue = ad.ADtype.ToString(); txtfile.Text = ad.ADurl; txthttp.Text = ad.ADhttpurl; txtheight1.Text = ad.ADheight.ToString(); txtwidth1.Text = ad.ADwidth.ToString(); txtpx.Text = ad.Px.ToString(); txtcontents.Text = ad.ADcontents; Button2.Text = "修改广告"; } } else if (action == "add1" && id != 0)//修改广告位时 { ADModel ame = new ADBll().GetModel(id); txtwtitle.Text = ame.ADtitle; Rshowhide.SelectedValue = ame.ADShowHide.ToString(); txtwwidth.Text = ame.ADwidth.ToString(); txtwheight.Text = ame.ADheight.ToString(); txtwcontents.Text = ame.ADcontents; txtadpx.Text = ame.Px.ToString(); Button1.Text = "修改广告位"; } else if (action == "del" && id != 0) { //删除 bool b = false; //检查是否为广告位,如果是广告位则检查有没广告 int i = new CommonBll().GetRecordCount(datatable, "id=" + id + " and IsAD=1"); if (i > 0) { //是广告位,检查有没广告 int ii = new CommonBll().GetRecordCount(datatable, "Tid=" + id); if (ii > 0) { BasePage.Alertback("请先删除此广告位下的广告。"); Response.End(); } else { //检查有没广告位管理权 if (showhide("22")) { //广告位管理 b = new CommonBll().Delete(datatable, id); //删除广告位 } else { BasePage.Alertback("删除失败,您不能删除此广告位!"); Response.End(); } } } else { //非广告位 if (showhide("19")) { //删除广告权限 b = new CommonBll().Delete(datatable, id); //删除广告位 } else { BasePage.Alertback("删除失败,您不能删除此广告!"); Response.End(); } } if (Request.UrlReferrer != null) { ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); } if (b) { BasePage.JscriptPrint(Page, "删除成功!", ViewState["UrlReferrer"].ToString()); } } else if (action == "clone" && id != 0) { //克隆一条广告 if (showhide("18")) { string filename = "ADtitle,Tid,IsAD,ADtype,ADurl,ADhttpurl,ADcontents,Px,ADheight,ADwidth,ADShowHide"; string cstrwhere = "id=" + id; int ci = new CommonBll().CloneData(filename, datatable, cstrwhere); if (ci > 0) { if (Request.UrlReferrer != null) { ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); } BasePage.JscriptPrint(Page, "克隆成功!", ViewState["UrlReferrer"].ToString()); } } } } }
public IBaseController() { ViewBag.iMenuList = AdminBll.GetMenuList(); }
//添加 protected void Button1_Click(object sender, EventArgs e) { int id = BasePage.GetRequestId(Request.QueryString["id"]); AdminModel model = new AdminModel(); model.id = id; model.UserName = txtUserName.Text.Trim(); model.Sex = TxtSex.Checked ? 0 : 1; model.TelPhone = txtTTelPhone.Text.Trim(); model.Email = txtEmail.Text.Trim(); model.AddDate = DateTime.Now; if (Request.QueryString["id"] == "1") { model.Locked = 0; } else { model.Locked = txtLocked.Checked ? 1 : 0; } if (userid == 1) { model.ModelPower = GetChecked(this.txtModelPower, ","); } else if (userid == 2) { model.ModelPower = GetChecked(this.txtModelPower2, ","); } else { model.ModelPower = HiddenFieldmp.Value; } addoreditadminpur(); if (id != 0) { if (String.IsNullOrEmpty(txtPassWord.Text.Trim())) { model.PassWord = txtPassWordOld.Value; } else { model.PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassWord.Text.Trim() + "fan<>?", "MD5"); } int ex = new CommonBll().GetRecordCount("GL_Admin", "UserName='******' and id<>" + id); if (ex > 0) { BasePage.Alertback("此用户名已存在!"); } else { bool b = new AdminBll().Update(model); if (b) { BasePage.JscriptPrint(Page, "修改成功!", "admin.aspx"); } } } else { if (userid <= 2) { //添加 if (String.IsNullOrEmpty(txtPassWord.Text.Trim())) { BasePage.Alertback("密码不能为空!"); Response.End(); } if (new AdminBll().ExistName(txtUserName.Text.Trim())) { BasePage.Alertback(Page, "用户名" + txtUserName.Text.Trim() + "已经存在,请用其它名称!"); } else { int b = new AdminBll().Add(model); if (b > 0) { BasePage.JscriptPrint(Page, "添加成功!", "admin.aspx"); } } } } }
private string titletips = "";//字段名 protected void Page_Load(object sender, EventArgs e) { //删除相册图片 if (Request.QueryString["ac"] == "uppic") { new CommonBll().Delete("GL_Album", BasePage.GetRequestId(Request.QueryString["delid"])); } mid = BasePage.GetRequestId(Request.QueryString["mid"]); if (mid == 1) { mid = 2; } id = BasePage.GetRequestId(Request.QueryString["id"]); if (!String.IsNullOrEmpty(Request.QueryString["language"])) { Language = BasePage.GetRequestId(Request.QueryString["Language"]).ToString(); } //根据模型找出数据表名 ModelModel mo = new ModelBll().GetModel(mid); datatable = mo.ModelTable; ItemName = mo.ItemName; if (!Page.IsPostBack) { string checklogin = new AdminBll().CheckLogin("m" + mid); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } //绑定栏目下拉 // ClassTreeBind(0, "请选择所属类别", mid, this.txtTid, "ClassType=0 and Languagen=" + Language); txtTid.Text = new ClassBll().GetClassSelect(0, "请选择所属类别", mid, "txtTid", "ClassType=0 and Languagen=" + BasePage.GetRequestId(Language) + "", "", "required input-control select-control"); FieldBind(id);//绑定自定义 txtAddDate.Text = BasePage.formatDateTime(DateTime.Now.ToString()); Drlanguage.SelectedValue = Language.ToString(); hiddenbackurl.Value = "Products.aspx?mid=" + mid; //将公司名读取 txtcompany.Text = Cookies.GetCookie("company").ToString(); txtcompanyid.Value = Cookies.GetCookie("companyId").ToString(); GetData();//编辑时 //提示 if (!String.IsNullOrEmpty(mo.ModeContent)) {//0模型内容可选字段`1模型栏目可选字段`2内容字段名称`3模型列表可选字段`4提示语`5发表审核选择 string[] aa = mo.ModeContent.Split('`'); string[] a = aa[4].Split('|'); ModeContent = aa[0]; txtTips0.Text = a[0]; txtTips1.Text = a[1]; txtTips2.Text = a[2]; txtTips3.Text = a[3]; isw = a[4]; ish = a[5]; txtTips6.Text = a[6]; txtTips7.Text = a[7]; txtTips8.Text = a[8]; txtTips9.Text = a[9]; txtTips10.Text = a[10]; txtTips11.Text = a[11]; ibw = a[12]; ibh = a[13]; txtTips14.Text = a[14]; txtTips15.Text = a[15]; titletips = aa[2]; } ((Literal)Master.FindControl("breadcrumbs")).Text = "<a class=\"home\" href=\"Products.aspx?mid=" + mid + "\">" + ItemName + "管理</a><span class=\"add\">添加" + ItemName + "</span><a href=\"Products.aspx?del=del&mid=" + mid + "\" class=\"del\">" + ItemName + "回收站</a>"; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string checklogin = new AdminBll().CheckLogin("no"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } //model //Repeater_model.DataSource = new CommonBll().GetList("", "GL_Model", "ModelLock=0", "id asc"); //Repeater_model.DataBind(); DataSet dsm = new CommonBll().GetList("", "GL_Model", "ModelLock=0", "id asc"); string dsmli = ""; foreach (DataRow dr in dsm.Tables[0].Rows) { if (GetPower("z" + dr["id"].ToString())) { dsmli += "<li><a href=\"ModelField.aspx?mid=" + dr["id"].ToString() + "\" target=\"main\"> " + dr["ModelName"].ToString() + "字段</a></li>\r"; } } txtmodel.Text = dsmli; //Article DataSet ds = new CommonBll().GetList("", "GL_Model", "ModelLock=0", "id asc"); string aml = ""; foreach (DataRow dr in ds.Tables[0].Rows) { if (GetPower("m" + dr["id"].ToString())) { string id = dr["id"].ToString(); string url = "Article.aspx?mid=" + id; if (dr["ModelType"].ToString() == "1") { url = "Products.aspx?mid=" + id; } string url2 = "ArticleAdd.aspx?mid=" + id; if (dr["ModelType"].ToString() == "1") { url2 = "ProductsAdd.aspx?mid=" + id; } aml += "<li><a href=\"" + url + "\" target=\"main\">" + dr["ModelName"].ToString() + "</a><span><a href=\"" + url2 + "\" target=\"main\">添加</a></span></li>\r"; } } Articlemodel.Text = aml; //Class //Repeater_Class.DataSource = new CommonBll().GetList("", "GL_Model", "ModelLock=0", "id asc"); //Repeater_Class.DataBind(); DataSet dsc = new CommonBll().GetList("", "GL_Model", "ModelLock=0", "id asc"); string dsclass = ""; foreach (DataRow dr in dsc.Tables[0].Rows) { if (GetPower("ce" + dr["id"].ToString())) { dsclass += "<li><a href=\"Class.aspx?mid=" + dr["id"].ToString() + "\" target=\"main\"> " + dr["ModelName"].ToString() + "栏目管理</a></li>\r"; } } txtClass.Text = dsclass; siteurl = new CommonBll().GetTitle("GL_WebConfig", "SiteUrl", 1); //取得域名 string cururl = Request.Url.Host.ToString(); if (!String.IsNullOrEmpty(cururl)) { } } }
protected void Page_Load(object sender, EventArgs e) { shsiteconfig.Visible = false; if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<span class=\"home\">系统基本设置</span>"; string checklogin = new AdminBll().CheckLogin("0"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "6")) { shsiteconfig.Visible = true; } WebConfigModel wm = new WebConfigBll().GetModel(1); txtSiteName.Text = wm.SiteName; txtsitetitle.Text = wm.SiteTitle; txtsitetitleen.Text = wm.SiteTitleEn; txtSiteUrl.Text = wm.SiteUrl; txticp.Text = wm.SiteICP; txtSiteKeyword.Text = wm.SiteKeyword; txtSiteKeyworden.Text = wm.SiteKeywordEn; txtSiteDescription.Text = wm.SiteDescription; txtSiteDescriptionen.Text = wm.SiteDescriptionEn; txtsiteemail.Text = wm.SiteMail; txtEmailsmtp.Text = wm.EmailSMTP; txtSmtpName.Text = wm.EmailName; txtsitecnzz.Text = wm.Sitecnzz; txtfax.Text = wm.SiteFax; txttel.Text = wm.SiteTel; txtaddress.Text = wm.SiteAddress; txtqq.Text = wm.SiteQQ; txtaddress.Text = wm.SiteAddress; txtother.Text = wm.Other; txtSmtpPassword.Attributes.Add("value", wm.EmailPassword); txtidnum.Text = BasePage.SiteId(); if (!String.IsNullOrEmpty(wm.SiteConfig)) { string siteconfig = wm.SiteConfig; string[] a = siteconfig.Split('|'); if (a.Length > 0) { SetCheckedBox.SetChecked(this.CheckBoxList1, a[0], ","); //基本配置 SetCheckedBox.SetChecked(this.CheckBoxList2, a[1], ","); //留言内容 SetCheckedBox.SetChecked(this.CheckBoxList3, a[2], ","); //留言列表 RadioButtonList1.SelectedValue = a[3]; //单页显示可选 showhide = a[0]; } } //序列号 //string word = GreateFiles.Read_File(Server.MapPath("~/id.txt")); //if (!String.IsNullOrEmpty(word)) //{ // txtidnum.Text = word.Trim(); //} } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ((Literal)Master.FindControl("breadcrumbs")).Text = "<a class=\"home\" href=\"User.aspx\">会员管理</a><a class=\"add\" href=\"?action=Add\">添加会员</a>"; string checklogin = new AdminBll().CheckLogin("7"); if (checklogin != "true") { BasePage.Alertback(checklogin); Response.End(); } if (!String.IsNullOrEmpty(Request.QueryString["action"])) { action = Request.QueryString["action"]; } else { action = "show"; } id = BasePage.GetRequestId(Request.QueryString["id"]); DataSet dsUserGroup = new CommonBll().GetList("", "GL_UserGroup", "", "id asc"); if (action == "Add") { //用户组 ddlGroupID.DataSource = dsUserGroup; ddlGroupID.DataTextField = "GroupName"; ddlGroupID.DataValueField = "id"; ddlGroupID.DataBind(); if (id != 0) { //编辑修改 Literal1.Text = "修改用户信息"; Literal2.Text = "不修改请留空"; UserModel model = new UserBll().GetModel(id); ddlGroupID.SelectedValue = model.GroupID.ToString(); txtUserName.Text = model.UserName; HiddenField1.Value = model.PassWord; txtLocked.SelectedValue = model.Locked.ToString(); txtEmail.Text = model.Email; txtQQ.Text = model.QQ; string city = model.City; if (city != "") { string[] v = city.Split(','); ddlp = v[0]; ddlc = v[1]; ddla = v[2]; } txtAddress.Text = model.Address; txtSex.SelectedValue = model.Sex.ToString(); txtregDate.Text = BasePage.formatDateTime(model.RegDate.ToString()); txtlastLoginTime.Text = BasePage.formatDateTime(model.LastLoginTime.ToString()); txtlastLoginIP.Text = model.LastLoginIP; txtloginTimes.Text = model.LoginTimes.ToString(); txtCompany.Text = model.Company; txtTel.Text = model.Tel; txtWenXin.Text = model.WenXin; txtSource.Text = model.Source; Button4.Text = "确认修改"; } } else { //列表 //绑定快速查看下拉 ddlUserGroup.DataSource = dsUserGroup; ddlUserGroup.DataTextField = "GroupName"; ddlUserGroup.DataValueField = "id"; ddlUserGroup.DataBind(); ddlUserGroup.Items.Insert(0, new ListItem("所有会员组", "")); string keywords = Request.QueryString["keywords"]; string strwhere = "id is not null"; int GroupId = 0; if (!String.IsNullOrEmpty(Request.QueryString["GroupId"])) { GroupId = int.Parse(Request.QueryString["GroupId"]); strwhere += " and GroupId=" + GroupId; } if (!String.IsNullOrEmpty(Request.QueryString["keywords"])) { strwhere += " and UserName like '%" + keywords + "%'"; } ddlUserGroup.SelectedValue = GroupId.ToString(); DataSet ds = new DataSet(); int PageSize = 25; int PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页 ds = new CommonBll().GetListPage("", datatable, strwhere, "LastLoginTime desc", PageSize, PageIndex); Repeater1.DataSource = ds; Repeater1.DataBind(); int totalrecord = new CommonBll().GetRecordCount(datatable, strwhere);//总记录数 if (totalrecord == 0) { txtpage.Text = "<p align=\"center\" class=\"red\">暂无会员</p>"; } else if (totalrecord > PageSize) { txtpage.Text = GetPage.GetAspxPager(totalrecord, PageSize, PageIndex); } } } }