public string Delete(shipment_cost shipservice) { string rpta; shipment_cost shipCost = new shipment_cost(); try { using (var ctx = new transshipEntities()) { shipCost = ctx.shipment_cost.FirstOrDefault(x => x.shipmentId == shipservice.shipmentId && x.service_typeId == shipservice.service_typeId && x.measure_unitId == shipservice.measure_unitId); if (shipCost != null) { ctx.Entry(shipCost).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public string ChangePassword(int id, string email, string password, string newPass) { string rpta; Users user = new Users(); Payments us; try { us = user.getUser(email); if (us.password == password) { newPass = TransShip.Security.Security.Encrypt(newPass, new RijndaelManaged(), KEY); users u = new users() { userId = id, email = email, password = newPass }; using (var ctx = new transshipEntities()) { ctx.users.Attach(u); ctx.Entry(u).Property(x => x.password).IsModified = true; ctx.Configuration.ValidateOnSaveEnabled = false; ctx.SaveChanges(); } rpta = "Password was changed sucessfull"; } else { rpta = "Password incorrect"; } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public string DeleteUnit(int id) { string rpta; measure_units unit = new measure_units(); try { using (var ctx = new transshipEntities()) { unit = ctx.measure_units.FirstOrDefault(x => x.measure_unitId == id); if (unit != null) { ctx.Entry(unit).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public string DeleteCustomer(int id) { string rpta; customers customer = new customers(); try { using (var ctx = new transshipEntities()) { customer = ctx.customers.FirstOrDefault(x => x.customerId == id); if (customer != null) { ctx.Entry(customer).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public string Delete(int id) { string rpta; membership_history history = new membership_history(); try { using (var ctx = new transshipEntities()) { history = ctx.membership_history.FirstOrDefault(x => x.membership_HistoryId == id); if (history != null) { ctx.Entry(history).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public string DeleteAddres(int idAddress) { string rpta; recurring_addresses address = new recurring_addresses(); try { using (var ctx = new transshipEntities()) { address = ctx.recurring_addresses.FirstOrDefault(x => x.addressId == idAddress); if (address != null) { ctx.Entry(address).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public string Delete(shipment_tracking tracking) { string rpta; shipment_tracking shipTrack = new shipment_tracking(); try { using (var ctx = new transshipEntities()) { shipTrack = ctx.shipment_tracking.FirstOrDefault(x => x.shipmentId == tracking.shipmentId && x.trackingId == tracking.trackingId && x.userId == tracking.userId); if (shipTrack != null) { ctx.Entry(shipTrack).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public string DeleteService(int id) { string rpta; service_types service = new service_types(); try { using (var ctx = new transshipEntities()) { service = ctx.service_types.FirstOrDefault(x => x.service_typeId == id); if (service != null) { ctx.Entry(service).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public string DeleteRates(rates rates) { string rpta; rates rate = new rates(); try { using (var ctx = new transshipEntities()) { rate = ctx.rates.FirstOrDefault(x => (x.vendorId == rates.vendorId && x.countryId == rates.countryId && x.service_typeId == rates.service_typeId && x.measure_unitId == rates.measure_unitId)); if (rate != null) { ctx.Entry(rate).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "rate deleted"; } else { rpta = "rate not found"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public string DeleteVendorContacts(vendor_contacts vendorcontacts) { string rpta; vendor_contacts vendorContacts = new vendor_contacts(); try { using (var ctx = new transshipEntities()) { vendorContacts = ctx.vendor_contacts.FirstOrDefault(x => (x.vendorId == vendorcontacts.vendorId && x.contactId == vendorcontacts.contactId)); if (vendorContacts != null) { ctx.Entry(vendorContacts).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "register deleted"; } else { rpta = "register not found"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public Memberships_levels SaveMemberShip(Memberships_levels model) { var member = new Memberships_levels(); try { using (var ctx = new transshipEntities()) { member = ctx.Memberships_levels.Add(model); ctx.SaveChanges(); return member; } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public state SaveState(state model) { var stat = new state(); try { using (var ctx = new transshipEntities()) { stat = ctx.state.Add(model); ctx.SaveChanges(); return(stat); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public measure_units SaveUnit(measure_units model) { var unit = new measure_units(); try { using (var ctx = new transshipEntities()) { unit = ctx.measure_units.Add(model); ctx.SaveChanges(); return(unit); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public membership_history SaveHistory(membership_history model) { var history = new membership_history(); try { using (var ctx = new transshipEntities()) { history = ctx.membership_history.Add(model); ctx.SaveChanges(); return(history); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public rates SaveRates(rates model) { var rate = new rates(); try { using (var ctx = new transshipEntities()) { rate = ctx.rates.Add(model); ctx.SaveChanges(); return(rate); } }catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public shipment_cost Save(shipment_cost model) { var shipCost = new shipment_cost(); try { using (var ctx = new transshipEntities()) { shipCost = ctx.shipment_cost.Add(model); ctx.SaveChanges(); return(shipCost); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
//save a new shipment_note public shipment_attachment saveShipentFile(shipment_attachment model) { var file = new shipment_attachment(); try { using (var ctx = new transshipEntities()) { file = ctx.shipment_attachment.Add(model); ctx.SaveChanges(); return(file); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public vendor_contacts SaveVendorContacts(vendor_contacts model) { var contrie = new vendor_contacts(); try { using (var ctx = new transshipEntities()) { contrie = ctx.vendor_contacts.Add(model); ctx.SaveChanges(); return(contrie); } }catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public customers SaveCustomer(customers model) { var customer = new customers(); try { using (var ctx = new transshipEntities()) { customer = ctx.customers.Add(model); ctx.SaveChanges(); return(customer); } }catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public service_types SaveService(service_types model) { var service = new service_types(); try { using (var ctx = new transshipEntities()) { service = ctx.service_types.Add(model); ctx.SaveChanges(); return(service); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public recurring_addresses SaveAddress(recurring_addresses model) { var address = new recurring_addresses(); try { using (var ctx = new transshipEntities()) { address = ctx.recurring_addresses.Add(model); ctx.SaveChanges(); return(address); } }catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public Memberships_levels UpdateMember(Memberships_levels model) { Memberships_levels member = new Memberships_levels(); member = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(member).State = EntityState.Modified; ctx.SaveChanges(); return member; } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public shipment_services SaveShipmentService(shipment_services model) { var ShipService = new shipment_services(); model.estimated_unit_price = 0; try { using (var ctx = new transshipEntities()) { ShipService = ctx.shipment_services.Add(model); ctx.SaveChanges(); return(ShipService); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public membership_history UpdateHistory(membership_history model) { membership_history history = new membership_history(); history = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(history).State = EntityState.Modified; ctx.SaveChanges(); return(history); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public users SaveUser(users model) { var user = new users(); try { using (var ctx = new transshipEntities()) { model.password = TransShip.Security.Security.Encrypt(model.password, new RijndaelManaged(), KEY); user = ctx.users.Add(model); ctx.SaveChanges(); return(user); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public vendor_contacts UpdateVendorContacts(vendor_contacts model) { vendor_contacts vendorContacts = new vendor_contacts(); vendorContacts = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(vendorContacts).State = EntityState.Modified; ctx.SaveChanges(); return(vendorContacts); } }catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public service_types UpdateService(service_types model) { service_types service = new service_types(); service = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(service).State = EntityState.Modified; ctx.SaveChanges(); return(service); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public shipments updateShipment(shipments model) { shipments shipment = new shipments(); shipment = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(shipment).State = EntityState.Modified; ctx.SaveChanges(); return(shipment); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public recurring_addresses UpdateAddress(recurring_addresses model) { recurring_addresses address = new recurring_addresses(); address = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(address).State = EntityState.Modified; ctx.SaveChanges(); return(address); } }catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public customers UpdateCustomer(customers model) { customers customer = new customers(); customer = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(customer).State = EntityState.Modified; ctx.SaveChanges(); return(customer); } }catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }