private void button1_Click(object sender, EventArgs e)
 {
     this.Close();
     ApplicationLogic.dateStart = dateTimePicker1.Value;
     ApplicationLogic.dateEnd   = dateTimePicker2.Value;
     Drugs f = new Drugs(ApplicationLogic.FilterDrugsCategory.ByDateRange); f.Show();
 }
示例#2
0
 public void SearchAtDrugs()
 {
     DrugsToShow.Clear();
     if (String.IsNullOrEmpty(SearchForDrugText))
     {
         foreach (var item in Drugs)
         {
             DrugsToShow.Add(item);
         }
         return;
     }
     String[] words = SearchForDrugText.Split(' ');
     foreach (String toSearch in words)
     {
         List <Drug> filtered = new List <Drug>(Drugs.Where(x =>
                                                            x.DrugName.StartsWith(toSearch) || x.ExpirationDays.ToString().StartsWith(toSearch) ||
                                                            x.Miligram.ToString().StartsWith(toSearch) || x.Manufacturer.ToLower().StartsWith(toSearch) ||
                                                            x.DrugType.ToString().ToLower().StartsWith(toSearch) ||
                                                            x.Active.ToLower().ToLower().ToString().Contains(toSearch)));
         foreach (var item in filtered)
         {
             DrugsToShow.Add(item);
         }
     }
 }
示例#3
0
        public void LoadSessionInfo()
        {
            if (SelectedPayor == null)
            {
                return;
            }

            _currentSession = _esClinicContext.Sessions.Find(SelectedPayor.SessionId);

            TotalCost = _currentSession.TotalCost;

            var services =
                _esClinicContext.Services.Include("ServiceType").ToList().Where(s => s.SessionId == SelectedPayor.SessionId);

            Services.Clear();
            foreach (var service in services)
            {
                Services.Add(service);
            }

            var drugs =
                _esClinicContext.Drugs.Include("Product").ToList().Where(d => d.SessionId == SelectedPayor.SessionId);

            Drugs.Clear();
            foreach (var drug in drugs)
            {
                Drugs.Add(drug);
            }
        }
