Esempio n. 1
0
        public static Department ToDALDepartment(this DepartmentFixed department, int retailerId, DataErrorDAL dataErrorDAL)
        {
            if (department == null)
            {
                return(null);
            }

            try
            {
                Department result = new Department
                {
                    RetailerId  = retailerId,
                    Id          = department.DepartmentId.ToInt(),
                    Description = department.Description.RemoveTrailCommaAndSanitize()
                };

                return(result);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                DataError dataError = new DataError {
                    RetailerId = retailerId, Source = InputFileType.Items, ElementId = department.DepartmentId.ToInt()
                };
                dataErrorDAL.InsertDataError(dataError);
                return(null);
            }
        }
Esempio n. 2
0
        public static Item ToDALItem(this ItemFixed item, int retailerId, JobAudit job, DataErrorDAL dataErrorDAL)
        {
            if (item == null)
            {
                return(null);
            }
            try
            {
                string sDepIp = item.DepartmentID.RemoveTrailComma();
                int    depId  = 0;
                if (!string.IsNullOrEmpty(sDepIp))
                {
                    depId = Convert.ToInt32(sDepIp);
                }

                Item result = new Item
                {
                    RetailerId       = retailerId,
                    SKU              = item.ItemID.ToLong(),
                    Description      = item.ReceiptDescription.RemoveTrailCommaAndSanitize(),
                    DepartmentId     = item.DepartmentID.ToNullableInt(),
                    PriceGroup       = item.PriceGroupId.ToInt(),
                    ProductGroup     = item.MixMatchIdFiveDigit.ToInt(),
                    Category7        = item.FoodStampFlag.ToBool(),
                    Category8        = item.NoneMerchandiseID.ToBool(),
                    Category9        = item.StoreCouponFlag.ToBool(),
                    Category10       = item.WICFlag.ToBool(),
                    Size             = item.Size.RemoveTrailComma(),
                    Unit             = item.Unit.RemoveTrailComma(),
                    CurrentUnitPrice = item.CenterPrice.ToDouble(),
                    QtyPrice         = item.RetailPrice.ToDouble(),
                    QtyBreak         = item.UnitQuantity.ToInt()
                };

                return(result);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                DataError dataError = new DataError {
                    RetailerId = retailerId, Source = InputFileType.Items, ElementId = item.ItemID.ToLong(), Note = "Items file parse error! Row is wrongly formatted!"
                };
                dataErrorDAL.InsertDataError(dataError);
                job.IncrementError(1);
                return(null);
            }
        }
 public DepartmentProcessor()
 {
     DataErrDAL = new DataErrorDAL();
     DeptDAL    = new DepartmentDAL(DataErrDAL);
 }
 public TransactionProcessor()
 {
     DataErrDAL = new DataErrorDAL();
     TransDAL   = new TransactionDAL(DataErrDAL);
 }
Esempio n. 5
0
 public ItemProcessor()
 {
     DataErrDAL = new DataErrorDAL();
     ItmDAL     = new ItemDAL(DataErrDAL);
 }