public JsonResult GetTempStoreCrops() { if (Session["EmployeeInfo"] != null) { StockTempRecord obj = new StockTempRecord(); //obj.StockAmount EmployeeRoleTable objEmployee = (EmployeeRoleTable)Session["EmployeeInfo"]; ViewBag.UserName = objEmployee.User_tbl.FullName; ViewBag.StorageCompanyId = new SelectList(db.StorageCompany_tbl, "StorageCompanyId", "CompanyName"); ViewBag.CropsId = new SelectList(db.Crops_tbl, "CropsId", "CropsName"); ViewBag.StockMasterRecordId = new SelectList(db.EmployeeRoleTables, "EmployeeId", "EmployeeRole"); ViewBag.CropsCatagoryId = new SelectList(new List <CropsCatagory_tbl>(), "CropsCatagoryId", "CropsCatagoryName"); List <StockTempRecord> stockTempRecordTableInfo = db.StockTempRecords.Where(emp => emp.EmployeerId == objEmployee.EmployeeId).ToList(); return(Json(stockTempRecordTableInfo.Select(x => new { tmpStockDetailId = x.tmpStockDetailId, CropsCatagoryName = x.CropsCatagory_tbl.CropsCatagoryName, CropsName = x.CropsCatagory_tbl.Crops_tbl.CropsName, Description = x.Description, StockAmount = x.StockAmount }), JsonRequestBehavior.AllowGet)); } return(Json(new SelectList(new List <StockTempRecord>()))); }
public ActionResult DeleteConfirmed(int id) { StockTempRecord stockTempRecord = db.StockTempRecords.Find(id); db.StockTempRecords.Remove(stockTempRecord); db.SaveChanges(); return(RedirectToAction("Index")); }
public JsonResult CropsTempDelete(int id = 0) { StockTempRecord objTempRecord = db.StockTempRecords.FirstOrDefault(d => d.tmpStockDetailId == id); db.StockTempRecords.Remove(objTempRecord); var message = db.SaveChanges(); return(Json(new { msg = message })); }
public ActionResult Edit([Bind(Include = "tmpStockDetailId,CropsCatagoryId,StockAmount")] StockTempRecord stockTempRecord) { if (ModelState.IsValid) { db.Entry(stockTempRecord).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CropsCatagoryId = new SelectList(db.CropsCatagory_tbl, "CropsCatagoryId", "CropsCatagoryName", stockTempRecord.CropsCatagoryId); return(View(stockTempRecord)); }
// GET: StockTempRecords/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StockTempRecord stockTempRecord = db.StockTempRecords.Find(id); if (stockTempRecord == null) { return(HttpNotFound()); } return(View(stockTempRecord)); }
public JsonResult CropsTempStore(TempClass item) { StockTempRecord objTempRecord = new StockTempRecord(); EmployeeRoleTable objEmployee = (EmployeeRoleTable)Session["EmployeeInfo"]; objTempRecord.CropsCatagoryId = item.CatagoryId; objTempRecord.Description = item.Description; objTempRecord.StockAmount = Convert.ToDecimal(item.StockAmount); objTempRecord.EmployeerId = objEmployee.EmployeeId; db.StockTempRecords.Add(objTempRecord); var message = db.SaveChanges(); return(Json(new { msg = message }, JsonRequestBehavior.AllowGet)); }
// GET: StockTempRecords/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StockTempRecord stockTempRecord = db.StockTempRecords.Find(id); if (stockTempRecord == null) { return(HttpNotFound()); } ViewBag.CropsCatagoryId = new SelectList(db.CropsCatagory_tbl, "CropsCatagoryId", "CropsCatagoryName", stockTempRecord.CropsCatagoryId); return(View(stockTempRecord)); }
public ActionResult DeleteCropsInfo(int CropsCatagoryId, string cropsDescription, string CropsAmount) { if (Session["EmployeeInfo"] != null) { EmployeeRoleTable tmpEmp = (EmployeeRoleTable)Session["EmployeeInfo"]; StockTempRecord tmpObj = new StockTempRecord(); tmpObj.CropsCatagoryId = CropsCatagoryId; tmpObj.Description = cropsDescription; tmpObj.StockAmount = Convert.ToDecimal(CropsAmount); tmpObj.EmployeerId = tmpEmp.EmployeeId; db.StockTempRecords.Add(tmpObj); db.SaveChanges(); return(RedirectToAction("StockCropsDetails", "StockMasterRecordCrops")); } return(RedirectToAction("Login", "Login")); }