예제 #1
0
 public JsonResult UpdateState(string memberId, bool state)
 {
     try
     {
         string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.会员管理.会员资料.审核);
         if (!IsPermission(funcId))
         {
             return(Error("您没有操作权限,请联系系统管理员!"));
         }
         var    entity        = AccountService.GetAccountPro(SystemID, CompanyID, memberId);
         var    result        = AccountService.UpdateAccountStatePro(SystemID, CompanyID, memberId, state);
         string newEntityJson = GetNewEntityJson(entity, state);
         TableOperationManager.Update(entity, newEntityJson, result);
         if (result)
         {
             return(Success("ok"));
         }
         else
         {
             return(Error("fail"));
         }
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
        public JsonResult Save(string positionId)
        {
            try
            {
                if (!IsSavePermission(positionId))
                {
                    return(Error("您没有操作权限,请联系系统管理员!"));
                }

                string fPositionId   = GetFormValue("fPositionId");
                string fPositionName = GetFormValue("fPositionName");
                string fSort         = GetFormValue("fSort");
                string fDescription  = GetFormValue("fDescription");
                string fState        = GetFormValue("fState");

                if (string.IsNullOrEmpty(positionId))
                {
                    if (string.IsNullOrWhiteSpace(fPositionId))
                    {
                        return(Error("职位编号不能为空!"));
                    }
                    else
                    {
                        if (fPositionId.Length > 6)
                        {
                            return(Error("职位编号必是6位数字!"));
                        }
                    }
                    fPositionId = fPositionId.PadLeft(6, '0');
                }
                int  sort   = fSort.ToInt();
                bool state  = fState.ToBool();
                bool result = false;
                if (string.IsNullOrEmpty(positionId))
                {
                    result = PositionService.SavePositionPro(SystemID, CompanyID, fPositionId, fPositionName, fDescription, sort, state);
                    var entity = PositionService.GetPositionPro(SystemID, CompanyID, fPositionId);
                    TableOperationManager.Add(entity, result);
                }
                else
                {
                    var entity = PositionService.GetPositionPro(SystemID, CompanyID, positionId);
                    result = PositionService.UpdatePositionPro(SystemID, CompanyID, positionId, fPositionName, fDescription, sort, state);
                    string newEntityJson = GetNewEntityJson(entity, fPositionName, fDescription, sort, state);
                    TableOperationManager.Update(entity, newEntityJson, result);
                }
                if (result)
                {
                    return(Success("ok"));
                }
                else
                {
                    return(Error("fail"));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
예제 #3
0
        public JsonResult UpdateState(string messageId, bool state)
        {
            try
            {
                string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.客服管理.留言管理.审阅);
                if (!IsPermission(funcId))
                {
                    return(Error("您没有操作权限,请联系系统管理员!"));
                }

                var entity    = MessageBoardService.GetMessageBoard(SystemID, CompanyID, messageId);
                var oldEntity = GetOldEntity(entity);
                var result    = MessageBoardService.UpdateMessageBoardState(SystemID, CompanyID, messageId, state);
                TableOperationManager.Update(oldEntity, entity.ToJson(), result);
                if (result)
                {
                    return(Success("ok"));
                }
                else
                {
                    return(Error("fail"));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
예제 #4
0
        public JsonResult Save(string rankId)
        {
            try
            {
                if (!IsSavePermission(rankId))
                {
                    return(Error("您没有操作权限,请联系系统管理员!"));
                }

                string fRankName  = GetFormValue("fRankName");
                string fMaxPoints = GetFormValue("fMaxPoints");
                string fDiscount  = GetFormValue("fDiscount");
                string fRemark    = GetFormValue("fRemark");
                string fState     = GetFormValue("fState");

                int  maxPoints = fMaxPoints.ToInt();
                int  discount  = fDiscount.ToInt();
                int  showPrice = discount;
                bool state     = fState.ToBool();

                if (maxPoints <= 0)
                {
                    return(Error("升级积分必须大于0"));
                }

                if (discount <= 0 || discount > 100)
                {
                    return(Error("优惠拆扣必须是1-100之间"));
                }


                bool result = false;
                if (string.IsNullOrEmpty(rankId))
                {
                    result = RankService.SaveRankPro(SystemID, CompanyID, fRankName, maxPoints, discount, showPrice, fRemark, state);
                    var entity = RankService.GetRankByMaxPointsPro(SystemID, CompanyID, maxPoints);
                    TableOperationManager.Add(entity, result);
                }
                else
                {
                    var entity = RankService.GetRankPro(SystemID, CompanyID, rankId);
                    result = RankService.UpdateRankPro(SystemID, CompanyID, rankId, fRankName, maxPoints, discount, showPrice, fRemark, state);
                    string newEntityJson = GetNewEntityJson(entity, fRankName, maxPoints, discount, showPrice, fRemark, state);
                    TableOperationManager.Update(entity, newEntityJson, result);
                }
                if (result)
                {
                    return(Success("ok"));
                }
                else
                {
                    return(Error("fail"));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
        public JsonResult UpdatePassword()
        {
            try
            {
                string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.公司管理.员工管理.改密);
                if (!IsPermission(funcId))
                {
                    return(Error("您没有操作权限,请联系系统管理员!"));
                }

                string staffId         = GetQueryString("staffId");
                string newPassword     = GetFormValue("fNewPassword");
                string confirmPassword = GetFormValue("fConfirmPassword");
                if (string.IsNullOrEmpty(staffId))
                {
                    return(Error("员工工号不能为空!"));
                }
                if (confirmPassword.Length < 6)
                {
                    return(Error("密码长度不能少于6位字符!"));
                }
                if (newPassword != confirmPassword)
                {
                    return(Error("输入的二次密码不相同!"));
                }
                string password      = AlgorithmHelper.MD5(confirmPassword).ToLower();
                var    entity        = StaffService.GetStaffPro(SystemID, CompanyID, staffId);
                var    result        = StaffService.UpdateStaffPasswordPro(SystemID, CompanyID, staffId, password);
                string newEntityJson = GetNewEntityJson(entity, password);
                TableOperationManager.Update(entity, newEntityJson, result);
                if (result)
                {
                    return(Success("ok"));
                }
                else
                {
                    return(Error("fail"));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
        public JsonResult Update(string companyId)
        {
            try
            {
                string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.公司管理.资料管理.编辑);
                if (!IsPermission(funcId))
                {
                    return(Error("您没有操作权限,请联系系统管理员!"));
                }
                string companyName = GetFormValue("fCompanyName");
                string nickName    = GetFormValue("fNickName");
                string tel         = GetFormValue("fTel");
                string fax         = GetFormValue("fFax");
                string phone       = GetFormValue("fPhone");
                string email       = GetFormValue("fEmail");
                string address     = GetFormValue("fAddress");
                string description = GetFormValue("fDescription");

                var entity = CompanyService.GetCompanyPro(SystemID, companyId);
                if (entity == null)
                {
                    return(Error("公司编号不存在!"));
                }
                string strNewEntity = GetNewEntityJson(entity, companyName, nickName, tel, fax, phone, email, address, description);

                long operationId = 0;
                TableOperationManager.Update(entity, strNewEntity, out operationId);
                var result = CompanyService.UpdateCompanyPro(SystemID, companyId, companyName, nickName, tel, fax, phone, email, address, description);
                TableOperationManager.SetState(operationId, result);
                if (result)
                {
                    return(Success("ok"));
                }
                else
                {
                    return(Error("fail"));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
예제 #7
0
        public JsonResult Update()
        {
            try
            {
                string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.系统管理.系统设置.编辑);
                if (!IsPermission(funcId))
                {
                    return(Error("您没有操作权限,请联系系统管理员!"));
                }
                string title                   = GetFormValue("title");
                string keyword                 = GetFormValue("keyword");
                string description             = GetFormValue("description");
                string homeUrl                 = GetFormValue("homeUrl");
                string styleSrc                = GetFormValue("styleSrc");
                string uploadRoot              = GetFormValue("uploadRoot");
                string copyright               = GetFormValue("copyright");
                string icpNumber               = GetFormValue("icpNumber");
                string statisticsCode          = GetFormValue("statisticsCode");
                string loginIpAddressWhiteList = GetFormValue("loginIpAddressWhiteList");
                string maxLoginFail            = GetFormValue("maxLoginFail");
                string isLoginIpAddress        = GetFormValue("isLoginIpAddress");
                string emailSendPattern        = GetFormValue("emailSendPattern");
                string emailHost               = GetFormValue("emailHost");
                string emailPort               = GetFormValue("emailPort");
                string emailName               = GetFormValue("emailName");
                string emailPassword           = GetFormValue("emailPassword");
                string emailAddress            = GetFormValue("emailAddress");
                bool   isLogin                 = isLoginIpAddress.Split(",")[0].ToBool();

                Ld_Sys_Config entity = new Ld_Sys_Config();
                entity.SystemID                = SystemID;
                entity.CompanyID               = CompanyID;
                entity.Title                   = title;
                entity.Keyword                 = keyword;
                entity.Description             = description;
                entity.HomeUrl                 = homeUrl;
                entity.StyleSrc                = styleSrc;
                entity.UploadRoot              = uploadRoot;
                entity.Copyright               = copyright;
                entity.IcpNumber               = icpNumber;
                entity.StatisticsCode          = statisticsCode;
                entity.LoginIpAddressWhiteList = loginIpAddressWhiteList;
                entity.MaxLoginFail            = maxLoginFail.ToInt();
                entity.IsLoginIpAddress        = isLogin;
                entity.EmailSendPattern        = emailSendPattern;
                entity.EmailHost               = emailHost;
                entity.EmailPort               = emailPort.ToInt();
                entity.EmailName               = emailName;
                entity.EmailPassword           = emailPassword;
                entity.EmailAddress            = emailAddress;
                entity.CreateDate              = DateTime.Now;

                var m = ConfigService.GetConfigPro(SystemID, CompanyID);
                if (m == null)
                {
                    return(Error("公司编号不存在!"));
                }
                long operationId = 0;
                TableOperationManager.Update(m, entity.ToJson(), out operationId);
                bool result = ConfigService.UpdateConfigPro(entity);
                TableOperationManager.SetState(operationId, result);
                if (result)
                {
                    return(Success("成功!"));
                }
                else
                {
                    return(Error("失败!"));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
        public JsonResult Save(string storeId)
        {
            try
            {
                if (!IsSavePermission(storeId))
                {
                    return(Error("您没有操作权限,请联系系统管理员!"));
                }

                string fStoreId     = GetFormValue("fStoreId");
                string fStoreName   = GetFormValue("fStoreName");
                string fContacts    = GetFormValue("fContacts");
                string fphone       = GetFormValue("fphone");
                string fTel         = GetFormValue("fTel");
                string fFax         = GetFormValue("fFax");
                string fEmail       = GetFormValue("fEmail");
                string fProvinceId  = GetFormValue("fProvinceId");
                string fCityId      = GetFormValue("fCityId");
                string fAreaId      = GetFormValue("fAreaId");
                string fAddress     = GetFormValue("fAddress");
                string fSort        = GetFormValue("fSort");
                string fDescription = GetFormValue("fDescription");
                string fState       = GetFormValue("fState");

                string   logo       = "";
                string   keyword    = fDescription.Left(100);
                DateTime startTime  = DateTime.Now;
                DateTime endTime    = DateTime.Now.AddYears(10);
                int      provinceId = fProvinceId.ToInt();
                int      cityId     = fCityId.ToInt();
                int      areaId     = fAreaId.ToInt();
                int      sort       = fSort.ToInt();
                bool     push       = false;
                bool     state      = fState.ToBool();
                if (string.IsNullOrEmpty(storeId))
                {
                    if (string.IsNullOrWhiteSpace(fStoreId))
                    {
                        return(Error("网点编号不能为空!"));
                    }
                    else
                    {
                        if (fStoreId.Length > 6)
                        {
                            return(Error("网点编号必是6位数字!"));
                        }
                    }
                    fStoreId = fStoreId.PadLeft(6, '0');
                }
                bool result = false;
                if (string.IsNullOrEmpty(storeId))
                {
                    result = StoreService.SaveStorePro(SystemID, CompanyID, fStoreId, fStoreName, logo, fContacts, fTel, fFax, fphone, fEmail, provinceId, cityId, areaId, fAddress, keyword, fDescription, startTime, endTime, push, sort, state);
                    var entity = StoreService.GetStorePro(SystemID, CompanyID, fStoreId);
                    TableOperationManager.Add(entity, result);
                }
                else
                {
                    var entity = StoreService.GetStorePro(SystemID, CompanyID, storeId);
                    result = StoreService.UpdateStorePro(SystemID, CompanyID, storeId, fStoreName, logo, fContacts, fTel, fFax, fphone, fEmail, provinceId, cityId, areaId, fAddress, keyword, fDescription, startTime, endTime, push, sort, state);
                    string newEntityJson = GetNewEntityJson(entity, fStoreName, logo, fContacts, fTel, fFax, fphone, fEmail, provinceId, cityId, areaId, fAddress, keyword, fDescription, startTime, endTime, push, sort, state);
                    TableOperationManager.Update(entity, newEntityJson, result);
                }
                if (result)
                {
                    return(Success("ok"));
                }
                else
                {
                    return(Error("fail"));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }