public ResResultModel ChangePassword(string username, string oldPassword, string password) { try { MenusDataProxy.ValidateAccess((int)EnumOperationAccess.编辑, true); if (string.IsNullOrWhiteSpace(username)) { username = HttpContext.Current.User.Identity.Name; } if (!Regex.IsMatch(password, Membership.PasswordStrengthRegularExpression)) { return(ResResult.Response(false, MC.Login_InvalidPassword, "")); } if (!Membership.ValidateUser(username, oldPassword)) { return(ResResult.Response(false, MC.Login_InvalidOldPsw, "")); } if (!Membership.GetUser(username).ChangePassword(oldPassword, password)) { return(ResResult.Response(false, MC.M_Save_Error, "")); } return(ResResult.Response(true, "", "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel GetSiteMultiList(ListModel model) { try { MenusDataProxy.ValidateAccess((int)EnumOperationAccess.浏览, true); var bll = new SiteMulti(); int totalRecord = 0; StringBuilder sqlWhere = null; ParamsHelper parms = null; if (!string.IsNullOrWhiteSpace(model.Keyword)) { parms = new ParamsHelper(); sqlWhere = new StringBuilder("and (Coded like @Keyword or Named like @Keyword) "); var parm = new SqlParameter("@Keyword", SqlDbType.NVarChar, 50); parm.Value = parm.Value = "%" + model.Keyword + "%"; parms.Add(parm); } var list = bll.GetListByJoin(model.PageIndex, model.PageSize, out totalRecord, sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray()); return(ResResult.Response(true, "", JsonConvert.SerializeObject(list))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
private void GetInfo(HttpContext context, string reqName) { MenusDataProxy.ValidateAccess((int)EnumData.EnumOperationAccess.浏览, true); var Id = context.Request.Form["Id"]; switch (reqName) { case "GetOrderPickProductInfo": GetOrderPickProductInfo(context, Guid.Parse(Id)); break; case "GetShelfMissionProductInfo": GetShelfMissionProductInfo(context, Guid.Parse(Id)); break; case "GetInfoneCustomerInfo": GetInfoneCustomerInfo(context, Guid.Parse(Id)); break; case "GetInfoneProjectReportPrepareInfo": GetInfoneProjectReportPrepareInfo(context, Guid.Parse(Id)); break; default: break; } }
public ResResultModel ResetPassword(string username) { try { MenusDataProxy.ValidateAccess((int)EnumOperationAccess.编辑, true); if (!Membership.EnablePasswordReset) { return(ResResult.Response(false, "系统不允许重置密码操作,请联系管理员", "")); } var user = Membership.GetUser(username); if (user == null) { return(ResResult.Response(false, "用户【" + username + "】不存在或已被删除,请检查", "")); } string rndPsw = new Random().Next(100000, 999999).ToString(); if (!user.ChangePassword(user.ResetPassword(), rndPsw)) { return(ResResult.Response(false, "重置密码失败,请稍后再重试", "")); } return(ResResult.Response(true, "调用成功", rndPsw)); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DeleteCustomer(string itemAppend) { try { MenusDataProxy.ValidateAccess((int)EnumData.EnumOperationAccess.除, true); if (string.IsNullOrWhiteSpace(itemAppend)) { return(ResResult.Response(false, MC.Request_Params_InvalidError, "")); } var items = itemAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var bll = new Customer(); if (!bll.DeleteBatch((IList <object>)items.ToList <object>())) { return(ResResult.Response(false, MC.M_Save_Error, "")); } return(ResResult.Response(true, MC.M_Save_Ok, "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DeleteOrderMake(string itemAppend) { try { MenusDataProxy.ValidateAccess((int)EnumData.EnumOperationAccess.除, true); if (string.IsNullOrWhiteSpace(itemAppend)) { return(ResResult.Response(false, MC.Request_Params_InvalidError, "")); } var items = itemAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var bll = new OrderMake(); var opBll = new OrderProcess(); var effect = 0; foreach (var item in items) { var orderId = Guid.Parse(item); effect += bll.Delete(orderId); effect += opBll.DeleteByOrder(orderId); } return(ResResult.Response(true, MC.M_Save_Ok, "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel SaveContentType(ContentTypeFmModel model) { try { if (model == null) { return(ResResult.Response(false, MC.Request_Params_InvalidError, null)); } if (string.IsNullOrWhiteSpace(model.Named) || string.IsNullOrWhiteSpace(model.AppCode)) { return(ResResult.Response(false, MC.Request_Params_InvalidError, null)); } var Id = Guid.Empty; var parentId = Guid.Empty; if (model.Id != null && !string.IsNullOrWhiteSpace(model.Id.ToString())) { Guid.TryParse(model.Id.ToString(), out Id); } if (model.ParentId != null && !string.IsNullOrWhiteSpace(model.ParentId.ToString())) { Guid.TryParse(model.ParentId.ToString(), out parentId); } var openness = (byte)EnumData.Openness.完全公开; var currTime = DateTime.Now; var bll = new ContentType(); int effect = 0; if (bll.IsExistCode(model.Coded, Id)) { return(ResResult.Response(false, MC.GetString(MC.Params_CodeExistError, model.Coded), Id)); } var modelInfo = new ContentTypeInfo(model.AppCode, Id, WebCommon.GetUserId(), model.Coded, model.Named, parentId, model.Step.Trim(','), model.FlagName, openness, model.Sort, model.Remark, currTime, currTime); if (modelInfo.Id.Equals(Guid.Empty)) { MenusDataProxy.ValidateAccess((int)EnumData.OperationAccess.新增, true); modelInfo.Id = Guid.NewGuid(); modelInfo.Step = modelInfo.Id.ToString() + "," + modelInfo.Step; effect = bll.InsertByOutput(modelInfo); } else { MenusDataProxy.ValidateAccess((int)EnumData.OperationAccess.编辑, true); effect = bll.Update(modelInfo); } if (effect < 1) { return(ResResult.Response(false, MC.M_Save_Error, null)); } return(ResResult.Response(true, MC.M_Save_Ok, modelInfo.Id)); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, null)); } }
public ResResultModel GetRolesForUser(string userName) { try { MenusDataProxy.ValidateAccess((int)EnumOperationAccess.浏览, true); string[] roles = Roles.GetRolesForUser(userName); if (roles.Length == 0) { return(ResResult.Response(false, MC.M_DataEmpty, "")); } return(ResResult.Response(true, "", string.Join(",", roles))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel GetUserList(ListModel model) { try { MenusDataProxy.ValidateAccess((int)EnumOperationAccess.浏览, true); var totalRecord = 0; var users = Membership.GetAllUsers((model.PageIndex - 1), model.PageSize, out totalRecord); var list = new List <ComboboxInfo>(); foreach (MembershipUser user in users) { list.Add(new ComboboxInfo(user.ProviderUserKey.ToString(), user.UserName)); } return(ResResult.Response(true, "", "{\"total\":" + totalRecord + ",\"rows\":" + JsonConvert.SerializeObject(list) + "}")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DeleteContentType(string appCode, Guid Id) { try { if (Id.Equals(Guid.Empty)) { return(ResResult.Response(false, MC.Request_Params_InvalidError, null)); } var bll = new ContentType(); if (bll.IsExistChild(Id)) { return(ResResult.Response(false, MC.M_DeleteTreeNodeError, null)); } MenusDataProxy.ValidateAccess((int)EnumData.OperationAccess.除, true); return(ResResult.Response(bll.Delete(appCode, Id) > 0, "", null)); } catch (Exception ex) { return(ResResult.Response(false, "操作异常:" + ex.Message + "", null)); } }
public ResResultModel CheckUserName(string userName) { if (string.IsNullOrWhiteSpace(userName)) { return(ResResult.Response(false, "参数不能为空字符串", "-1")); } try { MenusDataProxy.ValidateAccess((int)EnumOperationAccess.浏览, true); MembershipUser user = Membership.GetUser(userName); if (user != null) { return(ResResult.Response(true, "调用成功", 1)); } return(ResResult.Response(true, "调用成功", 0)); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel GetUsersInRole(string roleName) { try { MenusDataProxy.ValidateAccess((int)EnumOperationAccess.浏览, true); string[] users = Roles.GetUsersInRole(roleName); if (users.Length == 0) { return(ResResult.Response(false, "", "")); } var list = new List <ComboboxInfo>(); foreach (var item in users) { list.Add(new ComboboxInfo(item, item)); } return(ResResult.Response(true, "", "{\"total\":" + list.Count + ",\"rows\":" + JsonConvert.SerializeObject(list) + "}")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
private void GetList(HttpContext context, string reqName) { MenusDataProxy.ValidateAccess((int)EnumData.EnumOperationAccess.浏览, true); int pageIndex = 1, pageSize = 10; if (!string.IsNullOrWhiteSpace(context.Request.Form["PageIndex"])) { int.TryParse(context.Request.Form["PageIndex"], out pageIndex); } if (!string.IsNullOrWhiteSpace(context.Request.Form["PageSize"])) { int.TryParse(context.Request.Form["PageSize"], out pageSize); } var parentId = Guid.Empty; if (!string.IsNullOrWhiteSpace(context.Request.Form["ParentId"])) { Guid.TryParse(context.Request.Form["ParentId"], out parentId); } var keyword = context.Request.Form["Keyword"]; var typeName = context.Request.Form["TypeName"]; switch (reqName) { case "GetMesProductList": GetMesProductList(context, pageIndex, pageSize, keyword); break; case "GetMesOrderList": GetMesOrderList(context, pageIndex, pageSize, keyword); break; case "GetRFIDList": GetRFIDList(context, pageIndex, pageSize, keyword); break; case "GetOrderSendList": GetOrderSendList(context, pageIndex, pageSize, keyword); break; case "GetLogisticsDistributionList": GetLogisticsDistributionList(context, pageIndex, pageSize, keyword); break; case "GetZoneList": GetZoneList(context, pageIndex, pageSize, keyword); break; case "GetStockLocationList": GetStockLocationList(context, pageIndex, pageSize, keyword); break; case "GetSupplierList": GetSupplierList(context, pageIndex, pageSize, keyword); break; case "GetCustomerList": GetCustomerList(context, pageIndex, pageSize, keyword); break; case "GetCompanyList": GetCompanyList(context, pageIndex, pageSize, keyword); break; case "GetVehicleList": GetVehicleList(context, pageIndex, pageSize, keyword); break; case "GetSiteMultiList": GetSiteMultiList(context, pageIndex, pageSize, keyword); break; case "GetInfoneDeviceBorrowRecordList": GetInfoneDeviceBorrowRecordList(context, pageIndex, pageSize, keyword, typeName); break; case "GetInfoneCustomerList": GetInfoneCustomerList(context, pageIndex, pageSize, keyword, typeName, parentId); break; case "GetInfoneProjectReportPrepareList": GetInfoneProjectReportPrepareList(context, pageIndex, pageSize, keyword, typeName, parentId); break; case "GetInfoneDeviceRepairRecordList": GetInfoneDeviceRepairRecordList(context, pageIndex, pageSize, keyword); break; default: break; } }