Beispiel #1
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (textBox8.Text.Length == 0 || textBox7.Text.Length == 0 || textBox2.Text.Length == 0)
     {
         MessageBox.Show("لطفا تمامی فیلد های اجباری را وارد نمایید");
     }
     else
     {
         try
         {
             database DB = new database();
             if (DB.Search_in_DB(1, textBox8.Text, textBox7.Text) != -1)
             {
                 MessageBox.Show("کارمندی با این نام و نام خانوادگی از قبل وجود دارد لطفا دوباره امتحان کنید");
             }
             else
             {
                 DB.HourDB_Creator(this.textBox8.Text, this.textBox7.Text, this.textBox6.Text, this.textBox5.Text, this.comboBox1.Text, this.textBox4.Text, Convert.ToUInt32(this.textBox2.Text), this.textBox3.Text);
                 MessageBox.Show("عملیات با موفقیت انجام شد");
                 this.Close();
             }
         }
         catch (FormatException)
         {
             MessageBox.Show("در حقوق قراردادی مقدار عددی وارد نمایید");
         }
     }
 }
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     constindex = DB.Search_in_DB(2, textBox1.Text, textBox2.Text);
     hourindex  = DB.Search_in_DB(1, textBox1.Text, textBox2.Text);
     if (constindex == -1 && hourindex == -1)
     {
         MessageBox.Show("هیچ کارمندی با این مشخصات یافت نشد");
     }
     else
     {
         SearchResult shr = new SearchResult();
         shr.constindex = constindex;
         shr.hourindex  = hourindex;
         shr.Show();
     }
 }
Beispiel #3
0
 private void pictureBox9_Click(object sender, EventArgs e)
 {
     hourindex = DB.Search_in_DB(1, textBox1.Text, textBox2.Text);
     if (hourindex != -1)
     {
         pictureBox9.Visible = false;
         label15.Visible     = true;
         label16.Visible     = true;
         label18.Text        = database.hourbase[hourindex].Codemelli;
         label18.Visible     = true;
         textBox5.Visible    = true;
         button1.Visible     = true;
     }
     else
     {
         MessageBox.Show("کارمند مورد نظر یافت نشد");
     }
 }
Beispiel #4
0
        private void linkLabel7_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            openFileDialog1.FileName = string.Empty;
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                bool status = true;
                try
                {
                    string   Directory = openFileDialog1.FileName;
                    string[] st        = new string[2000];
                    st = File.ReadAllLines(Directory);
                    for (int i = 0; i < st.Length; i++)
                    {
                        string[] subst = new string[5];
                        subst = st[i].Split('*');
                        if (subst.Length == 4)
                        {
                            database DB = new database();
                            if (DB.Search_in_DB(1, subst[0], subst[1]) == -1)
                            {
                                DB.HourDB_Creator(subst[0], subst[1], string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToUInt32(subst[3]), string.Empty);
                            }
                            else
                            {
                                MessageBox.Show("برخی از اسامی از قبل در دیتابیس موجود می باشد آنها را اصلاح کرده و دوباره امتحان کنید");
                                status = false;
                                break;
                            }
                        }
                        if (subst.Length == 5)
                        {
                            database DB = new database();
                            if (DB.Search_in_DB(2, subst[0], subst[1]) == -1)
                            {
                                DB.ConstDB_Creator(subst[0], subst[1], string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToUInt32(subst[3]), string.Empty, Convert.ToInt32(subst[4]));
                            }
                            else
                            {
                                MessageBox.Show("برخی از اسامی از قبل در دیتابیس موجود می باشد آنها را اصلاح کرده و دوباره امتحان کنید");
                                status = false;
                                break;
                            }
                        }
                        if (subst.Length != 4 && subst.Length != 5)
                        {
                            MessageBox.Show("متن داخل فایل فرمت مناسبی جهت ذخیره سازی در دیتابیس ندارد");
                        }
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("متن داخل فایل فرمت مناسبی جهت ذخیره سازی در دیتابیس ندارد");
                }

                if (status)
                {
                    MessageBox.Show("ورود فایل با موفقیت انجام شد");
                }
            }
        }