public bool UpdateDepreciationMethod(FA_DepreciationMethod method) { string sql = " Update FA_DepreciationMethod set OrganizationId=@OrganizationId, MethodName=@MethodName,DepreciationRate=@DepreciationRate," + "Description=@Description ,LastUpdatedBy=@LastUpdatedBy,LastUpdatedDate=@LastUpdatedDate" + " where MethodId=@MethodId"; using (var db = DbHelper.GetDBConnection()) { using (var trsn = new TransactionScope()) { //db.Execute(sql); var lst = db.Execute(sql, method); trsn.Complete(); db.Close(); if (lst > 0) { return(true); } else { return(false); } } } }
public bool InsertDepreciationMethod(FA_DepreciationMethod method) { string sql = " Insert into FA_DepreciationMethod (OrganizationId, MethodName,DepreciationRate,Description ,EnteredBy," + " EnteredDate,LastUpdatedBy,LastUpdatedDate,IsDeleted,DeletedBy,DeletedDate) " + " values " + "(@OrganizationId, @MethodName,@DepreciationRate,@Description ,@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, method); trsn.Complete(); db.Close(); if (lst > 0) { return(true); } else { return(false); } } } }
// GET: Category/Edit/5 public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } FA_DepreciationMethod method = db.GetDepreciationMethodById((int)id); if (method == null) { return HttpNotFound(); } //ViewBag.OrganizationId = new SelectList(ddl.GetOrganizationList(), "Id", "Name", mS_Category.OrganizationId); return View(method); }
public ActionResult Edit(FormCollection frm) { var ses = sesrepo.GetSessionById((User as CustomPrincipal).UserId); int orgid = ses.OrganizationId; FA_DepreciationMethod method = db.GetDepreciationMethodById(Convert.ToInt32(frm["MethodId"])); method.MethodName = frm["MethodName"]; method.DepreciationRate = Convert.ToDecimal(frm["DepreciationRate"]); method.Description = frm["Description"]; method.OrganizationId = orgid;// Convert.ToInt32(frm["OrganizationId"]); method.LastUpdatedBy = (User as CustomPrincipal).UserId; method.LastUpdatedDate = DateTime.Now; if (ModelState.IsValid) { db.UpdateDepreciationMethod(method); return RedirectToAction("Index"); } return View(method); }
public ActionResult Create(FormCollection frm) { var ses = sesrepo.GetSessionById((User as CustomPrincipal).UserId); int orgid = ses.OrganizationId; FA_DepreciationMethod method = new FA_DepreciationMethod(); method.MethodName = frm["MethodName"]; method.DepreciationRate = Convert.ToDecimal(frm["DepreciationRate"]); method.Description = frm["Description"]; method.OrganizationId = orgid;// Convert.ToInt32(frm["OrganizationId"]); method.EnteredBy = (User as CustomPrincipal).UserId; method.EnteredDate = DateTime.Now; method.IsDeleted = false; if (ModelState.IsValid) { db.InsertDepreciationMethod(method); return RedirectToAction("Index"); } //ViewBag.OrganizationId = new SelectList(ddl.GetOrganizationList(), "Id", "Name", mS_Category.OrganizationId); return View(method); }