Exemplo n.º 1
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            if (nameTxt.Text == "")
            {
                nameTxt.BackColor = Color.Red;
                return;
            }

            string id = Guid.NewGuid().ToString();

            if (chronicBtn.Checked == true)
            {
                _chronic = new Chronic(id, nameTxt.Text, descriptionTxt.Text, PatientID, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), Helper.orgID);
                DBConnect.Insert(_chronic);
            }
            if (allergyBtn.Checked == true)
            {
                _allergy = new Allergy(id, nameTxt.Text, descriptionTxt.Text, PatientID, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), Helper.orgID);
                DBConnect.Insert(_allergy);
            }
            if (additBtn.Checked == true)
            {
                _addiction = new Addiction(id, nameTxt.Text, descriptionTxt.Text, PatientID, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), Helper.orgID);
                DBConnect.Insert(_addiction);
            }
            nameTxt.Text        = "";
            descriptionTxt.Text = "";

            MessageBox.Show("Information Saved");
            LoadAddiction(PatientID);
            LoadAllergy(PatientID);
            LoadChronic(PatientID);
        }
Exemplo n.º 2
0
        // Wash the THC/CBD from the plant remains.
        public ISolventMix Wash(int washCount = 1)
        {
            // Check if there's enough chemical available to wash.
            if (Chemical.Contents <= (Chronic.Yield * 2.5))
            {
                throw new NotEnoughSolventException(Chemical);
            }

            Weight = (Contents + Yield) / 1.5;
            SetStage(Stage.Washing);

            // When washing for the first time, extract 80% of the THC.
            if (washCount == 1)
            {
                Solvent.SetTHC(_extractedOils * Chronic.THC);
                Solvent.SetCBD(_extractedOils * Chronic.CBD);
                Solvent.SetYield((Chronic.THC * Chronic.Yield) + (Chronic.CBD * Chronic.Yield));
                Chronic.ImproveTHC(0.2);
                Chronic.ImproveCBD(0.2);
            }

            // When washing for the second time, extract remaining 20% of the THC.
            if (washCount == 2)
            {
                Solvent.SetTHC(Chronic.THC);
                Solvent.SetCBD(Chronic.CBD);
                Solvent.SetYield((Chronic.THC * Chronic.Yield) + (Chronic.CBD * Chronic.Yield));
                Chronic.ImproveTHC(0);
                Chronic.ImproveCBD(0);
            }

            return(this);
        }
Exemplo n.º 3
0
        // Apply filter to SolventMix and return Waste (as Chronic) and Solvent (Chemical with THC extracted)
        public FilterResult Filter(IFilter filter)
        {
            SetStage(Stage.Filtering);

            // Use the effectiveness of the filter to improve the yield/quality\
            Solvent.SetYield(Solvent.Yield * (1 + (filter.Effectiveness / 100)));
            // Change the weight to reflect the filtered status
            Chronic.SetWeight(Yield);
            Solvent.SetWeight((Weight - Yield));

            return(new FilterResult(Chronic, Solvent));
        }
Exemplo n.º 4
0
 private void LoadChronic(string patientID)
 {
     _chronics = Chronic.ListChronic(patientID);
     tb        = new DataTable();
     // create and execute query
     tb.Columns.Add("id");          //0
     tb.Columns.Add("Name");        //1
     tb.Columns.Add("Description"); //2
     tb.Columns.Add("Created");     //4
     tb.Columns.Add("Delete");      //
     foreach (Chronic r in _chronics)
     {
         tb.Rows.Add(new object[] { r.Id, r.Name, r.Description, r.Created, "Delete" });
     }
     dtChronic.DataSource         = tb;
     dtChronic.DataSource         = tb;
     dtChronic.AllowUserToAddRows = false;
     dtChronic.Columns[0].Visible = false;
     dtChronic.Columns[4].DefaultCellStyle.BackColor = Color.Aquamarine;
 }
Exemplo n.º 5
0
        public IHttpActionResult CreateClient([FromBody] CreateClientReq req)
        {
            if (req == null)
            {
                return(BadRequest());
            }
            Client client = new Client
            {
                Id             = Guid.NewGuid().ToString(),
                Surname        = req.surname,
                Name           = req.name,
                PatronymicName = req.patronymicName,
                BirthDate      = req.birthDate,
                Gender         = req.gender,
                PassSerial     = req.passserial,
                PassNumber     = req.passnumber,
                PassDate       = req.passdate,
                PassPlace      = req.passplace,
                Cityid         = req.cityid,
                Addres         = req.addres,
                Insurance      = req.insurance,
                Snils          = req.snils
            };

            dc.GetTable <Client>().InsertOnSubmit(client);
            if (req.chronic.Any())
            {
                foreach (var ch in req.chronic)
                {
                    Chronic chronic = new Chronic
                    {
                        Id = Guid.NewGuid().ToString(),
                        ChronicDiseaseTypeId = ch,
                        ClientId             = client.Id
                    };
                    dc.GetTable <Chronic>().InsertOnSubmit(chronic);
                }
            }
            if (req.allergy.Any())
            {
                foreach (var al in req.allergy)
                {
                    Allergy allergy = new Allergy
                    {
                        Id         = Guid.NewGuid().ToString(),
                        AlergyName = al,
                        ClientId   = client.Id
                    };
                    dc.GetTable <Allergy>().InsertOnSubmit(allergy);
                }
            }
            try
            {
                dc.SubmitChanges();
                return(Json(client.Id));
            }
            catch
            {
                return(BadRequest("Create client error"));
            }
        }
Exemplo n.º 6
0
 // Refer to SetStage method from Chronic.
 public void SetStage(Stage stage)
 {
     Chronic.SetStage(stage);
 }
Exemplo n.º 7
0
 // Refer to print from Chronic class
 public void Print()
 {
     Chronic.Print();
 }
Exemplo n.º 8
0
 // Method to increase or Decrease the yield by a percentage.
 public void ImproveYield(double percentage)
 {
     Chronic.ImproveYield(percentage);
 }