Пример #1
0
        public RespondWebViewData <List <RespondSystemParameterConfigViewModel> > GetSystemParameterConfigViewModels()
        {
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <List <RespondSystemParameterConfigViewModel> > >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetSystemParameterConfigViewModels"),

                #region ========================
                CallBackFunc = () =>
                {
                    var dataModels = this.mSystemParameterConfigDataAccess.GetSystemParameterConfigDataModels();
                    var viewModels = new RespondWebViewData <List <RespondSystemParameterConfigViewModel> >
                    {
                        rows = dataModels.Select(data => new RespondSystemParameterConfigViewModel
                        {
                            ParameterConfigName = data.ParameterConfigName,
                            ParameterConfigValue = data.ParameterConfigValue
                        }).ToList()
                    };
                    return viewModels;
                },
                #endregion

                ManageCacheKeyForKey = THISSERVICE_PRE_CACHE_KEY_MANAGE,
                ParamsKeys = new object[]
                {
                    this.mSigninUser.UserID,
                    this.mSigninUser.CompanySerialNum
                }
            }));
        }
Пример #2
0
        public RespondWebViewData <RespondQueryEmployeeViewModel> GetEmployeeByEmpId(RequestWebViewData <RequestGetEmployeeByIdViewModel> request)
        {
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <RespondQueryEmployeeViewModel> >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetEmployeeByEmpId"),

                #region ====================
                CallBackFunc = () =>
                {
                    var respond = new RespondWebViewData <RespondQueryEmployeeViewModel>
                    {
                        rows = new RespondQueryEmployeeViewModel()
                    };
                    var employee = this.mEmployeeDataAccess.GetemployeeDataModelById(request.data.EmpId);
                    if (employee == null)
                    {
                        return respond;
                    }
                    if (employee.deleted == (short)CommonDeleted.Deleted || employee.status != (short)CommonStatus.Used)
                    {
                        return respond;
                    }
                    var totalScale = this.mSystemParameterConfigViewService.SystemParameterConfig()[SystemParameterConfigConst.TotalScale].ParameterConfigValue.ToInt16();

                    respond = new RespondWebViewData <RespondQueryEmployeeViewModel>
                    {
                        rows = new RespondQueryEmployeeViewModel
                        {
                            Address = employee.address,
                            ChildNumber = employee.childnumber,
                            ClassId = employee.classid,
                            Comment = employee.comment,
                            Deleted = employee.deleted,
                            DepId = employee.depid,
                            DepName = employee.depname,
                            EmpId = employee.empid,
                            LowestDiscount = employee.lowestdiscount,
                            Mobile = employee.mobile,
                            Name = employee.name,
                            ParentId = employee.parentid,
                            PreInAdvanceTotal = employee.preinadvancetotal.ToNumberString(totalScale),
                            PrePayFeeTotal = employee.prepayfeetotal.ToNumberString(totalScale),
                            SerialNumber = employee.serialnumber,
                            Status = employee.status,
                            Spelling = employee.pinyin,
                            Sort = employee.sort
                        }
                    };
                    return respond;
                },
                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicEmployee,
                ParamsKeys = new object[]
                {
                    request.data.EmpId
                }
            }));
        }
Пример #3
0
        public JsonResult Login(RequestSigninUserViewModel request)
        {
            bool isValid;
            var  errorMessage = this.GenerateModelValidateErrMessage(ModelState, out isValid);
            RespondWebViewData <RespondSigninUserViewModel> respond;

            if (!isValid)
            {
                respond = new RespondWebViewData <RespondSigninUserViewModel>(WebViewErrorCode.ModelValidateError.ErrorCode, errorMessage);
                return(Json(respond));
            }
            var _sessionVerifyCode = HttpContext.Session[BeforeCompileConstDefined.HttpContext_Login_Img_Verify_Code].ToString().ToLower();

            if (_sessionVerifyCode != request.ValidCode.ToLower())
            {
                respond = new RespondWebViewData <RespondSigninUserViewModel>(WebViewErrorCode.VerifyCodeError);
                return(Json(respond));
            }

            respond = this.mSigninUserViewService.QuerySigninUserViewModel(request);
            HttpContext.Session[BeforeCompileConstDefined.HttpContext_Login_Img_Verify_Code] = string.Empty;
            if (respond.rows.CurrentUser.UserID > 0)
            {
                //var _signature_text = SignatureHelper.BuildSignature(JObject.FromObject(respond.Data.CurrentUser));
                //return Json(new RespondWebViewData<object>
                //{
                //    Data = _signature_text
                //});
                return(Json(respond));
            }
            respond = new RespondWebViewData <RespondSigninUserViewModel>(WebViewErrorCode.NotExistUserInfo);
            return(Json(respond));
        }
Пример #4
0
        public RespondWebViewData <RespondEditStorageViewModel> EditStorage(RequestWebViewData <RequestEditStorageViewModel> request)
        {
            var rData = request.data;

            if (this.mStorageDataAccess.CheckStorageIsExist(new QueryStorageListParameter {
                Name = rData.Name, SerialNumber = rData.SerialNumber, StorageId = rData.StorageId
            }))
            {
                return(new RespondWebViewData <RespondEditStorageViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的仓库已经存在", rData.Name, rData.SerialNumber)));
            }

            var respond = new RespondWebViewData <RespondEditStorageViewModel>(WebViewErrorCode.Success);

            try
            {
                this.mDbConnection.ExecuteTransaction(tran =>
                {
                    var storage = this.mStorageDataAccess.GetstorageDataModelById(rData.StorageId);
                    if (storage == null)
                    {
                        respond = new RespondWebViewData <RespondEditStorageViewModel>(WebViewErrorCode.NotExistsDataInfo);
                        return;
                    }
                    if (storage.deleted == (short)CommonDeleted.Deleted)
                    {
                        respond = new RespondWebViewData <RespondEditStorageViewModel>(WebViewErrorCode.NotExistsDataInfo);
                        return;
                    }

                    var data = new storageDataModel
                    {
                        alias        = rData.Alias,
                        comment      = rData.Comment,
                        name         = rData.Name,
                        PinYin       = rData.Spelling,
                        serialnumber = rData.SerialNumber,
                        sort         = rData.Sort,
                        stoid        = rData.StorageId,
                        childcount   = storage.childcount,
                        classid      = storage.classid,
                        childnumber  = storage.childnumber,
                        deleted      = storage.deleted,
                        parentid     = storage.parentid,
                        status       = storage.status
                    };
                    this.mStorageDataAccess.Update(data, tran);
                    MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicStorage);

                    //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                    //this.SaveMongoDbData("编辑往来客户资料", request, respond, this.GetType());
                });
            }
            catch (Exception exception)
            {
                respond = new RespondWebViewData <RespondEditStorageViewModel>(new ErrorCodeItem(WebViewErrorCode.Exception.ErrorCode, exception.Message));
            }
            return(respond);
        }
