public void Updateliquidator(Liquidator subject) { try { var db = new ApplicationDbContext(); var liquidator = db.Liquidators.Where(s => s.LiquidatorID == subject.LiquidatorID).SingleOrDefault(); liquidator.Name = subject.Name; liquidator.RegistryNumber = subject.RegistryNumber; liquidator.Email = subject.Email; liquidator.MobilePhoneNumber = subject.MobilePhoneNumber; db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Text = exp.Message; ErrorLabel.Visible = true; } }
public void Insert([Control("ddlWorkflows")] long workflowID) { var db = new ApplicationDbContext(); var workflowStateTransition = new WorkflowStateTransition(); TryUpdateModel(workflowStateTransition); workflowStateTransition.WorkflowID = workflowID; if (ModelState.IsValid) { try { db.WorkflowStateTransitions.Add(workflowStateTransition); db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Visible = true; ErrorLabel.Text = exp.Message; } } else { ErrorLabel.Visible = true; ErrorLabel.Text = "Complete todos los campos."; } }
public void InsertLiquidator() { var db = new ApplicationDbContext(); var liquidator = new Liquidator(); TryUpdateModel(liquidator); if (ModelState.IsValid) { try { db.Liquidators.Add(liquidator); db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Text = exp.Message; ErrorLabel.Visible = true; } } else { ErrorLabel.Text = "Complete todos los campos."; ErrorLabel.Visible = true; } }
public void UpdateWorkShop(WorkShop subject) { try { var db = new ApplicationDbContext(); var workShop = db.WorkShops.Where(s => s.WorkshopID == subject.WorkshopID).SingleOrDefault(); workShop.Name = subject.Name; workShop.Address = subject.Address; workShop.PhoneNumber = subject.PhoneNumber; workShop.MobilePhoneNumber = subject.MobilePhoneNumber; workShop.Email = subject.Email; db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Text = exp.Message; ErrorLabel.Visible = true; } }
public void UpdateAssignment(Person subject) { var ddlUsers = PersonsListView.EditItem.FindControl("ddlUsers") as DropDownList; try { var db = new ApplicationDbContext(); var user = db.Users.Single(r => r.Id == ddlUsers.SelectedValue); var person = db.Persons.Where(p => p.PersonID == subject.PersonID).SingleOrDefault(); person.ApplicationUsers.Clear(); person.ApplicationUsers.Add(user); db.SaveChanges(); ErrorLabel.Visible = false; ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Visible = true; ErrorLabel.Text = exp.Message; } }
public void Update(Workflow subject) { try { var db = new ApplicationDbContext(); var workflow = db.Workflows.Where(s => s.WorkflowID == subject.WorkflowID).SingleOrDefault(); // workflow.WorkflowName = subject.WorkflowName; workflow.DefaultFormID = subject.DefaultFormID; db.SaveChanges(); this.WorkflowsListView.EditIndex = -1; ErrorLabel.Visible = false; ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Visible = true; ErrorLabel.Text = exp.Message; } }
public void Delete(Form subject) { try { var db = new ApplicationDbContext(); var form = db.Forms.Where(s => s.FormID == subject.FormID).SingleOrDefault(); db.Forms.Remove(form); db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Visible = false; ErrorLabel.Text = exp.Message; } }
public void Delete(WorkflowStateTransition subject) { try { var db = new ApplicationDbContext(); var workflowStateTransition = db.WorkflowStateTransitions.Where(s => s.WorkflowStateTransitionID == subject.WorkflowStateTransitionID).SingleOrDefault(); db.WorkflowStateTransitions.Remove(workflowStateTransition); db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Visible = true; ErrorLabel.Text = exp.Message; } }
public void DeleteCollectionState(CollectionState subject) { try { var db = new ApplicationDbContext(); var collectionState = db.CollectionStates.Where(s => s.CollectionStateID == subject.CollectionStateID).SingleOrDefault(); db.CollectionStates.Remove(collectionState); db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Text = exp.Message; ErrorLabel.Visible = true; } }
public void UpdateCollectionMethod(CollectionMethod subject) { try { var db = new ApplicationDbContext(); var collectionMethod = db.CollectionMethods.Where(s => s.CollectionMethodID == subject.CollectionMethodID).SingleOrDefault(); TryUpdateModel <CollectionMethod>(collectionMethod); db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Text = exp.Message; ErrorLabel.Visible = true; } }
public void UpdateClaimType(ClaimType subject) { try { var db = new ApplicationDbContext(); var claimType = db.ClaimTypes.Where(s => s.ClaimTypeID == subject.ClaimTypeID).SingleOrDefault(); claimType.Description = subject.Description; db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Text = exp.Message; ErrorLabel.Visible = true; } }
public void Update(WorkflowStateTransition subject) { try { var db = new ApplicationDbContext(); var workflowStateTransition = db.WorkflowStateTransitions.Where(s => s.WorkflowStateTransitionID == subject.WorkflowStateTransitionID).SingleOrDefault(); workflowStateTransition.InitialStateID = subject.InitialStateID; workflowStateTransition.FinalStateID = subject.FinalStateID; workflowStateTransition.EditableEffectiveDate = subject.EditableEffectiveDate; db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Visible = true; ErrorLabel.Text = exp.Message; } }
public void UpdateCurrency(Currency subject) { try { var db = new ApplicationDbContext(); var currency = db.Currencies.Where(s => s.CurrencyID == subject.CurrencyID).SingleOrDefault(); currency.Code = subject.Code; currency.Denomination = subject.Denomination; db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Text = exp.Message; ErrorLabel.Visible = true; } }
public void UpdateStateForm(WorkflowStateForm subject) { try { var db = new ApplicationDbContext(); var stateForm = db.WorkflowStatesForms.Where(p => p.WorkflowStateFormID == subject.WorkflowStateFormID).SingleOrDefault(); TryUpdateModel(stateForm); db.SaveChanges(); ErrorLabel.Visible = false; ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Visible = true; ErrorLabel.Text = exp.Message; } }
public void UpdateState(State subject) { try { var db = new ApplicationDbContext(); var state = db.States.Where(s => s.StateID == subject.StateID).SingleOrDefault(); state.StateName = subject.StateName; state.Active = subject.Active; db.SaveChanges(); ErrorLabel.Text = String.Empty; } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Text = exp.Message; ErrorLabel.Visible = true; } }
public void UpdatePayment(Collection subject) { try { var db = new ApplicationDbContext(); var theCollection = db.Collections.SingleOrDefault(c => c.CollectionID == subject.CollectionID); if (theCollection == null) { ModelState.AddModelError("", String.Format("No se encontró el elemento con id. {0}", subject.CollectionID.ToString())); return; } theCollection.Collected = subject.Collected; if (null == subject.CollectedDate) { theCollection.CollectedDate = DateTime.Today; } else { theCollection.CollectedDate = subject.CollectedDate; } theCollection.CollectionStateID = subject.CollectionStateID; db.SaveChanges(); } catch (DbEntityValidationException ex) { ErrorLabel.Visible = true; ErrorLabel.Text = EventLogManager.LogError(ex); } catch (Exception exp) { ErrorLabel.Visible = true; ErrorLabel.Text = exp.Message; } }