示例#4
0
        private Drugs ModelHelper(SqlDataReader reader)
        {
            Drugs drug = new Drugs();

            drug.ID        = reader.GetInt32(0);
            drug.Code      = reader.GetString(1);
            drug.Name      = reader.GetString(2);
            drug.UnitPrice = reader.GetDecimal(3);
            drug.Standard  = reader.GetString(4);
            drug.Unit      = reader.GetString(5);
            drug.Actived   = reader.GetBoolean(6);
            if (!reader.IsDBNull(7))
            {
                drug.Remark = reader.GetString(7);
            }
            drug.From         = new DrugFrom();
            drug.From.ID      = reader.GetInt32(8);
            drug.From.Code    = reader.GetString(9);
            drug.From.Name    = reader.GetString(10);
            drug.From.Actived = reader.GetBoolean(11);
            if (!reader.IsDBNull(12))
            {
                drug.From.Remark = reader.GetString(12);
            }
            drug.Category         = new DrugCategory();
            drug.Category.ID      = reader.GetInt32(13);
            drug.Category.Code    = reader.GetString(14);
            drug.Category.Name    = reader.GetString(15);
            drug.Category.Actived = reader.GetBoolean(16);
            if (!reader.IsDBNull(17))
            {
                drug.Category.Remark = reader.GetString(17);
            }
            return(drug);
        }
        public void DeleteAction(object sender, EventArgs e)
        {
            var   menuItem = sender as MenuItem;
            Drugs Drugs    = menuItem.CommandParameter as Drugs;

            _viewModel.DeleteDrugsCommand(Drugs);
        }
        public IActionResult deleteDrug(int drugId)
        {
            Drugs Drug = new Drugs();

            try
            {
                var DrugJson = JsonConvert.SerializeObject(Json(getDrugById(drugId)).Value, Newtonsoft.Json.Formatting.Indented);
                Drug = JsonConvert.DeserializeObject <Drugs>(DrugJson);
            }
            catch (Exception)
            {
                return(StatusCode(500, "Error parsing JSON"));
            }

            string StoredProcedureName             = DrugsProcedures.deleteDrug;
            Dictionary <string, object> Parameters = new Dictionary <string, object>();

            Parameters.Add("@id", drugId);
            try
            {
                int returnCode = dbMan.ExecuteNonQuery(StoredProcedureName, Parameters);
                if (returnCode == -1)
                {
                    return(StatusCode(200, "Drug deleted successfully"));
                }
                else
                {
                    return(StatusCode(500, "Internal Server Error"));
                }
            }
            catch (Exception)
            {
                return(StatusCode(500, "Internal Server Error"));
            }
        }
        // GET: Drugs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Drugs drugs = db.Drugs.Find(id);

            if (drugs == null)
            {
                return(HttpNotFound());
            }

            // 薬品コードが登録されている薬品は編集不可
            if (!string.IsNullOrEmpty(drugs.DrugCode))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ViewBag.ClassificationId = db.Classifications.Select(item => new SelectListItem
            {
                Text     = item.ClassificationCode + ":" + item.Name,
                Value    = item.ClassificationId.ToString(),
                Selected = item.ClassificationId == drugs.ClassificationId
            });
            return(View(drugs));
        }
        public IActionResult CreateByStore(StoreDrugViewModel viewModel, Drugs config)
        {
            if (ModelState.IsValid)
            {
                string uniqueFileName = null;
                if (viewModel.Photo != null)
                {
                    string uploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                    uniqueFileName = Guid.NewGuid().ToString() + "_" + viewModel.Photo.FileName;
                    string filePath = Path.Combine(uploadsFolder, uniqueFileName);

                    viewModel.Photo.CopyTo(new FileStream(filePath, FileMode.Create));
                }
                Drugs drugs = new Drugs
                {
                    Stores      = storeRepository.GetStorebyId(viewModel.StoreId),
                    Name        = viewModel.Name,
                    Description = viewModel.Description,
                    Photopath   = uniqueFileName
                };
                Stores storeschoice = storeRepository.GetStoresByViewModel(viewModel);
                if (storeschoice == null)
                {
                    return(NotFound());
                }
                viewModel.Store = storeschoice;
                drugs.Stores    = viewModel.Store;
                _drugRepository.Add(drugs);
                viewModel = GetStoreDrugView(storeschoice);
                return(View(viewModel));
            }
            return(View());
        }
        public IActionResult getDrugById(int drugId)
        {
            string StoredProcedureName             = DrugsProcedures.getDrug;
            Dictionary <string, object> Parameters = new Dictionary <string, object>();

            Parameters.Add("@id", drugId);

            DataTable dt   = dbMan.ExecuteReader(StoredProcedureName, Parameters);
            var       Drug = new Drugs();

            if (dt != null)
            {
                Drug.id            = drugId;
                Drug.name          = Convert.ToString(dt.Rows[0]["name"]);
                Drug.officialPrice = Convert.ToInt32(dt.Rows[0]["officialPrice"]);
            }
            else
            {
                return(StatusCode(500, "Drug not found"));
            }


            List <string> imgsUrls            = aux_getImgsFromDrug(drugId);
            List <string> effectiveSubstances = aux_getEffectiveSubstancesFromDrug(drugId);
            List <int>    categories          = aux_getCategoriesFromDrug(drugId);

            Drug.imgsUrls            = imgsUrls;
            Drug.effectiveSubstances = effectiveSubstances;
            Drug.categoriesIds       = categories;

            return(Json(Drug));
        }
示例#10
0
    public static List <Drugs> GetDrugs(string prefixText, int count)
    {
        List <Drugs> items = new List <Drugs>();
        IDrug        objRptFields;

        objRptFields = (IDrug)ObjectFactory.CreateInstance("BusinessProcess.Pharmacy.BDrug,BusinessProcess.Pharmacy");
        string sqlQuery;

        sqlQuery = string.Format("Select GenericID[drug_pk], GenericName[drugname] from mst_generic  WHERE DeleteFlag=0 and GenericName LIKE '%{0}%'", prefixText);
        DataTable dataTable = objRptFields.ReturnDatatableQuery(sqlQuery);

        if (dataTable.Rows.Count > 0)
        {
            foreach (DataRow row in dataTable.Rows)
            {
                try
                {
                    Drugs item = new Drugs();
                    item.DrugId   = (int)row["Drug_pk"];
                    item.DrugName = (string)row["DrugName"];
                    items.Add(item);
                }
                catch (Exception ex)
                {
                }
            }
        }
        return(items);
    }
