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); }
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); }
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); }
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); }
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 <RespondSaveSystemParameterConfigViewModel> SaveSystemParameterConfig(RequestWebViewData <RequestSystemParameterConfigListViewModel> request) { var parameters = request.data.ParameterConfigList.Select(item => new SystemParameterConfigParameter { ParameterConfigName = item.ParameterConfigName, ParameterConfigValue = item.ParameterConfigValue }).ToList(); var dataResult = this.mSystemParameterConfigDataAccess.SaveSystemParameterConfig(parameters); if (dataResult) { MemcacheHelper.RemoveBy(THISSERVICE_PRE_CACHE_KEY_MANAGE); } return(new RespondWebViewData <RespondSaveSystemParameterConfigViewModel>(dataResult ? WebViewErrorCode.Success : WebViewErrorCode.Exception)); }
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); }
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); }
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); }
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); }
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 <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 <RespondEditEmployeeViewModel> EditEmployee(RequestWebViewData <RequestEditEmployeeViewModel> request) { var rData = request.data; var employee = this.mEmployeeDataAccess.GetemployeeDataModelById(rData.EmpId); if (employee == null) { return(new RespondWebViewData <RespondEditEmployeeViewModel>(WebViewErrorCode.NotExistsDataInfo)); } if (employee.deleted == (short)CommonDeleted.Deleted) { return(new RespondWebViewData <RespondEditEmployeeViewModel>(WebViewErrorCode.NotExistsDataInfo)); } if (this.mEmployeeDataAccess.CheckEmployeeIsExist(new QueryEmployeeListParameter { Name = rData.Name, SerialNumber = rData.SerialNumber, DepId = employee.depid, EmpId = rData.EmpId })) { return(new RespondWebViewData <RespondEditEmployeeViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的职员已经存在", rData.Name, rData.SerialNumber))); } var respond = new RespondWebViewData <RespondEditEmployeeViewModel>(WebViewErrorCode.Success); try { this.mDbConnection.ExecuteTransaction(tran => { //TODO 开账后部门、名称、折扣、预收、预付等字段是不允许修改的,未实现。 var data = new employeeDataModel { address = rData.Address, childnumber = employee.childnumber, classid = employee.classid, comment = rData.Comment, depid = employee.depid, depname = employee.depname, deleted = employee.deleted, empid = rData.EmpId, mobile = rData.Mobile, name = rData.Name, prepayfeetotal = employee.prepayfeetotal, preinadvancetotal = employee.preinadvancetotal, pinyin = rData.Spelling, parentid = employee.parentid, serialnumber = rData.SerialNumber, sort = rData.Sort, status = employee.status, lowestdiscount = employee.lowestdiscount }; this.mEmployeeDataAccess.Update(data, tran); MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicEmployee); //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作 //this.SaveMongoDbData("编辑职员资料", request, respond, this.GetType()); }); } catch (Exception ex) { respond = new RespondWebViewData <RespondEditEmployeeViewModel>(WebViewErrorCode.Exception.ErrorCode, ex.Message); } return(respond); }
public RespondWebViewData <RespondAddEmployeeViewModel> AddEmployee(RequestWebViewData <RequestAddEmployeeViewModel> request) { var rData = request.data; if (this.mEmployeeDataAccess.CheckEmployeeIsExist(new QueryEmployeeListParameter { Name = rData.Name, SerialNumber = rData.SerialNumber, DepId = rData.DepId })) { return(new RespondWebViewData <RespondAddEmployeeViewModel>(WebViewErrorCode.ExistsDataInfo.ErrorCode, string.Format("名称为[{0}]或编号为[{1}]的职员已经存在", rData.Name, rData.SerialNumber))); } var respond = new RespondWebViewData <RespondAddEmployeeViewModel>(WebViewErrorCode.Success); try { var employee = this.mEmployeeDataAccess.GetEmployeeByClassID(new QueryEmployeeListParameter { ParentId = rData.ParentId }); if (employee == null) { return(new RespondWebViewData <RespondAddEmployeeViewModel>(WebViewErrorCode.NotExistsDataInfo)); } if (employee.deleted == (short)CommonDeleted.Deleted) { return(new RespondWebViewData <RespondAddEmployeeViewModel>(WebViewErrorCode.NotExistsDataInfo)); } this.mDbConnection.ExecuteTransaction(tran => { var parameter = new QueryEmployeeListParameter() { ParentId = rData.ParentId }; var classId = string.Concat(rData.ParentId, "000001"); var depList = this.mEmployeeDataAccess.GetEmployeeListByParentID(parameter); if (depList.Count > 0) { classId = BuildNewClassIdByLastClassId.GeneratedNewClassIdByLastClassId(depList[0].classid); } var data = new employeeDataModel { address = rData.Address, childnumber = 0, classid = classId, comment = rData.Comment, deleted = (short)CommonDeleted.NotDeleted, depid = rData.DepId, depname = rData.DepName, lowestdiscount = rData.LowestDiscount, mobile = rData.Mobile, name = rData.Name, parentid = rData.ParentId, pinyin = rData.Spelling, serialnumber = rData.SerialNumber, sort = rData.Sort, status = (short)CommonStatus.Used, preinadvancetotal = rData.PreInAdvanceTotal, prepayfeetotal = rData.PrepayFeeTotal }; var addResult = this.mEmployeeDataAccess.Add(data, tran); if (addResult > 0) { this.mEmployeeDataAccess.UpdateChildNumberByClassId(tran, parameter); } MemcacheHelper.RemoveBy(ServiceMemcachedKeyManageConst.BasicEmployee); //由于电脑配置不上mongodb固暂时先屏蔽掉此段mongodb的数据操作 //this.SaveMongoDbData("新增职员资料", request, respond, this.GetType()); }); } catch (Exception ex) { respond = new RespondWebViewData <RespondAddEmployeeViewModel>(new ErrorCodeItem(WebViewErrorCode.Exception.ErrorCode, ex.Message)); } return(respond); }