Пример #5
0
        public RespondWebViewData <RequestEditClientViewModel> EditClient(RequestWebViewData <RequestEditClientViewModel> request)
        {
            var rData = request.data;

            if (this.mClientDataAccess.CheckClientIsExist(new QueryClientListParameter {
                Name = rData.Name, SerialNumber = rData.SerialNumber, ClientId = rData.ClientId
            }))
            {
                return(new RespondWebViewData <RequestEditClientViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的往来单位已经存在", rData.Name, rData.SerialNumber)));
            }

            var respond = new RespondWebViewData <RequestEditClientViewModel>(WebViewErrorCode.Success);

            this.mDbConnection.ExecuteTransaction(tran =>
            {
                var client = this.mClientDataAccess.GetclientDataModelById(rData.ClientId);
                if (client == null)
                {
                    respond = new RespondWebViewData <RequestEditClientViewModel>(WebViewErrorCode.NotExistsDataInfo);
                    return;
                }
                if (client.deleted == (short)CommonDeleted.Deleted)
                {
                    respond = new RespondWebViewData <RequestEditClientViewModel>(WebViewErrorCode.NotExistsDataInfo);
                    return;
                }

                var data = new clientDataModel
                {
                    address      = rData.Address,
                    alias        = rData.Alias,
                    clientid     = rData.ClientId,
                    comment      = rData.Comment,
                    credits      = rData.Credits,
                    linkaddress  = rData.LinkAddress,
                    linktel      = rData.LinkTel,
                    linkman      = rData.LinkMan,
                    name         = rData.Name,
                    pinyin       = rData.Spelling,
                    pricemode    = rData.PriceMode,
                    serialnumber = rData.SerialNumber,
                    sort         = rData.Sort,
                    zipcode      = rData.ZipCode,
                    status       = client.status,
                    deleted      = client.deleted,
                    parentid     = client.parentid,
                    childnumber  = client.childnumber,
                    childcount   = client.childcount,
                    classid      = client.classid
                };
                this.mClientDataAccess.Update(data, tran);
                MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicClient);

                //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                //this.SaveMongoDbData("编辑往来客户资料", request, respond, this.GetType());
            });
            return(respond);
        }
Пример #6
0
        public RespondWebViewData <RespondQueryClientViewModel> GetClientByClientId(RequestWebViewData <RequestGetClientByIdViewModel> request)
        {
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <RespondQueryClientViewModel> >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetClientByClientId"),

                #region ====================
                CallBackFunc = () =>
                {
                    var respond = new RespondWebViewData <RespondQueryClientViewModel>
                    {
                        rows = new RespondQueryClientViewModel()
                    };
                    var client = this.mClientDataAccess.GetclientDataModelById(request.data.ClientId);
                    if (client == null)
                    {
                        return respond;
                    }
                    if (client.deleted == (short)CommonDeleted.Deleted || client.status != (short)CommonStatus.Used)
                    {
                        return respond;
                    }

                    respond = new RespondWebViewData <RespondQueryClientViewModel>
                    {
                        rows = new RespondQueryClientViewModel
                        {
                            Address = client.address,
                            Alias = client.alias,
                            ChildNumber = client.childnumber,
                            ClassId = client.classid,
                            ClientId = client.clientid,
                            Comment = client.comment,
                            Credits = client.credits.ToNumberString(5),
                            LinkAddress = client.linkaddress,
                            LinkMan = client.linkman,
                            LinkTel = client.linktel,
                            Name = client.name,
                            ParentId = client.parentid,
                            Spelling = client.pinyin,
                            PriceMode = client.pricemode,
                            SerialNumber = client.serialnumber,
                            Sort = client.sort,
                            ZipCode = client.zipcode
                        }
                    };
                    return respond;
                },
                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicClient,
                ParamsKeys = new object[]
                {
                    request.data.ClientId
                }
            }));
        }
