public ActionResult CreateNew() { Medicine medicine = new Medicine(); MedicineViewModel Model = new MedicineViewModel(medicine); return(View(Model)); }
public AddOperationViewModel() { operation = new Operation(); dentalChartViewModel = new DentalChartViewModel() { TreatmentRecordViewModel = null }; copyOperation = (Operation)operation.Clone(); AddCommand = new DelegateCommand(new Action(addTooth)); RemoveCommand = new DelegateCommand(new Action(removeTooth)); ClearCommand = new DelegateCommand(new Action(clearTeeth)); MedicineViewModel = new MedicineViewModel(); MedicineViewModel.LoadMedicines(); ProviderViewModel = new ProviderViewModel(); ProviderViewModel.LoadProviders(); AddItemCommand = new DelegateCommand(AddItem); RemoveItemCommand = new DelegateCommand(RemoveItem); ClearItemsCommad = new DelegateCommand(ClearItems); Consumables = new List <ConsumableItem>(); AddBillingViewModel = new AddBillingViewModel(); AllPermanentCommand = new DelegateCommand(AllPermanent); UpperPermanentCommand = new DelegateCommand(UpperPermanent); LowerPermanentCommand = new DelegateCommand(LowerPermanent); AllTemporaryCommand = new DelegateCommand(AllTemporary); UpperTemporaryCommand = new DelegateCommand(UpperTemporary); LowerTemporaryCommand = new DelegateCommand(LowerTemporary); DeselectCommand = new DelegateCommand(Deselect); }
public ActionResult Edit(int id, MedicineViewModel mvm, HttpPostedFileBase ImageFile) { if (ModelState.IsValid) { IBL bl = new BLImplement(); Medicine medicine = new Medicine() { Id = mvm.Id, Name = mvm.Name, GenericName = mvm.GenericName, ActiveIngredients = mvm.ActiveIngredients, PortionProperties = mvm.PortionProperties, Producer = mvm.Producer }; try { if (ImageFile != null) { bl.updateMedicinePicture(medicine.Id, ImageFile); } bl.updateMedicine(medicine); ViewBag.Message = String.Format("The Medicine {0} successfully updated", medicine.Name); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Message = String.Format(ex.Message); return(RedirectToAction("Index")); } } return(View(new MedicineViewModel())); }
// GET: MedicinesList public ActionResult Index() { MedicineModel Model = new MedicineModel(); MedicineViewModel viewModel = new MedicineViewModel(Model.GetList()); return(View(viewModel.GetList())); }
public async Task <IActionResult> Medicine(MedicineViewModel model) { if (!ModelState.IsValid) { return(View(model)); } using (var client = new HttpClient()) { string baseUrl = _config["APISettings:BaseUrl"] + "UpdateMedicine?id=" + model.Id + "¬es=" + model.Notes; HttpResponseMessage response = await client.GetAsync(baseUrl); string result = await response.Content.ReadAsStringAsync(); var res = JsonConvert.DeserializeObject <dynamic>(result); if (!response.IsSuccessStatusCode) { ErrorMessage = res.message; } else { SuccessMessage = res.message; } } return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Index(MedicineViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var json = JsonConvert.SerializeObject(model); var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json"); using (var client = new HttpClient()) { string baseUrl = _config["APISettings:BaseUrl"] + "AddMedicine"; HttpResponseMessage response = await client.PostAsync(baseUrl, stringContent); string result = await response.Content.ReadAsStringAsync(); var res = JsonConvert.DeserializeObject <dynamic>(result); if (!response.IsSuccessStatusCode) { ErrorMessage = res.message; } else { SuccessMessage = res.message; } } return(RedirectToAction(nameof(Index))); }
public List <MedicineModel> SearchProduct(MedicineViewModel vm) { List <MedicineModel> result = new List <MedicineModel>(); vm.SearchText = "%" + vm.SearchText + "%"; if (String.IsNullOrEmpty(vm.ProductCode)) { vm.ProductCode = "All"; } PractitionerData dataLayer = new PractitionerData(); //MedicineModel row = new MedicineModel(); //row.ProductCode = "ABC"; //row.ProductName = "Testing"; //row.ExpiryDate = DateTime.Now; //row.ExpiryDateString = row.ExpiryDate.ToString("dd/MM/yyyy"); //row.TotalAmount = 15; //row.Threshold = 3; //result.Add(row); result = dataLayer.SearchProduct(vm); return(result); }
public async Task <IActionResult> AddMedicine(MedicineViewModel model) { if (model.ExpiryDate.Date <= DateTime.Now.Date) { return(_baseRepo.CustomResponce(statusCode: StatusCodes.Status400BadRequest, success: false, message: "ExpiryDate should be greater than today's date", data: "")); } MedicineModel medicine = new MedicineModel() { Id = _generateID.GeneratID(), Brand = model.Brand, ExpiryDate = model.ExpiryDate, Notes = model.Notes, Price = model.Price, Quantity = model.Quantity }; bool isAdded = await _repo.AddMedicine(model : medicine); if (isAdded) { return(_baseRepo.CustomResponce(statusCode: StatusCodes.Status200OK, success: true, message: SuccessContants.RecordAddedSuccessfully, data: "")); } else { return(_baseRepo.CustomResponce(statusCode: StatusCodes.Status200OK, success: false, message: ErrorContants.Techincalproblempleasetryagain, data: "")); } }
public List <MedicineModel> ProductSearch(MedicineViewModel search) { List <MedicineModel> result = new List <MedicineModel>(); try { SqlConnection conn = new SqlConnection(ConstantHelper.DBAppSettings.FYP); conn.Open(); SqlCommand cmd = new SqlCommand(ConstantHelper.StoredProcedure.ProductSearch, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter(ConstantHelper.StoredProcedure.Parameter.SearchText, search.SearchText)); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { MedicineModel medicine = new MedicineModel(); medicine.ProductCode = reader[ConstantHelper.SQLColumn.ProductSearch.ProductCode].ToString(); medicine.ProductName = reader[ConstantHelper.SQLColumn.ProductSearch.ProductName].ToString(); medicine.TotalAmount = Convert.ToInt32(reader[ConstantHelper.SQLColumn.ProductSearch.TotalAmount].ToString()); medicine.CompanyId = Guid.Parse(reader[ConstantHelper.SQLColumn.ProductSearch.CompanyId].ToString()); medicine.CompanyName = reader[ConstantHelper.SQLColumn.ProductSearch.CompanyName].ToString(); medicine.CompanyPostalCode = reader[ConstantHelper.SQLColumn.ProductSearch.PostalCode].ToString(); medicine.CompanyState = reader[ConstantHelper.SQLColumn.ProductSearch.State].ToString(); result.Add(medicine); } } catch (Exception err) { new LogHelper().LogMessage("PatientData.ProductSearch : " + err); } return(result); }
/// <summary> /// save medicine details /// </summary> /// <param name="medicineViewModel">medicine view model</param> /// <returns>Return medicine detail</returns> public MedicineViewModel SaveMedicineDetails(MedicineViewModel medicineViewModel) { Medicine medicineInstance; if (medicineViewModel.MedicineID == 0) { medicineInstance = new Medicine(); medicineInstance.CreatedDate = DateTime.Now; } else { medicineInstance = this.unitOfWork.MedicineRepository.GetByID(medicineViewModel.MedicineID); } medicineInstance.MedicineName = medicineViewModel.MedicineName; medicineInstance.Price = Convert.ToInt32(medicineViewModel.Price); medicineInstance.Quantity = Convert.ToInt32(medicineViewModel.Quantity); medicineInstance.IssueDate = DateTime.ParseExact(medicineViewModel.IssueDate, "mm/dd/yyyy", CultureInfo.InvariantCulture); if (medicineViewModel.MedicineID == 0) { this.unitOfWork.MedicineRepository.Insert(medicineInstance); } else { this.unitOfWork.MedicineRepository.Update(medicineInstance); } this.unitOfWork.Save(); return(medicineViewModel); }
// GET: Medicine public ActionResult Index() { try { List <Medicine> list = db.Medicines.ToList(); List <MedicineViewModel> viewList = new List <MedicineViewModel>(); foreach (Medicine s in list) { MedicineViewModel obj = new MedicineViewModel(); obj.MedId = s.MedId; obj.MedicineName = s.MedicineName; obj.Description = s.Description; obj.Measurement = s.Measurement; obj.Price = s.Price; obj.StockID = s.StockID; obj.CategoryID = s.CategoryID; viewList.Add(obj); } return(View(viewList)); } catch (Exception ex) { throw ex; } }
public IActionResult Add(MedicineViewModel medicineVm) { var dto = _vMMapper.Map(medicineVm); _doctorManager.AddNewMedicine(dto, PrescriptionId); return(RedirectToAction("Index", new { doctorId = DoctorId, prescriptionId = PrescriptionId })); }
public IActionResult AddMedicinesDetails([FromBody] MedicineViewModel model) { try { var result = _medicineService.AddMedicineDetails(model); if (result) { var response = new Response { Data = result, Message = "Medicine is added successfully" }; return(Ok(response)); } else { var response = new Response { Data = result, Message = "Cannot add medicine with expiry date less than 15 days." }; return(BadRequest(response)); } } catch (Exception ex) { var response = new Response { Message = ex.Message }; return(BadRequest(response)); } }
public IActionResult AddToCart(int id) { var model = new MedicineViewModel(); model.GetDetails(id); return(View(model)); }
/// <summary> /// Add or Edit Medicine details /// </summary> /// <param name="model">Medicine View Model</param> /// <returns>medicine list view</returns> public ActionResult SaveMedicineDetails(MedicineViewModel model) { if (model != null) { var medicineDetails = this._manageClient.SaveMedicineDetails(model); if (medicineDetails.MedicineID == 0) { this.TempData["SucessAlert"] = "1"; } else { this.TempData["SucessAlert"] = "2"; } if (this.Session["UserType"] != null) { if (this.Session["UserType"].ToString() != "ADMN") { return(this.RedirectToAction("ClientDashboard", "ClientDashboard", new { Area = "Client", userStatus = this.Session["UserStatus"].ToString() })); } else { return(this.RedirectToAction("AdminDashboard", "AdminDashboard", new { Area = "Admin" })); } } } return(this.RedirectToAction("AdminDashboard", "AdminDashboard", new { Area = "Admin" })); }
public ActionResult SaveRecord(MedicineViewModel model) { try { SaglikDBEntities1 db = new SaglikDBEntities1(); //SendEmail("", "İlaçların Tarihlerinin Geçmesine 1 Aydan Az Kaldı", DateList.ToString()); MedicineTable newMedicine = new MedicineTable { IsDeleted = model.IsDeleted, MedicineCount = model.MedicineCount, MedicineDate = model.MedicineDate, MedicineId = db.MedicineTables.ToList().Count, MedicineName = model.MedicineName, MedicineUnit = model.MedicineUnit }; db.MedicineTables.Add(newMedicine); db.SaveChanges(); MedicineViewModel.showFlag = true; return(RedirectToAction("Index4")); } catch (Exception ex) { throw ex; } }
public ActionResult Create(MedicineViewModel mvm, HttpPostedFileBase ImageFile)//[Bind(Include = "Id,Name,Producer,GenericName,ActiveIngredients,PortionProperties")] MedicineViewModel mvm) { if (ModelState.IsValid) { IBL bl = new BLImplement(); Medicine medicine = new Medicine() { //Name = collection["Name"], //GenericName = collection["GenericName"], //ActiveIngredients = collection["ActiveIngredients"], //PortionProperties = collection["PortionProperties"], //Producer = collection["Producer"] Name = mvm.Name, GenericName = mvm.GenericName, ActiveIngredients = mvm.ActiveIngredients, PortionProperties = mvm.PortionProperties, Producer = mvm.Producer }; try { bl.addMedicine(medicine, ImageFile); ViewBag.Message = String.Format("The medicine {0} is successfully added", medicine.Name); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Message = String.Format(ex.Message); return(RedirectToAction("Index")); } } return(View(new MedicineViewModel())); }
public IActionResult Add(MedicineViewModel medicineVM) { var dto = _ViewModelMapper.Map(medicineVM); _DoctorManager.AddNewMedicine(dto, int.Parse(TempData["PrescriptionId"].ToString())); return(RedirectToAction("Index", new { doctorId = int.Parse(TempData["DoctorId"].ToString()), prescriptionId = int.Parse(TempData["PrescriptionId"].ToString()) })); }
public IActionResult Add(MedicineViewModel medicineVm) { TestDatabasePleaseDelete.Doctors.ElementAt(IndexOfDoctor) .Prescriptions.ElementAt(IndexOfPrescription) .Medicines.Add(medicineVm); return(RedirectToAction("Index")); }
// GET: MedicinesList/Delete/5 public ActionResult Delete(int id) { MedicineModel Model = new MedicineModel(); Medicine medicine = new Medicine(Model.GetMedicineById(id)); MedicineViewModel viewModel = new MedicineViewModel(medicine); return(View(viewModel)); }
//[HttpGet] //public IActionResult ManageCategories(int medId) //{ // ViewBag.id = medId; // var model = new MedicineCategoryViewModel(); // var selectedCategoryList=model.GetSelectedMedicineCategories(medId); // return View(selectedCategoryList); //} //[HttpPost] //public IActionResult ManageCategories(List<MedicineCategoryViewModel> modelList, int medicineId) //{ // var model = new MedicineCategoryViewModel(); // model.SetSelectedCategory( modelList, medicineId); // return RedirectToAction("Edit", new { id = medicineId }); //} public IActionResult GetMedicines() { var tableModel = new DataTablesAjaxRequestModel(Request); var model = new MedicineViewModel(); var data = model.GetMedicines(tableModel); return(Json(data)); }
//public IActionResult Index() //{ // var model = new MedicineViewModel(); // return View(model.GetMedicines()); //} public IActionResult Index(int?page) //Add page parameter { var model = new MedicineViewModel(); var pageNumber = page ?? 1; // if no page is specified, default to the first page (1) int pageSize = 6; // Get 25 students for each requested page. var onePageOfStudents = model.GetMedicines().ToPagedList(pageNumber, pageSize); return(View(onePageOfStudents)); // Send 25 students to the page. }
public void Edit_UpdatingExistingLeaflets() { MedicinesController controller; try { var mr = new MockRepository(true); controller = mr.CreateController <MedicinesController>(); } catch { Assert.Inconclusive("Test initialization has failed."); return; } var medicineName = "My Medicine"; // all these active ingredients have already been created. // now we have to associate them with the original active ingredients var formModel = new MedicineViewModel() { Name = medicineName, Leaflets = new List <MedicineLeafletViewModel>() { new MedicineLeafletViewModel() { Url = "http://www.google.com", Description = "desc 1" } } }; controller.Create(formModel); var medicine = this.db.Medicines.FirstOrDefault(m => m.Name == medicineName); Assert.IsNotNull(medicine); Assert.AreEqual(1, medicine.Leaflets.Count); formModel.Id = medicine.Id; formModel.Leaflets[0].Id = medicine.Leaflets.ElementAt(0).Id; formModel.Leaflets[0].Url = "http://www.facebook.com"; formModel.Leaflets[0].Description = "desc 2"; // Let's edit now and change some properties controller.Edit(formModel); // we need to refresh since the DB inside the controller is different from this this.db.Refresh(RefreshMode.StoreWins, medicine.Leaflets); // verify that all the active ingredients inside the medicine are those that // we've EDITED here Assert.AreEqual(formModel.Leaflets[0].Url, medicine.Leaflets.ElementAt(0).Url); Assert.AreEqual(formModel.Leaflets[0].Description, medicine.Leaflets.ElementAt(0).Description); }
public MedicineController(ApplicationDbContext db, IHostingEnvironment hostingEnvironment) { _db = db; _hostingEnvironment = hostingEnvironment; MedicineVM = new MedicineViewModel() { MedicineType = _db.MedicineType, Medicine = new Models.Medicine() }; }
public void addMedicine([FromBody] MedicineViewModel medicine) { try { _medicalManager.addMedicine(medicine); } catch (Exception ex) { throw ex; } }
public static void CompareMedicines(Medicine m, MedicineViewModel mvm) { m.Amount.ShouldBe(mvm.Amount); m.Expired.ShouldBe(mvm.Expired); m.Id.ShouldBe(mvm.Id); m.Name.ShouldBe(mvm.Name); m.Refund.ShouldBe(mvm.Refund); m.UnitPrice.ShouldBe(mvm.UnitPrice); m.MedType.ShouldBe(mvm.MedType.AsDatabaseType()); m.Unit.ShouldBe(mvm.Unit.AsDatabaseType()); }
public IActionResult UpdateMedicine([FromBody] MedicineViewModel MedicineVm) { if (!ModelState.IsValid) { IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors); return(new BadRequestObjectResult(allErrors)); } _medicineService.Update(MedicineVm); _medicineService.SaveChanges(); return(new OkObjectResult(MedicineVm)); }
public void GetAll() { var obj = new MedicineViewModel() { Id = 1, Name = "Keto", Cost = 200 }; var itemrepo = new PlaceOrderRepository(itemcontextmock.Object); var itemlist = itemrepo.PlaceOrder(obj); Assert.NotNull(itemlist); }
public async Task <OrderDetails> PlaceOrder(MedicineViewModel model) { OrderDetails order = new OrderDetails { MedId = model.Id, MedName = model.Name, Amount = model.Cost, }; _context.OrderList.Add(order); await _context.SaveChangesAsync(); return(order); }
public List <MedicineModel> SearchProduct(MedicineViewModel vm) { List <MedicineModel> result = new List <MedicineModel>(); if (vm != null) { PractitionerBusiness businessLayer = new PractitionerBusiness(); result = businessLayer.SearchProduct(vm); } return(result); }