private void Form5_Load(object sender, EventArgs e)
        {
            PersianCalendar pc = new PersianCalendar();

            ss.Text = "1111/11/11";
            sr.Text = "1111/11/11";
            string m = pc.GetMonth(DateTime.Now).ToString();

            if (m.Length < 2)
            {
                m = "0" + m;
            }
            string da = pc.GetDayOfMonth(DateTime.Now).ToString();

            if (da.Length < 2)
            {
                da = "0" + da;
            }
            string date = pc.GetYear(DateTime.Now).ToString() + "/" + m + "/" + da;

            te.Text = date;
            er.Text = date;
            ch      = true;
            Hokm hokm = new Hokm();

            dt = hokm.getAllHokm();

            DataTable dtCloned = dt.Clone();

            dtCloned.Columns[0].DataType = typeof(string);
            dtCloned.Columns[1].DataType = typeof(string);
            dtCloned.Columns[2].DataType = typeof(string);
            dtCloned.Columns[3].DataType = typeof(string);
            dtCloned.Columns[4].DataType = typeof(string);
            dtCloned.Columns[5].DataType = typeof(string);
            dtCloned.Columns[6].DataType = typeof(string);
            dtCloned.Columns[7].DataType = typeof(string);
            dtCloned.Columns[8].DataType = typeof(string);
            dtCloned.Columns[9].DataType = typeof(string);
            foreach (DataRow row in dt.Rows)
            {
                dtCloned.ImportRow(row);
            }
            gridEX1.DataSource = dtCloned;
        }
 private void elButton3_Click(object sender, EventArgs e)
 {
     if (gridEX1.CurrentRow != null)
     {
         Hokm hokm = new Hokm();
         hokm.Number_Hokm = gridEX1.CurrentRow.Cells[3].Value.ToString();
         hokm.Var_per     = gridEX1.CurrentRow.Cells[8].Value.ToString();
         int a = hokm.deleteRecord();
         if (a == 1)
         {
             gridEX1.CurrentRow.Delete();
             MessageBox.Show("عملیات حذف با موفقیت انجام شده است ");
         }
         else
         {
             MessageBox.Show("عملیات حذف دچار مشکل شده");
         }
     }
 }
        private void Form5_Activated(object sender, EventArgs e)
        {
            Hokm      hokm = new Hokm();
            DataTable dt   = hokm.getAllHokm();

            DataTable dtCloned = dt.Clone();

            dtCloned.Columns[0].DataType = typeof(string);
            dtCloned.Columns[1].DataType = typeof(string);
            dtCloned.Columns[2].DataType = typeof(string);
            dtCloned.Columns[3].DataType = typeof(string);
            dtCloned.Columns[4].DataType = typeof(string);
            dtCloned.Columns[5].DataType = typeof(string);
            dtCloned.Columns[6].DataType = typeof(string);
            dtCloned.Columns[7].DataType = typeof(string);
            dtCloned.Columns[8].DataType = typeof(string);
            dtCloned.Columns[9].DataType = typeof(string);

            foreach (DataRow row in dt.Rows)
            {
                dtCloned.ImportRow(row);
            }
            gridEX1.DataSource = dtCloned;
        }
