partial void DeleteSalesCode(SalesCode instance);
 partial void UpdateSalesCode(SalesCode instance);
 public void SaveImportData(IEnumerable<ImportClass> importSalesCodes, int SalesPromotionId = 0, string fileName = "")
 {
     s26webDataContext db = new s26webDataContext();
     try
     {
         foreach (var item in importSalesCodes)
         {
             SalesCode new_item = new SalesCode
             {
                 SalesPromotionId = SalesPromotionId,
                 SalesPromotionPoint = Get_SalesPromotionPoint(SalesPromotionId),
                 SalesPromotionDeadline = Get_SalesPromotionDeadline(SalesPromotionId),
                 Code = item.Code,
                 ExchangeStatus = false,
                 VolunteersId = 0,
                 CreateTime = DateTime.UtcNow
             };
             db.SalesCode.InsertOnSubmit(new_item);
             db.SubmitChanges();
             db.Connection.Close();
         }
         if (File.Exists(fileName))
         {
             File.Delete(fileName);
         }
     }
     catch
     {
         throw;
     }
 }
 partial void InsertSalesCode(SalesCode instance);
 public int Insert(SalesCodeModelShow item)
 {
     s26webDataContext db = new s26webDataContext();
     try
     {
         SalesCode new_item = new SalesCode
         {
             Code = item.Code,
             SalesPromotionId = item.SalesPromotionId,
             SalesPromotionPoint = Get_SalesPromotionPoint(item.SalesPromotionId),
             SalesPromotionDeadline = Get_SalesPromotionDeadline(item.SalesPromotionId),
             ExchangeStatus = false,
             VolunteersId = 0,
             CreateTime = DateTime.UtcNow
         };
         db.SalesCode.InsertOnSubmit(new_item);
         db.SubmitChanges();
         db.Connection.Close();
         return new_item.Id;
     }
     catch
     {
         return -1;
     }
 }