protected AUDIT_SCHEDULER CreateNewAuditScheduler() { decimal auditScheduleId = 0; PLANT auditPlant = SQMModelMgr.LookupPlant(Convert.ToDecimal(hdnAuditLocation.Value.ToString())); var newAuditScheduler = new AUDIT_SCHEDULER() { DAY_OF_WEEK = Convert.ToInt32(rddlDayOfWeek.SelectedValue.ToString()), INACTIVE = false, JOBCODE_CD = rddlAuditJobcodes.SelectedValue.ToString(), PLANT_ID = auditPlant.PLANT_ID, CREATE_DT = DateTime.Now, CREATE_PERSON = SessionManager.UserContext.Person.PERSON_ID, AUDIT_TYPE_ID = auditTypeId }; entities.AddToAUDIT_SCHEDULER(newAuditScheduler); entities.SaveChanges(); auditScheduleId = newAuditScheduler.AUDIT_SCHEDULER_ID; return(newAuditScheduler); }