Beispiel #1
0
        public void addMedicine(string meds)
        {
            if (!GlobalComponents.IsEmptyText(meds))
            {
                if (!medicalValidation(meds))
                {
                    try
                    {
                        DataProcessor.getStreamOn();

                        cmdExec = DataProcessor.execCommand(sqlAdd(meds));
                        cmdExec.ExecuteNonQuery();

                        MessageBox.Show($"Medicamento ingresado con Exito");
                    }
                    catch (Exception e)
                    {
                        GlobalComponents.InsertError(e);
                    }
                    finally
                    {
                        DataProcessor.getStreamOff();
                    }
                }
                else
                {
                    MessageBox.Show($"Ya existe un codigo similar en el catalogo");
                }
            }
            else
            {
                MessageBox.Show($"Todos los campos son obligatorios");
            }
        }
Beispiel #2
0
        private string medicalChainString()
        {
            string medicineValues;

            string text1 = (!GlobalComponents.IsEmptyText(this.barCode.Text))? this.barCode.Text :null;
            string text2 = (!GlobalComponents.IsEmptyText(this.textBox1.Text)) ? this.textBox1.Text : null;
            string text3 = (!GlobalComponents.IsEmptyText(this.textBox2.Text)) ? this.textBox2.Text : null;
            string text4 = (!GlobalComponents.IsEmptyText(this.textBox3.Text)) ? this.textBox3.Text : null;
            string date  = (this.dateTimePicker2.Value.Date > DateTime.Now.Date)? $"{(this.dateTimePicker2.Value):yyyy/MM/dd}": null;
            string text5 = (!GlobalComponents.IsEmptyText(this.textBox4.Text)) ? this.textBox4.Text : null;
            string text6 = (!GlobalComponents.IsEmptyText(this.textBox5.Text)) ? this.textBox5.Text : null;
            string text7 = (!GlobalComponents.IsEmptyText(this.textBox6.Text)) ? this.textBox6.Text : null;
            string text8 = (!GlobalComponents.IsEmptyText(this.textBox7.Text)) ? this.textBox7.Text : null;



            if (text1 == null || text2 == null || text3 == null || date == null || text4 == null || text5 == null || text6 == null || text7 == null || text8 == null)
            {
                medicineValues = "";
            }
            else
            {
                medicineValues =

                    $"{this.barCode.Text},'{this.textBox1.Text}','{this.textBox2.Text}','{this.textBox3.Text}'," +
                    $"'{(this.dateTimePicker2.Value):yyyy/MM/dd}',{this.textBox4.Text},'{ this.textBox5.Text}'," +
                    $"{this.textBox6.Text },{this.textBox7.Text}," +
                    $"'{DateTime.Now:yyy/MM/dd HH:mm}','{GlobalComponents.getSessionId}'," +
                    $"{((this.radioButton1.Checked) ? "1" : "0")}";
            }


            return(medicineValues);
        }
Beispiel #3
0
        public void delMedicine(string code)
        {
            if (!GlobalComponents.IsEmptyText(code))
            {
                ///TODO
                ///hay que agregar una validacion, si hay existencias no se puede eliminar
                int barcode = int.Parse(code);
                try
                {
                    DialogResult a = MessageBox.Show("El elemento se eliminara de manera definitiva \n ¿desea continuar?", "Alerta", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    if (a == DialogResult.OK)
                    {
                        DataProcessor.getStreamOn();
                        cmdExec = DataProcessor.execCommand(this.sqlDel(barcode));
                        cmdExec.ExecuteNonQuery();

                        MessageBox.Show("Se elimino el registro");
                    }
                }
                catch (Exception e)
                {
                    GlobalComponents.InsertError(e);
                }
                finally
                {
                    DataProcessor.getStreamOff();
                }
            }
            else
            {
                MessageBox.Show($"El codigo del medicamento es obligatorio");
            }
        }