public static AdjusterDeploymentEvent SaveEvent(AdjusterDeploymentEvent objAdjusterDeploymentEvent) { //if (objAdjusterDeploymentEvent.Id == 0) //{ DbContextHelper.DbContext.Add(objAdjusterDeploymentEvent); // } DbContextHelper.DbContext.SaveChanges(); return objAdjusterDeploymentEvent; }
protected void btnEventSave_Click(object sender, EventArgs e) { if (txtEventName.Text.Trim() != string.Empty && txtEventType.Text.Trim() != string.Empty && txtEventDeploymentDate.Text.Trim() != string.Empty) { AdjusterDeploymentEvent objAdjusterDeploymentEvent = new AdjusterDeploymentEvent(); objAdjusterDeploymentEvent.AdjusterId = adjusterID; objAdjusterDeploymentEvent.EventName = txtEventName.Text; objAdjusterDeploymentEvent.EventType = txtEventType.Text; if (!string.IsNullOrEmpty(txtEventDeploymentDate.Text)) { objAdjusterDeploymentEvent.DeploymentDate = Convert.ToDateTime(txtEventDeploymentDate.Text); } if (!string.IsNullOrEmpty(txtEventArrivalDate.Text)) { objAdjusterDeploymentEvent.ArrivalDate = Convert.ToDateTime(txtEventArrivalDate.Text); } if (!string.IsNullOrEmpty(txtEventDepartureDate.Text)) { objAdjusterDeploymentEvent.DepartureDate = Convert.ToDateTime(txtEventDepartureDate.Text); } if (!string.IsNullOrEmpty(txtEventDateReturned.Text)) { objAdjusterDeploymentEvent.DateReturned = Convert.ToDateTime(txtEventDateReturned.Text); } if (ddlDeploymentAddress.SelectedValue!="0") { objAdjusterDeploymentEvent.DeploymentAddressId =Convert.ToInt32(ddlDeploymentAddress.SelectedValue); } AdjusterManager.SaveEvent(objAdjusterDeploymentEvent); divEventAdd.Visible = false; BlankEventControl(); BindDeploymentEvent(); } }