Пример #7
0
        public RespondWebViewData <RespondQueryStorageViewModel> GetStorageByStorageId(RequestWebViewData <RequestGetStorageByIdViewModel> request)
        {
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <RespondQueryStorageViewModel> >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetStorageByStorageId"),

                #region ====================
                CallBackFunc = () =>
                {
                    var respond = new RespondWebViewData <RespondQueryStorageViewModel>
                    {
                        rows = new RespondQueryStorageViewModel()
                    };
                    var storage = this.mStorageDataAccess.GetstorageDataModelById(request.data.StorageId);
                    if (storage == null)
                    {
                        return respond;
                    }
                    if (storage.deleted == (short)CommonDeleted.Deleted || storage.status != (short)CommonStatus.Used)
                    {
                        return respond;
                    }

                    respond = new RespondWebViewData <RespondQueryStorageViewModel>
                    {
                        rows = new RespondQueryStorageViewModel
                        {
                            Alias = storage.alias,
                            ParentId = storage.parentid,
                            Spelling = storage.PinYin,
                            ChildNumber = storage.childnumber,
                            ClassId = storage.classid,
                            Comment = storage.comment,
                            Deleted = storage.deleted,
                            Name = storage.name,
                            SerialNumber = storage.serialnumber,
                            Sort = storage.sort,
                            StorageId = storage.stoid,
                            Status = storage.status
                        }
                    };
                    return respond;
                },

                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicStorage,
                ParamsKeys = new object[]
                {
                    request.data.StorageId
                }
            }));
        }
        public RespondWebViewData <List <RespondQueryUserViewModel> > GetUserList(RequestWebViewData <RequestQueryUserViewModel> request)
        {
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <List <RespondQueryUserViewModel> > >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetUserList"),

                #region ============================================

                CallBackFunc = () =>
                {
                    var parameter = new QueryUserParameter
                    {
                        EmpId = request.data.EmpId,
                        PageIndex = request.page,
                        PageSize = request.rows,
                        UserName = request.data.UserName
                    };
                    var pageList = this.mUserDataAccess.GetUserPageData(parameter);
                    var respond = new RespondWebViewData <List <RespondQueryUserViewModel> >
                    {
                        total = pageList.DataCount,
                        rows = pageList.Datas.Select(item => new RespondQueryUserViewModel
                        {
                            CTime = item.CTime,
                            Comment = item.Comment,
                            EmpId = item.EmpId,
                            Manager = item.Manager,
                            Prefix = item.Prefix,
                            Status = item.Status,
                            UserName = item.UserName,
                            UsePwd = item.UsePwd,
                            UserId = item.UserId,
                            Deleted = item.Deleted,
                            Synchron = item.Synchron,
                            ComId = item.ComId
                        }).ToList()
                    };
                    return respond;
                },

                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.UserManage,
                ParamsKeys = new object[]
                {
                    request.data.EmpId,
                    request.page,
                    request.rows,
                    request.data.UserName
                }
            }));
        }
        /// <summary>
        /// 未实现
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public JsonResult GetPrintDesignStyle(RequestWebViewData <RequestGetPrintDesignStyleViewModel> request)
        {
            var respond = new RespondWebViewData <RespondGetPrintDesignStyleViewModel>
            {
                rows = new RespondGetPrintDesignStyleViewModel
                {
                    PrintDesignStyle = string.Empty
                }
            };

            return(Json(respond));
        }
        public RespondWebViewData <RespondEditSubCompanyViewModel> EditSubCompany(RequestWebViewData <RequestEditSubCompanyViewModel> request)
        {
            var rData = request.data;

            if (this.mSubCompanyDataAccess.CheckSubCompanyIsExist(new QuerySubCompanyListParameter {
                Name = rData.Name, SerialNumber = rData.SerialNumber, SubComId = rData.ComId
            }))
            {
                return(new RespondWebViewData <RespondEditSubCompanyViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的分公司已经存在", rData.Name, rData.SerialNumber)));
            }

            var respond = new RespondWebViewData <RespondEditSubCompanyViewModel>(WebViewErrorCode.Success);

            this.mDbConnection.ExecuteTransaction(tran =>
            {
                var company = this.mSubCompanyDataAccess.GetsubcompanyDataModelById(rData.ComId);
                if (company == null)
                {
                    respond = new RespondWebViewData <RespondEditSubCompanyViewModel>(WebViewErrorCode.NotExistsDataInfo);
                    return;
                }
                if (company.deleted == (short)CommonDeleted.Deleted)
                {
                    respond = new RespondWebViewData <RespondEditSubCompanyViewModel>(WebViewErrorCode.NotExistsDataInfo);
                    return;
                }

                var data = new subcompanyDataModel
                {
                    subcomid     = rData.ComId,
                    comment      = rData.Comment,
                    email        = rData.Email,
                    linktel      = rData.LinkTel,
                    linkman      = rData.LinkMan,
                    name         = rData.Name,
                    pinyin       = rData.Spelling,
                    pricemode    = rData.PriceMode,
                    serialnumber = rData.SerialNumber,
                    sort         = rData.Sort,
                    status       = company.status,
                    deleted      = company.deleted,
                    childnumber  = company.childnumber,
                    classid      = company.classid,
                    parentid     = company.parentid
                };
                this.mSubCompanyDataAccess.Update(data, tran);
                MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicSubCompany);

                //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                //this.SaveMongoDbData("编辑分公司资料", request, respond, this.GetType());
            });
            return(respond);
        }
Пример #11
0
        public JsonResult GetSpellingByChineseChar(RequestWebViewData <RequestGetNameSpellingViewModel> request)
        {
            var respond = new RespondWebViewData <RespondGetNameSpellingViewModel>
            {
                rows = new RespondGetNameSpellingViewModel
                {
                    Spelling = this.GetChineseSpelling(request.data.ChineseChar)
                }
            };

            return(Json(respond));
        }
Пример #12
0
        public RespondWebViewData <RespondQueryDepartmentViewModel> GetDepartmentByDepId(RequestWebViewData <RequestGetDepartmentByIdViewModel> request)
        {
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <RespondQueryDepartmentViewModel> >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetDepartmentByDepId"),

                #region ====================
                CallBackFunc = () =>
                {
                    var respond = new RespondWebViewData <RespondQueryDepartmentViewModel>
                    {
                        rows = new RespondQueryDepartmentViewModel()
                    };
                    var department = this.mDepartmentDataAccess.GetdepartmentDataModelById(request.data.DepId);
                    if (department == null)
                    {
                        return respond;
                    }
                    if (department.deleted == (short)CommonDeleted.Deleted || department.status != (short)CommonStatus.Used)
                    {
                        return respond;
                    }
                    respond = new RespondWebViewData <RespondQueryDepartmentViewModel>
                    {
                        rows = new RespondQueryDepartmentViewModel
                        {
                            ChildCount = department.childcount,
                            ChildNumber = department.childnumber,
                            ClassId = department.classid,
                            Comment = department.comment,
                            Deleted = department.deleted,
                            DepId = department.depid,
                            Name = department.name,
                            ParentId = department.parentid,
                            SerialNumber = department.serialnumber,
                            Status = department.status,
                            Spelling = department.pinyin,
                            Sort = department.sort.ToString()
                        }
                    };
                    return respond;
                },
                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicDepartment,
                ParamsKeys = new object[]
                {
                    request.data.DepId
                }
            }));
        }
        public RespondWebViewData <RespondQuerySubCompanyViewModel> GetSubCompanyByComId(RequestWebViewData <RequestGetSubCompanyByIdViewModel> request)
        {
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <RespondQuerySubCompanyViewModel> >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetSubCompanyByComId"),

                #region =================

                CallBackFunc = () =>
                {
                    var respond = new RespondWebViewData <RespondQuerySubCompanyViewModel>(WebViewErrorCode.NotExistsDataInfo)
                    {
                        rows = new RespondQuerySubCompanyViewModel()
                    };
                    var subCompany = this.mSubCompanyDataAccess.GetsubcompanyDataModelById(request.data.ComId);
                    if (subCompany == null)
                    {
                        return respond;
                    }
                    if (subCompany.deleted == (short)CommonDeleted.Deleted || subCompany.status != (short)CommonStatus.Used)
                    {
                        return respond;
                    }
                    respond = new RespondWebViewData <RespondQuerySubCompanyViewModel>
                    {
                        rows = new RespondQuerySubCompanyViewModel
                        {
                            ComId = subCompany.subcomid,
                            Comment = subCompany.comment,
                            Email = subCompany.email,
                            LinkMan = subCompany.linkman,
                            LinkTel = subCompany.linktel,
                            Name = subCompany.name,
                            PriceMode = subCompany.pricemode.ToString(),
                            SerialNumber = subCompany.serialnumber,
                            sort = subCompany.sort.ToString(),
                            Spelling = subCompany.pinyin
                        }
                    };
                    return respond;
                },

                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicSubCompany,
                ParamsKeys = new object[]
                {
                    request.data.ComId
                }
            }));
        }
