/// <summary> /// 用戶管理列表頁 /// </summary> /// <returns></returns> public HttpResponseBase MailUserList() { string jsonStr = string.Empty; try { List<MailUserQuery> MailUserStore = new List<MailUserQuery>(); MailUserQuery query = new MailUserQuery(); if (!string.IsNullOrEmpty(Request.Params["user_name"])) { query.user_name = Request.Params["user_name"]; } if (!string.IsNullOrEmpty(Request.Params["user_mail"])) { query.user_mail = Request.Params["user_mail"]; } if (!string.IsNullOrEmpty(Request.Params["relation_id"]))//待回覆 { query.row_id = Convert.ToInt32(Request.Params["relation_id"]); } List<ManageUserQuery> ManageUseStore = new List<ManageUserQuery>(); ManageUserQuery ManageUserQuery = new ManageUserQuery(); ManageUserQuery.IsPage = false; #region 查詢管理人員綁定到表中 DataTable _dtManageUser = new DataTable(); _dtManageUser.Columns.Add("user_id", typeof(String)); _dtManageUser.Columns.Add("user_name", typeof(String)); int total = 0; _IManageUserMgr = new ManageUserMgr(mySqlConnectionString); ManageUseStore = _IManageUserMgr.GetNameMail(ManageUserQuery, out total); foreach (var item in ManageUseStore) { DataRow dr = _dtManageUser.NewRow(); dr[0] = item.user_id; dr[1] = item.user_name; _dtManageUser.Rows.Add(dr); } #endregion if (!string.IsNullOrEmpty(Request.Params["pagers"])) { if (Convert.ToInt32(Request.Params["pagers"]) == 0) { query.IsPage = false; } } query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 _IMailUserMgr = new MailUserMgr(mySqlConnectionString); int totalCount = 0; MailUserStore = _IMailUserMgr.GetMailUserStore(query, out totalCount);//查询出供應商出貨單 foreach (var item in MailUserStore) { item.nameemail = item.user_name + "(" + item.user_mail + ")"; DataRow[] rows = _dtManageUser.Select("user_id='" + item.create_user + "'"); foreach (DataRow row in rows)//篩選出的最多只有一條數據, { item.create_user_name = item.create_user.ToString(); if (!string.IsNullOrEmpty(row["user_id"].ToString())) { item.create_user_name = row["user_name"].ToString();//---創建人 } } rows = _dtManageUser.Select("user_id='" + item.update_user + "'"); foreach (DataRow row in rows)//篩選出的最多只有一條數據, { item.update_user_name = item.update_user.ToString(); if (!string.IsNullOrEmpty(row["user_id"].ToString())) { item.update_user_name = row["user_name"].ToString();//---修改人 } } if (Convert.ToBoolean(Request.Params["isSecret"])) { if (!string.IsNullOrEmpty(item.user_name)) { item.user_name = item.user_name.Substring(0, 1) + "**"; } item.user_mail = item.user_mail.Split('@')[0] + "@***"; if (item.nameemail.ToString().Length > 3) { item.nameemail = item.nameemail.Substring(0, 3) + "***"; } else { item.nameemail = item.nameemail + "***"; } } } IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; jsonStr = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(MailUserStore, Formatting.Indented, timeConverter) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); jsonStr = "{success:false,msg:0}"; } this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; }
public HttpResponseBase GetManagerUser() { string json = string.Empty; ManageUser mu = new ManageUser(); ManageUserQuery muq = new ManageUserQuery(); int totalCount = 0; List<ManageUser> store = new List<ManageUser>(); List<ManageUserQuery> storeq = new List<ManageUserQuery>(); try { _muMgr = new ManageUserMgr(mySqlConnectionString); //判斷輸入密碼是否和登入密碼一樣 if (!string.IsNullOrEmpty(Request.Params["user_id"])) { mu.user_id = uint.Parse(Request.Params["user_id"]); store = _muMgr.GetManageUser(mu); if (store.Count > 0) { if (!string.IsNullOrEmpty(Request.Params["secret_password"])) { HashEncrypt hmd5 = new HashEncrypt(); if (hmd5.SHA256Encrypt(Request.Params["secret_password"]) == store[0].user_password) { json = "{success:false}"; } else { json = "{success:true}"; } } } else { json = "{success:false}"; } } //獲取管理用戶下拉列表 else { muq.IsPage = false; muq.user_username = Request.Params["user_name"]; muq.user_status = 1; storeq = _muMgr.GetNameMail(muq, out totalCount); json = "{success:true,data:" + JsonConvert.SerializeObject(storeq, Formatting.Indented) + "}";//返回json數據 } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
/// <summary> /// 用戶管理中,添加用戶時的下拉框綁定數據 /// </summary> /// <returns></returns> public HttpResponseBase ManageUser() { string jsonStr = string.Empty; try { List<ManageUserQuery> store = new List<ManageUserQuery>(); ManageUserQuery query = new ManageUserQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 query.IsPage = false; query.user_status = 1; _IManageUserMgr = new ManageUserMgr(mySqlConnectionString); int totalCount = 0; store = _IManageUserMgr.GetNameMail(query, out totalCount);//查询出供應商出貨單 IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd"; jsonStr = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); jsonStr = "{success:false,msg:0}"; } this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; }
public HttpResponseBase GetVoteArticleList() { List<VoteArticleQuery> store = new List<VoteArticleQuery>(); string json = string.Empty; int totalCount = 0; try { _muMgr = new ManageUserMgr(mySqlConnectionString); ManageUserQuery muq = new ManageUserQuery(); muq.IsPage = false; List<ManageUserQuery> mustore = _muMgr.GetNameMail(muq, out totalCount); VoteArticleQuery query = new VoteArticleQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); if (!string.IsNullOrEmpty(Request.Params["limit"])) { query.Limit = Convert.ToInt32(Request.Params["limit"]); } if (!string.IsNullOrEmpty(Request.Params["ddlSel"])) { query.event_id = Convert.ToInt32(Request.Params["ddlSel"]); } if (!string.IsNullOrEmpty(Request.Params["selcontent"])) { query.article_title = Request.Params["selcontent"]; } if (!string.IsNullOrEmpty(Request.Params["date"])) { query.date = Convert.ToInt32(Request.Params["date"]); } if (!string.IsNullOrEmpty(Request.Params["time_start"])) { query.time_start = Convert.ToDateTime(Request.Params["time_start"]).ToString("yyyy-MM-dd HH:mm:ss"); } if (!string.IsNullOrEmpty(Request.Params["time_end"])) { query.time_end = Convert.ToDateTime(Request.Params["time_end"]).ToString("yyyy-MM-dd HH:mm:ss"); } _votearticle = new VoteArticleMgr(mySqlConnectionString); store = _votearticle.GetAll(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; foreach (var item in store) { item.kendo_editor = Server.HtmlDecode(Server.HtmlDecode(item.article_content)); if (item.article_banner != "") { item.article_banner = imgServerPath + PaperPath + item.article_banner; } int indexc = mustore.FindIndex((ManageUserQuery e) => e.user_id == uint.Parse(item.create_user.ToString())); if (indexc != -1) { item.creat_name = mustore[indexc].user_name; } else { item.creat_name = string.Empty; } int indexu = mustore.FindIndex((ManageUserQuery e) => e.user_id == uint.Parse(item.update_user.ToString())); if (indexu != -1) { item.upd_name = mustore[indexu].user_name; } else { item.upd_name = string.Empty; } } //listUser是准备转换的对象 json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }