示例#1
0
 public byte InsertTransaction(Transaction transaction)
 {
     try
     {
         ExecuteNonQuery("usp_Insert_Transaction", transaction);
         return(0);
     }
     catch (Exception ex)
     {
         string note = ex.Message;
         if (ex.Message.Contains("dbo.Item_"))
         {
             note = string.Format("Error inserting transaction. Transaction number: {0}. Item with SKU: {1} does not exist!", transaction.Number, transaction.SKU);
         }
         else if (ex.Message.Contains("dbo.Department_"))
         {
             note = string.Format("Error inserting transaction. Transaction number: {0}. DepartmentId: {1} does not exist!", transaction.Number, transaction.DepartmentId);
         }
         DataError dataError = new DataError {
             RetailerId = transaction.RetailerId, Source = InputFileType.Transactions, ElementId = transaction.SKU ?? -1, Note = note
         };
         DataErrDAL.InsertDataError(dataError);
         return(1);
     }
 }
示例#2
0
 public byte InsertDepartment(Department dept)
 {
     try
     {
         ExecuteNonQuery("usp_Insert_Department", dept);
         return(0);
     }
     catch (Exception ex)
     {
         DataError dataError = new DataError {
             RetailerId = dept.RetailerId, Source = InputFileType.Departments, ElementId = dept.Id, Note = ex.Message
         };
         DataErrDAL.InsertDataError(dataError);
         return(1);
     }
 }
示例#3
0
 public byte InsertItem(Item item)
 {
     try
     {
         ExecuteNonQuery("usp_Insert_Item", item);
         return(0);
     }
     catch (Exception ex)
     {
         string note = ex.Message;
         if (ex.Message.Contains("dbo.Department_"))
         {
             note = string.Format("Error inserting Item. Department with ID: {0} does not exist.", item.DepartmentId);
         }
         DataError dataError = new DataError {
             RetailerId = item.RetailerId, Source = InputFileType.Items, ElementId = item.SKU, Note = note
         };
         DataErrDAL.InsertDataError(dataError);
         return(1);
     }
 }