示例#11
0
        private async Task SearchDrugs(string value) //эксперементальная функция горячего поиска, нужно прерывание и задержка
        {
            if (value.Length > 2)
            {
                if (PharmacoData.Drug == null)
                {
                    IsLoadingPharma = true;
                    try
                    {
                        var result = await _therapyDataService.GetDrugs(value);

                        Drugs.Clear(); //drugsearchlist
                        foreach (Drug drug in result)
                        {
                            Drugs.Add(drug);
                        }
                    }
                    catch (Exception ex)
                    {
                        NotificationManager.AddException(ex, 4);
                    }
                    IsLoadingPharma = false;
                }
            }
            else
            {
                PharmacoData.Drug = null;
            }
        }
示例#12
0
        public async Task <IActionResult> AddDrug(Drugs input)
        {
            Drugs drug = null;

            if (input.Name == null)
            {
                return(BadRequest());
            }

            drug      = new Drugs();
            drug.Name = input.Name;
            try
            {
                using (var unitOfWork = new UnitOfWork(new ModelContext()))
                {
                    unitOfWork.Drugs.Add(drug);
                    unitOfWork.Complete();
                }
            }
            catch (Exception e)
            {
                return(BadRequest());
            }
            return(Ok(drug));
        }
示例#13
0
 public void Notify()
 {
     foreach (var observer in _observers)
     {
         observer.Update(Drugs.Last(), this);
     }
 }
示例#14
0
 public DrugsAddViewModel(Patient Patient)
 {
     this.Patient    = Patient;
     Drugs           = new Drugs();
     LogoutCommand   = new Command(this.Logout);
     AddDrugsCommand = new Command(ExecuteAddDrugsCommand);
 }
示例#15
0
        //Adds Subscription Details if the user required is available
        public Subscription AddSubscription(Subscription subscription)
        {
            bool flag = true;

            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", SubscriptionHelper.SessionToken);

                client.BaseAddress = new Uri("http://52.230.228.30/api/");//Target Web Api

                var responseTask = client.GetAsync("DrugsApi/SearchDrugsById/" + subscription.DrugId);
                responseTask.Wait();
                var result = responseTask.Result;

                if (result.IsSuccessStatusCode)
                {
                    string data = result.Content.ReadAsStringAsync().Result;

                    Drugs drug = JsonConvert.DeserializeObject <Drugs>(data);

                    SubscriptionHelper.SubscriptionDetails.Add(subscription);
                }
                else
                {
                    flag = false;
                }
            }
            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", SubscriptionHelper.SessionToken);
                client.BaseAddress = new Uri("https://refillservice.azurewebsites.net/api/");


                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                StringContent content = new StringContent(JsonConvert.SerializeObject(subscription), Encoding.UTF8, "application/json");

                //HTTP POST Request
                var responseTask = client.PostAsync("Refill/AddRefillStatus", content);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsStringAsync();
                    readTask.Wait();
                }
                else
                {
                    flag = false;
                }
            }
            if (flag)
            {
                return(null);
            }
            return(subscription);
        }
示例#16
0
        public void DeleteBy(Drugs changedValues)
        {
            var valu = _application.Drugs.Attach(changedValues);

            valu.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _application.Remove(valu);
            _application.SaveChanges();
        }
示例#17
0
        public Drugs Update(Drugs changedValues)
        {
            var valu = _application.Drugs.Attach(changedValues);

            valu.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _application.SaveChanges();
            return(changedValues);
        }
示例#18
0
 /// <summary>
 /// 增加一个药品信息
 /// </summary>
 /// <param name="drug"></param>
 /// <param name="creator"></param>
 public void CreateDrug(Drugs drug, string creator)
 {
     using (IDbConnection conn = DAOFactory.Instance.OpenConnection())
     {
         IDrugsDAO dao = DAOFactory.Instance.CreateDrugsDAO();
         dao.InsertDrug(drug, conn);
     }
 }