Пример #14
0
        public RespondWebViewData <RespondEditProductViewModel> EditProduct(RequestWebViewData <RequestEditProductViewModel> request)
        {
            var rData   = request.data;
            var product = this.mProductDataAccess.GetproductDataModelById(rData.ProId);

            if (product == null)
            {
                return(new RespondWebViewData <RespondEditProductViewModel>(WebViewErrorCode.NotExistsDataInfo));
            }
            if (product.deleted == (short)CommonDeleted.Deleted)
            {
                return(new RespondWebViewData <RespondEditProductViewModel>(WebViewErrorCode.NotExistsDataInfo));
            }
            if (this.mProductDataAccess.CheckProductIsExist(new QueryProductListParameter {
                Name = rData.Name, SerialNumber = rData.SerialNumber
            }))
            {
                return(new RespondWebViewData <RespondEditProductViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的商品已经存在", rData.Name, rData.SerialNumber)));
            }

            var respond = new RespondWebViewData <RespondEditProductViewModel>(WebViewErrorCode.Success);

            try
            {
                this.mDbConnection.ExecuteTransaction(tran =>
                {
                    var data = new productDataModel
                    {
                        classid      = product.classid,
                        comment      = rData.Comment,
                        deleted      = product.deleted,
                        proid        = rData.ProId,
                        name         = rData.Name,
                        pinyin       = rData.Spelling,
                        parentid     = product.parentid,
                        serialnumber = rData.SerialNumber,
                        sort         = rData.Sort,
                        status       = product.status
                    };
                    this.mProductDataAccess.Update(data, tran);
                    MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicProduct);

                    //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                    //this.SaveMongoDbData("编辑商品资料", request, respond, this.GetType());
                });
            }
            catch (Exception ex)
            {
                respond = new RespondWebViewData <RespondEditProductViewModel>(WebViewErrorCode.Exception.ErrorCode, ex.Message);
            }
            return(respond);
        }
Пример #15
0
        public RespondWebViewData <List <RespondQueryUnitViewModel> > GetQueryUnitList(RequestWebViewData <RequestQueryUnitViewModel> request)
        {
            if (request.data == null)
            {
                request.data = new RequestQueryUnitViewModel();
            }
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <List <RespondQueryUnitViewModel> > >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetQueryUnitList"),

                #region =================
                CallBackFunc = () =>
                {
                    var parameter = new QueryUnitListParameter
                    {
                        Deleted = request.data.Deleted,
                        Name = request.data.Name,
                        PageIndex = request.page,
                        PageSize = request.rows,
                        Status = request.data.Status
                    };
                    var pageDataList = this.mUnitDataAccess.GetQueryUnitList(parameter);
                    var respond = new RespondWebViewData <List <RespondQueryUnitViewModel> >
                    {
                        total = pageDataList.DataCount,
                        rows = pageDataList.Datas.Select(item => new RespondQueryUnitViewModel
                        {
                            UnitId = item.unitid,
                            Name = item.name,
                            Deleted = item.deleted,
                            Status = item.status,
                            Sort = item.sort.ToString()
                        }).ToList()
                    };
                    return respond;
                },

                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicUnit,
                ParamsKeys = new object[]
                {
                    request.data.Name,
                    request.data.Status,
                    request.data.Deleted,
                    request.page,
                    request.rows
                }
            }));
        }
        public RespondWebViewData <RespondQueryUserViewModel> GetUserDataByUserId(RequestWebViewData <RequestQueryUserViewModel> request)
        {
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <RespondQueryUserViewModel> >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetUserDataByUserId"),

                #region ========================================================

                CallBackFunc = () =>
                {
                    var parameter = new QueryUserParameter
                    {
                        userid = request.data.UserId
                    };
                    var dataModel = this.mUserDataAccess.GetUserDataByUserId(parameter);
                    if (dataModel == null)
                    {
                        return new RespondWebViewData <RespondQueryUserViewModel>(WebViewErrorCode.NotExistsDataInfo);
                    }
                    var respond = new RespondWebViewData <RespondQueryUserViewModel>
                    {
                        rows = new RespondQueryUserViewModel
                        {
                            CTime = dataModel.CTime,
                            Comment = dataModel.Comment,
                            EmpId = dataModel.EmpId,
                            Manager = dataModel.Manager,
                            Prefix = dataModel.Prefix,
                            Status = dataModel.Status,
                            UserName = dataModel.UserName,
                            UsePwd = dataModel.UsePwd,
                            UserId = dataModel.UserId,
                            Deleted = dataModel.Deleted,
                            Synchron = dataModel.Synchron,
                            ComId = dataModel.ComId
                        }
                    };
                    return respond;
                },

                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.UserManage,
                ParamsKeys = new object[]
                {
                    request.data.UserId
                }
            }));
        }
