private async Task<ImportValidationResultInfo> ValidateCommodityOwnerTypeAsync(CommodityOwnerType commodityType) { return await Task.Run(() => { var res = _commodityOwnerTypeRepository.Validate(commodityType); return new ImportValidationResultInfo() { Results = res.Results, // Description = "Row-" + count, Entity = commodityType }; }); }
public bool CheckCommodityOwnerTypeIsUsed(CommodityOwnerType commodityOwnerType, EntityStatus intendedStatus) { if (intendedStatus == EntityStatus.Inactive) { if (_ctx.tblCommodityOwner.Any(n => n.CommodityOwnerTypeId == commodityOwnerType.Id && n.IM_Status == (int)EntityStatus.Active)) return true; } else if (intendedStatus == EntityStatus.Deleted) { if (_ctx.tblCommodityOwner.Any(n => n.CommodityOwnerTypeId == commodityOwnerType.Id && (n.IM_Status == (int)EntityStatus.Inactive || n.IM_Status == (int)EntityStatus.Active))) return true; } return false; }
public CommodityOwnerTypeDTO Map(CommodityOwnerType commodityOwnerType) { if (commodityOwnerType == null) return null; var commodityOwnerTypeDto = Mapper.Map<CommodityOwnerType, CommodityOwnerTypeDTO>(commodityOwnerType); return commodityOwnerTypeDto; }
private ValidationResultInfo Validate(CommodityOwnerType commodityTypeImport) { return _commodityOwnerTypeRepository.Validate(commodityTypeImport); }
private void ClearViewModel() { AccountFullName = ""; AccountName = ""; AccountNumber = ""; PinNumber = ""; CostCenterCode =""; SelectedBank = new Bank(Guid.Empty){Name="--Select Bank--"}; SelectedBankBranch = new BankBranch(Guid.Empty) { Name = "--Select Bank Branch--" }; SelectedCommoditySupplierType = CommoditySupplierType.Default; SelectedCommoditySupplierType = CommoditySupplierType.Individual; SelectedMaritalStatus = MaritalStatas.Default; SelectedMaritalStatus = MaritalStatas.Single; FarmCode = ""; FarmName =""; Acerage = ""; FarmRegistrationNo = ""; FarmPhysicalAddress = ""; FarmDescription = ""; Surname = ""; FirstName = ""; MiddleName = ""; OwnerCode = ""; IdNumber = ""; PinNumber = ""; PhysicalAddress = ""; PostalAddress = ""; Email = ""; PhoneNumber = ""; BusinessNumber = ""; FaxNumber = ""; OfficeNumber = ""; Description = ""; DateOfBirth = DateTime.Now; AssignedCentresList.Clear(); SupplierIsEnabled = true; SelectedCommodityOwnerType = new CommodityOwnerType(Guid.Empty){Name="--Select Commodity Type--"}; }
protected Guid AddCommodityOwnerType(string code,string name) { CommodityOwnerType cot = new CommodityOwnerType(Guid.NewGuid()) { Code = code, Name = name, Description = "desc", _Status = EntityStatus.Active, }; return _commodityOwnerTypeRepository.Save(cot); }
private void AssertCommodityType(CommodityOwnerType commodityOwnerType, CommodityOwnerType savedCommodityOwnerType) { Assert.AreEqual(commodityOwnerType.Code,savedCommodityOwnerType.Code); Assert.AreEqual(commodityOwnerType.Name,savedCommodityOwnerType.Name); Assert.AreEqual(commodityOwnerType.Description,savedCommodityOwnerType.Description); Assert.AreEqual(commodityOwnerType._Status,savedCommodityOwnerType._Status); }