Beispiel #4
0
        private void Form4_Load(object sender, EventArgs e)
        {
            if (Auto == 1)
            {
                txt_numEste.Text          = Num_Este;
                Cmb_var_per.SelectedIndex = (Convert.ToInt16(Var_per) - 1);
                btn_search_Click(sender, e);
            }
            else if (Auto == 2)
            {
                Hokm hokm = new Hokm();
                hokm.Num_Este    = Num_Este;
                hokm.Var_per     = Var_per;
                hokm.Number_Hokm = Num_Hokm;
                recordFromHokm   = hokm.getRecordHokm();
                if (recordFromHokm.Count > 0)
                {
                    txt_numEste.Text          = Num_Este;
                    Cmb_var_per.SelectedIndex = (Convert.ToInt16(Var_per) - 1);
                    btn_search.Enabled        = false;
                    txt_numEste.Enabled       = false;
                    Cmb_var_per.Enabled       = false;
                    txt_dateSodor.Enabled     = true;
                    txt_run.Enabled           = true;
                    txt_numberHokm.Enabled    = true;
                    txt_Con_Str.Enabled       = true;
                    txt_AddAll.Enabled        = true;
                    elButton1.Text            = "ثبت ویرایش";
                    txt_run.Text        = recordFromHokm[0].date_run;
                    txt_dateSodor.Text  = recordFromHokm[0].date_sodor;
                    txt_numberHokm.Text = Num_Hokm;
                    txt_Con_Str.Text    = recordFromHokm[0].num2str;
                    txt_Tozeh.Text      = recordFromHokm[0].tozihat;
                    elab_meli.Text      = recordFromHokm[0].meli;
                    elab_degree.Text    = recordFromHokm[0].degree;
                    if (recordFromHokm[0].Base == 0)
                    {
                        elab_base.Text = "";
                    }
                    else
                    {
                        elab_base.Text = recordFromHokm[0].Base.ToString();
                    }
                    elab_var.Text   = Cmb_var_per.SelectedValue.ToString();
                    elab_name.Text  = recordFromHokm[0].name + " " + recordFromHokm[0].family;
                    txt_AddAll.Text = recordFromHokm[0].add_all.ToString();
                    txt_base.Text   = recordFromHokm[0].costBase.ToString();
                    //  MessageBox.Show(""+recordFromHokm[0].partical.ToString());
                    if (Var_per == "1" || Var_per == "2" || Var_per == "4")
                    {
                        // MessageBox.Show(recordFromHokm[0].partical.ToString() + "   " + recordFromHokm[0].partical);
                        txt_parti.Text     = recordFromHokm[0].partical.ToString();
                        txt_abso.Text      = recordFromHokm[0].absorption.ToString();
                        txt_mange.Text     = recordFromHokm[0].mangment.ToString();
                        txt_help.Text      = recordFromHokm[0].helop.ToString();
                        txt_costChild.Text = recordFromHokm[0].helpChild.ToString();
                        txt_speci.Text     = recordFromHokm[0].special.ToString();
                        txt_heat.Text      = recordFromHokm[0].heat.ToString();
                    }
                    else
                    {
                        txt_parti.Text     = recordFromHokm[0].job.ToString();
                        txt_abso.Text      = recordFromHokm[0].mangment.ToString();
                        txt_mange.Text     = recordFromHokm[0].special.ToString();
                        txt_help.Text      = recordFromHokm[0].super.ToString();
                        txt_costChild.Text = recordFromHokm[0].expert.ToString();
                        txt_speci.Text     = recordFromHokm[0].technic.ToString();
                        txt_heat.Text      = recordFromHokm[0].childern.ToString();
                        txt_Cost.Text      = recordFromHokm[0].house.ToString();
                        txt_Diff.Text      = recordFromHokm[0].diff.ToString();
                        txt_Turn.Text      = recordFromHokm[0].turn.ToString();
                    }
                }
            }
            else
            {
                foreach (Control c in contin_main.Controls)
                {
                    if (!c.Name.Equals(Cmb_var_per.Name) && (!c.Name.Equals(txt_numEste.Name)) && !(c.Name.Equals(btn_search.Name)))
                    {
                        c.Enabled = false;
                    }
                }
                Cmb_var_per.SelectedIndex = 4;

                txt_Cost.Text = "0";
                txt_Diff.Text = "0";
                txt_Turn.Text = "0";

                txt_parti.Text     = "0";
                txt_abso.Text      = "0";
                txt_mange.Text     = "0";
                txt_help.Text      = "0";
                txt_costChild.Text = "0";
                txt_speci.Text     = "0";
                txt_heat.Text      = "0";
                txt_base.Text      = "0";
            }
        }