Пример #17
0
        public RespondWebViewData <RespondEditDepartmentViewModel> EditDepartment(RequestWebViewData <RequestEditDepartmentViewModel> request)
        {
            var rData = request.data;

            if (this.mDepartmentDataAccess.CheckDepartmentIsExist(new QueryDepartmentListParameter {
                Name = rData.Name, SerialNumber = rData.SerialNumber, DepId = rData.DepId
            }))
            {
                return(new RespondWebViewData <RespondEditDepartmentViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的部门已经存在", rData.Name, rData.SerialNumber)));
            }

            var respond = new RespondWebViewData <RespondEditDepartmentViewModel>(WebViewErrorCode.Success);

            this.mDbConnection.ExecuteTransaction(tran =>
            {
                var department = this.mDepartmentDataAccess.GetdepartmentDataModelById(rData.DepId);
                if (department == null)
                {
                    respond = new RespondWebViewData <RespondEditDepartmentViewModel>(WebViewErrorCode.NotExistsDataInfo);
                    return;
                }
                if (department.deleted == (short)CommonDeleted.Deleted)
                {
                    respond = new RespondWebViewData <RespondEditDepartmentViewModel>(WebViewErrorCode.NotExistsDataInfo);
                    return;
                }

                var data = new departmentDataModel()
                {
                    depid        = rData.DepId,
                    comment      = rData.Comment,
                    name         = rData.Name,
                    pinyin       = rData.Spelling,
                    serialnumber = rData.SerialNumber,
                    sort         = rData.Sort,
                    status       = department.status,
                    deleted      = department.deleted,
                    childnumber  = department.childnumber,
                    classid      = department.classid,
                    parentid     = department.parentid
                };
                this.mDepartmentDataAccess.Update(data, tran);
                MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicDepartment);

                //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                //this.SaveMongoDbData("编辑分公司资料", request, respond, this.GetType());
            });
            return(respond);
        }
        public RespondWebViewData <RespondSigninUserViewModel> FindSininUserDataModelByUserID(RequestOnlineSigninUserViewModel request)
        {
            var parameter = new OnlineSigninUserParameter
            {
                UserID = request.UserID
            };
            var dataModel = this.mSiginUserDataAccess.FindSininUserDataModelByUserID(parameter);

            if (dataModel == null)
            {
                return(new RespondWebViewData <RespondSigninUserViewModel>(WebViewErrorCode.NotExistUserInfo));
            }
            var companyInfoRequest = new RequestCompanyInfoViewModel
            {
                CompanyID = dataModel.comid
            };
            var companyInfo      = this.mCompanyInfoViewService.GetCompanyInfoViewModel(companyInfoRequest);
            var connectionConfig = new DbConnectionConfig
            {
                ConnectTimeout = companyInfo.ConnectTimeout,
                Database       = companyInfo.Database,
                Password       = companyInfo.Password,
                Server         = companyInfo.Server,
                UserID         = companyInfo.UserID
            };

            FormsAuthenticationTicketManage.RenewTicketIfOld(request.SGuid);
            var respond = new RespondWebViewData <RespondSigninUserViewModel>
            {
                rows = new RespondSigninUserViewModel
                {
                    CurrentUser = new SigninUser
                    {
                        CompanySerialNum = dataModel.comid,
                        UserID_g         = request.SGuid,
                        UserID           = dataModel.userid,
                        UserName         = dataModel.username,
                        AddressIP        = UserIPAddressTool.GetRealUserIPAddress(),
                        ConnectionConfig = connectionConfig,
                        IsManager        = dataModel.ismanager,
                        IsSystem         = dataModel.issystem
                    }
                }
            };

            HttpContext.Current.Items.Add(BeforeCompileConstDefined.HttpContext_Login_User, respond.rows.CurrentUser);
            return(respond);
        }
Пример #19
0
        public RespondWebViewData <RespondQueryUnitViewModel> GetUnitByUnitId(RequestWebViewData <RequestGetUnitByIdViewModel> request)
        {
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <RespondQueryUnitViewModel> >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetUnitByUnitId"),

                #region ====================
                CallBackFunc = () =>
                {
                    var respond = new RespondWebViewData <RespondQueryUnitViewModel>
                    {
                        rows = new RespondQueryUnitViewModel()
                    };
                    var unit = this.mUnitDataAccess.GetunitDataModelById(request.data.UnitId);
                    if (unit == null)
                    {
                        return respond;
                    }
                    if (unit.deleted == (short)CommonDeleted.Deleted || unit.status != (short)CommonStatus.Used)
                    {
                        return respond;
                    }
                    respond = new RespondWebViewData <RespondQueryUnitViewModel>
                    {
                        rows = new RespondQueryUnitViewModel
                        {
                            UnitId = unit.unitid,
                            Deleted = unit.deleted,
                            Name = unit.name,
                            Status = unit.status,
                            Sort = unit.sort.ToString()
                        }
                    };
                    return respond;
                },
                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicUnit,
                ParamsKeys = new object[]
                {
                    request.data.UnitId
                }
            }));
        }
Пример #20
0
        public RespondWebViewData <RespondEditUnitViewModel> EditUnit(RequestWebViewData <RequestEditUnitViewModel> request)
        {
            var rData = request.data;

            if (this.mUnitDataAccess.CheckUnitIsExist(new QueryUnitListParameter {
                Name = rData.Name, UnitId = rData.UnitId
            }))
            {
                return(new RespondWebViewData <RespondEditUnitViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]的计量单位已经存在", rData.Name)));
            }

            var respond = new RespondWebViewData <RespondEditUnitViewModel>(WebViewErrorCode.Success);

            this.mDbConnection.ExecuteTransaction(tran =>
            {
                var unit = this.mUnitDataAccess.GetunitDataModelById(rData.UnitId);
                if (unit == null)
                {
                    respond = new RespondWebViewData <RespondEditUnitViewModel>(WebViewErrorCode.NotExistsDataInfo);
                    return;
                }
                if (unit.deleted == (short)CommonDeleted.Deleted)
                {
                    respond = new RespondWebViewData <RespondEditUnitViewModel>(WebViewErrorCode.NotExistsDataInfo);
                    return;
                }

                var data = new unitDataModel()
                {
                    unitid  = rData.UnitId,
                    name    = rData.Name,
                    status  = unit.status,
                    deleted = unit.deleted,
                    sort    = rData.Sort
                };
                this.mUnitDataAccess.Update(data, tran);
                MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicUnit);

                //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                //this.SaveMongoDbData("编辑分公司资料", request, respond, this.GetType());
            });
            return(respond);
        }
        public RespondWebViewData <RespondDeleteSubCompanyViewModel> ReDeleteSubCompany(RequestWebViewData <RequestDeleteSubCompanyViewModel> request)
        {
            var respond   = new RespondWebViewData <RespondDeleteSubCompanyViewModel>(WebViewErrorCode.Exception);
            var parameter = new DeleteSubCompanyParameter
            {
                ComId   = request.data.ComId,
                Deleted = (short)CommonDeleted.NotDeleted
            };
            var dataResult = this.mSubCompanyDataAccess.ReDelete(parameter);

            if (dataResult <= 0)
            {
                return(respond);
            }
            respond = new RespondWebViewData <RespondDeleteSubCompanyViewModel>(WebViewErrorCode.Success);
            MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicSubCompany);

            //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
            //this.SaveMongoDbData("恢复删除分公司资料", request, respond, this.GetType());
            return(respond);
        }
