public ActionResult Index() { var db = new PharmacyEntities(); var products = db.Products.ToList(); return(View(products)); }
public ActionResult FindClient(ClientSearchModel model) { PharmacyEntities entities = new PharmacyEntities(); model.ClientResultList = new ClientListModel(); if (model.SearchingClientData.FirstName != null) { model.ClientResultList.ClientList = entities.MainClientDatas.Where( x => (x.FirstName.Contains(model.SearchingClientData.FirstName))).ToList(); } if (model.SearchingClientData.LastName != null) { model.ClientResultList.ClientList = entities.MainClientDatas.Where( x => (x.LastName.Contains(model.SearchingClientData.LastName))).ToList(); } if (model.SearchingClientData.Email != null) { model.ClientResultList.ClientList = entities.MainClientDatas.Where( x => (x.Email.Contains(model.SearchingClientData.Email))).ToList(); } model.SearchingClientData = new MainClientData(); model.SearchStatus = true; return(View(model)); }
public ActionResult Index(string barcode) { //using (MemoryStream memoryStream = new MemoryStream()) //{ // using (Bitmap bitMap = new Bitmap(barcode.Length * 40, 80)) // { // using (Graphics graphics = Graphics.FromImage(bitMap)) // { // Font oFont = new Font("IDAutomationHC39M", 16); // PointF point = new PointF(2f, 2f); // SolidBrush whiteBrush = new SolidBrush(Color.White); // graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height); // SolidBrush blackBrush = new SolidBrush(Color.DarkBlue); // graphics.DrawString("*" + barcode + "*", oFont, blackBrush, point); // } // bitMap.Save(memoryStream, ImageFormat.Jpeg); // ViewBag.BarcodeImage = "data:image/png;base64," + Convert.ToBase64String(memoryStream.ToArray()); // } //} ViewBag.Barcode = barcode; var db = new PharmacyEntities(); var model = db.Products.Where(x => x.Barcode != null).ToList(); return(View(model)); }
public ActionResult Index() { var db = new PharmacyEntities(); var model = db.Products.Where(x => x.Barcode != null).ToList(); return(View(model)); }
private void addButton_Click_1(object sender, EventArgs e) { using (PharmacyEntities db = new PharmacyEntities()) { PointsOfSale buff = new PointsOfSale(); try { buff.id = Convert.ToInt32(idTextBox.Text); } catch (FormatException) { MessageBox.Show("Неверно введенные данные!"); return; } buff.AddressOfPoint = adressTexBox.Text; db.PointsOfSale.Add(buff); try { db.SaveChanges(); } catch (DbUpdateException) { MessageBox.Show("ID не должен повторяться!"); return; } } Close(); }
public ActionResult GetAllProduct(string Type) { using (PharmacyEntities dc = new PharmacyEntities()) { var result = dc.prGetProduct(Type).ToList(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json("", JsonRequestBehavior.AllowGet)); }
public ActionResult Clients() { PharmacyEntities entities = new PharmacyEntities(); ClientListModel model = new ClientListModel(); model.ClientList = entities.MainClientDatas.ToList(); return(View(model)); }
public ActionResult GetProductInfo(string ProductCode, string Type) { using (PharmacyEntities dc = new PharmacyEntities()) { var result = dc.prSalesProduct(ProductCode, Type).ToList(); return(Json(result, JsonRequestBehavior.AllowGet)); } //return Json("", JsonRequestBehavior.AllowGet); }
public EditDialogManufacturesForm(int id) { InitializeComponent(); using (PharmacyEntities db = new PharmacyEntities()) { nameTextBox.Text = db.Manufactures.Find(id).NameManufacture; } this.id = id; }
public EditDialogPointsOfSaleForm(int id) { InitializeComponent(); using (PharmacyEntities db = new PharmacyEntities()) { adressTexBox.Text = db.PointsOfSale.Find(id).AddressOfPoint; this.id = id; } }
public AddDialogMedicalPreparationsForm() { InitializeComponent(); using (PharmacyEntities db = new PharmacyEntities()) { foreach (var item in db.Manufactures) { manufacturesComboBox.Items.Add(item.NameManufacture); } } }
// GET: Reports public ActionResult Stock() { var result = new ReportStockModel(); var application = new ApplicationDbContext(); var db = new PharmacyEntities(); var users = application.Users.ToList(); var products = db.Products.ToList(); result.Users = users; result.Products = products; return(View(result)); }
public ActionResult InsertSalesItem(string ProductCode, int Quantity, string UnitPrice, string TotalCost, int RestOfAmount) { var UserID = "1001"; DateTime today = DateTime.Today; using (PharmacyEntities dc = new PharmacyEntities()) { var result = dc.prISalesIntem(ProductCode, Quantity, UnitPrice, TotalCost, RestOfAmount, UserID, today, "").ToString(); //var result = dc.prISalesIntem("6", 1, "10", "20", RestOfAmount, UserID, today, "").ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json("", JsonRequestBehavior.AllowGet)); }
public AddDialogProductListForm() { InitializeComponent(); using (PharmacyEntities db = new PharmacyEntities()) { foreach (var item in db.MedicalPreparations) { medicalPreparationsComboBox.Items.Add(item.NamePreparation); } foreach (var item in db.PointsOfSale) { pointsOfSaleComboBox.Items.Add(item.AddressOfPoint); } } }
private void addButton_Click(object sender, EventArgs e) { using (PharmacyEntities db = new PharmacyEntities()) { ProductList buff = new ProductList(); try { buff.ProductID = Convert.ToInt32(idTextBox.Text); } catch (FormatException) { MessageBox.Show("Неверно введенные данные!"); return; } foreach (var item in db.MedicalPreparations) { if (medicalPreparationsComboBox.Text == item.NamePreparation) { buff.ProductID = item.id; break; } } foreach (var item in db.PointsOfSale) { if (pointsOfSaleComboBox.Text == item.AddressOfPoint) { buff.PointOfSaleID = item.id; break; } } buff.shelfLife = dateTimePicker1.Value; try { db.SaveChanges(); } catch (DbUpdateException) { MessageBox.Show("ID не должен повторяться!"); return; } } }
// GET: Client public ActionResult Details(MainClientData model) { PharmacyEntities entities = new PharmacyEntities(); ClientDetailsModel viewModel = new ClientDetailsModel(); if ((model != null) && (model.id != 0)) { viewModel.MainData = model; viewModel.EyeData = entities.EyeClientDatas.First(x => x.ClientId == model.id); viewModel.OtherData = entities.OtherClientDatas.First(x => x.ClientId == model.id); return(View(viewModel)); } else { return(HttpNotFound("Sorry but this page is not exists.")); } }
public ActionResult Index(int id) { var db = new PharmacyEntities(); var model = db.Products.Find(id); var detail = new ProductDetailModel() { id = model.ID, ProductName = model.ProductName, Unit = model.Unit, Price = model.Buy, Category = model.Category.CateName, Barcode = model.Barcode, uuid = System.Guid.NewGuid().ToString() }; return(Json(detail, JsonRequestBehavior.AllowGet)); }
private void editButton_Click(object sender, EventArgs e) { using (PharmacyEntities db = new PharmacyEntities()) { db.PointsOfSale.Find(id).AddressOfPoint = adressTexBox.Text; try { db.SaveChanges(); } catch (DbUpdateException) { MessageBox.Show("Ошибка!"); return; } Close(); } }
private void editButton_Click(object sender, EventArgs e) { using (PharmacyEntities db = new PharmacyEntities()) { try { db.ProductList.Find(id).id = Convert.ToInt32(idTextBox.Text); } catch (FormatException) { MessageBox.Show("Неверно введенные данные!"); return; } foreach (var item in db.MedicalPreparations) { if (medicalPreparationsComboBox.Text == item.NamePreparation) { db.ProductList.Find(id).ProductID = item.id; } } foreach (var item in db.PointsOfSale) { if (pointsOfSaleComboBox.Text == item.AddressOfPoint) { db.ProductList.Find(id).PointOfSaleID = item.id; } } db.ProductList.Find(id).shelfLife = dateTimePicker.Value; try { db.SaveChanges(); } catch (DbUpdateException) { MessageBox.Show("Ошибка"); return; } } Close(); }
private void AddButton_Click(object sender, EventArgs e) { using (PharmacyEntities db = new PharmacyEntities()) { MedicalPreparations buff = new MedicalPreparations(); try { buff.id = Convert.ToInt32(idTextBox.Text); buff.NamePreparation = nameTextBox.Text; foreach (var item in db.Manufactures) { if (manufacturesComboBox.Text == item.NameManufacture) { buff.ManufactureID = item.id; break; } } buff.Price = Convert.ToDouble(priceTextBox.Text); buff.CountInPackage = Convert.ToInt32(countTextBox.Text); } catch (FormatException) { MessageBox.Show("Неверно введенные данные!"); return; } db.MedicalPreparations.Add(buff); try { db.SaveChanges(); } catch (DbUpdateException) { MessageBox.Show("ID не должен повторяться!"); return; } } this.Close(); }
public ActionResult Create(CreateClientModel model) { if (ModelState.IsValid) { PharmacyEntities entities = new PharmacyEntities(); entities.MainClientDatas.Add(model.MainData); entities.SaveChanges(); int mainDataId = entities.MainClientDatas.First(x => x.Email == model.MainData.Email).id; model.OtherData.ClientId = mainDataId; model.EyeData.ClientId = mainDataId; entities.OtherClientDatas.Add(model.OtherData); entities.EyeClientDatas.Add(model.EyeData); entities.SaveChanges(); return(RedirectToAction("FindClient")); } else { return(View(model)); } }
private void AddButton_Click(object sender, EventArgs e) { using (PharmacyEntities db = new PharmacyEntities()) { db.Manufactures.Find(this.id).NameManufacture = nameTextBox.Text; try { db.SaveChanges(); } catch (DbUpdateException) { MessageBox.Show("ID не должен повторяться!"); return; } } this.Close(); }
public EditDialogMedicalPreparationsForm(int id) { InitializeComponent(); using (PharmacyEntities db = new PharmacyEntities()) { nameTextBox.Text = db.MedicalPreparations.Find(id).NamePreparation; foreach (var items in db.Manufactures) { manufacturesComboBox.Items.Add(items.NameManufacture); } priceTextBox.Text = db.MedicalPreparations.Find(id).Price.ToString(); countTextBox.Text = db.MedicalPreparations.Find(id).CountInPackage.ToString(); this.id = id; } }
public EditDialogProductListForm(int id) { InitializeComponent(); using (PharmacyEntities db = new PharmacyEntities()) { idTextBox.Text = db.ProductList.Find(id).id.ToString(); foreach (var item in db.MedicalPreparations) { medicalPreparationsComboBox.Items.Add(item.NamePreparation); } foreach (var item in db.PointsOfSale) { pointsOfSaleComboBox.Items.Add(item.AddressOfPoint); } dateTimePicker.Value = db.ProductList.Find(id).shelfLife; } this.id = id; }
public ActionResult Barcode(string Barcode) { var db = new PharmacyEntities(); var model = db.Products.Where(x => x.Barcode == Barcode).FirstOrDefault(); try { var detail = new ProductDetailModel() { id = model.ID, ProductName = model.ProductName, Unit = model.Unit, Price = model.Buy, Barcode = model.Barcode, uuid = System.Guid.NewGuid().ToString() }; return(Json(detail, JsonRequestBehavior.AllowGet)); } catch (Exception) { var detail = new ProductDetailModel(); return(Json(detail, JsonRequestBehavior.AllowGet)); } }
public Form1() { InitializeComponent(); _db = new PharmacyEntities(); }
public DeleteType(ComboBox cmb) { InitializeComponent(); _db = new PharmacyEntities(); _cmb = cmb; }
public MedicinesListController() { _context = new PharmacyEntities(); }