Ejemplo n.º 1
0
 private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabControl1.SelectedTab == types)
     {
         RefreshTeeth();
     }
     else if (tabControl1.SelectedTab == accounts)
     {
         RefreshAccount();
     }
     else if (tabControl1.SelectedTab == outcomes_type)
     {
         RefreshOutType();
     }
     else if (tabControl1.SelectedTab == outcome)
     {
         foreach (string s in db.ListOF("SELECT * FROM outcome_type"))
         {
             outcome_type_combo.Items.Add(s);
         }
         outcome_type_combo.SelectedIndex = 0;
         RefreshOut(out_query);
     }
     else if (tabControl1.SelectedTab == colortab)
     {
         RefreshColorType();
     }
     else if (tabControl1.SelectedTab == needitemstab)
     {
         RefreshNeedItems();
     }
 }
Ejemplo n.º 2
0
        public AddCustomerForm(MainForm form, int id)
        {
            InitializeComponent();
            this.id       = id;
            this.form     = form;
            db            = new SqlConnectionDB();
            save.Text     = "تعديل";
            this.Text     = "تعديل الزبون";
            cases         = 2;
            name_txt.Text = db.ListOF("SELECT cust_name from customer where cust_id=" + id).ElementAt(0);
            string type = db.ListOF("SELECT cust_type from customer where cust_id=" + id).ElementAt(0);

            if (type == "دكتور")
            {
                type_combo.SelectedIndex = 0;
            }
            else if (type == "مختبر")
            {
                type_combo.SelectedIndex = 1;
            }
            else
            {
                type_combo.SelectedIndex = 2;
            }
            email_txt.Text = db.ListOF("SELECT cust_email from customer where cust_id=" + id).ElementAt(0);
            phone_list.Clear();
            foreach (string s in db.ListOF("Select number from phones where cust_id=" + id))
            {
                phone_list.Items.Add(s);
            }
        }
Ejemplo n.º 3
0
 private void AddCustomerForm_Load(object sender, EventArgs e)
 {
     if (cases == 2)
     {
         DataSet data = new DataSet();
         db.selectDB(ref data, "SELECT * FROM customer WHERE cust_id=" + id);
         LinkedList <string> phones = db.ListOF("Select number from phones where cust_id=" + id);
         name_txt.Text = data.Tables[0].Rows[0][1].ToString();
         string type = data.Tables[0].Rows[0][2].ToString();
         if (type == "دكتور")
         {
             type_combo.SelectedIndex = 0;
         }
         else if (type == "مختبر")
         {
             type_combo.SelectedIndex = 1;
         }
         else
         {
             type_combo.SelectedIndex = 2;
         }
         email_txt.Text = data.Tables[0].Rows[0][3].ToString();
         phone_list.Clear();
         foreach (string s in phones)
         {
             phone_list.Items.Add(s);
         }
     }
 }
Ejemplo n.º 4
0
        public void RefreshTheBill()
        {
            try
            {
                data = new DataSet();

                DataSet data2 = new DataSet();
                new Thread(() =>
                {
                    if (InvokeRequired)
                    {
                        this.Invoke(new MethodInvoker(delegate
                        {
                            db.selectDB(ref data, "SELECT * FROM bill where id='" + Id + "'");
                            db.selectDB(ref data2, "SELECT cust_name,cust_type from customer  where cust_id='" + data.Tables[0].Rows[0][2] + "'");

                            DataSet dataUser = new DataSet();
                            db.selectDB(ref dataUser, "SELECT user_fullname from users WHERE user_id='" + data.Tables[0].Rows[0][11] + "'");
                            name_label.Text       = "اسم ال" + data2.Tables[0].Rows[0][1];
                            pk_label.Text         = Id + "";
                            id_label.Text         = data.Tables[0].Rows[0][1].ToString();
                            cust_label.Text       = data2.Tables[0].Rows[0][0].ToString();
                            rec_label.Text        = FormatDate(Convert.ToDateTime(data.Tables[0].Rows[0][7]));
                            teeth_label.Text      = concate(db.ListOF("SELECT number from teeth where bill_id=" + Id));
                            type_label.Text       = data.Tables[0].Rows[0][5].ToString();
                            string delv_state     = data.Tables[0].Rows[0][6].ToString();
                            delv_state_label.Text = delv_state;
                            if (delv_state != "لم يسلم")
                            {
                                delv_label.Text         = FormatDate(Convert.ToDateTime(data.Tables[0].Rows[0][8].ToString()));
                                delv_show_label.Visible = true;
                                delv_label.Visible      = true;
                            }
                            else
                            {
                                delv_show_label.Visible = false;
                                delv_label.Visible      = false;
                            }
                            color_label.Text = data.Tables[0].Rows[0][4].ToString();
                            price_label.Text = data.Tables[0].Rows[0][9].ToString();
                            notes_label.Text = data.Tables[0].Rows[0][10].ToString();
                            user_label.Text  = dataUser.Tables[0].Rows[0][0].ToString();
                            user_role        = db.SelectStr("SELECT user_role from users WHERE user_id=" + user_id);

                            DateTime rec = Convert.ToDateTime(data.Tables[0].Rows[0][7]);
                            this.rec     = rec;

                            today_label.Text = FormatDate(DateTime.Today);
                        }));
                    }
                }).Start();
            }
            catch
            {
                this.Close();
            }
        }
Ejemplo n.º 5
0
        private void AddOutcomeForm_Load(object sender, EventArgs e)
        {
            LinkedList <string> types = db.ListOF("SELECT * FROM outcome_type");

            foreach (string s in types)
            {
                type_combo.Items.Add(s);
            }
        }
