Example #1
0
        private void save_Click(object sender, EventArgs e)
        {
            string name  = name_txt.Text;
            string type  = type_combo.SelectedItem.ToString();
            string email = email_txt.Text;

            if (name != "" && type != "")
            {
                if (cases == 1)
                {
                    string insert_query = "INSERT INTO customer (cust_name,cust_type,cust_email) VALUES('" + name + "','" + type + "','" + email + "')";
                    if (db.insertDB(insert_query))
                    {
                        int id = db.SelectID("SELECT cust_id FROM customer WHERE cust_name='" + name + "'");
                        for (int i = 0; i < phone_list.Items.Count; i++)
                        {
                            string p     = phone_list.Items[i].Text;
                            string query = "INSERT INTO phones VALUES('" + p + "'," + id + ")";
                            if (db.insertDB(query))
                            {
                            }
                        }
                        MessageBox.Show("تم اضافه الزبون");
                        this.Close();
                        form.RefreshCust(form.cust_query);
                    }
                }
                else if (cases == 2)
                {
                    string update_query = "UPDATE customer SET cust_name='" + name + "',cust_type='" + type + "',cust_email='" + email + "' WHERE cust_id=" + id;
                    if (db.updateDB(update_query))
                    {
                        db.deleteDB("DELETE FROM phones WHERE cust_id=" + id);
                        for (int i = 0; i < phone_list.Items.Count; i++)
                        {
                            string p     = phone_list.Items[i].Text;
                            string query = "INSERT INTO phones VALUES('" + p + "'," + id + ")";
                            if (db.insertDB(query))
                            {
                            }
                        }
                        MessageBox.Show("تم تعديل معلومات الزبون الزبون");
                        this.Close();
                        form.RefreshCust(form.cust_query);
                    }
                }
            }
            else
            {
                MessageBox.Show("ادخل معلومات صحيحه");
            }
        }
Example #2
0
 private void edit_Click(object sender, EventArgs e)
 {
     try {
         patient = Interaction.InputBox("ادخل اسم المريض", "تعديل اسم المريض", patient + "", 200, 200);
         period  = Convert.ToInt32(Interaction.InputBox("ادخل عدد السنين", "تعديل سنوات الكفاله", period + "", 200, 200));
         string update_query = "UPDATE warrnity SET warr_years='" + period + "',warr_patient='" + patient + "' WHERE bill_id=" + id;
         if (db.updateDB(update_query))
         {
             MessageBox.Show("تم تعديل الفاتوره");
         }
         RefreshWarr();
     }
     catch (FormatException)
     {
         MessageBox.Show("ادخل رقم صحيح");
     }
 }
Example #3
0
 private void update_Click(object sender, EventArgs e)
 {
     if (id_txt.Text != "")
     {
         if (MessageBox.Show("هل تريد تعديل الحساب", "تعديل", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             string update_query = "update users set user_name='" + username_txt.Text + "',user_fullname='" + name_txt.Text + "',user_password='******',user_role='" + role_combo.SelectedItem.ToString() + "' WHERE user_id='" + id_txt.Text + "'";
             if (db.updateDB(update_query))
             {
                 RefreshAccount();
             }
         }
     }
     else
     {
         MessageBox.Show("يجب اختيار حساب لتعديله");
     }
 }
Example #4
0
        private void change_Click(object sender, EventArgs e)
        {
            string s = "";

            MessageBox.Show(delv_state_combo.SelectedItem.ToString());
            if (delv_state_combo.SelectedItem.ToString() == "تم التسليم")
            {
                s = ",bill_delv_date='" + FormatDate(DateTime.Today) + "' ";
            }
            string update_query = "UPDATE bill set bill_delv_state='" + delv_state_combo.SelectedItem + "'" + s + " WHERE id='" + id + "'";

            MessageBox.Show(update_query);
            if (db.updateDB(update_query))
            {
                form.RefreshTheBill();
                this.Close();
            }
        }
Example #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (name_txt.Text != "" && phone_txt.Text != "")
         {
             if (casses == 1)
             {
                 string insert_query = "INSERT INTO seller (sell_name,sell_no,sell_email) VALUES('" + name_txt.Text + "','" + phone_txt.Text + "','" + email_txt.Text + "')";
                 if (db.insertDB(insert_query))
                 {
                     MessageBox.Show("تم ادخال التاجر");
                     this.Close();
                     form.RefreshSell(form.sell_query);
                 }
             }
             else if (casses == 2)
             {
                 string update_query = "UDPATE seller SET sell_name='" + name_txt.Text + "',sell_no='" + phone_txt.Text + "',sell_email='" + email_txt.Text + "' WHERE sell_id=" + this.id;
                 if (db.updateDB(update_query))
                 {
                     MessageBox.Show("تم تعديل التاجر");
                     this.Close();
                     form.RefreshSell(form.sell_query);
                 }
             }
         }
         else
         {
             MessageBox.Show("يجب ملئ خانتي الاسم والرقم");
         }
     }
     catch (FormatException)
     {
         MessageBox.Show("ادخل رقم هاتف صحيح");
     }
 }