private static string GetPOSNumber(POSDto posDto) { int year = ValidationHelper.GetInteger(posDto.Year, default(int)); if (year != default(int)) { return($"{GetBrandCode(posDto.Brand)}{(year % 100)}{posDto.POSCode}"); } else { return(string.Empty); } }
private static bool ValidateImportItem(POSDto pos, out List <string> validationErrors) { var errorMessageFormat = "field {0} - {1}"; bool isValid = ValidatorHelper.ValidateDto(pos, out validationErrors, errorMessageFormat); if (!isValid) { return(false); } if (IsPOSNumberExists(GetPOSNumber(pos))) { isValid = false; validationErrors.Add(ResHelper.GetString("Kadena.POS.BulkImport.POSAlreadyExists")); } return(isValid); }
private static void SavePOS(POSDto posDto) { POSCategoryItem posCategory = GetPOSCategory(posDto.POSCategory); BrandItem brand = GetBrand(posDto.Brand); if (posCategory != null && brand != null) { POSNumberItem pos = new POSNumberItem() { BrandID = brand.BrandCode, BrandName = brand.BrandName, Year = ValidationHelper.GetInteger(posDto.Year, default(int)), POSCode = ValidationHelper.GetString(posDto.POSCode, default(string)), POSNumber = ValidationHelper.GetString(GetPOSNumber(posDto), default(string)), POSCategoryID = posCategory.ItemID, POSCategoryName = posCategory.PosCategoryName }; pos.Insert(); _currentPOSList.Add(pos); } }