internal static void CommitWarrenty(Warranty warranty) { using (Connection Connection = new Connection()) { Connection.BeginTransaction(); try { foreach (var x in warranty) { try { x.WarrentyNumber = Connection.Insert(x, warranty.Reciept.RecieptID, warranty.CustomerName, warranty.Email, warranty.Phone, warranty.Address, warranty.Country); } catch (Exception ex) { throw ex; } } try { using (HQConnection x = new HQConnection()) { HQConnection.UpdateWarrenties(); } } catch (Exception) { } Connection.CommitTransaction(); } catch (Exception ex) { Connection.RollbackTransaction(); throw ex; } } }
internal static List <Customer> GetCustomer(string Name, string Email, string PhoneNumber) { using (HQConnection Connection = new HQConnection()) { return(Connection.GetCustomers(Name, Email, PhoneNumber)); } }
internal static void CommitCustomer(Customer customer) { using (HQConnection Connection = new HQConnection()) { Connection.BeginTransaction(); try { Connection.UpdateCustomer(customer); Connection.CommitTransaction(); } catch (Exception ex) { Connection.RollbackTransaction(); throw ex; } } }