public string AddUser(User u, string roleIds) { int uid = 0; string msg = "用户添加失败!"; if (HasUserName(u.UserName, u.KeyId)) { uid = -2; msg = "用户名已存在。"; } else { u.Password = StringHelper.MD5string(u.Password + u.PassSalt); uid = UserDal.Instance.Insert(u); if (!string.IsNullOrEmpty(roleIds)) { var roleIdArr = roleIds.Split(','); var roleIdList = roleIdArr.Select(n => PublicMethod.GetInt(n)).ToArray(); UserDal.Instance.AddUserTo(uid, roleIdList); } if (uid > 0) { msg = "添加新用户成功!"; LogBll <User> log = new LogBll <User>(); u.KeyId = uid; log.AddLog(u); } } return(new JsonMessage { Data = uid.ToString(), Message = msg, Success = uid > 0 }.ToString()); }
public int GetCount(string driverids, string where) { StringBuilder sql = new StringBuilder(); sql.AppendLine("SELECT COUNT(1)"); sql.AppendLine(" FROM (SELECT ROWNUM AS rowno, T.*"); sql.AppendLine(" FROM (SELECT T1.*, T2.NAME,T2.PLAT_FORM_NAME"); sql.AppendLine(" FROM TB_MESSAGE T1"); sql.AppendLine(" LEFT JOIN TB_APP_USER T2"); sql.AppendLine(" ON T1.USER_ID = T2.FID"); ////sql.AppendLine(" LEFT JOIN " + SysVisitor.Instance.TmsUser + "." + "TMS_PLATFORM T3"); ////sql.AppendLine(" ON T2.PLAT_FORM_ID = T3.ID"); sql.AppendLine(" WHERE 1=1 "); //sql.AppendLine(" WHERE T2.ID IN ("+ driverids + ")) T) table_alias"); if (!string.IsNullOrEmpty(SysVisitor.Instance.DataStartDate)) { sql.AppendLine(" AND (T1.SEND_TIME >= to_date('" + SysVisitor.Instance.DataStartDate + "','yyyy-mm-dd'))"); } sql.AppendLine(" ) T) table_alias"); sql.AppendLine(" WHERE 1=1"); if (where != "" && where != "()") { sql.AppendLine(" and " + where.Replace("SEND_TIME", "TO_CHAR(SEND_TIME, 'YYYY-MM-DD')")); } DataTable table = DbUtils.Query(sql.ToString()); return(PublicMethod.GetInt(table.Rows[0][0])); }
public string JsonDataForEasyUIdataGrid(int pageindex, int pagesize, string filterJson, string sort = "keyid", string order = "asc") { string sortorder = sort + " " + order; var pcp = new ProcCustomPage("sys_roles") { PageIndex = pageindex, PageSize = pagesize, OrderFields = sortorder, WhereString = FilterTranslator.ToSql(filterJson) }; int recordCount; DataTable dt = base.GetPageWithSp(pcp, out recordCount); dt.Columns.Add(new DataColumn("Departments")); //可以访问的部门数据 var rolelist = RoleDal.Instance.GetAll(); foreach (DataRow row in dt.Rows) { row["Departments"] = rolelist.First(n => n.KeyId == PublicMethod.GetInt(row["KeyId"])).Departments; } return(JSONhelper.FormatJSONForEasyuiDataGrid(recordCount, dt)); }
/// <summary> /// 设置用户的可用性 /// </summary> /// <param name="ctx">HTTP请求</param> private void SetUserEnabled(HttpContext ctx) { var vId = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("KeyId")); var vValue = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("isenabled")); vValue = vValue == "1" ? "0" : "1"; try { var vUser = Utils.UserInfo; var entity = RDIFrameworkService.Instance.UserService.GetEntity(vUser, vId); entity.Enabled = PublicMethod.GetInt(vValue); string statusMessage; string statusCode; RDIFrameworkService.Instance.UserService.UpdateUser(Utils.UserInfo, entity, out statusCode, out statusMessage); ctx.Response.Write(statusCode == StatusCode.OKUpdate.ToString() ? new JsonMessage { Success = true, Data = "1", Message = statusMessage }.ToString() : new JsonMessage { Success = false, Data = "0", Message = statusMessage }.ToString()); } catch (Exception ex) { ctx.Response.Write(new JsonMessage { Success = false, Data = "-1", Message = "发生异常信息:" + ex.Message }.ToString()); } }
/// <summary> /// 写cookie值(操作已经存在的cookie,存放数组形式参数) /// </summary> /// <param name="cookieName">cookies名字</param> /// <param name="strValuesName">cookie项的名称,cookie[strValuesName][]</param> /// <param name="strValue">cookie项的值,cookie[strValuesName][strValue]</param> /// <param name="cookieDomain">cookie域属性</param> public static void WriteCookie(string cookieName, string strValuesName, string strValue, string cookieDomain) { HttpCookie cookie = HttpContext.Current.Request.Cookies[cookieName]; if (cookie == null) { cookie = new HttpCookie(cookieName); cookie.Values[strValuesName] = HttpUtility.UrlEncode(strValue); } else { cookie.Values[strValuesName] = HttpUtility.UrlEncode(strValue); var httpCookie = HttpContext.Current.Request.Cookies[cookieName]; if (httpCookie != null && httpCookie["expires"] != null) { int intExpires = PublicMethod.GetInt(httpCookie["expires"], 0); if (intExpires > 0) { cookie.Values["expires"] = intExpires.ToString(); cookie.Expires = DateTime.Now.AddMinutes(intExpires); } } } if (cookieDomain != string.Empty && HttpContext.Current.Request.Url.Host.IndexOf(cookieDomain, System.StringComparison.Ordinal) > -1 && IsValidDomain(HttpContext.Current.Request.Url.Host)) { cookie.Domain = cookieDomain; } HttpContext.Current.Response.AppendCookie(cookie); }
private void onUptICSEOUT3() { try { DataTable table = _service.GetFinfo_RE_id0(); foreach (DataRow row in table.Rows) { var icsoutlist = V_ICSEOUTBILLDAL.Instance.GetWhere(new { FBILLNO = row["FBILLNO"] }).ToList(); if (icsoutlist.Count > 0) { ICSEOUTBILLENTRYDAL.Instance.UpdateWhatWhere( new { FINFO_RE_STATUS = row["Finfo_RE_status"], FINFO_RE_QTY = row["Finfo_RE_qty"] }, new { FENTRYID = row["FENTRYID"], FICSEOUTID = icsoutlist[0].FID }); } //将同步状态修改为3:华耐同步成功 _service.UpdateFinfo_RE_id(PublicMethod.GetInt(row["FID"])); } } catch (Exception ex) { LogHelper.WriteLog(ex); } }
public static DataTable GetPageWithSp(ProcCustomPage pcp, out int recordCount) { using (var conn = new SqlConnection(cs)) { using (var cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = pcp.Sp_PagerName; cmd.InjectFrom(new SetParamsValues().IgnoreFields("sp_pagername"), pcp); SqlParameter outputPara = new SqlParameter("@RecordCount", SqlDbType.Int); outputPara.Direction = ParameterDirection.Output; cmd.Parameters.Add(outputPara); conn.Open(); using (var da = new SqlDataAdapter(cmd)) { DataSet ds = new DataSet(); da.Fill(ds); cmd.Parameters.Clear(); recordCount = PublicMethod.GetInt(outputPara.Value); conn.Close(); return(ds.Tables[0]); } } } }
protected override void Inject(DataRow source, object target) { for (var i = 0; i < source.Table.Columns.Count; i++) { var activeTarget = target.GetProps().GetByName(source.Table.Columns[i].ToString(), true); if (activeTarget == null) { continue; } var value = source.ItemArray[i]; if (value == DBNull.Value) { continue; } if (activeTarget.PropertyType.Name == "Int32") { activeTarget.SetValue(target, PublicMethod.GetInt(value)); } else if (activeTarget.PropertyType.Name == "Boolean") { activeTarget.SetValue(target, PublicMethod.GetBool(value)); } else if (activeTarget.PropertyType.Name == "String") { activeTarget.SetValue(target, PublicMethod.GetString(value)); } else { activeTarget.SetValue(target, value); } } }
protected override void Inject(IDataReader source, object target) { for (var i = 0; i < source.FieldCount; i++) { var activeTarget = target.GetProps().GetByName(source.GetName(i), true); if (activeTarget == null) { continue; } var value = source.GetValue(i); if (value == DBNull.Value) { continue; } if (activeTarget.PropertyType.Name == "Int32") { activeTarget.SetValue(target, PublicMethod.GetInt(value)); } else if (activeTarget.PropertyType.Name == "Boolean") { activeTarget.SetValue(target, PublicMethod.GetBool(value)); } else { activeTarget.SetValue(target, value); } } }
private string GetAccordionTreeJsonByTable(DataTable tabel, string idCol, string txtCol, string rela, object pId) { result += tmpStr; tmpStr = string.Empty; if (tabel.Rows.Count <= 0) { return(result); } tmpStr += "["; var filer = string.Format("{0}='{1}'", rela, pId); var rows = tabel.Select(filer); if (rows.Length > 0) { foreach (var row in from row in rows let moduleType = BusinessLogic.ConvertToNullableInt(row[PiModuleTable.FieldModuleType]) let modulePublic = BusinessLogic.ConvertToNullableInt(row[PiModuleTable.FieldIsPublic]) where moduleType == null || moduleType == 2 || moduleType == 3 || modulePublic == 1 select row) { tmpStr += "{\"id\":\"" + row[idCol] + "\",\"text\":\"" + row[txtCol] + "\",\"iconCls\":\"" + BusinessLogic.ConvertToString(row[PiModuleTable.FieldIconCss]).Replace("icon ", "") + "\",\"attributes\":{" + "\"url\":\"" + row[PiModuleTable.FieldNavigateUrl] + "\",\"FullName\":\"" + row[PiModuleTable.FieldFullName] + "\"}"; if (tabel.Select(string.Format("{0}='{1}'", rela, row[idCol])).Length > 0) { tmpStr += PublicMethod.GetInt(row[PiModuleTable.FieldExpand]) == 1 ? ",\"state\":\"open\"" : ",\"state\":\"closed\""; tmpStr += ",\"children\":"; GetAccordionTreeJsonByTable(tabel, idCol, txtCol, rela, row[idCol]); result += tmpStr; tmpStr = string.Empty; } result += tmpStr; tmpStr = string.Empty; tmpStr += "},"; } tmpStr = tmpStr.Remove(tmpStr.Length - 1, 1); } else { if (!string.IsNullOrEmpty(result)) { result = result.TrimEnd(",\"children\":]".ToCharArray()); } } tmpStr += "]"; result += tmpStr; tmpStr = string.Empty; return(result); }
public string SetDepartment(FormCollection context) { UserBll.Instance.CheckUserOnlingState(); var roleid = PublicMethod.GetInt(Request["FID"]); var deps = Request["deps"]; return(UserBll.Instance.SetDepartments(roleid, deps).ToString()); }
public IEnumerable <Role> GetRolesBy(int userId) { string s = "select roleid from Sys_UserRoles where userid=@userid"; DataTable dt = SqlEasy.ExecuteDataTable(s, new SqlParameter("@userid", userId)); var list = from n in RoleDal.Instance.GetAll() where dt.AsEnumerable().Select(r => PublicMethod.GetInt(r[0])).ToArray <int>().Contains(n.KeyId) select n; return(list); }
public List <int> GetDepIDs(int userid) { List <int> list = new List <int>(); var dr = SqlEasy.ExecuteDataReader("select depid from Sys_Users_Departments where userid=@UserID", new SqlParameter("@UserID", userid)); while (dr.Read()) { list.Add(PublicMethod.GetInt(dr[0])); } return(list); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; UserBll.Instance.CheckUserOnlingState(); int k; var json = HttpContext.Current.Request["json"]; var rpm = new RequestParamModel <DemoRuKuDanModel>(context) { CurrentContext = context, Action = context.Request["action"], KeyId = PublicMethod.GetInt(context.Request["keyid"]) }; if (!string.IsNullOrEmpty(json)) { rpm = JSONhelper.ConvertToObject <RequestParamModel <DemoRuKuDanModel> >(json); rpm.CurrentContext = context; } switch (rpm.Action) { case "add": context.Response.Write(DemoRuKuDanBll.Instance.Add(rpm.Entity)); break; case "edit": DemoRuKuDanModel d = new DemoRuKuDanModel(); d.InjectFrom(rpm.Entity); d.KeyId = rpm.KeyId; context.Response.Write(DemoRuKuDanBll.Instance.Update(d)); break; case "delete": context.Response.Write(DemoRuKuDanBll.Instance.Delete(rpm.KeyId)); break; case "mx": var str = new SqlFilter(GroupOp.AND.ToString(), new FilterRule("rkdid", rpm.KeyId, "eq")); context.Response.Write( DemoRuKuDanMingXiBll.Instance.GetJson(rpm.Pageindex, rpm.Pagesize, str.ToString(), rpm.Sort, rpm.Order) ); break; default: context.Response.Write(DemoRuKuDanBll.Instance.GetJson(rpm.Pageindex, rpm.Pagesize, rpm.Filter, rpm.Sort, rpm.Order)); break; } }
/// <summary> /// 为指定的用户分配角色 /// </summary> /// <param name="userid">用户Id</param> /// <param name="roleIds">角色</param> /// <returns></returns> public int AddUserToRoles(int userid, string roleIds) { UserDal.Instance.DeleteRolesBy(userid); if (string.IsNullOrEmpty(roleIds)) { return(1); } var roleIdArr = roleIds.Split(','); var roleIdList = roleIdArr.Select(n => PublicMethod.GetInt(n)).ToArray(); return(UserDal.Instance.AddUserTo(userid, roleIdList)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //if (DateTime.Now.Month == 11 && DateTime.Now.Day > 30) //{ // context.Response.Write("<h1>试用期到啦,请联系QQ:406590790,获取正版,谢谢。</h2>"); // context.Response.End(); //} try { var username = PublicMethod.GetString(context.Request["uName"]); var password = PublicMethod.GetString(context.Request["uPwd"]); var systemType = PublicMethod.GetString(context.Request["systemType"]); var savedays = PublicMethod.GetInt(context.Request["cookieDay"]); var theme = PublicMethod.GetString(context.Request["theme"]); //皮肤 if (theme == "") { theme = "gray"; //默认皮肤 } HttpContext.Current.Session["theme"] = theme; var cook = new HttpCookie("theme") { Value = theme, Expires = DateTime.Now.AddDays(30) }; HttpContext.Current.Response.Cookies.Add(cook); string returnStatusCode = string.Empty; string returnStatusMessage = string.Empty; string permissionItemCode = string.Empty; // 登录验证 var userModel = Utils.LogOn(username, password, string.Empty, permissionItemCode, true, false, out returnStatusCode, out returnStatusMessage); if (userModel != null && returnStatusCode.Equals(StatusCode.OK.ToString())) { context.Response.Write("1"); } else if (userModel == null || !returnStatusCode.Equals(StatusCode.OK.ToString())) { context.Response.Write(!string.IsNullOrEmpty(returnStatusMessage) ? returnStatusMessage : "请检查您的用户名或密码!或者与管理员联系(QQ:406590790)。"); } } catch (Exception ex) { context.Response.Write(ex.Message); } }
public string LogClear(FormCollection context) { UserBll.Instance.CheckUserOnlingState(); var rpm = new RequestParamModel <LogModel>(context) { CurrentContext = context, Action = Request["action"], FID = PublicMethod.GetString(Request["FID"]) }; LogBll <object> log = new LogBll <object>(); int days = PublicMethod.GetInt(Request["days"]); return(log.ClearLog(days)); }
protected override void OnPreInit(EventArgs e) { string absolutePath = Request.Url.AbsolutePath.ToLower(); string dir = absolutePath.Substring(0, absolutePath.LastIndexOf('/')); if (SysVisitor.Instance.IsGuest) { if (absolutePath == dir + MainPage) { Response.Redirect(dir + LoginUrl, true); } var loginUrlWithVirturalDir = LoginUrl; if (dir.IndexOf(dir, System.StringComparison.Ordinal) > -1) { loginUrlWithVirturalDir = dir + LoginUrl; } Response.Write("<script>alert('亲,登录已过期!请重新登录哦。');window.top.location='" + loginUrlWithVirturalDir + "';</script>"); Response.End(); } UserId = SysVisitor.Instance.UserId; UserName = SysVisitor.Instance.UserName; NavId = PublicMethod.GetInt(Request["navid"]); if (NavId <= 0) { return; } if (!SysVisitor.Instance.IsAdmin) { if (!UserBll.Instance.HasMenu(UserId, NavId)) { Response.Write(AlertMessage("亲,您没有权限哦!", true)); Response.End(); } } PageButtons = UserBll.Instance.GetPageButtons(UserId, NavId); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var userName = context.Request["username"]; var password = context.Request["password"]; var validateCode = context.Request["validateCode"]; var saveCookieDays = PublicMethod.GetInt(context.Request["savedays"]); var msg = new { success = false, message = "亲,用户名不存在哦!仔细猜一哈。" }; var useValidateCode = ConfigHelper.GetValue("showValidateCode"); if (useValidateCode == "true" && !VcodePage.Validation(validateCode)) { msg = new { success = false, message = "亲,验证码不正确。" }; } else { User u = UserDal.Instance.GetUserBy(userName); if (u != null) { if (!u.IsDisabled) { bool flag = UserBll.Instance.UserLogin(userName, password, saveCookieDays); if (flag) { msg = new { success = true, message = "ok" }; } else { msg = new { success = false, message = "亲,用户名或密码不正确哦。" }; } } else { msg = new { success = false, message = "亲,您的帐号已被禁用,请联系管理员吧。" }; } } } context.Response.Write(JSONhelper.ToJson(msg)); context.Response.End(); }
/// <summary> /// 分页获取数据列表 适用于SQL2000 /// </summary> /// <param name="fieldlist">查找的字段</param> /// <param name="tablename">表名</param> /// <param name="where">查询条件</param> /// <param name="orderfield">排序字段 如 id asc,name desc</param> /// <param name="key">主键</param> /// <param name="pageindex">页索引</param> /// <param name="pagesize">每页记录数</param> /// <returns></returns> public static DataTable GetDataByPager2000(string fieldlist, string tablename, string where, string orderfield, string key, int pageindex, int pagesize, out int recordcount) { string cmd = "ProcCustomPage"; SqlParameter[] para = new SqlParameter[8]; para[0] = new SqlParameter("@tbname", tablename); para[1] = new SqlParameter("@FieldKey", key); para[2] = new SqlParameter("@WhereString", where); para[3] = new SqlParameter("@PageSize", pagesize); para[4] = new SqlParameter("@PageCurrent", pageindex); para[5] = new SqlParameter("@FieldOrder", orderfield); para[6] = new SqlParameter("@FieldShow", fieldlist); para[7] = new SqlParameter("@RecordCount", SqlDbType.Int); para[7].Direction = ParameterDirection.Output; DataTable dt = SqlHelper.ExecuteDataset(connString, CommandType.StoredProcedure, cmd, para).Tables[0]; recordcount = PublicMethod.GetInt(para[7].Value); return(dt); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; if (SysVisitor.Instance.IsGuest) { context.Response.Write( new JsonMessage { Success = false, Data = "-99", Message = "登录已过期,请重新登录" }.ToString() ); context.Response.End(); } var rpm = new RequestParamModel <LogModel>(context) { CurrentContext = context, Action = context.Request["action"], KeyId = PublicMethod.GetInt(context.Request["keyid"]) }; switch (rpm.Action) { case "logdetail": context.Response.Write(JSONhelper.ToJson(LogDetailDal.Instance.GetBy(rpm.KeyId).ToList())); break; case "clearlog": LogBll <object> log = new LogBll <object>(); int days = PublicMethod.GetInt(context.Request["days"]); context.Response.Write(log.ClearLog(days)); break; default: string s = LogDal.Instance.JsonDataForEasyUIdataGrid(rpm.Pageindex, rpm.Pagesize, rpm.Filter); context.Response.Write(s); break; } }
public List <int> GetDepIDs(int userid, bool withRoles = false) { User u = GetUser(userid); if (u != null) { List <int> deps = UserDal.Instance.GetDepIDs(u.KeyId); if (withRoles) { var roles = u.Roles; string[] strArr; if (roles.Any()) { foreach (Role r in roles) { if (!string.IsNullOrEmpty(r.Departments)) { strArr = r.Departments.Split(','); foreach (string depid in strArr) { int depID = PublicMethod.GetInt(depid); if (deps.Contains(depID)) { continue; } deps.Add(depID); } } } } } return(deps); } return(new List <int>()); }
public string GetJsonData(int pageindex, int pagesize, string filterJson, string sort, string order) { var pcp = new ProcCustomPage("sys_Users") { PageIndex = pageindex, PageSize = pagesize, OrderFields = sort + " " + order, WhereString = FilterTranslator.ToSql(filterJson) }; var users = UserDal.Instance.GetAll(); int recordCount; DataTable dt = UserDal.Instance.GetPageWithSp(pcp, out recordCount); dt.Columns.Add(new DataColumn("depname")); dt.Columns.Add(new DataColumn("Departments")); //可以访问的部门数据 var departments = DepartmentDal.Instance.GetAll().ToList(); foreach (DataRow row in dt.Rows) { var row1 = row; var dep = departments.Where(n => row1 != null && n.KeyId == (int)row1["departmentid"]); var enumerable = dep as Department[] ?? dep.ToArray(); if (enumerable.Any()) { row["depname"] = enumerable.First().DepartmentName; } else { row["depname"] = ""; } var userList = users as IList <User> ?? users.ToList(); row["Departments"] = userList.First(n => n.KeyId == PublicMethod.GetInt(row["KeyId"])).Departments; } return(JSONhelper.FormatJSONForEasyuiDataGrid(recordCount, dt)); }
private void onUptTMP_STOCKBill() { DataTable table = _service.GetTMP_STOCKBill(); string billno = ""; string billid = ""; foreach (DataRow row in table.Rows) { if (billno != row["FBILLNO"].ToString()) { ICSTOCKBILLMODEL model = new ICSTOCKBILLMODEL(); model.FACCOUNT = PublicMethod.GetString(row["FACCOUNT"]); model.FBILLNO = PublicMethod.GetString(row["FBILLNO"]); model.FSYNCSTATUS = PublicMethod.GetInt(row["FSYNCSTATUS"]); billid = ICSTOCKBILLDAL.Instance.Insert(model); } ICSTOCKBILLENTRYMODEL entryModel = new ICSTOCKBILLENTRYMODEL(); entryModel.ICSTOCKBILLID = billid; entryModel.FENTRYID = PublicMethod.GetDecimal(row["FENTRYID"]); entryModel.FSRCCODE = PublicMethod.GetString(row["FSRCCODE"]); entryModel.FSRCMODEL = PublicMethod.GetString(row["FSRCMODEL"]); entryModel.FBATCHNO = PublicMethod.GetString(row["FBATCHNO"]); entryModel.FCOLORNO = PublicMethod.GetString(row["FCOLORNO"]); entryModel.FAUDQTY = PublicMethod.GetDecimal(row["FAUDQTY"]); entryModel.FBASENUMBER = PublicMethod.GetString(row["FBASENUMBER"]); entryModel.FSTOCKNUMBER = PublicMethod.GetString(row["FSTOCKNUMBER"]); entryModel.FSTOCKNAME = PublicMethod.GetString(row["FSTOCKNAME"]); entryModel.FSPNUMBER = PublicMethod.GetString(row["FSPNUMBER"]); entryModel.FSPNAME = PublicMethod.GetString(row["FSPNAMEFACCOUNT"]); entryModel.FREMARK = PublicMethod.GetString(row["FREMARKFACCOUNT"]); ICSTOCKBILLENTRYDAL.Instance.Insert(entryModel); billno = row["FBILLNO"].ToString(); } }
private void onUptICSEOUT2() { try { DataTable table = _service.GetICSEOUTUpdateData2(); foreach (DataRow row in table.Rows) { int syncstatus = PublicMethod.GetInt(row["FSYNCSTATUS"]); if (syncstatus == 2) //2:厂家更新成功 { var icsoutlist = V_ICSEOUTBILLDAL.Instance.GetWhere(new { FBILLNO = row["FBILLNO"] }).ToList(); if (icsoutlist.Count > 0) { ICSEOUTBILLENTRYDAL.Instance.UpdateWhatWhere( new { //FCOMMITQTY = row["FCOMMITQTY"], //FBATCHNO = row["FBATCHNO"], //FCOLORNO = row["FCOLORNO"], //FLEVEL = row["FGRADE"], //FPRICE = row["FPRICE"], //FAMOUNT = row["FAMOUNT"], FERR_MESSAGE = row["FERR_MESSAGE"] }, new { FENTRYID = row["FENTRYID"], FICSEOUTID = icsoutlist[0].FID }); ICSEOUTBILLDAL.Instance.UpdateWhatWhere(new { FSTATUS = 5, FSYNCSTATUS = 2, FSRCBILLNO = row["codetg"] }, new { FID = icsoutlist[0].FID }); } //将同步状态修改为3:华耐同步成功 _service.UpdateCSEOUTSyncStatus2(PublicMethod.GetInt(row["FID"]), 3); } else if (syncstatus == -1) //1:厂家同步成功; -1: 数据检查不通过 { var icsoutlist = V_ICSEOUTBILLDAL.Instance.GetWhere(new { FBILLNO = row["FBILLNO"] }).ToList(); if (icsoutlist.Count > 0) { ICSEOUTBILLENTRYDAL.Instance.UpdateWhatWhere( new { FERR_MESSAGE = row["FERR_MESSAGE"] }, new { FENTRYID = row["FENTRYID"], FICSEOUTID = icsoutlist[0].FID }); int count = ICSEOUTBILLDAL.Instance.UpdateWhatWhere( new { FSYNCSTATUS = -1 }, new { FID = icsoutlist[0].FID }); LogHelper.WriteLog("FID=" + icsoutlist[0].FID + ",FSYNCSTATUS=" + row["FSYNCSTATUS"]); if (count > 0) { //将同步状态修改为-3:错误处理成功 _service.UpdateCSEOUTSyncStatus2(PublicMethod.GetInt(row["FID"]), -3); } } } } } catch (Exception ex) { LogHelper.WriteLog(ex); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; UserBll.Instance.CheckUserOnlingState(); int k; var json = HttpContext.Current.Request["json"]; var rpm = new RequestParamModel <User>(context) { CurrentContext = context, Action = context.Request["action"] }; if (!string.IsNullOrEmpty(json)) { rpm = JSONhelper.ConvertToObject <RequestParamModel <User> >(json); rpm.CurrentContext = context; } switch (rpm.Action) { case "deps": context.Response.Write(UserBll.Instance.GetDepartmentTreeData()); break; case "roles": context.Response.Write(UserBll.Instance.GetAllRoles()); break; case "add": var roleIds = rpm.Request("roles"); context.Response.Write(UserBll.Instance.AddUser(rpm.Entity, roleIds)); break; case "update": User u = new User(); u.InjectFrom(rpm.Entity); u.KeyId = rpm.KeyId; context.Response.Write(UserBll.Instance.EditUser(u)); break; case "editpass": k = UserBll.Instance.EditPassword(rpm.KeyId, rpm.Request("password")); context.Response.Write(k); break; case "editpass2": string oldPass = context.Request["old"]; string newPass = context.Request["new"]; context.Response.Write(UserBll.Instance.EditPassowrd(SysVisitor.Instance.UserId, oldPass, newPass)); break; case "delete": //删除用户 context.Response.Write(UserBll.Instance.DeleteUser(rpm.KeyId)); break; case "isadmin": u = UserBll.Instance.GetUser(rpm.KeyId); if (u != null) { var isamdin = rpm.Request("val"); u.IsAdmin = isamdin != "true"; context.Response.Write(UserBll.Instance.EditUser(u)); } else { context.Response.Write(0); } break; case "isdisabled": //禁用 激活 帐号 u = UserBll.Instance.GetUser(rpm.KeyId); if (u != null) { var isdisabled = rpm.Request("val"); u.IsDisabled = isdisabled != "true"; context.Response.Write(UserBll.Instance.EditUser(u)); } else { context.Response.Write(0); } break; case "setroles": //为用户分配角色 var rolse = rpm.Request("roles"); k = UserBll.Instance.AddUserToRoles(rpm.KeyId, rolse); context.Response.Write(k); break; case "getroles": //获取指定用户的角色 context.Response.Write(UserBll.Instance.GetRolesBy(rpm.KeyId)); break; case "menus": //获取导航菜单及按钮用于用户授权 context.Response.Write(UserBll.Instance.GetNavBtnsJson(rpm.KeyId)); break; case "authorize": //为用户授权 var data = rpm.Request("data"); if (string.IsNullOrEmpty(data)) { context.Response.Write("参数错误!"); context.Response.End(); } k = UserBll.Instance.UserAuthorize(data); context.Response.Write(k); break; case "setdep": var roleid = PublicMethod.GetInt(context.Request["keyid"]); var deps = context.Request["deps"]; k = UserBll.Instance.SetDepartments(roleid, deps); context.Response.Write(k); break; default: string j = UserBll.Instance.GetJsonData(rpm.Pageindex, rpm.Pagesize, rpm.Filter, rpm.Sort, rpm.Order); context.Response.Write(j); break; } }
public override void ProcessRequest(HttpContext context) { //初始化密码 string passalt = StringHelper.RandomString(4); string pwd = StringHelper.MD5string("111111" + passalt); //初始化密码 string pwdss = StringHelper.MD5string("111111" + StringHelper.RandomString(4)); context.Response.ContentType = "text/plain"; var username = context.Request["username"]; var password = context.Request["password"]; var validateCode = context.Request["validateCode"]; var saveCookieDays = PublicMethod.GetInt(context.Request["savedays"]); var msg = new { success = false, message = "用户名不存在" }; //Session登录 if (Sys_User != null) { msg = new { success = true, message = "ok" }; } else { if (!Validate.Validation(validateCode)) { msg = new { success = false, message = "验证码错误" }; } else { try { Mod_Sys_User u = S_KYA_Core.Dal.Dal_Sys_User.Instance.testGetUser(username); if (u != null) { if (!u.IsDisabled) { bool flag = Bll_Sys_User.Instance.UserLogin(username, password, saveCookieDays); if (flag) { msg = new { success = true, message = "ok" }; u.ExpiresTime = DateTime.Now.AddDays(saveCookieDays); Sys_User = u; } else { msg = new { success = false, message = "亲,用户名或密码不正确哦。" }; } } else { msg = new { success = false, message = "亲,您的帐号已被禁用,请联系管理员吧。" }; } //msg = new { success = true, message = "ok" };//跳过验证,随便都可以登录 } else { msg = new { success = false, message = "亲,用户名或密码不正确哦。" }; } } catch (Exception ex) { msg = new { success = false, message = $"系统错误:【{ex.Message}】请联系开发人员" }; } } } context.Response.Write(JSONhelper.ToJson(msg)); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; if (SysVisitor.Instance.IsGuest) { context.Response.Write( new JsonMessage { Success = false, Data = "-99", Message = "登录已过期,请重新登录" }.ToString() ); context.Response.End(); } int k; var json = HttpContext.Current.Request["json"]; var rpm = new RequestParamModel <Dic>(context) { CurrentContext = context, Action = context.Request["action"] }; if (!string.IsNullOrEmpty(json)) { rpm = JSONhelper.ConvertToObject <RequestParamModel <Dic> >(json); rpm.CurrentContext = context; } switch (rpm.Action) { case "category": //读取字典类别 context.Response.Write(DicBll.Instance.DicCategoryJson()); break; case "add_cate": //添加字典类别 var dc = new DicCategory { Code = rpm.Request("code"), Title = rpm.Request("title"), Sortnum = PublicMethod.GetInt(rpm.Request("sortnum")), Remark = rpm.Request("remark") }; AddCategory(dc, context); break; case "edit_cate": dc = new DicCategory { KeyId = PublicMethod.GetInt(rpm.Request("keyid")), Code = rpm.Request("code"), Title = rpm.Request("title"), Sortnum = PublicMethod.GetInt(rpm.Request("sortnum")), Remark = rpm.Request("remark") }; EditCategory(dc, context); break; case "del_cate": var cateId = PublicMethod.GetInt(rpm.Request("cateId")); DelCategory(cateId, context); break; case "add": k = DicBll.Instance.Add(rpm.Entity); context.Response.Write(new JsonMessage { Success = k > 0, Data = k.ToString(), Message = (k > 0 ? "添加成功!" : "字典编码已存在,请更改编码。") }.ToString()); break; case "edit": if (rpm.KeyId == rpm.Entity.ParentId) { context.Response.Write(new JsonMessage { Success = false, Data = "0", Message = "上级字典不能与当前字典相同!" }.ToString()); context.Response.End(); } Dic d = new Dic(); d.InjectFrom(rpm.Entity); d.KeyId = rpm.KeyId; k = DicBll.Instance.Edit(d); context.Response.Write(new JsonMessage { Success = k > 0, Data = k.ToString(), Message = (k > 0 ? "编辑成功!" : "字典编码已存在,请更改编码。") }.ToString()); break; case "del": k = DicBll.Instance.Delete(rpm.KeyId); var msg = "删除成功。"; switch (k) { case 0: msg = "参数错误!"; break; case 2: msg = "请先删除子字典数据。"; break; } context.Response.Write(new JsonMessage { Success = k == 1, Data = k.ToString(), Message = msg }.ToString()); break; case "code": var category = DicCategoryDal.Instance.GetWhere(new { Code = rpm.Request("code") }).FirstOrDefault(); context.Response.Write(DicBll.Instance.GetDicListBy(category == null ? 0 : category.KeyId)); break; default: //字典列表 var categoryId = PublicMethod.GetInt(rpm.Request("categoryId")); string dicJson = DicBll.Instance.GetDicListBy(categoryId); context.Response.Write(dicJson); break; } }
public int GetUsersCountByDepartment(int depid) { string sql = "select count(*) from Sys_Users_Departments where depid=@depid"; return(PublicMethod.GetInt(SqlEasy.ExecuteScalar(sql, new SqlParameter("@depid", depid)))); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var json = HttpContext.Current.Request["json"]; var rpm = new RequestParamModel <bookhelp.Model.PressInfo>(context) { CurrentContext = context, Action = context.Request["action"], KeyId = PublicMethod.GetInt(context.Request["id"]) }; if (!string.IsNullOrEmpty(json)) { rpm = JSONhelper.ConvertToObject <RequestParamModel <bookhelp.Model.PressInfo> >(json); rpm.CurrentContext = context; //rpm.KeyId = PublicMethod.GetInt(context.Request["id"]); } int k = 0; switch (rpm.Action) { case "add": //添加 string textPressName = context.Request["textPressName"]; string textPressAddress = context.Request["textPressAddress"]; string textPressPhone = context.Request["textPressPhone"]; PressInfo info = new PressInfo(); info.PressName = textPressName; info.PressAddress = textPressAddress; info.PressPhone = textPressPhone; PressInfoBll.Instance.SavePress(info); context.Response.Write(new JsonMessage { Data = k.ToString(), Message = "添加成功", Success = true }.ToString()); break; case "edit": //修改 string uid = context.Request["ID"]; string utextPressName = context.Request["textPressName"]; string utextPressAddress = context.Request["textPressAddress"]; string utextPressPhone = context.Request["textPressPhone"]; PressInfo uinfo = new PressInfo(); uinfo.ID = Int32.Parse(uid); uinfo.PressName = utextPressName; uinfo.PressAddress = utextPressAddress; uinfo.PressPhone = utextPressPhone; PressInfoBll.Instance.UpdatePress(uinfo); context.Response.Write(new JsonMessage { Data = k.ToString(), Message = "修改成功", Success = true }.ToString()); break; case "delete": string did = context.Request["id"]; PressInfo dinfo = new PressInfo(); dinfo.ID = Int32.Parse(did); //bool result = BookInfoBll.DeleteBook(dinfo); PressInfoBll bll = new PressInfoBll(); //bll.DeleteBook(dinfo); if (bll.DeletePress(dinfo)) { context.Response.Write("ok"); } else { context.Response.Write("no"); } break; case "search": //string bookName = context.Request["bookName"]; //string pressName = context.Request["pressName"]; //string sn = context.Request["sn"]; //string priceLow = context.Request["priceLow"]; //string priceHigh = context.Request["priceHigh"]; context.Response.Write(JsonDataForEasyUIdataGrid(rpm.Pageindex, rpm.Pagesize, rpm.Filter)); break; case "list": var r = PressInfoBll.Instance.GetPressInfo(); context.Response.Write(r); //context.Response.Write(JsonDataForEasyUIdataGrid2(rpm.Pageindex, rpm.Pagesize, rpm.Filter)); break; default: context.Response.Write(JsonDataForEasyUIdataGrid(rpm.Pageindex, rpm.Pagesize, rpm.Filter)); break; } }