示例#19
0
        void ConfirmDrug()
        {
            var drug = new Drug(NameTextBox.Text);

            DB <Drug> .AddItem(drug);

            Drugs.Add(new DrugVM(drug));
        }
示例#20
0
 /// <summary>
 /// 删除一个药品信息
 /// </summary>
 /// <param name="drug"></param>
 /// <param name="Deleter"></param>
 public void DeleteDrug(Drugs drug, string Deleter)
 {
     using (IDbConnection conn = DAOFactory.Instance.OpenConnection())
     {
         IDrugsDAO dao = DAOFactory.Instance.CreateDrugsDAO();
         dao.DeleteDrug(drug.ID, conn);
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
            ManufacturersEntity selected = (ManufacturersEntity)ManufacturersCB.SelectedItem;

            ApplicationLogic.intParameter = selected.ID;
            Drugs f = new Drugs(ApplicationLogic.FilterDrugsCategory.ByManufacturer);
        }
示例#22
0
        public ActionResult DeleteConfirmed(int id)
        {
            Drugs drugs = db.Drugs.Find(id);

            db.Drugs.Remove(drugs);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#23
0
        private void UpdateList(Drugs_Model selected_item)
        {
            var index = Drugs.IndexOf(selected_item);

            Taking_Time = Resources[selected_item.Taking_Time];
            Drugs.Remove(selected_item);
            Drugs.Insert(index, selected_item);
        }
示例#24
0
 /// <summary>
 /// 保存修改过的药品信息
 /// </summary>
 /// <param name="drug"></param>
 /// <param name="Modifier"></param>
 public void SaveDrug(Drugs drug, string Modifier)
 {
     using (IDbConnection conn = DAOFactory.Instance.OpenConnection())
     {
         IDrugsDAO dao = DAOFactory.Instance.CreateDrugsDAO();
         dao.UpdateDrug(drug, conn);
     }
 }
示例#25
0
        public void Edit(Drugs drugs)
        {
            var query = _application.Set <Drugs>().Find(drugs.Id);

            query.Description = drugs.Description;
            query.Description = drugs.Description;
            //query.Drugs = stores.Drugs;
            query.Name = drugs.Name;
            _application.SaveChanges();
        }
示例#26
0
 public ActionResult Edit([Bind(Include = "DrugsID,drugName")] Drugs drugs)
 {
     if (ModelState.IsValid)
     {
         db.Entry(drugs).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(drugs));
 }
示例#27
0
        public void TestDrug()
        {
            Drugs drugs = new Drugs();

            drugs.Name = "Brufen";
            drugs.Name = "Kafetin";

            Assert.AreEqual(drugs.Name, "Brufen");
            Assert.AreEqual(drugs.Name, "Kafetin");
        }
        DeleteAsync([Bind("Id,drugname,description,price,stock")] Drugs item)
        {
            if (ModelState.IsValid)
            {
                await DocumentDBRespository <Drugs> .DeleteItemAsync(item.Id, item);

                return(RedirectToAction("Index"));
            }
            return(View(item));
        }
示例#29
0
        public void SellDrugs(int drug_id, int units, int price)
        {
            Dopewars_Drug dd = Drugs.FirstOrDefault(p => p.Drug_Id.Equals(drug_id));

            if (dd != null)
            {
                dd.Units -= units;
                Cash     += units * price;
            }
        }
        public IActionResult Delete(int id)
        {
            Drugs doctor = _drugRepository.GetDrugsbyId(id);

            _drugRepository.Delete(doctor);
            return(RedirectToAction("CreateByStore", "Drugs", new
            {
                Id = doctor.StoresId
            }));
            //return RedirectToAction("CreateByStore");
        }
 private void Init()
 {
     diseases = MedicalChestManeger.Instance.Diseases;
     drugs = MedicalChestManeger.Instance.Drugs;
 }
 public static void ToMDMA()
 {
     _currentDrug = Drugs.MDMA;
 }
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Height = 242;
            incorrect = new List<string>();
            correct = new HashSet<string>();

            newCat = true;
            num = 0;
            flag = true;
            answer = "____";
            random = new Random();
            textBox1.Text = "Press enter here to start";

            choice = 1;
            choice2 = 1;
            index = 0;
            data = new List<Drugs>();

            // Read the file and display it line by line.
            lines = System.IO.File.ReadAllLines("data.txt");

            comboBox1.Items.Add("All drugs");
            comboBox1.Items.Add("Drugs by numbers");
            comboBox1.Items.Add("Drugs #1-50");
            comboBox1.Items.Add("Drugs #51-100");
            comboBox1.Items.Add("Drugs #101-150");
            comboBox1.Items.Add("Drugs #151-200");

            foreach (string line in lines)
            {
                if (line.Length != 0)
                {
                    string[] temp = line.Split('\t');
                    if (newCat)
                    {
                        Drugs x = new Drugs();
                        x.num = 0;
                        x.corr = 0;
                        x.list = new List<Drug>();
                        data.Add(x);
                        newCat = false;
                        comboBox1.Items.Add(temp[3]);
                    }

                    Drug y = new Drug();
                    y.num = Int32.Parse(temp[4]);
                    y.descr = line;
                    data[data.Count - 1].list.Add(y);
                    data[data.Count - 1].num++;
                }
                else
                    newCat = true;
            }

            comboBox1.SelectedIndex = 0;
            comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
            index = random.Next(0, data.Count);
            index2 = random.Next(0, data[index].list.Count);

            string[] str = data[index].list[index2].descr.Split('\t');
            label7.Text = "____";
            label8.Text = str[1];
            label9.Text = str[2];
            label10.Text = str[3];
            textBox1.Text = "";
            label6.Text = "____";
            answer = str[0];
            
           
            textBox1.Focus();
        }
        private void button3_Click(object sender, EventArgs e)
        {
      //      numericUpDown1.Value = 1;
      //      numericUpDown2.Value = 10;
      //      radioButton1.Select();
      //      this.Height = 242;
      //      button2.Enabled = false;
      //      button1.Enabled = true;
            incorrect = new List<string>();
            correct = new HashSet<string>();

            newCat = true;
            num = 0;
            flag = true;
     //       answer = "____";
            random = new Random();
            textBox1.Text = "";

     //       choice = 1;
       //     choice2 = 1;
         //   index = 0;
            data = new List<Drugs>();

            // Read the file and display it line by line.
            lines = System.IO.File.ReadAllLines("data.txt");
/*
            comboBox1.Items.Clear();
            comboBox1.Items.Add("All drugs");
            comboBox1.Items.Add("Drugs by number");
            comboBox1.Items.Add("Drugs 1-50");
            comboBox1.Items.Add("Drugs 51-100");
            comboBox1.Items.Add("Drugs 101-150");
            comboBox1.Items.Add("Drugs 151-200");
*/
            foreach (string line in lines)
            {
                if (line.Length != 0)
                {
                    string[] temp = line.Split('\t');
                    if (newCat)
                    {
                        Drugs x = new Drugs();
                        x.num = 0;
                        x.corr = 0;
                        x.list = new List<Drug>();
                        data.Add(x);
                        newCat = false;
      //                  comboBox1.Items.Add(temp[3]);
                    }

                    Drug y = new Drug();
                    y.num = Int32.Parse(temp[4]);
                    y.descr = line;
                    data[data.Count - 1].list.Add(y);
                    data[data.Count - 1].num++;
                }
                else
                    newCat = true;
            }

     //       comboBox1.SelectedIndex = 0;
     //       comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
    //        index = random.Next(0, data.Count);
      //      index2 = random.Next(0, data[index].list.Count);

     /*       string[] str = data[index].list[index2].descr.Split('\t');
            label7.Text = "____";
            label8.Text = str[1];
            label9.Text = str[2];
            label10.Text = str[3];
            textBox1.Text = "";
            label6.Text = "____";
            answer = str[0];
*/
            listBox1.Items.Clear();
            chooseQuestion();
            textBox1.Focus();
            System.Windows.Forms.SendKeys.Send("{ENTER}");
        }
 public static void ToNeutral()
 {
     _currentDrug = Drugs.Neutral;
 }
 public static void ToCocaine()
 {
     _currentDrug = Drugs.Cocaine;
 }
示例#37
0
 private void DataViewForm_Load(object sender, EventArgs e)
 {
     drugs = DbManeger.Drugs;
     dataGridView.DataSource = drugs.GetData();
 }