Ejemplo n.º 6
0
 public AddNeedForm(MainForm form)
 {
     InitializeComponent();
     db        = new SqlConnectionDB();
     this.form = form;
     foreach (string s in db.ListOF("SELECT * FROM items_type"))
     {
         name_combo.Items.Add(s);
     }
 }
Ejemplo n.º 7
0
 public AddSellBillForm(MainForm form)
 {
     InitializeComponent();
     db        = new SqlConnectionDB();
     this.form = form;
     foreach (string s in db.ListOF("SELECT sell_name from seller"))
     {
         seller_combo.Items.Add(s);
     }
 }
Ejemplo n.º 8
0
 private void cust_type_combo_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cust_type_combo.SelectedIndex >= 0)
     {
         customer_combo.Items.Clear();
         customer_label.Text = "اسم ال" + cust_type_combo.SelectedItem.ToString();
         string select = "SELECT cust_name from customer where cust_type='" + cust_type_combo.SelectedItem.ToString() + "'";
         foreach (string s in db.ListOF(select))
         {
             customer_combo.Items.Add(s);
         }
     }
 }
Ejemplo n.º 9
0
 private void add_Click(object sender, EventArgs e)
 {
     if (seller_combo.SelectedItem.ToString() != "" && data != null)
     {
         int    seller_id     = db.SelectID("SELECT sell_id FROM seller WHERE sell_name='" + seller_combo.SelectedItem + "'");
         string insert_query1 = "INSERT INTO sell_bill (sell_id,sbill_price) VALUES(" + seller_id + "," + price_txt.Text + ")";
         if (db.insertDB(insert_query1))
         {
             int real_id = Convert.ToInt32(db.ListOF("SELECT sbill_id FROM sell_bill").Last());
             for (int i = 0; i < data.GetLength(0); i++)
             {
                 string insert_query2 = "INSERT INTO sell_bill_items VALUES('" + real_id + "','" + data[i, 0] + "','" + data[i, 1] + "','" + data[i, 2] + "')";
                 db.insertDB(insert_query2);
             }
             MessageBox.Show("تم اضافه الفاتوره");
             this.Close();
             form.RefreshSellBill(form.sell_bill_query);
         }
     }
 }
Ejemplo n.º 10
0
        public SellBillItemsDialog(AddSellBillForm form)
        {
            InitializeComponent();
            db        = new SqlConnectionDB();
            data      = db.ListOF("SELECT * FROM items_type");
            this.form = form;
            int counts;

            while (true)
            {
                try
                {
                    counts = Convert.ToInt32(Interaction.InputBox("ادخل عدد الاغراض", "عدد الاغراض", "العدد", 200, 200));
                    break;
                } catch (FormatException)
                {
                    MessageBox.Show("ادخل عدد صحيح");
                }
            }
            int j = 0;

            #region
            for (int i = 0; i < counts; i++)
            {
                ComboBox comboBox1 = new ComboBox();
                Label    label1    = new Label();
                Label    label2    = new Label();
                TextBox  textBox1  = new TextBox();
                TextBox  textBox2  = new TextBox();
                Label    label3    = new Label();

                //
                // comboBox1
                //
                comboBox1.FormattingEnabled = true;
                comboBox1.Location          = new System.Drawing.Point(84, 86 + j);
                comboBox1.Name     = "comboBox1";
                comboBox1.Size     = new System.Drawing.Size(141, 21);
                comboBox1.TabIndex = 0;
                //
                // label1
                //
                label1.AutoSize = true;
                label1.Location = new System.Drawing.Point(25, 89 + j);
                label1.Name     = "label1";
                label1.Size     = new System.Drawing.Size(53, 13);
                label1.TabIndex = 1;
                label1.Text     = "اسم الماده";
                //
                // label2
                //
                label2.AutoSize = true;
                label2.Location = new System.Drawing.Point(258, 89 + j);
                label2.Name     = "label2";
                label2.Size     = new System.Drawing.Size(29, 13);
                label2.TabIndex = 2;
                label2.Text     = "العدد";
                //
                // textBox1
                //
                textBox1.Location  = new System.Drawing.Point(303, 86 + j);
                textBox1.Name      = "textBox1";
                textBox1.Size      = new System.Drawing.Size(100, 20);
                textBox1.TabIndex  = 3;
                textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
                //
                // textBox2
                //
                textBox2.Location  = new System.Drawing.Point(467, 86 + j);
                textBox2.Name      = "textBox2";
                textBox2.Size      = new System.Drawing.Size(100, 20);
                textBox2.TabIndex  = 5;
                textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
                //
                // label3
                //
                label3.AutoSize = true;
                label3.Location = new System.Drawing.Point(422, 89 + j);
                label3.Name     = "label3";
                label3.Size     = new System.Drawing.Size(33, 13);
                label3.TabIndex = 4;
                label3.Text     = "السعر";
                this.Controls.Add(comboBox1);
                this.Controls.Add(label1);
                this.Controls.Add(textBox1);
                this.Controls.Add(label2);
                this.Controls.Add(textBox2);
                this.Controls.Add(label3);
                foreach (string s in data)
                {
                    comboBox1.Items.Add(s);
                }
                list.AddLast(new Items
                {
                    item_combo = comboBox1,
                    count_txt  = textBox1,
                    price_txt  = textBox2
                });

                j += 50;
            }
            #endregion
        }