Esempio n. 1
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     try
     {
         int       id       = int.Parse(lblId.Text);
         Medicines medicine = db.Medicines.Find(id);
         medicine.Name            = txtMedicineName.Text;
         medicine.BarcodeNo       = txtBarcodeNo.Text;
         medicine.ManufacturerId  = int.Parse(cmbbxManufacturer.SelectedValue.ToString());
         medicine.Price           = Convert.ToDouble(txtPrice.Text.Replace(".", ","));
         medicine.PurposeOfUsing  = txtPurposeOfUsing.Text;
         medicine.SideEffects     = txtSideEffects.Text;
         db.Entry(medicine).State = EntityState.Modified;
         db.SaveChanges();
         DialogResult result = MessageBox.Show(this, "İlaç kaydı başarıyla düzenlendi.", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
         if (result == DialogResult.OK)
         {
             raiseUpdate();
             this.Close();
         }
     }
     catch (Exception)
     {
         DialogResult result = MessageBox.Show(this, "İlaç kaydı düzenlenirken hata ile karşılaşıldı.", "Hata !", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public ActionResult updateMedicineVitamin(Medicines mv)
        {
            BL_AddMedicineVitaminAndSensitivities b = new BL_AddMedicineVitaminAndSensitivities();
            string result = b.Update_MedicineVitamin(mv.Influens, mv.Vitamin, mv.Active, mv.GivenKind, mv.Quantity, mv.Days, mv.GivenOn, mv.Text);

            return(View());
        }
Esempio n. 3
0
 public MedicinesForm(Medicines medicine)
     : base(medicine)
 {
     this.mEntry = medicine;
     this.InitializeComponent();
     this.UserInitialize();
 }
Esempio n. 4
0
        public IActionResult AddMedicine(Medicines medicines)
        {
            _medicines.AddMedicine(medicines);

            return(Created(HttpContext.Request.Scheme + "://" + HttpContext.Request.Host + HttpContext.Request.Path + "/" +
                           medicines.Id, medicines));
        }
Esempio n. 5
0
        public string MedicinesUpdate(dynamic data)
        {
            string strResponse             = "";
            string strmedicineid           = data.id;
            string strmedicineName         = data.medicineName;
            string strmedicinetypeid       = data.medicinetypeid;
            string strmedicinecontentvalue = data.medicinecontentvalue;
            string strmedicinecontenttype  = data.medicinecontenttype;
            string strpacketsize           = data.packetsize;
            string strpacketprice          = data.packetprice;
            string strdosage         = data.dosage;
            string strgenericid      = data.genericid;
            string strmanufacturerid = data.manufacturerid;
            string strusage          = data.usage;
            string strsideeffect     = data.sideeffect;
            string stralternate      = data.alternate;

            Medicines objMed  = new Medicines();
            bool      bResult = objMed.MedicinesUpdate(strmedicineid, strmedicineName, strmedicinetypeid, strmedicinecontentvalue, strmedicinecontenttype, strpacketsize, strpacketprice, strdosage, strgenericid, strmanufacturerid, strusage, strsideeffect, stralternate, ref strResponse);

            if (bResult)
            {
                strResponse = "Medicine updated successfully";
            }
            else
            {
                strResponse = "Failed to updated Medicine";
            }
            return(strResponse);
        }
Esempio n. 6
0
        public DataTable GetAllMedicines()
        {
            Medicines objMedicines = new Medicines();
            DataTable dtb          = objMedicines.getAllMedicines();

            return(dtb);
        }
Esempio n. 7
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     try
     {
         Medicines medicine = new Medicines();
         medicine.Name           = txtMedicineName.Text;
         medicine.BarcodeNo      = txtBarcodeNo.Text;
         medicine.ManufacturerId = int.Parse(cmbbxManufacturer.SelectedValue.ToString());
         medicine.Price          = Convert.ToDouble(txtPrice.Text.Replace(".", ","));
         medicine.PurposeOfUsing = txtPurposeOfUsing.Text;
         medicine.SideEffects    = txtSideEffects.Text;
         db.Medicines.Add(medicine);
         db.SaveChanges();
         DialogResult result = MessageBox.Show(this, "İlaç başarıyla kayıt edildi.", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Question);
         if (result == DialogResult.OK)
         {
             raiseUpdate();
             this.Close();
         }
     }
     catch (Exception)
     {
         DialogResult result = MessageBox.Show(this, "İlaç oluştururken hata ile karşılaşıldı.", "Hata !", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 8
0
        public List <Medicines> GetAllMedicines(string Id)
        {
            DAMedicines    DAM    = new DAMedicines();
            ListDictionary Params = new ListDictionary();

            Params.Add("@MyId", Id);
            DataSet          ds  = DAM.GetAllMedicines(Params);
            Medicines        M   = new Medicines();
            List <Medicines> MyM = new List <Medicines>();


            foreach (DataRow item in ds.Tables[0].Rows)
            {
                M.Code        = BLCtrl.getInt(item, "Code", 0);
                M.Influens    = BLCtrl.getInt(item, "Medicine", 0);
                M.Vitamin     = BLCtrl.getInt(item, "Vitamin", 0);
                M.Active      = BLCtrl.getBool(item, "Active", false);
                M.GivenKind   = BLCtrl.getString(item, "GivenKind", "");
                M.Quantity    = BLCtrl.getString(item, "Quantity", "");
                M.Days        = BLCtrl.getInt(item, "Days", 0);
                M.GivenOn     = BLCtrl.getString(item, "GivenOn", "");
                M.Text        = BLCtrl.getString(item, "Text", "");
                M.By          = BLCtrl.getInt(item, "By", 0);
                M.PatiantCode = BLCtrl.getString(item, "PatiantCode", "");
                MyM.Add(M);
            }
            return(MyM);
        }
Esempio n. 9
0
        public async Task <Medicines> PutMedicines(Medicines medicines)
        {
            Medicines model = context.Medicines.SingleOrDefault(s => s.MedicineID.Equals(medicines.MedicineID));

            if (model != null)
            {
                // model.MedicineID = medicines.MedicineID;
                model.MedicineName        = medicines.MedicineName;
                model.MedicineSKU         = medicines.MedicineSKU;
                model.MedicineStatus      = medicines.MedicineStatus;
                model.MedicineTag         = medicines.MedicineTag;
                model.MedicineDescription = medicines.MedicineDescription;
                model.MedicinePrice       = medicines.MedicinePrice;
                model.MedicineImage       = medicines.MedicineImage;
                model.MedicineLock        = medicines.MedicineLock;
                model.MedicineExpiryDate  = medicines.MedicineExpiryDate;
                model.CategoryChild_ID    = medicines.CategoryChild_ID;
                context.SaveChanges();
                return(medicines);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 10
0
        public async Task <IActionResult> PutMedicines(int id, Medicines medicines)
        {
            if (id != medicines.Id)
            {
                return(BadRequest());
            }

            _context.Entry(medicines).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MedicinesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 11
0
        public async Task <ActionResult <Medicines> > PostMedicines(Medicines medicines)
        {
            _context.Medicines.Add(medicines);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMedicines", new { id = medicines.Id }, medicines));
        }
        public IHttpActionResult PutMedicines(int id, Medicines medicines)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != medicines.Id)
            {
                return(BadRequest());
            }

            db.Entry(medicines).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MedicinesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <Medicines> GetMedicinesAsync(string searchText = null)
        {
            Medicines medicineResponse = new Medicines();

            try
            {
                var medicines = await medicineQueryRepository.GetMedicineInfo(searchText);

                medicineResponse.MedicineInfoDto = medicines;
                medicineResponse.ExtendedInfo    = string.Empty;
                medicineResponse.IsSuccess       = true;
                if (medicineResponse.MedicineInfoDto.Count == 0)
                {
                    medicineResponse.ExtendedInfo = "No record found, sorry Vithal Deshpande..";
                }
            }
            catch (Exception ex)
            {
                medicineResponse.MedicineInfoDto = null;
                medicineResponse.ExtendedInfo    = "Unable to fetch the medicine information";
                medicineResponse.ExtendedInfo    = ex.Message;
                medicineResponse.IsSuccess       = false;
            }
            return(medicineResponse);
        }
        public MedicineController(string medicineName, int number)
        {
            if (string.IsNullOrWhiteSpace(medicineName) || medicineName.Length > 100)
            {
                throw new ArgumentNullException("Наименование изделия медицинского назначения не может быть пустым и не должно превышать 100 знаков.", nameof(medicineName));
            }

            if (number <= 0 || number > 300)
            {
                throw new ArgumentException("Количество не может быть отрицательным, и не должно быть больше 300 единиц.", nameof(number));
            }

            Medicines = GetAllMedicines();

            CurrentMedicine = Medicines.SingleOrDefault(c => c.Name == medicineName);
            if (CurrentMedicine == null)
            {
                CurrentMedicine = new Medicine(medicineName, number);
                Medicines.Add(CurrentMedicine);
                IsNewMedicine = true;
                Save();
            }
            else
            {
                var numCurr = GetNumber();
                var N       = numCurr + number;
                ChangeNumber(CurrentMedicine.Id, N);
            }
        }
Esempio n. 15
0
        public async Task <IActionResult> Post([FromBody] Medicines value)
        {
            try
            {
                bool result = await _medicineService.CreateMedcine(value);

                if (result)
                {
                    return(Ok(new Response {
                        IsSucces = true, Message = "Medicine Successfully Created"
                    }));
                }
                else
                {
                    return(BadRequest(new Response {
                        IsSucces = false, Message = "Medicine Creation Failed"
                    }));
                }
            } catch (Exception ex)
            {
                Response response = new Response
                {
                    IsSucces = false,
                    Message  = "Some Error Occoured While processing Request"
                };

                return(StatusCode(500, response));
            }
        }
Esempio n. 16
0
 /// <summary>
 /// This method can be used to add new medicines to the inventory
 /// </summary>
 /// <param name="medicines" is the model that contains the name as well as the cost of the medicines in the inventory></param>
 /// <returns>This method returns true if the medicine was added successfully else returns false</returns>
 public bool AddMedicines(Medicines medicines)
 {
     try
     {
         if (CheckIfMedicineExists(medicines) == false)
         {
             Medicines medicineData = db.Medicines.OrderByDescending(t => t.CreatedAt).FirstOrDefault(t => t.Name == medicines.Name);
             if (medicineData != null)
             {
                 medicineData.DeletedAt  = DateTime.Now;
                 medicineData.ModifiedAt = DateTime.Now;
                 db.Medicines.Attach(medicineData);
                 db.Entry(medicineData).State = EntityState.Modified;
             }
             medicines.CreatedAt = DateTime.Now;
             db.Medicines.Add(medicines);
             db.SaveChanges();
             return(true);
         }
         else
         {
             throw new MedicineAlreadyExistsEx("Medicine already Exists");
         }
     }
     catch (Exception e)
     {
         var ravenClient = new RavenClient("https://[email protected]/1820886");
         ravenClient.Capture(new SentryEvent(e));
         throw new MedicineAlreadyExistsEx("Medicine already Exists");
     }
 }
        private void cmbCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.nupAmount.Value = 0;
            if (cmbCategory.SelectedItem != null)
            {
                Guid categoryGuid             = new Guid(cmbCategory.SelectedItem.ToString());
                CompanyCollection companyList = new CompanyCollection();
                if (cmbCompany.SelectedItem == null)
                {
                    this.cmbCompany.DataSource    = companyList;
                    this.cmbCompany.DisplayMember = "DisplayName";
                }
            }
            this.nupAmount.Value = 0;
            if (cmbCategory.SelectedItem != null && cmbCompany.SelectedItem != null && cmbItem.SelectedItem != null)
            {
                availableStock = 0;
                Medicines m = new Medicines();
                availableStock               = m.GetMaxQuantityAvailable(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item);
                lblAvailableQuantity.Text    = "Max Available (" + availableStock.ToString() + " )";
                lblAvailableQuantity.Visible = true;

                MedicineSale MSale  = new MedicineSale();
                decimal      mrp    = MSale.GetMRP(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item);
                decimal      amount = mrp * (this.nupQuantity.Value);
                this.nupAmount.Value = amount;
            }
        }
Esempio n. 18
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Capacity,Price")] Medicines medicines)
        {
            if (id != medicines.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(medicines);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MedicinesExists(medicines.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(medicines));
        }
        public bool updateDeleteMedicine(Medicines medicines_detail)
        {
            using (ABCPharma_DBEntities context = new ABCPharma_DBEntities())
            {
                using (var transaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        Medicine medicineToAdd = new Medicine();
                        medicineToAdd.MedicineName      = medicines_detail.medicineName;
                        medicineToAdd.PKGDate           = medicines_detail.pkgDate;
                        medicineToAdd.ExpiryDate        = medicines_detail.expiryDate;
                        medicineToAdd.QuantityAvailable = medicines_detail.quantity;
                        medicineToAdd.UnitPrice         = medicines_detail.unitPrice;

                        context.Medicines.Add(medicineToAdd);

                        context.SaveChanges();
                        transaction.Commit();
                    }
                    catch (System.Exception ex)
                    {
                        var abc = ex.Message;
                        transaction.Rollback();
                    }
                }
            }
            return(true);
        }
Esempio n. 20
0
 public Medicines AddMedicine(Medicines medicine)
 {
     medicine.Id = Guid.NewGuid();
     _medicineContext.Medicines.Add(medicine);
     _medicineContext.SaveChanges();
     return(medicine);
 }
Esempio n. 21
0
        public Medicines ToMedicines()
        {
            Medicines medicines = new Medicines();

            medicines.Name = this.Name.Trim();
            medicines.Cost = this.Cost;
            return(medicines);
        }
Esempio n. 22
0
        public ActionResult ilacHatırlatıcı()
        {
            Medicines Medicine = new Medicines();

            Medicine.Medicine         = db.Medicine.ToList();
            Medicine.MedicineReminder = db.MedicineReminder.ToList();
            return(View(Medicine));
        }
Esempio n. 23
0
        private void DeleteMedicineCommandHandler(object obj)
        {
            var medicine = obj as Medicine;

            if (medicine != null)
            {
                var result = Medicines.Remove(medicine);
            }
        }
        private void OnAddClick(object sender, EventArgs e)
        {
            Medicines obj = new Medicines();

            if (MedicinesForm.ShowForm(obj))
            {
                this.LoadListData(obj);
            }
        }
Esempio n. 25
0
        public HttpResponseMessage SaveMedicines(Medicines medicineToAdd)
        {
            MedicineRepository medicineRepository = new MedicineRepository();

            bool sucess = medicineRepository.updateDeleteMedicine(medicineToAdd);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, "OK");

            return(response);
        }
Esempio n. 26
0
        public Medicines EditMedicine(Medicines medicine)
        {
            var exixingMedicine = GetMedicine(medicine.Id);

            exixingMedicine.Name        = medicine.Name;
            exixingMedicine.CompanyName = medicine.CompanyName;
            exixingMedicine.Disease     = medicine.Disease;
            exixingMedicine.Amount      = medicine.Amount;
            return(exixingMedicine);
        }
        public IHttpActionResult GetMedicines(int id)
        {
            Medicines medicines = db.Medicines.Find(id);

            if (medicines == null)
            {
                return(NotFound());
            }

            return(Ok(medicines));
        }
Esempio n. 28
0
        public async Task <IActionResult> Create([Bind("Id,Name,Capacity,Price")] Medicines medicines)
        {
            if (ModelState.IsValid)
            {
                _context.Add(medicines);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(medicines));
        }
Esempio n. 29
0
        public IActionResult EditMedicine(Guid id, Medicines medicines)
        {
            var exixtingMedicine = _medicines.GetMedicine(id);

            if (exixtingMedicine != null)
            {
                medicines.Id = exixtingMedicine.Id;
                _medicines.EditMedicine(medicines);
            }
            return(Ok(medicines));
        }
Esempio n. 30
0
        public void Delete(object med)
        {
            var medicine = med as MedicineModel;

            if (medicine == null)
            {
                return;
            }
            medicineService.Delete(medicine);
            Medicines.Remove(medicine);
            AddNewMedicine();
        }