public bool UpdateAcademicProgram(ACD_Program program) { string sql = " Update ACD_Program set ProgramName=@ProgramName, ProgramCode=@ProgramCode, OrganizationId=@OrganizationId, StartedDate=@StartedDate, StartedDateBS=@StartedDateBS, " + " LastUpdatedBy=@LastUpdatedBy, LastUpdatedDate=@LastUpdatedDate " + " where ProgramId=@ProgramId "; using (var db = DbHelper.GetDBConnection()) { using (var trsn = new TransactionScope()) { //db.Execute(sql); var lst = db.Execute(sql, program); trsn.Complete(); db.Close(); if (lst > 0) { return(true); } else { return(false); } } } }
public bool InsertAcademicProgram(ACD_Program program) { string sql = " Insert into ACD_Program ( ProgramName, ProgramCode, OrganizationId, StartedDate, StartedDateBS, " + " EnteredBy, EnteredDate, LastUpdatedBy, LastUpdatedDate, IsDeleted, DeletedBy, DeletedDate) " + " values " + "( @ProgramName, @ProgramCode, @OrganizationId, @StartedDate, @StartedDateBS, " + " @EnteredBy, @EnteredDate, 0, null, 0, 0, null)"; using (var db = DbHelper.GetDBConnection()) { using (var trsn = new TransactionScope()) { //db.Execute(sql); var lst = db.Execute(sql, program); trsn.Complete(); db.Close(); if (lst > 0) { return(true); } else { return(false); } } } }
// GET: AcademicProgram/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ACD_Program aCD_Program = db.GetAcademicProgramById((int)id); if (aCD_Program == null) { return(HttpNotFound()); } ViewBag.OrganizationId = new SelectList(ddl.GetOrganizationList(), "Id", "Name", aCD_Program.OrganizationId); return(View(aCD_Program)); }
public ActionResult Create(FormCollection frm) { var ses = sesrepo.GetSessionById((User as CustomPrincipal).UserId); int orgid = ses.OrganizationId; var aCD_Program = new ACD_Program(); aCD_Program.ProgramCode = frm["ProgramCode"]; aCD_Program.ProgramName = frm["ProgramName"]; //aCD_Program.ProgramId = Convert.ToInt32(frm["ProgramId"]); aCD_Program.OrganizationId = orgid;// Convert.ToInt32(frm["OrganizationId"]); aCD_Program.StartedDate = DateTime.ParseExact(frm["StartedDate"], "yyyy-MM-dd", null); aCD_Program.StartedDateBS = frm["StartedDateBS"]; aCD_Program.EnteredBy = (User as CustomPrincipal).UserId; aCD_Program.EnteredDate = DateTime.Now; if (ModelState.IsValid) { //db.ACD_Batch.Add(aCD_Batch); db.InsertAcademicProgram(aCD_Program); return(RedirectToAction("Index")); } ViewBag.OrganizationId = new SelectList(ddl.GetOrganizationList(), "Id", "Name", aCD_Program.OrganizationId); return(View(aCD_Program)); }