//[HttpGet] public ActionResult Medicine_Supply() { DataBase_Gateway aGateway = new DataBase_Gateway(); stock_tb asStockTb = new stock_tb(); ViewBag.Dis = aGateway.get_districtdata(); ViewBag.Med = aGateway.get_medicinedata(); return(View()); }
public ActionResult Medicine_Supply(string districtId, string thanaId, string centerId, List <temp1> obj) { DataBase_Gateway aGateway = new DataBase_Gateway(); List <district_tb> aDistrictTbs = aGateway.get_districtdata(); List <medicine_tb> ameTbs = aGateway.get_medicinedata(); ViewBag.Dis = aDistrictTbs; ViewBag.Med = ameTbs; try { obj.RemoveAll(item => item == null); List <temp1> aTemp1s = new List <temp1>(); aTemp1s = obj; aTemp1s.RemoveAll(item => item.id == null); string check1 = ""; string check2 = ""; //List<stock_tb> aList = new List<stock_tb>(); List <total_stock_tb> aList = new List <total_stock_tb>(); foreach (temp1 item in aTemp1s) { total_stock_tb asStockTb = new total_stock_tb(); if (item.id != null && item.text2 != null) { asStockTb.centerID = Convert.ToInt32(centerId); check1 = aGateway.getCenterNamebyCenterId(Convert.ToInt32(centerId)); if (check1 != null) { asStockTb.centerName = check1; } asStockTb.medicineID = Convert.ToInt32(item.id); check2 = aGateway.getMedNamebyMedId(Convert.ToInt32(item.id)); if (check2 != null) { asStockTb.medicineName = check2; } asStockTb.stock = Convert.ToInt32(item.text2); } aList.Add(asStockTb); } //aGateway.insert_stock_data(aList); aGateway.populateStockData(aList); } catch (NullReferenceException ex) { } return(View()); }
public ActionResult Medicine_Setup([Bind(Include = "medicineName,mg_ml")] medicine_tb aMedicineTb) { DataBase_Gateway aGateway = new DataBase_Gateway(); try { if (ModelState.IsValid) { aGateway.insert_data(aMedicineTb); return(View("Index")); } } catch (DataException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View("Medicine_Setup")); }
public ActionResult DoctorEntry([Bind(Include = "doctorName,degree,specialization")] doctor_tb aDoctorTb) { DataBase_Gateway aGateway = new DataBase_Gateway(); try { if (ModelState.IsValid) { aDoctorTb.centerID = (int)TempData["doc1"]; aDoctorTb.centerName = Convert.ToString(TempData["doc2"]); aGateway.insert_data(aDoctorTb); return(View("Center")); } } catch (DataException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View("error1")); }