//NOTE: Use Save() when calling directly, it will generate correct salt. //NOTE: Add and Update should be used only by Replication on the remote side, so that they don't regenerate salt again !!! public static void Update(string pSalt, PartnerDto pPartner) { using (Rbr_Db _db = new Rbr_Db()) { using (Transaction _tx = new Transaction(_db, pSalt, pPartner)) { PartnerDto _originalPartner = PartnerManager.Get(_db, pPartner.PartnerId); ContactInfoManager.Update(_db, pPartner.ContactInfo); //TODO: NEW DAL - handle Person deletion... if (pPartner.Employees != null) { foreach (PersonDto _employee in pPartner.Employees) { _employee.PartnerId = pPartner.PartnerId; PersonManager.Save(_db, pSalt, _employee); } } if (pPartner.BillingSchedule != null) { ScheduleManager.Save(_db, pPartner.BillingSchedule); } else if (_originalPartner.BillingSchedule != null) { ScheduleManager.Delete(_db, _originalPartner.BillingSchedule.ScheduleId); } PartnerManager.Update(_db, pPartner); _tx.Commit(); } } }
public static void Save(CustomerSupportVendorDto pCustomerSupportVendor) { using (Rbr_Db _db = new Rbr_Db()) { using (Transaction _tx = new Transaction(_db, pCustomerSupportVendor)) { //1. REQUIRED set Contact Info if (pCustomerSupportVendor.ContactInfo.ContactInfoId == 0) { ContactInfoManager.Add(_db, pCustomerSupportVendor.ContactInfo); } else { ContactInfoManager.Update(_db, pCustomerSupportVendor.ContactInfo); } CustomerSupportManager.SaveCustomerSupportVendor(_db, pCustomerSupportVendor); _tx.Commit(); } } }
public static Result Update(VirtualSwitchDto pVirtualSwitch) { var _result = new Result(); using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pVirtualSwitch)) { try { //1. REQUIRED set Contact Info ContactInfoManager.Update(_db, pVirtualSwitch.ContactInfo); VirtualSwitchManager.Update(_db, pVirtualSwitch); _tx.Commit(); } catch (Exception _ex) { _result.Success = false; _result.ErrorMessage = _ex.Message; TimokLogger.Instance.LogRbr(LogSeverity.Error, "VirtualSwitchController.Delete", string.Format("Exception:\r\n{0}", _ex)); } } } return(_result); }