Beispiel #5
0
        private void elButton1_Click(object sender, EventArgs e)
        {
            if (txt_numberHokm.Text != "")
            {
                Hokm hokm = new Hokm();
                hokm.Date_run    = txt_run.Text;
                hokm.Date_sodor  = txt_dateSodor.Text;
                hokm.Number_Hokm = txt_numberHokm.Text;
                hokm.Num2str     = txt_Con_Str.Text;
                hokm.Tozehat     = txt_Tozeh.Text;
                hokm.Var_per     = "" + (Cmb_var_per.SelectedIndex + 1);
                hokm.Num_Este    = txt_numEste.Text;
                hokm.Add_all     = txt_AddAll.Text;
                hokm.Cost_base   = txt_base.Text;
                if (Cmb_var_per.SelectedIndex == 0 || Cmb_var_per.SelectedIndex == 3)
                {
                    hokm.Partical   = txt_parti.Text;
                    hokm.Absorption = txt_abso.Text;
                    hokm.Mangment   = txt_mange.Text;
                    hokm.Helop      = txt_help.Text;
                    hokm.HelpChild  = txt_costChild.Text;
                    hokm.Special    = txt_speci.Text;
                    hokm.Heat       = txt_heat.Text;
                    hokm.Degree     = elab_degree.Text;
                    hokm.Bse        = elab_base.Text;
                }
                else if (Cmb_var_per.SelectedIndex == 1)
                {
                    hokm.Partical   = txt_parti.Text;
                    hokm.Absorption = txt_abso.Text;
                    hokm.Mangment   = txt_mange.Text;
                    hokm.Helop      = txt_help.Text;
                    hokm.HelpChild  = txt_costChild.Text;
                    hokm.Special    = txt_speci.Text;
                    hokm.Heat       = txt_heat.Text;
                    hokm.Degree     = elab_degree.Text;
                    hokm.Bse        = elab_base.Text;
                }
                else
                {
                    hokm.Job      = txt_parti.Text;
                    hokm.Mangment = txt_abso.Text;
                    hokm.Special  = txt_mange.Text;

                    hokm.Super    = txt_help.Text;
                    hokm.Expert   = txt_costChild.Text;
                    hokm.Technic  = txt_speci.Text;
                    hokm.Childern = txt_heat.Text;
                    hokm.House    = txt_Cost.Text;
                    hokm.Diff     = txt_Diff.Text;
                    hokm.Turn     = txt_Turn.Text;
                }
                int a = 0;
                if (auto == 2)
                {
                    hokm.Old_number_hokm = Num_Hokm;
                    a = hokm.updateHokm();
                }
                else
                {
                    a = hokm.insertHokm();
                }

                if (a == 1)
                {
                    //MessageBox.Show("عملیات موفقیت آمیز بود ");
                    DialogResult result1 = MessageBox.Show("عملیات موفقیت آمیز بود، آیا می خواهید حکم را پرینت بگیرید ؟ ",
                                                           "اخطار",
                                                           MessageBoxButtons.YesNo,
                                                           MessageBoxIcon.Warning);
                    if (result1 == DialogResult.Yes)
                    {
                        string tb      = "";
                        string tbHokm  = "";
                        string Varhokm = "";
                        if (Cmb_var_per.SelectedIndex == 0)
                        {
                            tb = "SELECT A.name,A.family," +
                                 "A.salar,A.father,A.iden,A.meli," +
                                 "A.born,A.W_born,A.ex_ostan,A.ex_sharstan," +
                                 "A.w_Doc,A.trai,A.ser_ostan,A.ser_sharstan," +
                                 "A.date_Start,A.date_End,A.situ,A.marr,A.child," +
                                 "B.* FROM tb_contract A, tb_contract_hokm B WHERE " +
                                 "B.number_Hokm ='" + txt_numberHokm.Text.Trim() + "'";
                            //   tb = "tb_contract";
                            tbHokm  = "tb_contract_hokm";
                            Varhokm = "Contract.mrt";
                        }
                        else if (Cmb_var_per.SelectedIndex == 1)
                        {
                            tb = "SELECT A.name,A.family," +
                                 "A.salar,A.father,A.iden,A.meli," +
                                 "A.born,A.W_born,A.ex_ostan,A.ex_sharstan," +
                                 "A.w_Doc,A.trai,A.ser_ostan,A.ser_sharstan," +
                                 "A.situ,A.marr,A.child," +
                                 "B.* FROM tb_formal A, tb_formal_hokm B WHERE " +
                                 "B.number_Hokm ='" + txt_numberHokm.Text.Trim() + "'";
                            // tb = "tb_formal";
                            tbHokm  = "tb_formal_hokm";
                            Varhokm = "Formal.mrt";
                        }
                        else if (Cmb_var_per.SelectedIndex == 2)
                        {
                            tb = "SELECT A.name,A.family," +
                                 "A.salar,A.father,A.iden,A.meli," +
                                 "A.born,A.W_born,A.ex_ostan,A.ex_sharstan," +
                                 "A.w_Doc,A.trai,A.ser_ostan,A.ser_sharstan," +
                                 "A.situ,A.marr,A.child," +
                                 "B.* FROM tb_personel A, tb_hokm_personel B WHERE " +
                                 "B.number_Hokm ='" + txt_numberHokm.Text.Trim() + "'";
                            //tb = "tb_personel";
                            tbHokm  = "tb_hokm_personel";
                            Varhokm = "Personel.mrt";
                        }
                        else if (Cmb_var_per.SelectedIndex == 3)
                        {
                            MessageBox.Show("kl");
                            tb = "SELECT A.name,A.family," +
                                 "A.salar,A.father,A.iden,A.meli," +
                                 "A.born,A.W_born,A.ex_ostan,A.ex_sharstan," +
                                 "A.w_Doc,A.trai,A.ser_ostan,A.ser_sharstan," +
                                 "A.situ,A.marr,A.child," +
                                 "B.* FROM tb_contractual A, tb_contractual_hokm B WHERE " +
                                 "B.number_Hokm ='" + txt_numberHokm.Text.Trim() + "'";
                            // tb = "tb_contractual";
                            tbHokm  = "tb_contractual_hokm";
                            Varhokm = "Contractual.mrt";
                        }

                        report.Load(Varhokm);
                        report.Compile();
                        report["var2"] = tb;

                        //report.Render();
                        report.Show();
                    }
                }
                else
                {
                    MessageBox.Show("مشکل در عملیات ثبت ");
                }
            }
            else
            {
                MessageBox.Show("لطفا شماره حکم را وارد کنید");
            }
        }