Пример #22
0
        public RespondWebViewData <RespondDeleteUnitViewModel> DeleteUnit(RequestWebViewData <RequestDeleteUnitViewModel> request)
        {
            var respond   = new RespondWebViewData <RespondDeleteUnitViewModel>(WebViewErrorCode.Exception);
            var parameter = new DeleteUnitParameter
            {
                UnitId  = request.data.UnitId,
                Deleted = (short)CommonDeleted.Deleted
            };
            var dataResult = this.mUnitDataAccess.Delete(parameter);

            if (dataResult <= 0)
            {
                return(respond);
            }
            respond = new RespondWebViewData <RespondDeleteUnitViewModel>(WebViewErrorCode.Success);
            MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicUnit);

            //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
            //this.SaveMongoDbData("删除部门资料", request, respond, this.GetType());
            return(respond);
        }
Пример #23
0
        public RespondWebViewData <RespondAddUnitViewModel> AddUnit(RequestWebViewData <RequestAddUnitViewModel> request)
        {
            var rData = request.data;

            if (this.mUnitDataAccess.CheckUnitIsExist(new QueryUnitListParameter {
                Name = rData.Name
            }))
            {
                return(new RespondWebViewData <RespondAddUnitViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]的计量单位已经存在", rData.Name)));
            }

            var respond = new RespondWebViewData <RespondAddUnitViewModel>(WebViewErrorCode.Success);

            try
            {
                this.mDbConnection.ExecuteTransaction(tran =>
                {
                    var data = new unitDataModel
                    {
                        name    = rData.Name,
                        status  = (short)CommonStatus.Used,
                        deleted = (short)CommonDeleted.NotDeleted,
                        sort    = rData.Sort
                    };
                    this.mUnitDataAccess.Add(data, tran);
                    MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicUnit);

                    //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                    //this.SaveMongoDbData("新增部门资料", request, respond, this.GetType());
                });
            }
            catch (Exception ex)
            {
                respond = new RespondWebViewData <RespondAddUnitViewModel>(new ErrorCodeItem(WebViewErrorCode.Exception.ErrorCode, ex.Message));
            }
            return(respond);
        }
Пример #24
0
        public RespondWebViewData <RespondAddStorageViewModel> AddStorage(RequestWebViewData <RequestAddStorageViewModel> request)
        {
            var rData = request.data;

            if (this.mStorageDataAccess.CheckStorageIsExist(new QueryStorageListParameter {
                Name = rData.Name, SerialNumber = rData.SerialNumber
            }))
            {
                return(new RespondWebViewData <RespondAddStorageViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的仓库已经存在", rData.Name, rData.SerialNumber)));
            }

            var respond = new RespondWebViewData <RespondAddStorageViewModel>(WebViewErrorCode.Success);

            try
            {
                var storage = this.mStorageDataAccess.GetStorageByClassID(new QueryStorageListParameter {
                    ParentId = rData.ParentId
                });
                if (storage == null)
                {
                    return(new RespondWebViewData <RespondAddStorageViewModel>(WebViewErrorCode.NotExistsDataInfo));
                }
                if (storage.deleted == (short)CommonDeleted.Deleted)
                {
                    return(new RespondWebViewData <RespondAddStorageViewModel>(WebViewErrorCode.NotExistsDataInfo));
                }

                this.mDbConnection.ExecuteTransaction(tran =>
                {
                    var parameter = new QueryStorageListParameter
                    {
                        ParentId = rData.ParentId
                    };
                    var classId    = string.Concat(rData.ParentId, "000001");
                    var clientList = this.mStorageDataAccess.GetStorageListByParentID(parameter);
                    if (clientList.Count > 0)
                    {
                        classId = BuildNewClassIdByLastClassId.GeneratedNewClassIdByLastClassId(clientList[0].classid);
                    }

                    var data = new storageDataModel
                    {
                        classid      = classId,
                        alias        = rData.Alias,
                        childnumber  = 0,
                        childcount   = 0,
                        comment      = rData.Comment,
                        deleted      = (short)CommonDeleted.NotDeleted,
                        name         = rData.Name,
                        parentid     = rData.ParentId,
                        PinYin       = rData.Spelling,
                        serialnumber = rData.SerialNumber,
                        status       = (short)CommonStatus.Used,
                        sort         = rData.Sort
                    };
                    var addResult = this.mStorageDataAccess.Add(data, tran);
                    if (addResult > 0)
                    {
                        this.mStorageDataAccess.UpdateChildNumberByClassId(tran, parameter);
                    }
                    MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicStorage);

                    //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                    //this.SaveMongoDbData("新增往来客户资料", request, respond, this.GetType());
                });
            }
            catch (Exception exception)
            {
                respond = new RespondWebViewData <RespondAddStorageViewModel>(new ErrorCodeItem(WebViewErrorCode.Exception.ErrorCode, exception.Message));
            }
            return(respond);
        }
        public RespondWebViewData <RespondSigninUserViewModel> QuerySigninUserViewModel(RequestSigninUserViewModel request)
        {
            var userID_g = Guid.NewGuid();
            var _tmp     = request.UserName.Split(':');

            if (_tmp.Length != 2)
            {
                return(new RespondWebViewData <RespondSigninUserViewModel>(WebViewErrorCode.SigninInfoError));
            }
            var parameter = new SigninUserParameter
            {
                UserName         = _tmp[1],
                UserPwd          = request.UserPwd.ToMD5String(),
                CompanySerialNum = _tmp[0]
            };
            var dataModel = this.mSiginUserDataAccess.QuerySigninUserDataModel(parameter);

            if (dataModel == null)
            {
                return(new RespondWebViewData <RespondSigninUserViewModel>(WebViewErrorCode.UserNameOrPwdError));
            }
            //var companyInfoRequest = new RequestCompanyInfoViewModel
            //{
            //    CompanyID = dataModel.CompanySerialNum
            //};
            //var companyInfo = this.mCompanyInfoViewService.GetCompanyInfoViewModel(companyInfoRequest);
            //var connectionConfig = new DbConnectionConfig
            //{
            //    ConnectTimeout = companyInfo.ConnectTimeout,
            //    Database = companyInfo.Database,
            //    Password = companyInfo.Password,
            //    Server = companyInfo.Server,
            //    UserID = companyInfo.UserID
            //};
            var _respond = new RespondWebViewData <RespondSigninUserViewModel>
            {
                rows = new RespondSigninUserViewModel
                {
                    CurrentUser = new SigninUser
                    {
                        CompanySerialNum = dataModel.comid,
                        UserID_g         = userID_g,
                        UserID           = dataModel.userid,
                        UserName         = dataModel.username,
                        IsManager        = dataModel.ismanager,
                        IsSystem         = dataModel.issystem
                    }
                }
            };

            this.SaveLoginUserToOnline(new RequestSigninUserViewModel
            {
                UserID   = dataModel.userid,
                UserName = dataModel.username,
                UserID_g = userID_g
            });
            FormsAuthenticationTicketManage.CreateFormsAuthentication(userID_g);
            HttpContext.Current.Items.Add(BeforeCompileConstDefined.HttpContext_Login_User, _respond.rows.CurrentUser);
            //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
            //this.SaveMongoDbData("登录操作", request, _respond, this.GetType());
            return(_respond);
        }
