public ResResultModel GetOrderPickedList(OrderSendModel model) { try { if (model.PageIndex < 1) { model.PageIndex = 1; } if (model.PageSize < 1) { model.PageSize = 10; } int totalRecord = 0; var bll = new OrderPicked(); var sb = new StringBuilder(300); var parms = new ParamsHelper(); if (!string.IsNullOrWhiteSpace(model.Keyword)) { sb.Append("and (op.OrderCode like @Keyword) "); var parm = new SqlParameter("@Keyword", SqlDbType.NVarChar, 50); parm.Value = model.Keyword; parms.Add(parm); } var list = bll.GetListByJoin(model.PageIndex, model.PageSize, out totalRecord, sb.ToString(), parms.ToArray()); return(ResResult.Response(true, "", JsonConvert.SerializeObject(list))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel GetAssetInStoreModel(object Id) { try { Guid gId = Guid.Empty; if (Id != null) { Guid.TryParse(Id.ToString(), out gId); } if (gId.Equals(Guid.Empty)) { return(ResResult.Response(false, "请求参数值“" + Id + "”不正确", "")); } var bll = new AssetInStore(); var model = bll.GetModel(gId); if (model == null) { return(ResResult.Response(false, "参数值“" + Id + "”对应数据不存在或已被删除", "")); } return(ResResult.Response(true, "调用成功", JsonConvert.SerializeObject(model))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DeleteContentDetail(string itemAppend) { try { if (string.IsNullOrWhiteSpace(itemAppend)) { return(ResResult.Response(false, MC.Request_Params_InvalidError, "")); } var items = itemAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var bll = new ContentDetail(); if (bll.DeleteBatch((IList <object>)items.ToList <object>())) { foreach (var item in items) { DeleteContentFile(item); } } return(ResResult.Response(true, MC.M_Save_Ok, "")); } 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, "")); } }
public ResResultModel GetCbbCompany() { try { var bll = new Company(); var list = bll.GetList(); if (list == null || list.Count() == 0) { return(ResResult.Response(true, "", "[]")); } var cbbList = new List <ComboboxModel>(); foreach (var item in list) { cbbList.Add(new ComboboxModel { Id = item.Id.ToString(), Text = string.Format("{0}{1}", item.Coded, item.Named) }); } return(ResResult.Response(true, "", JsonConvert.SerializeObject(cbbList))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
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 GetMenusTreeChildrenByParentId(Guid parentId) { try { var userMenuList = MenusDataProxy.GetUserMenus(); if (userMenuList == null || userMenuList.Count() == 0) { return(ResResult.Response(false, MC.Data_InvalidExist, "")); } var parentInfo = userMenuList.FirstOrDefault(m => m.Id.Equals(parentId)); if (parentInfo == null) { return(ResResult.Response(false, MC.Data_InvalidExist, "")); } var sb = new StringBuilder(); var bll = new SiteMenus(); bll.CreateTreeJson(userMenuList, parentInfo.Id, ref sb); return(ResResult.Response(true, "", sb.ToString())); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel ResetPassword(string username) { try { if (!HttpContext.Current.User.IsInRole("Administrators")) { return(ResResult.Response(false, MC.Role_InvalidError, "")); } 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 GetMenusChildrenByParentName(string parentName) { try { List <MenusInfo> userMenuList = MenusDataProxy.GetUserMenus(); var parentInfo = userMenuList.FirstOrDefault(m => (m.Title == parentName)); if (parentInfo == null) { return(ResResult.Response(false, MC.Data_InvalidExist, "")); } var childData = userMenuList.Where(m => (m.ParentId == parentInfo.Id)); if (childData == null) { return(ResResult.Response(false, MC.Data_InvalidExist, "")); } //var list = MenusDataProxy.GetList(); //var childData = list.Where(m => m.ParentId == list.First(mm => mm.Title == parentName).Id); return(ResResult.Response(true, "", JsonConvert.SerializeObject(childData))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel SendPush(PushFmModel model) { try { JPushHelper jpush = new JPushHelper(); JPushOptionInfo pushOptionInfo = null; if (!string.IsNullOrWhiteSpace(model.Alias)) { pushOptionInfo = new JPushOptionInfo { Title = model.Title, Content = model.Content, Alias = model.Alias, PushPayloadType = EnumPushPayloadType.Alias } } ; else { pushOptionInfo = new JPushOptionInfo { Title = model.Title, Content = model.Content, PushPayloadType = EnumPushPayloadType.All } }; var isOk = jpush.SendPush(pushOptionInfo); if (!isOk) { return(ResResult.Response(false, MC.M_Save_Error, "")); } return(ResResult.Response(true, "", "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DelRole(string itemAppend) { try { if (!HttpContext.Current.User.IsInRole("Administrators")) { return(ResResult.Response(false, MC.Role_InvalidError, "")); } itemAppend = itemAppend.Trim(); if (string.IsNullOrEmpty(itemAppend)) { return(ResResult.Response(false, MC.Submit_InvalidRow, "")); } string[] roleIds = itemAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string item in roleIds) { Roles.DeleteRole(item); } return(ResResult.Response(true, "调用成功", "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public string SaveBatchTaskCargoInfo(string pno, string oper, string rno, string bno, string boxno, string tocid, string tobno, string otype, string odate) { try { new CustomException(string.Format("SaveBatchTaskCargoInfo--pno:{0},oper:{1},rno:{2},bno:{3},boxno:{4},tocid:{5},tobno:{6},otype:{7},odate:{8}", pno, oper, rno, bno, boxno, tocid, tobno, otype, odate)); string otypeIndex = "0"; if (!string.IsNullOrWhiteSpace(otype)) { otypeIndex = EnumHelper.GetValue(typeof(EnumData.OType), otype).ToString(); } var date = DateTime.Parse("1754-01-01"); DateTime.TryParse(odate, out date); var bll = new TPDATaskBank(); var currTime = DateTime.Now.ToString("yyyy-MM-dd"); int effect = bll.SaveBatchTaskCargoInfo(currTime, pno, oper, rno, bno, boxno, tocid, tobno, otypeIndex, date.ToString("yyyy-MM-dd"), currTime); if (effect > 0) { return(ResResult.ResJsonString(true, "", "")); } return(ResResult.ResJsonString(false, MC.M_Save_Error, "")); } catch (Exception ex) { new CustomException("SaveBatchTaskCargoInfo--", ex); return(ResResult.ResJsonString(false, ex.Message, "")); } }
public ResResultModel SaveBarcodeScanQueue(BarcodeScanQueueModel model) { try { var list = new List <ComboboxInfo>(); var bsaBll = new BarcodeScanAsyn(); var sItemBody = HttpUtility.UrlDecode(model.ItemBody); new CustomException(sItemBody); if (model.From == EnumData.EnumStep.架.ToString()) { List <ShelfMissionProductQueueInfo> smpList = JsonConvert.DeserializeObject <List <ShelfMissionProductQueueInfo> >(sItemBody); if (smpList != null && smpList.Count > 0) { foreach (var item in smpList) { bsaBll.Insert(new BarcodeTypeInfo(model.From, JsonConvert.SerializeObject(item))); list.Add(new ComboboxInfo { Id = item.Id.ToString(), Text = "1" }); } } } return(ResResult.Response(true, "", JsonConvert.SerializeObject(list))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel GetOrderPickProductList(PdaOrderPickProductModel model) { try { if (model.PageIndex < 1) { model.PageIndex = 1; } if (model.PageSize < 1) { model.PageSize = 10; } var bll = new OrderPickProduct(); var sqlWhere = "and op.Id = @Id "; var parm = new SqlParameter("@Id", SqlDbType.UniqueIdentifier); parm.Value = Guid.Parse(model.Id.ToString()); var list = bll.GetListByJoin(model.PageIndex, model.PageSize, sqlWhere, parm); return(ResResult.Response(true, "", JsonConvert.SerializeObject(list))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DelUser(string userName) { try { if (!HttpContext.Current.User.IsInRole("Administrators")) { throw new ArgumentException(MC.Role_InvalidError); } var user = Membership.GetUser(userName); if (user == null) { throw new CustomException(MC.GetString(MC.Params_Data_NotExist, userName)); } if (!Membership.DeleteUser(userName)) { return(ResResult.Response(false, MC.M_Save_Error, "")); } new Staff().DeleteStaff(Guid.Parse(user.ProviderUserKey.ToString())); return(ResResult.Response(true, "", "")); } catch (CustomException ex) { return(ResResult.Response(false, ex.Message, "")); } catch (Exception ex) { return(ResResult.Response(false, "" + MC.AlertTitle_Ex_Error + ":" + 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 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 GetMenusChildrenByParentName(string parentName) { try { var userMenuList = MenusDataProxy.GetUserMenus(); if (userMenuList == null || userMenuList.Count() == 0) { return(ResResult.Response(false, MC.Data_InvalidExist, "")); } if (string.IsNullOrWhiteSpace(parentName) || HttpContext.Current.User.IsInRole("Administrators")) { parentName = "100000"; } var parentInfo = userMenuList.FirstOrDefault(m => (m.Title.Contains(parentName))); if (parentInfo == null) { return(ResResult.Response(false, MC.Data_InvalidExist, "")); } var childData = userMenuList.Where(m => (m.ParentId == parentInfo.Id) && m.Descr.IndexOf("hide") == -1); if (childData == null) { return(ResResult.Response(false, MC.Data_InvalidExist, "")); } return(ResResult.Response(true, "", JsonConvert.SerializeObject(childData))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DeleteMenus(Guid Id) { try { //MenusDataProxy.ValidateAccess((int)EnumData.EnumOperationAccess.删除, true); if (!HttpContext.Current.User.IsInRole("Administrators")) { throw new ArgumentException(MC.Role_InvalidError); } if (Id.Equals(Guid.Empty)) { return(ResResult.Response(false, MC.Request_Params_InvalidError, "")); } var bll = new SiteMenus(); bll.Delete(Id); return(ResResult.Response(true, "", "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel GetMenusTreeGrid(MenusPermissionModel model) { try { var accessId = Guid.Empty; var accessType = ""; var isAdministrators = false; if (!string.IsNullOrWhiteSpace(model.AllowRole)) { accessType = "Roles"; SiteRoles rBll = new SiteRoles(); var roleInfo = rBll.GetAspnetModel(Membership.ApplicationName, model.AllowRole); accessId = roleInfo.Id; isAdministrators = roleInfo.LowerName == "administrators"; } if (!string.IsNullOrWhiteSpace(model.DenyUser)) { accessType = "Users"; accessId = Guid.Parse(Membership.GetUser(model.DenyUser).ProviderUserKey.ToString()); } var bll = new SiteMenus(); return(ResResult.Response(true, "", bll.GetTreeGridJson(Membership.ApplicationName, accessId, accessType, isAdministrators))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DelRole(string itemAppend) { try { if (!HttpContext.Current.User.IsInRole("Administrators")) { throw new ArgumentException(MC.Role_InvalidError); } itemAppend = itemAppend.Trim(); if (string.IsNullOrEmpty(itemAppend)) { return(ResResult.Response(false, MC.Request_Params_InvalidError, "")); } string[] roles = itemAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (roles.Contains("Administrators") || roles.Contains("System") || roles.Contains("Users") || roles.Contains("Guest")) { return(ResResult.Response(false, MC.M_SysDataChangedError, "")); } foreach (string item in roles) { Roles.DeleteRole(item); } return(ResResult.Response(true, "调用成功", "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DeleteSiteMulti(string itemAppend) { try { if (!HttpContext.Current.User.IsInRole("Administrators")) { throw new ArgumentException(MC.Role_InvalidError); } if (string.IsNullOrWhiteSpace(itemAppend)) { throw new ArgumentException(MC.Request_Params_InvalidError); } var items = itemAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var bll = new SiteMulti(); if (bll.DeleteBatch(items)) { return(ResResult.Response(true, MC.M_Save_Ok, "")); } else { return(ResResult.Response(false, MC.M_Save_Error, "")); } } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel SaveIsLockedOut(string userName) { try { if (!HttpContext.Current.User.IsInRole("Administrators")) { throw new ArgumentException(MC.Role_InvalidError); } MembershipUser user = Membership.GetUser(userName); if (user == null) { return(ResResult.Response(false, "当前用户不存在,请检查", "")); } if (user.IsLockedOut) { if (user.UnlockUser()) { return(ResResult.Response(false, "", "0")); } else { return(ResResult.Response(false, "操作失败,请联系管理员", "")); } } return(ResResult.Response(false, "只有“已锁定”的用户才能执行此操作", "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel GetAssetInStore(AssetInStoreModel model) { try { if (model.PageIndex < 1) { model.PageIndex = 1; } if (model.PageSize < 1) { model.PageSize = 10; } int totalRecord = 0; var bll = new AssetInStore(); var list = bll.GetListByJoin(model.PageIndex, model.PageSize, out totalRecord, "", null); if (totalRecord == 0) { return(ResResult.Response(true, "", "{\"total\":0,\"rows\":[]}")); } var dgData = "{\"total\":" + totalRecord + ",\"rows\":" + JsonConvert.SerializeObject(list) + "}"; return(ResResult.Response(true, "", dgData)); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel ValidateUser(LoginFmModel model) { try { Log.Info(string.Format("{0}--platform:{1},deviceid:{2},username:{3},password:{4}", "ValidateUser", model.Platform, model.Deviceid, model.UserName, model.Password)); if (string.IsNullOrEmpty(model.UserName) || string.IsNullOrEmpty(model.Password)) { return(ResResult.Response(false, MC.Login_InvalidAccount, "")); } string userData = string.Empty; MembershipUser user = Membership.GetUser(model.UserName); if (!Membership.ValidateUser(model.UserName, model.Password)) { new EnumMembershipCreateStatus(user); } userData = user.ProviderUserKey.ToString(); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, model.UserName, DateTime.Now, DateTime.Now.Add(FormsAuthentication.Timeout), true, userData, FormsAuthentication.FormsCookiePath); HttpContext.Current.Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket))); return(ResResult.Response(true, MC.Response_Ok, "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel SavePandianDown(PdaPandianFmModel model) { try { object userId = null; SecurityService.DoCheckLogin(model.AppKey, model.UserName, out userId); var gId = Guid.Empty; if (!Guid.TryParse(model.Id.ToString(), out gId)) { return(ResResult.Response(false, "参数不正确", "")); } var bll = new Pandian(); if (bll.UpdateIsDown(gId) < 1) { return(ResResult.Response(false, "下载失败,请稍后再重试!", "")); } return(ResResult.Response(true, "调用成功", "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel SaveIsApproved(string userName) { try { if (!HttpContext.Current.User.IsInRole("Administrators")) { throw new ArgumentException(MC.Role_InvalidError); } MembershipUser user = Membership.GetUser(userName); if (user == null) { return(ResResult.Response(false, "当前用户不存在,请检查", "")); } if (user.IsApproved) { user.IsApproved = false; } else { user.IsApproved = true; } Membership.UpdateUser(user); return(ResResult.Response(true, "", user.IsApproved ? "1" : "0")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel DeleteContentFile(object Id) { try { var id = Guid.Empty; if (Id != null) { Guid.TryParse(Id.ToString(), out id); } if (id.Equals(Guid.Empty)) { return(ResResult.Response(false, MC.Request_Params_InvalidError, "")); } var bll = new ContentFile(); var model = bll.GetModel(id); if (model != null) { if (bll.Delete(id) > 0) { var dir = Path.GetDirectoryName(FilesHelper.GetFullPath(model.FileUrl)); Task.Factory.StartNew(() => { Directory.Delete(dir, true); }); } } return(ResResult.Response(true, MC.M_Save_Ok, "")); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }
public ResResultModel GetShelfMissionList(PdaShelfMissionModel model) { try { var bll = new ShelfMission(); StringBuilder sqlWhere = null; ParamsHelper parms = null; if (!string.IsNullOrWhiteSpace(model.OrderCode)) { sqlWhere = new StringBuilder(300); sqlWhere.AppendFormat("and OrderNum like @OrderNum "); var parm = new SqlParameter("@OrderNum", SqlDbType.VarChar, 20); parm.Value = "%" + model.OrderCode + "%"; parms = new ParamsHelper(); parms.Add(parm); } var list = bll.GetList(model.PageIndex, model.PageSize, sqlWhere == null ? "" : sqlWhere.ToString(), parms == null ? null : parms.ToArray()); return(ResResult.Response(true, "", JsonConvert.SerializeObject(list))); } catch (Exception ex) { return(ResResult.Response(false, ex.Message, "")); } }