Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string  user_select = "select user_id,user_name,user_password from users where user_name='" + user_txt.Text + "'";
            DataSet data        = new DataSet();

            db.selectDB(ref data, user_select);
            try
            {
                if (data.Tables[0].Rows.Count > 0)
                {
                    if (data.Tables[0].Rows[0][2].ToString() == password_txt.Text)
                    {
                        new MainForm(Convert.ToInt32(data.Tables[0].Rows[0][0].ToString())).Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("الرقم السري خاطئ");
                    }
                }
                else
                {
                    MessageBox.Show("المستخدم غير موجود");
                }
            }
            catch (Exception)
            {
            }
        }
Пример #2
0
 private void AddCheckForm_Load(object sender, EventArgs e)
 {
     if (cases == 1)
     {
         if (payment.customer_combo.SelectedIndex >= 0)
         {
             owner_txt.Text = payment.customer_combo.SelectedItem.ToString();
         }
         if (ch != null)
         {
             id_txt.Text             = ch.Id + "";
             bank_txt.Text           = ch.Bank;
             owner_txt.Text          = ch.Owner;
             date_pic.Value          = ch.Delv_Date;
             price_txt.Text          = ch.Price + "";
             note_combo.SelectedItem = ch.Notes;
         }
     }
     else if (cases == 3)
     {
         id_txt.Text = ch_id + "";
         data        = new DataSet();
         db.selectDB(ref data, "SELECT * FROM checks WHERE ch_id=" + ch_id);
         bank_txt.Text           = data.Tables[0].Rows[0][2].ToString();
         owner_txt.Text          = data.Tables[0].Rows[0][3].ToString();
         date_pic.Value          = Convert.ToDateTime(data.Tables[0].Rows[0][4].ToString());
         price_txt.Text          = data.Tables[0].Rows[0][5].ToString();
         note_combo.SelectedItem = data.Tables[0].Rows[0][6].ToString();
     }
 }
Пример #3
0
 private void AddBillForm_Load(object sender, EventArgs e)
 {
     foreach (string s in db.ListOF("select * from teeth_type"))
     {
         type_combo.Items.Add(s);
     }
     foreach (string s in db.ListOF("select * from color_type"))
     {
         color_combo.Items.Add(s);
     }
     if (cases == 2)
     {
         DataSet data1 = new DataSet();
         db.selectDB(ref data1, "SELECT * FROM bill WHERE id='" + bill_id + "'");
         DataSet data2 = new DataSet();
         db.selectDB(ref data2, "SELECT cust_name,cust_type from customer WHERE cust_id='" + data1.Tables[0].Rows[0][2] + "'");
         LinkedList <string> teethes_data = db.ListOF("SELECT number from teeth where bill_id='" + bill_id + "'");
         teethes.Text = "تعديل الاسنان";
         save.Text    = "تعديل";
         id_txt.Text  = data1.Tables[0].Rows[0][1].ToString();
         cust_type_combo.SelectedItem = data2.Tables[0].Rows[0][1].ToString();
         customer_combo.SelectedItem  = data2.Tables[0].Rows[0][0].ToString();
         teethes_list = new bool[49];
         for (int i = 0; i < teethes_list.Length; i++)
         {
             teethes_list[i] = false;
         }
         foreach (string s in teethes_data)
         {
             int index = Convert.ToInt32(s);
             teethes_list[index] = true;
         }
         teethes_txt.Text              = data1.Tables[0].Rows[0][3].ToString();
         color_combo.SelectedItem      = data1.Tables[0].Rows[0][4].ToString();
         type_combo.SelectedItem       = data1.Tables[0].Rows[0][5].ToString();
         price_txt.Text                = data1.Tables[0].Rows[0][9].ToString();
         delv_state_combo.SelectedItem = data1.Tables[0].Rows[0][6].ToString();
         price            = Convert.ToDouble(price_txt.Text);
         notes_txt.Text   = data1.Tables[0].Rows[0][10].ToString();
         warrnity.Visible = false;
         warr_txt.Visible = false;
     }
 }
Пример #4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            new Thread(() => {
                if (InvokeRequired)
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        user_data = new DataSet();
                        db.selectDB(ref user_data, "SELECT * FROM users WHERE user_id='" + Id + "'");
                        string title_select = user_data.Tables[0].Rows[0][2].ToString();
                        if (user_data.Tables[0].Rows.Count > 0)
                        {
                            title.Text = "مرحبا " + title_select;
                        }
                        user_role = user_data.Tables[0].Rows[0][4].ToString();
                        if (user_role != "مسؤول")
                        {
                            settings.Visible           = false;
                            del_bill.Visible           = false;
                            edit_cust.Visible          = false;
                            del_cust.Visible           = false;
                            dell_sell_bill.Visible     = false;
                            sell_bill_gridview.Visible = false;
                        }

                        cust_type_search         = "";
                        cust_name_search         = "";
                        date_combo.SelectedIndex = 0;
                        th = new Thread(new ThreadStart(UpdateEach10Mins));
                        th.Start();
                    }
                                                  ));
                }
            }).Start();
            //RefreshCust(cust_query);
            //RefreshBill(bill_query);
        }