Пример #26
0
        public RespondWebViewData <RespondAddProductViewModel> AddProduct(RequestWebViewData <RequestAddProductViewModel> request)
        {
            var rData = request.data;

            if (this.mProductDataAccess.CheckProductIsExist(new QueryProductListParameter {
                Name = rData.Name, SerialNumber = rData.SerialNumber
            }))
            {
                return(new RespondWebViewData <RespondAddProductViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的商品已经存在", rData.Name, rData.SerialNumber)));
            }

            var respond = new RespondWebViewData <RespondAddProductViewModel>(WebViewErrorCode.Success);

            try
            {
                var product = this.mProductDataAccess.GetProductByClassID(new QueryProductListParameter {
                    ParentId = rData.ParentId
                });
                if (product == null)
                {
                    return(new RespondWebViewData <RespondAddProductViewModel>(WebViewErrorCode.NotExistsDataInfo));
                }
                if (product.deleted == (short)CommonDeleted.Deleted)
                {
                    return(new RespondWebViewData <RespondAddProductViewModel>(WebViewErrorCode.NotExistsDataInfo));
                }
                this.mDbConnection.ExecuteTransaction(tran =>
                {
                    var parameter = new QueryProductListParameter()
                    {
                        ParentId = rData.ParentId
                    };
                    var classId = string.Concat(rData.ParentId, "000001");
                    var depList = this.mProductDataAccess.GetProductListByParentID(parameter);
                    if (depList.Count > 0)
                    {
                        classId = BuildNewClassIdByLastClassId.GeneratedNewClassIdByLastClassId(depList[0].classid);
                    }

                    var data = new productDataModel
                    {
                        classid      = classId,
                        deleted      = (short)CommonDeleted.NotDeleted,
                        name         = rData.Name,
                        parentid     = rData.ParentId,
                        pinyin       = rData.Spelling,
                        serialnumber = rData.SerialNumber,
                        sort         = rData.Sort,
                        status       = (short)CommonStatus.Used
                    };
                    var addResult = this.mProductDataAccess.Add(data, tran);
                    if (addResult > 0)
                    {
                        this.mProductDataAccess.UpdateChildNumberByClassId(tran, parameter);
                    }
                    MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicProduct);

                    //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                    //this.SaveMongoDbData("新增商品资料", request, respond, this.GetType());
                });
            }
            catch (Exception ex)
            {
                respond = new RespondWebViewData <RespondAddProductViewModel>(new ErrorCodeItem(WebViewErrorCode.Exception.ErrorCode, ex.Message));
            }
            return(respond);
        }
        public RespondWebViewData <List <RespondQuerySubCompanyViewModel> > GetQueryCompanyList(RequestWebViewData <RequestQuerySubCompanyViewModel> request)
        {
            if (request.data == null)
            {
                request.data = new RequestQuerySubCompanyViewModel();
            }

            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <List <RespondQuerySubCompanyViewModel> > >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetQueryCompanyList"),

                #region ==========================

                CallBackFunc = () =>
                {
                    var parameter = new QuerySubCompanyListParameter
                    {
                        Email = request.data.Email,
                        LinkMan = request.data.LinkMan,
                        LinkTel = request.data.LinkTel,
                        Name = request.data.Name,
                        PageIndex = request.page,
                        PageSize = request.rows,
                        ParentId = request.data.ParentId,
                        PriceMode = request.data.PriceMode,
                        SerialNumber = request.data.SerialNumber,
                        Spelling = request.data.Spelling,
                        Status = request.data.Status,
                        Deleted = request.data.Deleted
                    };
                    var pageDataList = this.mSubCompanyDataAccess.GetQuerySubCompanyList(parameter);
                    var respond = new RespondWebViewData <List <RespondQuerySubCompanyViewModel> >
                    {
                        total = pageDataList.DataCount,
                        rows = pageDataList.Datas.Select(item => new RespondQuerySubCompanyViewModel
                        {
                            ClassId = item.classid,
                            ComId = item.subcomid,
                            Email = item.email,
                            Comment = item.comment,
                            LinkMan = item.linkman,
                            LinkTel = item.linktel,
                            Name = item.name,
                            ParentId = item.parentid,
                            PriceMode = item.pricemode.ToString(),
                            SerialNumber = item.serialnumber,
                            sort = item.sort.ToString(),
                            Status = item.status.ToString(),
                            Spelling = item.pinyin,
                            ChildNumber = item.childnumber,
                            Deleted = item.deleted
                        }).ToList()
                    };
                    return respond;
                },

                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicSubCompany,
                ParamsKeys = new object[]
                {
                    request.page,
                    request.rows,
                    request.data.ParentId,
                    request.data.Email,
                    request.data.LinkMan,
                    request.data.LinkTel,
                    request.data.Name,
                    request.data.PriceMode,
                    request.data.SerialNumber,
                    request.data.Spelling,
                    request.data.Status,
                    request.data.Deleted
                }
            }));
        }
