public M_Admin GetModel(int userId) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@UserId", userId) }; DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Admin_GetInfoById", commandParameters); if ((table != null) && (table.Rows.Count > 0)) { M_Admin admin = new M_Admin(); admin.UserId = int.Parse(table.Rows[0]["UserId"].ToString()); admin.LoginName = table.Rows[0]["LoginName"].ToString(); admin.UserName = table.Rows[0]["UserName"].ToString(); admin.LoginName = table.Rows[0]["LoginName"].ToString(); admin.UserName = table.Rows[0]["UserName"].ToString(); admin.Password = table.Rows[0]["Password"].ToString(); admin.LastLoginIP = table.Rows[0]["LastLoginIP"].ToString(); if (table.Rows[0]["LastLoginTime"].ToString() != "") { admin.LastLoginTime = DateTime.Parse(table.Rows[0]["LastLoginTime"].ToString()); } if (table.Rows[0]["LastLogoutTime"].ToString() != "") { admin.LastLogoutTime = DateTime.Parse(table.Rows[0]["LastLogoutTime"].ToString()); } if (table.Rows[0]["LoginTime"].ToString() != "") { admin.LoginTime = int.Parse(table.Rows[0]["LoginTime"].ToString()); } if (table.Rows[0]["AllowMultiLogin"].ToString() != "") { if ((table.Rows[0]["AllowMultiLogin"].ToString() == "1") || (table.Rows[0]["AllowMultiLogin"].ToString().ToLower() == "true")) { admin.AllowMultiLogin = true; } else { admin.AllowMultiLogin = false; } } if (table.Rows[0]["CheckCount"].ToString() != "") { admin.CheckCount = int.Parse(table.Rows[0]["CheckCount"].ToString()); } if (table.Rows[0]["AddCount"].ToString() != "") { admin.AddCount = int.Parse(table.Rows[0]["AddCount"].ToString()); } if (table.Rows[0]["RejectCount"].ToString() != "") { admin.RejectCount = int.Parse(table.Rows[0]["RejectCount"].ToString()); } if (table.Rows[0]["GroupId"].ToString() != "") { admin.GroupId = int.Parse(table.Rows[0]["GroupId"].ToString()); } admin.GroupName = table.Rows[0]["GroupName"].ToString(); admin.RandNumber = table.Rows[0]["RandNumber"].ToString(); return admin; } return null; }
protected void Page_Load(object sender, EventArgs e) { AdminBll.CheckMulitLogin(); AdminModel = AdminBll.GetLoginModel(); AdminUserModel = AdminBll.GetModel(AdminModel.UserId); if (!string.IsNullOrEmpty(Request.QueryString["ModelId"])) { try { ModelId = int.Parse(Request.QueryString["ModelId"]); } catch { } } M_InfoModel infoModel = InfoModelBll.GetModel(ModelId); if (!Page.IsPostBack) { txtTemplatePath.Attributes.Add("readonly", ""); litNav.Text = "<a href=\"ModelList.aspx\">模型列表<a> >> <a href=\"FieldList.aspx?ModelId=" + ModelId + "\">字段列表</a> >> " + infoModel.ModelName + "预览"; //绑定自定义字段 ModelHtml.Text = infoModel.ModelHtml; //DataTable dt1 = new DataTable(); //dt1 = BModelField.GetList(ModelId); //Repeater1.DataSource = dt1; //Repeater1.DataBind(); //dt1.Clear(); //dt1.Dispose(); FilePicPath.Text = MInfoModel.UploadPath; TableName = MInfoModel.TableName; //BindSpeacil(); BindGroup(); } }
public bool Add(M_Admin model) { SqlParameter[] commandParameters = new SqlParameter[7]; commandParameters[0] = new SqlParameter("@LogName", SqlDbType.NVarChar, 20); commandParameters[0].Value = model.LoginName; commandParameters[1] = new SqlParameter("@UserName", SqlDbType.NVarChar, 20); commandParameters[1].Value = model.UserName; commandParameters[2] = new SqlParameter("@Password", SqlDbType.VarChar, 200); commandParameters[2].Value = model.Password; commandParameters[3] = new SqlParameter("@GroupId", SqlDbType.Int, 4); commandParameters[3].Value = model.GroupId; commandParameters[4] = new SqlParameter("@GroupName", SqlDbType.NVarChar, 50); commandParameters[4].Value = model.GroupName; commandParameters[5] = new SqlParameter("@AllowMultiLogin", SqlDbType.Bit, 1); commandParameters[5].Value = model.AllowMultiLogin; commandParameters[6] = new SqlParameter("@output", SqlDbType.Bit, 1); commandParameters[6].Direction = ParameterDirection.Output; commandParameters[6].Value = 0; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Admin_Add", commandParameters); return (bool) commandParameters[6].Value; }
protected void Page_Load(object sender, EventArgs e) { AdminBll.CheckMulitLogin(); AdminModel = AdminBll.GetLoginModel(); AdminUserModel = AdminBll.GetModel(AdminModel.UserId); AjaxPro.Utility.RegisterTypeForAjax(typeof(system_info_UpdateInfo)); if (!string.IsNullOrEmpty(Request.QueryString["ChId"])) { try { ChannelId = int.Parse(Request.QueryString["ChId"]); } catch { } } ChannelModel = ChannelId <= 0 ? null : ChannelBll.GetChannel(ChannelId); MInfoModel = BInfoModel.GetModel(ChannelModel.ModelType); Id = int.Parse(Request.QueryString["Id"]); if (Id > 0 && !AdminGroupBll.Power_Channel(ChannelId, ColumnId, AdminUserModel.GroupId, 3)) { Function.ShowSysMsg(0, "<li>你没有该栏目下的修改权限</li>"); } drInfo = BInfoOper.GetInfo(MInfoModel.TableName, Id); if (!Page.IsPostBack) { txtTemplatePath.Attributes.Add("readonly", ""); if (!ColumnBll.ChkHasColumnByChId(ChannelId)) { Function.ShowSysMsg(0, "<li>本频道下没有栏目,不能添加信息!</li><li>建议您先添加栏目</li><li><a href='info/SetColumn.aspx?ChId=" + ChannelId + "'>添加栏目</a> <a href='info/ColumnList.aspx?ChId=" + ChannelId + "'>栏目管理</a></li>"); } if (!string.IsNullOrEmpty(Request.QueryString["ColId"])) { try { ColumnId = int.Parse(Request.QueryString["ColId"]); } catch { } } litNav.Text = ChannelModel.TypeName + "管理 >> <a href='InfoList.aspx?ChId=" + ChannelId + "'>站点" + ChannelModel.TypeName + "列表</a> >> 设置" + ChannelModel.TypeName; //绑定自定义字段 ModelHtml.Text = MInfoModel.ModelHtml; //DataTable dt1 = new DataTable(); // dt1 = BModelField.GetList(ChannelModel.ModelType); //dt1.Clear(); //dt1.Dispose(); FilePicPath.Text = MInfoModel.UploadPath + "|" + MInfoModel.UploadSize.ToString(); TableName = MInfoModel.TableName; BindSpeacil(); BindGroup(); //赋值 GetShow(); } }
protected void Page_Load(object sender, EventArgs e) { AdminBll.CheckMulitLogin(); AdminModel = AdminBll.GetLoginModel(); AdminUserModel = AdminBll.GetModel(AdminModel.UserId); litMsg.Text = ""; SiteModel = SiteBll.GetSiteModel(); InfoSiteModel = SiteBll.GetInfoModel(); if (SiteModel == null) { Function.ShowSysMsg(0, "<li>全站参数获取错误</li>"); } txtTemplatePath.Attributes.Add("readonly", ""); txtUpdateDateTime.Attributes.Add("readonly", ""); txtHeaderColor.Attributes.Add("readonly", ""); txtViewer.Attributes.Add("readonly", ""); HistoryTime = InfoSiteModel.HistoryTime; if (!string.IsNullOrEmpty(Request.QueryString["ChId"])) { try { ChannelId = int.Parse(Request.QueryString["ChId"]); } catch { } } if (!ColumnBll.ChkHasColumnByChId(ChannelId)) { Function.ShowSysMsg(0, "<li>本频道下没有栏目,不能添加信息</li><li>建议您先添加栏目</li><li><a href='info/SetColumn.aspx?ChId=" + ChannelId + "'>添加栏目</a> <a href='info/ColumnList.aspx?ChId=" + ChannelId + "'>栏目管理</a></li>"); } ChannelModel = ChannelId <= 0 ? null : ChannelBll.GetChannel(ChannelId); if (ChannelModel == null || ChannelModel.ModelType != 1) { Function.ShowSysMsg(0, "<li>频道参数错误</li>"); } //保存路径 InfoModel = InfoModelBll.GetModel(ChannelModel.ModelType); FilePicPath.Text = InfoModel.UploadPath + "|" + InfoModel.UploadSize.ToString(); if (!string.IsNullOrEmpty(Request.QueryString["ColId"])) { try { ColumnId = int.Parse(Request.QueryString["ColId"]); } catch { } } ColumnModel = ColumnId <= 0 ? null : ColumnBll.GetColumn(ColumnId); if (ColumnId > 0 && ColumnModel == null) { Function.ShowSysMsg(0, "<li>所选栏目不存在或已经被删除</li>"); } if (Request.QueryString["Id"] != null && Request.QueryString["Id"] != "") { try { ArticleId = int.Parse(Request.QueryString["Id"]); } catch { } } if (ArticleId > 0 && !AdminGroupBll.Power_Channel(ChannelId, ColumnId, AdminUserModel.GroupId, 3)) { Function.ShowSysMsg(0, "<li>你没有该栏目下的修改权限</li>"); } if (!IsPostBack) { txtUpdateDateTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); if (HistoryTime == 0) { txtExpireTime.Text = "9999-01-01"; } else { txtExpireTime.Text = DateTime.Now.AddDays(HistoryTime).ToString("yyyy-MM-dd"); } for (int i = 0; i <= 20; i++) { ddlHeaderSize.Items.Add(new ListItem(i + "px", i + "px")); ddlHeaderSize.SelectedValue = "12px"; } if (ArticleId > 0) litNav.Text = "<a href='ColumnList.aspx?Chid=" + ChannelId + "'>" + ChannelModel.ChName + "</a> >> 修改" + ChannelModel.TypeName; else litNav.Text = "<a href='ColumnList.aspx?Chid=" + ChannelId + "'>" + ChannelModel.ChName + "</a> >> 添加" + ChannelModel.TypeName; BindSpeacil(); BindGroup(); if (ArticleId > 0) { ShowInfo(ArticleId); } } }
protected void Page_Load(object sender, EventArgs e) { AdminBll.CheckMulitLogin(); adminModel = admin.GetLoginModel(); M_InfoModel infoModel = InfoModelBll.GetModel(2); FilePicPath.Text = infoModel.UploadPath + "|" + infoModel.UploadSize; AdminUserModel = AdminBll.GetModel(adminModel.UserId); if (!string.IsNullOrEmpty(Request.QueryString["ChId"])) { ChannelId = Function.CheckNumberNotZero(Request.QueryString["ChId"]) == true ? int.Parse(Request.QueryString["ChId"]) : 0; } if (!string.IsNullOrEmpty(Request.QueryString["ColId"])) { ColId = Function.CheckNumber(Request.QueryString["ColId"]) ? int.Parse(Request.QueryString["ColId"]) : 0; } ChannelModel = ChannelId <= 0 ? null : ChannelBll.GetChannel(ChannelId); if (ChannelModel == null || ChannelModel.ModelType != 2) { Function.ShowSysMsg(0,"<li>频道参数错误</li><li><a href='javascript:window.history.back();'>返回上一步</a></li>"); return; } litNav.Text = ChannelModel.TypeName + "管理 >> <a href='InfoList.aspx?ChId=" + ChannelId + "'>站点" + ChannelModel.TypeName + "列表</a>>>设置" + ChannelModel.TypeName; txtTemplatePath.Attributes.Add("readonly", "readonly"); if (!IsPostBack) { BindData(); } if (Request.QueryString["ChId"] != null && Request.QueryString["ColId"] != null && Request.QueryString["Id"] != null) { ColId = Function.CheckNumber(Request.QueryString["ColId"]) == true ? int.Parse(Request.QueryString["ColId"]) : 0; ImgId = Function.CheckNumber(Request.QueryString["Id"]) == true ? int.Parse(Request.QueryString["Id"]) : 0; if (ImgId > 0 && !AdminGroupBll.Power_Channel(ChannelId, ColId, AdminUserModel.GroupId, 3)) { Function.ShowSysMsg(0, "<li>你没有该栏目下的修改权限</li>"); } model = imageBll.GetItem(ImgId); if (ChannelId > 0 && ColId > 0 && ImgId > 0 && model != null) { flag = "Update"; if (!IsPostBack) { BindDataOnUpdate(); } } else { Function.ShowSysMsg(0,"<li>参数错误</li><li><a href='javascript:window.history.back();'>返回上一步</a></li>"); } } }
protected void Page_Load(object sender, EventArgs e) { AdminBll.CheckMulitLogin(); AdminModel = AdminBll.GetLoginModel(); AdminUserModel = AdminBll.GetModel(AdminModel.UserId); if (!string.IsNullOrEmpty(Request.QueryString["ChId"])) { try { ChannelId = int.Parse(Request.QueryString["ChId"]); } catch { } } ChannelModel = ChannelId <= 0 ? null : ChannelBll.GetChannel(ChannelId); MInfoModel = BInfoModel.GetModel(ChannelModel.ModelType); if (!Page.IsPostBack) { txtTemplatePath.Attributes.Add("readonly", ""); if (!ColumnBll.ChkHasColumnByChId(ChannelId)) { Function.ShowSysMsg(0, "<li>本频道下没有栏目,不能添加信息!</li><li>建议您先添加栏目</li><li><a href='info/SetColumn.aspx?ChId=" + ChannelId + "'>添加栏目</a> <a href='info/ColumnList.aspx?ChId=" + ChannelId + "'>栏目管理</a></li>"); } if (!string.IsNullOrEmpty(Request.QueryString["ColId"])) { try { ColumnId = int.Parse(Request.QueryString["ColId"]); } catch { } } litNav.Text = ChannelModel.TypeName + "管理 >> <a href='InfoList.aspx?ChId=" + ChannelId + "'>站点" + ChannelModel.TypeName + "列表</a> >> 设置" + ChannelModel.TypeName; //绑定自定义字段 ModelHtml.Text = MInfoModel.ModelHtml; FilePicPath.Text = MInfoModel.UploadPath + "|" + MInfoModel.UploadSize.ToString(); TableName = MInfoModel.TableName; BindSpeacil(); BindGroup(); } }
public void UpdateState(M_Admin model) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@LastLoginIP", model.LastLoginIP), new SqlParameter("@LastLoginTime", model.LastLoginTime), new SqlParameter("@RandNumber", model.RandNumber), new SqlParameter("@LoginName", model.LoginName) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Admin_UpdateState", commandParameters); }
public void UpdateInfo(M_Admin model) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@UserId", model.UserId), new SqlParameter("@Password", model.Password), new SqlParameter("@AllowMultiLogin", model.AllowMultiLogin), new SqlParameter("@GroupId", model.GroupId), new SqlParameter("@GroupName", model.GroupName), new SqlParameter("@UserName", model.UserName) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Admin_Update", commandParameters); }
protected void Page_Load(object sender, EventArgs e) { AdminBll.CheckMulitLogin(); M_LoginAdmin loginAdminModel = AdminBll.GetLoginModel(); AdminModel = AdminBll.GetModel(loginAdminModel.UserId); SiteModel = SiteBll.GetSiteModel(); #region 频道,模型,栏目参数检验 if (!string.IsNullOrEmpty(Request.QueryString["ChId"])) { try { ChId = int.Parse(Request.QueryString["ChId"]); } catch { } } ChannelModel = ChannelBll.GetChannel(ChId); if (ChannelModel == null) { Function.ShowSysMsg(0, "<li>所属频道不存在或已经被删除</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>"); } InfoModel = InfoModelBll.GetModel(ChannelModel.ModelType); if (InfoModel == null) { Function.ShowSysMsg(0, "<li>所属模型不存在或已经被删除</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>"); } if (!string.IsNullOrEmpty(Request.QueryString["ColId"])) { try { ColumnId = int.Parse(Request.QueryString["ColId"]); } catch { } } ColumnModel = ColumnBll.GetColumn(ColumnId); if (ColumnId != 0 && ColumnModel == null) { Function.ShowSysMsg(0, "<li>所属栏目不存在或已经被删除</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>"); } #endregion SetNav(); AuditingLevel = PowerGroupBll.Power_Auditing(ChId, AdminModel.GroupId); SetBtnStatus(); #region 获取搜索字段 if (!string.IsNullOrEmpty(Request.QueryString["FieldName"])) { FieldName = Request.QueryString["FieldName"]; } if (!string.IsNullOrEmpty(Request.QueryString["Keyword"])) { Keyword = Request.QueryString["Keyword"].Trim(); if (!IsPostBack) { txtKeyword.Text = Keyword; } } #endregion #region 设置审核参数 if (!string.IsNullOrEmpty(Request.QueryString["Status"])) { string status = Request.QueryString["Status"].ToLower(); if (status == "no") { switch (AuditingLevel) { default: Status = "-99"; break; case "1": Status = "0"; break; case "2": Status = "0,1"; break; case "3": Status = "0,1,2"; break; } } else { Status = "3"; } } #endregion #region 设置投稿参数 if (!string.IsNullOrEmpty(Request.QueryString["UserType"])) { try { UserType = int.Parse(Request.QueryString["UserType"]); } catch { } } #endregion if (!IsPostBack) { InitProperty(); BindColumn(); BindChannel(); Bind(); ddlsortName.Items[0].Text = ChannelModel.TypeName + "标题"; if (gvInfoList.Rows.Count > 0) gvInfoList.HeaderRow.Cells[1].Text = ChannelModel.TypeName + "标题"; } }
protected void Page_Load(object sender, EventArgs e) { AdminBll.CheckMulitLogin(); LoginAdminModel = AdminBll.GetLoginModel(); AdminModel = AdminBll.GetModel(LoginAdminModel.UserId); litUserName.Text = AdminModel.UserName; AdminGroupModel = AdminGroupBll.Show(AdminModel.GroupId); litGroupName.Text = AdminGroupModel.PowerName; lbNotice.Visible = true; lbNotice.Text = "<script language=\"javascript\" src=\"http://info.kycms.com/notice_info.js\"></script>"; string dateStr = DateTime.Today.ToString("yyyy年MM月dd日"); int weekNumber = (int)DateTime.Today.DayOfWeek; string weekStr = string.Empty; switch (weekNumber) { default: case 0: weekStr = "星期日"; break; case 1: weekStr = "星期一"; break; case 2: weekStr = "星期二"; break; case 3: weekStr = "星期三"; break; case 4: weekStr = "星期四"; break; case 5: weekStr = "星期五"; break; case 6: weekStr = "星期六"; break; } litDate.Text = dateStr + " " + weekStr; StringBuilder sb = new StringBuilder(); sb.Append("共有会员: "); sb.Append(UserBll.GetUserCount(0, 0)); sb.Append("人 "); DataTable userGroupModelDt = UserGroupModelBll.GetAll(); for (int i = 0; i < userGroupModelDt.Rows.Count; i++) { DataRow dr = userGroupModelDt.Rows[i]; int typeId = int.Parse(dr["id"].ToString()); string name = "[" + dr["name"].ToString() + "]"; sb.Append(name); sb.Append(":"); int count = UserBll.GetUserCount(typeId, 0); sb.Append(count); if (i == userGroupModelDt.Rows.Count - 1) { sb.Append("人 "); } else { sb.Append("人 "); } } LitCount.Text = sb.ToString(); //DataTable dt = InfoModelBll.GetList(); //InfoModelDt = new DataTable(); //InfoModelDt.Columns.Add("name", typeof(string)); //InfoModelDt.Columns.Add("total", typeof(string)); //InfoModelDt.Columns.Add("nocheck", typeof(string)); //for (int i = 0; i < dt.Rows.Count; i++) //{ // DataRow dr = dt.Rows[i]; // string name = dr["modelname"].ToString(); // string tableName = dr["tablename"].ToString(); // int totalCount = InfoModelBll.GetModelInfoCount(tableName, "[status] in(0,1,2,3)"); // int noCheckCount = InfoModelBll.GetModelInfoCount(tableName,"[status] in(0,1,2)"); // DataRow infoModelDr = InfoModelDt.NewRow(); // infoModelDr["name"] = name; // infoModelDr["total"] = totalCount; // infoModelDr["nocheck"] = noCheckCount; // InfoModelDt.Rows.Add(infoModelDr); //} //repCount.DataSource = InfoModelDt.DefaultView; //repCount.DataBind(); //InfoModelDt.Dispose(); }
private void BindOnUpdate() { AdminModel = AdminBll.GetModel(UserId); if (AdminModel != null) { lbInfo.Text = "如果不修改密码,请留空"; txtAdminLoginID.Text = AdminModel.LoginName; txtAdminName.Text = AdminModel.UserName; DDlistGroup.SelectedValue = AdminModel.GroupId.ToString(); AllowMultiLogin.SelectedValue = AdminModel.AllowMultiLogin.ToString(); } else { Function.ShowSysMsg(0,"<li>无此用户</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } }
public bool Add(M_Admin model) { return this.dal.Add(model); }
public void UpdateState(M_Admin model) { this.dal.UpdateState(model); }
public void UpdateInfo(M_Admin model) { this.dal.UpdateInfo(model); }
public void SetLoginState(M_Admin model) { bool allowMultiLogin = model.AllowMultiLogin; M_Site siteModel = new B_SiteInfo().GetSiteModel(); string rndNum = Ky.Common.Function.GetRndNum(16); HttpContext.Current.Response.Cookies["AdminState"]["UserId"] = model.UserId.ToString(); HttpContext.Current.Response.Cookies["AdminState"]["LoginName"] = Ky.Common.Function.UrlEncode(model.LoginName); HttpContext.Current.Response.Cookies["AdminState"]["AdminName"] = Ky.Common.Function.UrlEncode(model.UserName); HttpContext.Current.Response.Cookies["AdminState"]["Password"] = Ky.Common.Function.DESEncrypt(model.Password); if (HttpContext.Current.Request.UserHostAddress != null) { model.LastLoginIP = HttpContext.Current.Request.UserHostAddress; } else { model.LastLoginIP = ""; } model.LastLoginTime = DateTime.Now; model.RandNumber = rndNum; this.UpdateState(model); HttpContext.Current.Response.Cookies["randNum"].Value = rndNum; B_Log.Add(LogType.Login, "登陆后台"); HttpContext.Current.Response.Redirect(Param.ApplicationRootPath + "/System/Index.aspx"); }