Пример #28
0
        public RespondWebViewData <List <RespondQueryStorageViewModel> > GetQueryStorageList(RequestWebViewData <RequestQueryStorageViewModel> request)
        {
            if (request.data == null)
            {
                request.data = new RequestQueryStorageViewModel();
            }
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <List <RespondQueryStorageViewModel> > >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetQueryStorageList"),

                #region =================
                CallBackFunc = () =>
                {
                    var parameter = new QueryStorageListParameter
                    {
                        Alias = request.data.Alias,
                        Deleted = request.data.Deleted,
                        Name = request.data.Name,
                        PageSize = request.rows,
                        PageIndex = request.page,
                        ParentId = request.data.ParentId,
                        SerialNumber = request.data.SerialNumber,
                        Spelling = request.data.Spelling,
                        Status = request.data.Status
                    };
                    var pageDataList = this.mStorageDataAccess.GetQueryStorageList(parameter);
                    var respond = new RespondWebViewData <List <RespondQueryStorageViewModel> >
                    {
                        total = pageDataList.DataCount,
                        rows = pageDataList.Datas.Select(item => new RespondQueryStorageViewModel
                        {
                            Alias = item.alias,
                            ParentId = item.parentid,
                            Spelling = item.PinYin,
                            ChildNumber = item.childnumber,
                            ClassId = item.classid,
                            Comment = item.comment,
                            Deleted = item.deleted,
                            Name = item.name,
                            SerialNumber = item.serialnumber,
                            Sort = item.sort,
                            StorageId = item.stoid,
                            Status = item.status
                        }).ToList()
                    };
                    return respond;
                },

                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicStorage,
                ParamsKeys = new object[]
                {
                    request.page,
                    request.rows,
                    request.data.Alias,
                    request.data.Deleted,
                    request.data.Name,
                    request.data.ParentId,
                    request.data.SerialNumber,
                    request.data.Spelling,
                    request.data.Status
                }
            }));
        }
        public RespondWebViewData <RespondAddSubCompanyViewModel> AddSubCompany(RequestWebViewData <RequestAddSubCompanyViewModel> request)
        {
            var rData = request.data;

            if (this.mSubCompanyDataAccess.CheckSubCompanyIsExist(new QuerySubCompanyListParameter {
                Name = rData.Name, SerialNumber = rData.SerialNumber
            }))
            {
                return(new RespondWebViewData <RespondAddSubCompanyViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的分公司已经存在", rData.Name, rData.SerialNumber)));
            }

            var respond = new RespondWebViewData <RespondAddSubCompanyViewModel>(WebViewErrorCode.Success);

            try
            {
                var subCompany = this.mSubCompanyDataAccess.GetSubCompanyByClassID(new QuerySubCompanyListParameter {
                    ParentId = rData.ParentId
                });
                if (subCompany == null)
                {
                    return(new RespondWebViewData <RespondAddSubCompanyViewModel>(WebViewErrorCode.NotExistsDataInfo));
                }
                if (subCompany.deleted == (short)CommonDeleted.Deleted)
                {
                    return(new RespondWebViewData <RespondAddSubCompanyViewModel>(WebViewErrorCode.NotExistsDataInfo));
                }
                this.mDbConnection.ExecuteTransaction(tran =>
                {
                    var parameter = new QuerySubCompanyListParameter
                    {
                        ParentId = rData.ParentId
                    };
                    var classId     = string.Concat(rData.ParentId, "000001");
                    var companyList = this.mSubCompanyDataAccess.GetSubCompanyListByParentID(parameter);
                    if (companyList.Count > 0)
                    {
                        classId = BuildNewClassIdByLastClassId.GeneratedNewClassIdByLastClassId(companyList[0].classid);
                    }

                    var data = new subcompanyDataModel
                    {
                        childnumber  = 0,
                        classid      = classId,
                        comment      = rData.Comment,
                        email        = rData.Email,
                        linktel      = rData.LinkTel,
                        linkman      = rData.LinkMan,
                        name         = rData.Name,
                        parentid     = rData.ParentId,
                        pinyin       = rData.Spelling,
                        pricemode    = rData.PriceMode,
                        serialnumber = rData.SerialNumber,
                        sort         = rData.Sort,
                        status       = (short)CommonStatus.Used,
                        deleted      = (short)CommonDeleted.NotDeleted
                    };
                    var addResult = this.mSubCompanyDataAccess.Add(data, tran);
                    if (addResult > 0)
                    {
                        this.mSubCompanyDataAccess.UpdateChildNumberByClassId(tran, parameter);
                    }
                    MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicSubCompany);

                    //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作
                    //this.SaveMongoDbData("新增分公司资料", request, respond, this.GetType());
                });
            }
            catch (Exception ex)
            {
                respond = new RespondWebViewData <RespondAddSubCompanyViewModel>(new ErrorCodeItem(WebViewErrorCode.Exception.ErrorCode, ex.Message));
            }
            return(respond);
        }
Пример #30
0
        public RespondWebViewData <List <RespondQueryProductViewModel> > GetQueryProductList(RequestWebViewData <RequestQueryProductViewModel> request)
        {
            if (request.data == null)
            {
                request.data = new RequestQueryProductViewModel();
            }
            return(MemcacheHelper.Get(new RequestMemcacheParameter <RespondWebViewData <List <RespondQueryProductViewModel> > >
            {
                CacheKey = string.Format(PRE_CACHE_KEY, "GetQueryProductList"),

                #region =================
                CallBackFunc = () =>
                {
                    var parameter = new QueryProductListParameter
                    {
                        PageSize = request.rows,
                        PageIndex = request.page,
                        Deleted = request.data.Deleted,
                        Name = request.data.Name,
                        ParentId = request.data.ParentId,
                        SerialNumber = request.data.SerialNumber,
                        Spelling = request.data.Spelling,
                        Status = request.data.Status
                    };
                    var pageDataList = this.mProductDataAccess.GetQueryProductList(parameter);
                    var respond = new RespondWebViewData <List <RespondQueryProductViewModel> >
                    {
                        total = pageDataList.DataCount,
                        rows = pageDataList.Datas.Select(item => new RespondQueryProductViewModel
                        {
                            Alias = item.alias,
                            BarCode = item.barcode,
                            Brand = item.brand,
                            ClassId = item.classid,
                            Comment = item.comment,
                            ChildCount = item.childcount,
                            CostMethod = item.costmethod,
                            Deleted = item.deleted,
                            MakeArea = item.makearea,
                            Modal = item.modal,
                            ParentId = item.parentid,
                            PermitCode = item.permitcode,
                            Spelling = item.pinyin,
                            ProId = item.proid,
                            Status = item.status,
                            SerialNumber = item.serialnumber,
                            SNLength = item.snlength,
                            SNManage = item.snmanage,
                            Sort = item.sort,
                            Standard = item.standard,
                            TaxRate = item.taxrate,
                            TradeMark = item.trademark,
                            UnitId = item.unitid,
                            ValidDay = item.validday,
                            ValidMonth = item.validmonth
                        }).ToList()
                    };
                    return respond;
                },

                #endregion

                ExpiresAt = DateTime.Now.AddMinutes(30),
                ManageCacheKeyForKey = ServiceMemcachedKeyManageConst.BasicProduct,
                ParamsKeys = new object[]
                {
                    request.data.ParentId,
                    request.page,
                    request.rows
                }
            }));
        }