Exemple #1
0
        private void Form26_Load(object sender, EventArgs e)
        {
            DB_Base database = new DB_Base();

            database.Connection_Open();
            database.Fill("SELECT * FROM [PKH] WHERE (no1 = 1)", objDataSet, "PKH1_1", true);
            database.Connection_Close();

            if (objDataSet.Tables["PKH1_1"].Rows[0]["no2"].ToString() == "1")
            {
                radioButton1.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_1"].Rows[0]["no2"].ToString() == "2")
            {
                radioButton2.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_1"].Rows[0]["no2"].ToString() == "3")
            {
                radioButton3.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_1"].Rows[0]["no2"].ToString() == "4")
            {
                radioButton4.Checked = true;
            }

            textBox1.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q1"].ToString();
            maskedTextBox1.Text = objDataSet.Tables["PKH1_1"].Rows[0]["q2"].ToString();
            textBox2.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q3"].ToString();
            textBox3.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q4"].ToString();
            textBox4.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q5"].ToString();
            textBox5.Text       = objDataSet.Tables["PKH1_1"].Rows[0]["q5"].ToString();

            database.Connection_Open();
            database.Fill("SELECT * FROM [PKH] WHERE (no1 = 2)", objDataSet, "PKH1_2", true);
            database.Connection_Close();

            if (objDataSet.Tables["PKH1_2"].Rows[0]["no2"].ToString() == "1")
            {
                radioButton5.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_2"].Rows[0]["no2"].ToString() == "2")
            {
                radioButton6.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_2"].Rows[0]["no2"].ToString() == "3")
            {
                radioButton7.Checked = true;
            }
            else if (objDataSet.Tables["PKH1_2"].Rows[0]["no2"].ToString() == "4")
            {
                radioButton8.Checked = true;
            }

            textBox6.Text       = objDataSet.Tables["PKH1_2"].Rows[0]["q1"].ToString();
            maskedTextBox2.Text = objDataSet.Tables["PKH1_2"].Rows[0]["q2"].ToString();
            textBox7.Text       = objDataSet.Tables["PKH1_2"].Rows[0]["q3"].ToString();
            textBox8.Text       = objDataSet.Tables["PKH1_2"].Rows[0]["q4"].ToString();
            textBox9.Text       = objDataSet.Tables["PKH1_2"].Rows[0]["q5"].ToString();
            textBox10.Text      = objDataSet.Tables["PKH1_2"].Rows[0]["q5"].ToString();
        }
Exemple #2
0
        private void call_comboBox3_SelectedIndexChanged()
        {
            if (comboBox3.Items.Count > 0)
            {
                if (comboBox3.SelectedValue != null)
                {
                    if (comboBox3.SelectedValue.ToString() != "System.Data.DataRowView")
                    {
                        DataBase1.Connection_Open();
                        DataBase1.Fill("SELECT DISTINCT moh_sal FROM tbl_month WHERE (idgroup=" + comboBox3.SelectedValue.ToString() + ") ORDER BY moh_sal ASC ", objDataSet, "tbl_month1", true);
                        DataBase1.Connection_Close();

                        comboBox2.Items.Clear();
                        if (objDataSet.Tables["tbl_month1"].Rows.Count > 0)
                        {
                            for (int q = 0; q <= objDataSet.Tables["tbl_month1"].Rows.Count - 1; q++)
                            {
                                comboBox2.Items.Add(objDataSet.Tables["tbl_month1"].Rows[q]["moh_sal"].ToString());
                            }
                        }
                        objDataSet.Tables["tbl_month1"].Clear();
                    }
                }
            }
        }
Exemple #3
0
        private void Form28_Load(object sender, EventArgs e)
        {
            database.Connection_Open();
            database.Fill("SELECT * FROM Excel_read_karkard", objDataSet, "Excel_read_karkard", true);
            database.Connection_Close();

            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource          = objDataSet;
            dataGridView1.DataMember          = "Excel_read_karkard";
            DataGridViewCellStyle objAlignRightCellStyle = new DataGridViewCellStyle();

            objAlignRightCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle();

            objAlternatingCellStyle.BackColor             = Color.WhiteSmoke;
            dataGridView1.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle;

            DataGridViewCellStyle objCurrencyCellStyle = new DataGridViewCellStyle();

            objCurrencyCellStyle.Format    = "c";
            objCurrencyCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            dataGridView1.Columns[0].Visible    = false;
            dataGridView1.Columns[1].HeaderText = "نام فیلد";
            dataGridView1.Columns[2].HeaderText = "نام ستون کادر بالا";

            objCurrencyCellStyle    = null;
            objAlternatingCellStyle = null;
            objAlignRightCellStyle  = null;
        }
Exemple #4
0
        private void Form21_Load(object sender, EventArgs e)
        {
            maskedTextBox5.Text = U_set.u_date();

            database.Connection_Open();
            database.Fill("SELECT * FROM Tbl_login WHERE (tmpid= 0)", objDataSet, "View_Process_2", true);
            database.Connection_Close();

            database.Connection_Open();
            database.Fill("SELECT * FROM Tbl_login WHERE (tmpid= 0)", objDataSet, "View1_Process_2", true);
            database.Connection_Close();
        }
Exemple #5
0
        public void Form_Load_set_color()
        {
            DataSet objDataSet1 = new DataSet();

            Database.Connection_Open();
            Database.Fill("SELECT * FROM Color_Font_Set ORDER BY tmpid", objDataSet1, "Color_Font_Set", true);
            Database.Connection_Close();

            TypeConverter tc0       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor0 = (Color)tc0.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[6]["promp"].ToString());

            foreach (SplitContainer spc in this.Controls)
            {
                foreach (Control ct in spc.Panel2.Controls)
                {
                    if (ct.GetType() == typeof(Button))
                    {
                        TypeConverter tc      = TypeDescriptor.GetConverter(typeof(Font));
                        Font          newFont = (Font)tc.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[13]["promp"].ToString());
                        ct.Font = newFont;

                        TypeConverter tc1      = TypeDescriptor.GetConverter(typeof(Color));
                        Color         newColor = (Color)tc1.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[14]["promp"].ToString());
                        ct.ForeColor = newColor;
                    }
                }
            }
            this.BackColor = newColor0;

            objDataSet1.Clear();
        }
Exemple #6
0
        private void ShowLoan_payment()
        {
            database.Connection_Open();
            database.Fill("SELECT * FROM tbl_loan_payment WHERE (loan_code = " + loan_code + ")", loan_peymentDataSet, "tbl_loan_payment", true);
            database.Connection_Close();

            dgvLoan_payment.DataSource          = loan_peymentDataSet;
            dgvLoan_payment.DataMember          = "tbl_loan_payment";
            dgvLoan_payment.AutoGenerateColumns = true;

            dgvLoan_payment.Columns[0].Visible    = false;
            dgvLoan_payment.Columns[1].HeaderText = "کد وام";
            dgvLoan_payment.Columns[2].HeaderText = "تاریخ قسط";
            dgvLoan_payment.Columns[3].HeaderText = "مبلغ";
            dgvLoan_payment.Columns[4].HeaderText = "وضعیت پرداخت";
        }
Exemple #7
0
        private void call_comboBox3_SelectedIndexChanged()
        {
            if (comboBox3.Items.Count > 0)
            {
                if (comboBox3.SelectedValue.ToString() != "System.Data.DataRowView")
                {
                    DataBase1.Connection_Open();
                    DataBase1.Fill("SELECT DISTINCT moh_sal FROM tbl_month WHERE (idgroup=" + comboBox3.SelectedValue.ToString() + ") ORDER BY moh_sal ASC ", objDataSet, "tbl_month", true);
                    DataBase1.Connection_Close();

                    comboBox2.Items.Clear();
                    if (objDataSet.Tables["tbl_month"].Rows.Count > 0)
                    {
                        for (int q = 0; q <= objDataSet.Tables["tbl_month"].Rows.Count - 1; q++)
                        {
                            comboBox2.Items.Add(objDataSet.Tables["tbl_month"].Rows[q]["moh_sal"].ToString());
                        }
                    }
                    else
                    {
                        روشهایمحاسبهToolStripMenuItem.Visible      = false;
                        اطلاعاتپرسنلToolStripMenuItem.Visible      = false;
                        پرداختکنندهحقوقToolStripMenuItem.Visible   = false;
                        ورودکارکردازاکسلToolStripMenuItem1.Visible = false;
                    }
                    objDataSet.Tables["tbl_month"].Clear();
                }
            }
        }
Exemple #8
0
        private void ShowLoan()
        {
            database.Connection_Open();
            database.Fill("SELECT * FROM tbl_loan WHERE (receiver = " + id_idmen + ")", LoanDataSet, "tbl_loan", true);
            database.Connection_Close();

            dgvLoan.DataSource          = LoanDataSet;
            dgvLoan.DataMember          = "tbl_loan";
            dgvLoan.AutoGenerateColumns = true;

            dgvLoan.Columns[0].Visible    = false;
            dgvLoan.Columns[1].HeaderText = "کد وام";
            dgvLoan.Columns[2].HeaderText = "مبلغ وام";
            dgvLoan.Columns[3].HeaderText = "تاریخ پرداخت وام";
            dgvLoan.Columns[4].Visible    = false;
            dgvLoan.Columns[5].HeaderText = "تسویه";
        }
Exemple #9
0
        private void Form1_Load(object sender, EventArgs e)
        {
            int amin2 = DataBase.Look_base();

            if (amin2 != 0)
            {
                MessageBox.Show("عدم شناسایی قفل " + amin2.ToString(), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }

            DataBase.Connection_Open();
            DataBase.Fill("SELECT tmpid ,(log_Name + ' ' + log_Family) as myname FROM Tbl_login", objDataSet, "Tbl_login", true);
            DataBase.Connection_Close();

            comboBox1.DataSource    = objDataSet.Tables["Tbl_login"];
            comboBox1.DisplayMember = "myname";
            comboBox1.ValueMember   = "tmpid";
        }
Exemple #10
0
        public string u_date()
        {
            Database.Connection_Open();
            Database.Fill("SELECT GETDATE() AS Expr1, DATEPART(HOUR, GETDATE()) AS Expr2, DATEPART(MINUTE, GETDATE()) AS Expr3, DATEPART(SECOND, GETDATE()) AS Expr4", objDataSet, "Server_Date1", true);
            Database.Connection_Close();

            int             y, m, d;
            PersianCalendar pr   = new PersianCalendar();
            string          amin = objDataSet.Tables["Server_Date1"].Rows[0]["Expr1"].ToString();

            d = pr.GetDayOfMonth(Convert.ToDateTime(amin));
            m = pr.GetMonth(Convert.ToDateTime(amin));
            y = pr.GetYear(Convert.ToDateTime(amin));

            string date;

            date = y.ToString().PadLeft(2, '0') + "/" + m.ToString().PadLeft(2, '0') + "/" + d.ToString().PadLeft(2, '0');
            return(date);
        }
Exemple #11
0
        public void Bind_Data1(string Qry, string DisplayMember, string ValueMember)
        {
            DB_Base DataBase = new DB_Base();

            DataBase.Connection_Open();
            DataBase.Fill(Qry, objDataSet, "MyTble", true);
            DataBase.Connection_Close();

            this.DataSource    = objDataSet.Tables["MyTble"];
            this.DisplayMember = DisplayMember;
            this.ValueMember   = ValueMember;
        }
        private void Color_Font_Set_Load(object sender, EventArgs e)
        {
            database.Connection_Open();
            database.Fill("SELECT * FROM Color_Font_Set", objDataSet, "Color_Font_Set", true);
            database.Connection_Close();

            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource          = objDataSet;
            dataGridView1.DataMember          = "Color_Font_Set";

            DataGridViewCellStyle objAlignRightCellStyle = new DataGridViewCellStyle();

            objAlignRightCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle();

            objAlternatingCellStyle.BackColor             = Color.WhiteSmoke;
            dataGridView1.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle;

            DataGridViewCellStyle objCurrencyCellStyle = new DataGridViewCellStyle();

            objCurrencyCellStyle.Format    = "c";
            objCurrencyCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            dataGridView1.Columns[1].Visible    = false;
            dataGridView1.Columns[2].HeaderText = "شرح";
            dataGridView1.Columns[2].Width      = 250;
            dataGridView1.Columns[3].Visible    = false;
            dataGridView1.Columns[4].Visible    = false;

            objCurrencyCellStyle    = null;
            objAlternatingCellStyle = null;
            objAlignRightCellStyle  = null;

            for (int q = 0; q <= dataGridView1.RowCount - 1; q++)
            {
                if (dataGridView1.Rows[q].Cells["noe"].FormattedValue.ToString() == "1")
                {
                    TypeConverter tc2      = TypeDescriptor.GetConverter(typeof(Font));
                    Font          newFont2 = (Font)tc2.ConvertFromString(dataGridView1.Rows[q].Cells["promp"].FormattedValue.ToString());

                    dataGridView1.Rows[q].Cells["name"].Style.Font = newFont2;
                }

                if (dataGridView1.Rows[q].Cells["noe"].FormattedValue.ToString() == "2")
                {
                    TypeConverter tc3       = TypeDescriptor.GetConverter(typeof(Color));
                    Color         newColor3 = (Color)tc3.ConvertFromString(dataGridView1.Rows[q].Cells["promp"].FormattedValue.ToString());

                    dataGridView1.Rows[q].Cells["name"].Style.BackColor = newColor3;
                }
            }
        }
        private void Form31_Load(object sender, EventArgs e)
        {
            noe_style(style);

            Database.Connection_Open();
            Database.Fill("SELECT tmpid, name_makaz FROM Tbl_markaz", objDataSet, "Tbl_markaz", true);
            Database.Connection_Close();

            comboBox1.DataSource    = objDataSet.Tables["Tbl_markaz"];
            comboBox1.DisplayMember = "name_makaz";
            comboBox1.ValueMember   = "tmpid";
        }
Exemple #14
0
        private void combo_bank_1_sabzkosh()
        {
            string file_name = Application.StartupPath.ToString() + @"\Bank\" + id_year.ToString() + id_moon.ToString().PadLeft(2, '0');

            if (Directory.Exists(file_name) == false)
            {
                Directory.CreateDirectory(file_name);
            }

            open_file_name = file_name;

            file_name += @"\" + "FL" + id_year.ToString() + id_moon.ToString().PadLeft(2, '0') + ".TXT";

            Database.Connection_Open();
            Database.Fill("SELECT Count(tbl_personel.tmpid) AS rsnumber ,SUM(Khales) AS rssum FROM Tbl_process INNER JOIN tbl_personel ON Tbl_process.idgroup = tbl_personel.idgroup AND Tbl_process.idyear = tbl_personel.idyear AND Tbl_process.idmoon = tbl_personel.idmoon AND Tbl_process.idpersonal = tbl_personel.tmpid AND Tbl_process.type1 = 1 AND tbl_personel.list2 = 1 WHERE (Tbl_process.idgroup=" + id_group + ") AND (Tbl_process.idyear=" + id_year + ") AND (Tbl_process.idmoon=" + id_moon + ")", objDataSet, "Tbl_process1", true);
            Database.Connection_Close();

            Database.Connection_Open();
            Database.Fill("SELECT sh_hesab ,Khales FROM Tbl_process INNER JOIN tbl_personel ON Tbl_process.idgroup = tbl_personel.idgroup AND Tbl_process.idyear = tbl_personel.idyear AND Tbl_process.idmoon = tbl_personel.idmoon AND Tbl_process.idpersonal = tbl_personel.tmpid AND Tbl_process.type1 = 1 AND tbl_personel.list2 = 1 WHERE (Tbl_process.idgroup=" + id_group + ") AND (Tbl_process.idyear=" + id_year + ") AND (Tbl_process.idmoon=" + id_moon + ")", objDataSet, "Tbl_process2", true);
            Database.Connection_Close();

            string[] installs = new string[(objDataSet.Tables["Tbl_process2"].Rows.Count + 1)];

            installs[0]  = objDataSet.Tables["Tbl_process1"].Rows[0]["rsnumber"].ToString().PadLeft(10, '0');
            installs[0] += "0000000";
            installs[0] += Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process1"].Rows[0]["rssum"].ToString())).ToString();

            for (int q = 1; q <= objDataSet.Tables["Tbl_process2"].Rows.Count; q++)
            {
                installs[q]  = objDataSet.Tables["Tbl_process2"].Rows[q - 1]["sh_hesab"].ToString();
                installs[q] += "0000000";
                installs[q] += Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process2"].Rows[q - 1]["Khales"].ToString())).ToString();
            }

            System.IO.File.WriteAllLines(file_name, installs, Encoding.ASCII);
            objDataSet.Clear();
        }
Exemple #15
0
        public void Form_Load_set_color()
        {
            Database.Connection_Open();
            Database.Fill("SELECT * FROM Color_Font_Set ORDER BY tmpid", objDataSet, "Color_Font_Set", true);
            Database.Connection_Close();

            TypeConverter tc0       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor0 = (Color)tc0.ConvertFromString(objDataSet.Tables["Color_Font_Set"].Rows[6]["promp"].ToString());

            foreach (Control ct in this.Controls)
            {
                if (ct.GetType() == typeof(GroupBox))
                {
                    foreach (Control Gt1 in ct.Controls)
                    {
                        if (Gt1.GetType() == typeof(Label))
                        {
                            TypeConverter tc      = TypeDescriptor.GetConverter(typeof(Font));
                            Font          newFont = (Font)tc.ConvertFromString(objDataSet.Tables["Color_Font_Set"].Rows[0]["promp"].ToString());
                            Gt1.Font = newFont;

                            TypeConverter tc1      = TypeDescriptor.GetConverter(typeof(Color));
                            Color         newColor = (Color)tc1.ConvertFromString(objDataSet.Tables["Color_Font_Set"].Rows[1]["promp"].ToString());
                            Gt1.ForeColor = newColor;
                        }

                        if ((Gt1.GetType() == typeof(TextBox)) || (Gt1.GetType() == typeof(ComboBox)) || (Gt1.GetType() == typeof(Db_Combo)) || (Gt1.GetType() == typeof(MaskedTextBox)))
                        {
                            TypeConverter tc      = TypeDescriptor.GetConverter(typeof(Font));
                            Font          newFont = (Font)tc.ConvertFromString(objDataSet.Tables["Color_Font_Set"].Rows[4]["promp"].ToString());
                            Gt1.Font = newFont;

                            TypeConverter tc1      = TypeDescriptor.GetConverter(typeof(Color));
                            Color         newColor = (Color)tc1.ConvertFromString(objDataSet.Tables["Color_Font_Set"].Rows[5]["promp"].ToString());
                            Gt1.ForeColor = newColor;
                        }

                        if (Gt1.GetType() == typeof(Button))
                        {
                            TypeConverter tc      = TypeDescriptor.GetConverter(typeof(Font));
                            Font          newFont = (Font)tc.ConvertFromString(objDataSet.Tables["Color_Font_Set"].Rows[13]["promp"].ToString());
                            Gt1.Font = newFont;

                            TypeConverter tc1      = TypeDescriptor.GetConverter(typeof(Color));
                            Color         newColor = (Color)tc1.ConvertFromString(objDataSet.Tables["Color_Font_Set"].Rows[14]["promp"].ToString());
                            Gt1.ForeColor = newColor;
                        }
                    }
                }
                if (ct.GetType() == typeof(Button))
                {
                    TypeConverter tc      = TypeDescriptor.GetConverter(typeof(Font));
                    Font          newFont = (Font)tc.ConvertFromString(objDataSet.Tables["Color_Font_Set"].Rows[13]["promp"].ToString());
                    ct.Font = newFont;

                    TypeConverter tc1      = TypeDescriptor.GetConverter(typeof(Color));
                    Color         newColor = (Color)tc1.ConvertFromString(objDataSet.Tables["Color_Font_Set"].Rows[14]["promp"].ToString());
                    ct.ForeColor = newColor;
                }
            }

            this.BackColor = newColor0;

            objDataSet.Clear();
        }
Exemple #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string file_name;

            saveFileDialog.DefaultExt      = "txt";
            saveFileDialog.Filter          = "Text Format (*.txt) |*.txt";
            saveFileDialog.FilterIndex     = 1;
            saveFileDialog.OverwritePrompt = true;
            saveFileDialog.Title           = "ذخیره فایل";

            database.Connection_Open();
            database.Fill("SELECT * FROM Tbl_process INNER JOIN tbl_personel ON Tbl_process.idgroup = tbl_personel.idgroup AND Tbl_process.idyear = tbl_personel.idyear AND Tbl_process.idmoon = tbl_personel.idmoon AND Tbl_process.idpersonal = tbl_personel.tmpid AND Tbl_process.type1 = 2", objDataSet, "Tbl_process", true);
            database.Connection_Close();

            database.Connection_Open();
            database.Fill("SELECT * FROM Tab_Shrkat WHERE (tmpid=" + id_group + ")", objDataSet, "Tab_Shrkat", true);
            database.Connection_Close();

            string[] installs = new string[(objDataSet.Tables["Tbl_process"].Rows.Count + 1)];

            installs[0]  = objDataSet.Tables["Tab_Shrkat"].Rows[0]["sh_parvande"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["kod_shobe"].ToString();
            installs[0] += "," + id_year;
            installs[0] += "," + id_moon;
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["noeasliepardakhtkonande"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["noefareiepardakhtkonande"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["pardakht_name"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["pardakht_family"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["pardakht_codemelli"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["idposti"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["phone"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["address"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["emza1_name"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["emza1_family"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["emza1_codemelli"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["emza1_semat"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["kod_shobe"].ToString();
            installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["kod_shobe"].ToString();
            installs[0] += ",";
            installs[0] += ",";
            installs[0] += ",";
            installs[0] += "";

            for (int q = 1; q <= objDataSet.Tables["Tbl_process"].Rows.Count; q++)
            {
                installs[q]  = objDataSet.Tables["Tbl_process"].Rows[q - 1]["cod_mely"].ToString();
                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["name"].ToString();
                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["family"].ToString();
                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["name_pedar"].ToString();
                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["noe_garardad"].ToString();
                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["code_posti"].ToString();

                database.Connection_Open();
                database.Fill("SELECT * FROM Maliat_coding WHERE (MCode = 2) AND (SCode = " + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_onvanShoghl"].ToString() + ")", objDataSet, "maliat_onvanShoghl", true);
                database.Connection_Close();
                installs[q] += "," + objDataSet.Tables["maliat_onvanShoghl"].Rows[q - 1]["SDesc"].ToString();
                objDataSet.Tables["maliat_onvanShoghl"].Clear();

                //installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["family"].ToString();

                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_madrak"].ToString();
                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_rasteshoghli"].ToString();
                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["code_moafiat_maliat"].ToString();
                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_meliat"].ToString();

                database.Connection_Open();
                database.Fill("SELECT * FROM Maliat_coding WHERE (MCode = 12) AND (SCode = " + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_namekeshvar"].ToString() + ")", objDataSet, "maliat_namekeshvar", true);
                database.Connection_Close();
                installs[q] += "," + objDataSet.Tables["maliat_namekeshvar"].Rows[q - 1]["SDesc"].ToString();
                objDataSet.Tables["maliat_namekeshvar"].Clear();

                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["noe_bimeh"].ToString();
                installs[q] += ",";
                installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["sh_bimeh"].ToString();

                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
                installs[q] += ",0";
            }

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                file_name = saveFileDialog.FileName;
                System.IO.File.WriteAllLines(file_name, installs, Encoding.Unicode);
            }

            objDataSet.Tables["Tbl_process"].Clear();
        }
Exemple #17
0
        private void Form17_Load(object sender, EventArgs e)
        {
            Form_sec();

            string file_name = Application.StartupPath.ToString();

            file_name += @"\Pey4_BG.Dll";

            string[] installs = new string[1];
            installs = System.IO.File.ReadAllLines(file_name, Encoding.ASCII);

            if (File.Exists(installs[0]) == true)
            {
                if (installs[0] != "")
                {
                    if (Directory.Exists(installs[0]) == false)
                    {
                        pictureBox1.Image = Image.FromFile(installs[0]);
                    }
                }
            }

            DataBase.Connection_Open();
            DataBase.Fill("SELECT * FROM Tab_Shrkat ORDER BY tmpid ASC", objDataSet, "Tab_Shrkat", true);
            DataBase.Connection_Close();

            comboBox3.Items.Clear();
            comboBox3.DataSource    = objDataSet.Tables["Tab_Shrkat"];
            comboBox3.DisplayMember = "Groupname";
            comboBox3.ValueMember   = "tmpid";

            if (objDataSet.Tables["Tab_Shrkat"].Rows.Count > 0)
            {
                comboBox3.SelectedIndex = 0;
                call_comboBox3_SelectedIndexChanged();

                PersianCalendar persian = new PersianCalendar();
                if (comboBox2.Items.Count > 0)
                {
                    int y = persian.GetYear(DateTime.Now);

                    for (int q = 0; q <= comboBox2.Items.Count - 1; q++)
                    {
                        comboBox2.SelectedIndex = q;
                        if (comboBox2.Text == y.ToString())
                        {
                            break;
                        }
                    }
                }

                int m = persian.GetMonth(DateTime.Now);
                comboBox1.SelectedIndex = m - 1;
            }
            else
            {
                اطلاعاتپرسنلToolStripMenuItem.Visible      = false;
                ورودکارکردازاکسلToolStripMenuItem1.Visible = false;
                پرداختکنندهحقوقToolStripMenuItem.Visible   = false;
                روشهایمحاسبهToolStripMenuItem.Visible      = false;
            }
        }
Exemple #18
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (maskedTextBox5.ToString().IndexOf("_").ToString() != "-1")
            {
                MessageBox.Show("لطفا فیلد تاریخ ثبت روزنامه را تکمیل نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                maskedTextBox5.Focus();
                return;
            }

            button2.Enabled = false;

            string file_name = @"DD.dll";

            string[] installs = new string[1];
            installs[0] = maskedTextBox5.Text;
            System.IO.File.WriteAllLines(file_name, installs, Encoding.Unicode);

            SqlCommand objCommand = new SqlCommand();

            objCommand.Connection  = objConnection;
            objCommand.CommandText = "DELETE FROM loan_view WHERE (idgroup=" + id_group + ") AND (idyear=" + id_year + ") AND (idmoon=" + id_moon + ")";
            objCommand.CommandType = CommandType.Text;
            objConnection.Open();
            objCommand.ExecuteNonQuery();
            objConnection.Close();

            database.Connection_Open();
            database.Fill("SELECT * FROM tbl_personel WHERE (idgroup=" + id_group + ") AND (idyear=" + id_year + ") AND (idmoon=" + id_moon + ") ORDER BY tmpid", objDataSet, "tbl_personel", true);
            database.Connection_Close();

            if (objDataSet.Tables["tbl_personel"].Rows.Count > 0)
            {
                progressBar1.Minimum = 0;
                progressBar1.Maximum = objDataSet.Tables["tbl_personel"].Rows.Count - 1;

                string amin = id_year + "/" + id_moon.ToString().PadLeft(2, '0');

                for (int q = 0; q <= objDataSet.Tables["tbl_personel"].Rows.Count - 1; q++)
                {
                    progressBar1.Value = q;

                    //وام
                    string vamt1 = "0";
                    string vamt2 = "0";
                    string vamt3 = "0";

                    database1.Connection_Open();
                    database1.Fill("SELECT a.tmpid, a.loan_price, a.loan_payment_date, a.receiver, b.tmpid AS Expr1, b.loan_code AS Expr2, b.payment_date, b.payment_price, b.payment_status AS Expr3 FROM tbl_loan AS a INNER JOIN tbl_loan_payment AS b ON a.tmpid = b.loan_code WHERE (LEFT(b.payment_date,7) = '" + amin + "') AND (a.receiver = " + objDataSet.Tables["tbl_personel"].Rows[q]["code"].ToString() + ")", objDataSet, "vam", true);
                    database1.Connection_Close();

                    if (objDataSet.Tables["vam"].Rows.Count > 0)
                    {
                        if (objDataSet.Tables["vam"].Rows.Count >= 1)
                        {
                            vamt1 = objDataSet.Tables["vam"].Rows[0]["payment_price"].ToString();

                            SqlCommand objCommand1 = new SqlCommand();
                            objCommand1.Connection  = objConnection;
                            objCommand1.CommandText = "UPDATE tbl_loan_payment SET [payment_status]=1 WHERE tmpid=" + objDataSet.Tables["vam"].Rows[0]["Expr1"].ToString();
                            objCommand1.CommandType = CommandType.Text;
                            objConnection.Open();
                            objCommand1.ExecuteNonQuery();
                            objConnection.Close();
                        }

                        if (objDataSet.Tables["vam"].Rows.Count >= 2)
                        {
                            vamt2 = objDataSet.Tables["vam"].Rows[1]["payment_price"].ToString();

                            SqlCommand objCommand1 = new SqlCommand();
                            objCommand1.Connection  = objConnection;
                            objCommand1.CommandText = "UPDATE tbl_loan_payment SET [payment_status]=1 WHERE tmpid=" + objDataSet.Tables["vam"].Rows[1]["Expr1"].ToString();
                            objCommand1.CommandType = CommandType.Text;
                            objConnection.Open();
                            objCommand1.ExecuteNonQuery();
                            objConnection.Close();
                        }

                        if (objDataSet.Tables["vam"].Rows.Count >= 3)
                        {
                            vamt3 = objDataSet.Tables["vam"].Rows[2]["payment_price"].ToString();

                            SqlCommand objCommand1 = new SqlCommand();
                            objCommand1.Connection  = objConnection;
                            objCommand1.CommandText = "UPDATE tbl_loan_payment SET [payment_status]=1 WHERE tmpid=" + objDataSet.Tables["vam"].Rows[2]["Expr1"].ToString();
                            objCommand1.CommandType = CommandType.Text;
                            objConnection.Open();
                            objCommand1.ExecuteNonQuery();
                            objConnection.Close();
                        }
                    }

                    SqlCommand objCommand2 = new SqlCommand();
                    objCommand2.Connection  = objConnection;
                    objCommand2.CommandText = "INSERT INTO loan_view (tmpid,idgroup,idyear,idmoon,vam1,vam2,vam3) VALUES (@tmpid,@idgroup,@idyear,@idmoon,@vam1,@vam2,@vam3)";
                    objCommand2.CommandType = CommandType.Text;
                    objCommand2.Parameters.AddWithValue("@tmpid", objDataSet.Tables["tbl_personel"].Rows[q]["tmpid"].ToString());
                    objCommand2.Parameters.AddWithValue("@idgroup", id_group);
                    objCommand2.Parameters.AddWithValue("@idyear", id_year);
                    objCommand2.Parameters.AddWithValue("@idmoon", id_moon);
                    objCommand2.Parameters.AddWithValue("@vam1", vamt1);
                    objCommand2.Parameters.AddWithValue("@vam2", vamt2);
                    objCommand2.Parameters.AddWithValue("@vam3", vamt3);
                    objConnection.Open();
                    objCommand2.ExecuteNonQuery();
                    objConnection.Close();

                    //مالیات
                    database1.Connection_Open();
                    database1.Fill("SELECT * FROM View_calc_maliat WHERE (tmpid=" + objDataSet.Tables["tbl_personel"].Rows[q]["tmpid"].ToString() + ")", objDataSet, "View1_Process_1_Maliat", true);
                    database1.Connection_Close();

                    database1.Connection_Open();
                    database1.Fill("SELECT * FROM Tbl_maliat ORDER BY maliat_az", objDataSet, "Maliat", true);
                    database1.Connection_Close();

                    int    w;
                    Double maliat1 = 0;
                    Double maliat2 = 0;
                    Double maliat3 = 0;

                    if (objDataSet.Tables["Maliat"].Rows.Count > 0)
                    {
                        for (w = objDataSet.Tables["Maliat"].Rows.Count - 1; w >= 0; w--)
                        {
                            //MessageBox.Show(Convert.ToInt64(objDataSet.Tables["View1_Process_1_Maliat"].Rows[0]["SUM_MASHMOL_MALIAT"]).ToString());
                            if ((Convert.ToInt64(objDataSet.Tables["View1_Process_1_Maliat"].Rows[0]["SUM_MASHMOL_MALIAT"]) >= Convert.ToInt64(objDataSet.Tables["Maliat"].Rows[w]["maliat_az"])) && (Convert.ToInt64(objDataSet.Tables["View1_Process_1_Maliat"].Rows[0]["SUM_MASHMOL_MALIAT"]) <= Convert.ToInt64(objDataSet.Tables["Maliat"].Rows[w]["maliat_ta"])))
                            {
                                //مالیات
                                maliat1 = Convert.ToDouble(objDataSet.Tables["View1_Process_1_Maliat"].Rows[0]["SUM_MASHMOL_MALIAT"]);

                                Double q1 = Convert.ToInt64(objDataSet.Tables["Maliat"].Rows[w]["maliat_az"]);
                                Double q2 = maliat1;

                                maliat2  = q2 - q1;
                                maliat3 += (maliat2 * Convert.ToInt64(objDataSet.Tables["Maliat"].Rows[w]["nerkh"])) / 100;

                                for (int f = (w - 1); f >= 0; f--)
                                {
                                    q1 = Convert.ToInt64(objDataSet.Tables["Maliat"].Rows[f]["maliat_az"]);
                                    q2 = Convert.ToInt64(objDataSet.Tables["Maliat"].Rows[f]["maliat_ta"]);

                                    maliat2  = q2 - q1;
                                    maliat3 += (maliat2 * Convert.ToInt64(objDataSet.Tables["Maliat"].Rows[f]["nerkh"])) / 100;
                                }
                                break;
                            }
                        }
                    }

                    SqlCommand objCommand3 = new SqlCommand();
                    objCommand3.Connection  = objConnection;
                    objCommand3.CommandText = "UPDATE loan_view SET view_maliat=@view_maliat WHERE tmpid = " + objDataSet.Tables["tbl_personel"].Rows[q]["tmpid"].ToString();
                    objCommand3.CommandType = CommandType.Text;
                    objCommand3.Parameters.AddWithValue("@view_maliat", Math.Round(maliat3));
                    objConnection.Open();
                    objCommand3.ExecuteNonQuery();
                    objConnection.Close();

                    objDataSet.Tables["vam"].Clear();
                    objDataSet.Tables["Maliat"].Clear();
                    objDataSet.Tables["View1_Process_1_Maliat"].Clear();
                }
            }

            //ثبت قانونی

            objDataSet.Tables.Remove("View1_Process_2");

            database.Connection_Open();
            database.Fill("SELECT * FROM View1_Process_2 WHERE ((idgroup=" + id_group + ") AND (idyear=" + id_year + ") AND (idmoon=" + id_moon + ") AND (type1=2))", objDataSet, "View1_Process_2", true);
            database.Connection_Close();

            SqlCommand objCommand10 = new SqlCommand();

            objCommand10.Connection  = objConnection;
            objCommand10.CommandText = "DELETE FROM Tbl_process WHERE (idgroup=" + id_group + ") AND (idyear=" + id_year + ") AND (idmoon=" + id_moon + ")";
            objCommand10.CommandType = CommandType.Text;
            objConnection.Open();
            objCommand10.ExecuteNonQuery();
            objConnection.Close();

            if (objDataSet.Tables["View1_Process_2"].Rows.Count > 0)
            {
                progressBar1.Minimum = 0;
                progressBar1.Maximum = objDataSet.Tables["View1_Process_2"].Rows.Count - 1;

                for (int q = 0; q <= objDataSet.Tables["View1_Process_2"].Rows.Count - 1; q++)
                {
                    progressBar1.Value = q;

                    SqlCommand objCommand2 = new SqlCommand();
                    objCommand2.Connection  = objConnection;
                    objCommand2.CommandText = "INSERT INTO Tbl_process (idgroup,idyear,idmoon,idpersonal,w1,w2,w3,w4,w5,w6,vam1,vam2,vam3,SUM_hogogh_mazaya,SUM_MASHMOL_BIMEH,Haghe_bime_personal,moafiat_Haghe_bime_personal,Haghe_bime_bikari,moafiat_Haghe_bime_bikari,Haghe_bime_karfarma,moafiat_Haghe_bime_karfarma,SUM_MASHMOL_MALIAT,moafiat_MASHMOL_MALIAT,view_maliat,ALL_kosorat,Khales,type1,wt1,wt2,wt3,wt4,wt5,wt6,SUM_mazaya,bime2,SUM_mazaya_maliat) VALUES (@idgroup,@idyear,@idmoon,@idpersonal,@w1,@w2,@w3,@w4,@w5,@w6,@vam1,@vam2,@vam3,@SUM_hogogh_mazaya,@SUM_MASHMOL_BIMEH,@Haghe_bime_personal,@moafiat_Haghe_bime_personal,@Haghe_bime_bikari,@moafiat_Haghe_bime_bikari,@Haghe_bime_karfarma,@moafiat_Haghe_bime_karfarma,@SUM_MASHMOL_MALIAT,@moafiat_MASHMOL_MALIAT,@view_maliat,@ALL_kosorat,@Khales,@type1,@wt1,@wt2,@wt3,@wt4,@wt5,@wt6,@SUM_mazaya,@bime2,@SUM_mazaya_maliat)";
                    objCommand2.CommandType = CommandType.Text;
                    objCommand2.Parameters.AddWithValue("@idgroup", objDataSet.Tables["View1_Process_2"].Rows[q]["idgroup"].ToString());
                    objCommand2.Parameters.AddWithValue("@idyear", objDataSet.Tables["View1_Process_2"].Rows[q]["idyear"].ToString());
                    objCommand2.Parameters.AddWithValue("@idmoon", objDataSet.Tables["View1_Process_2"].Rows[q]["idmoon"].ToString());
                    objCommand2.Parameters.AddWithValue("@idpersonal", objDataSet.Tables["View1_Process_2"].Rows[q]["tmpid"].ToString());

                    objCommand2.Parameters.AddWithValue("@w1", objDataSet.Tables["View1_Process_2"].Rows[q]["w1"].ToString());
                    objCommand2.Parameters.AddWithValue("@w2", objDataSet.Tables["View1_Process_2"].Rows[q]["w2"].ToString());
                    objCommand2.Parameters.AddWithValue("@w3", objDataSet.Tables["View1_Process_2"].Rows[q]["w3"].ToString());
                    objCommand2.Parameters.AddWithValue("@w4", objDataSet.Tables["View1_Process_2"].Rows[q]["w4"].ToString());
                    objCommand2.Parameters.AddWithValue("@w5", objDataSet.Tables["View1_Process_2"].Rows[q]["w5"].ToString());
                    objCommand2.Parameters.AddWithValue("@w6", objDataSet.Tables["View1_Process_2"].Rows[q]["w6"].ToString());

                    objCommand2.Parameters.AddWithValue("@vam1", objDataSet.Tables["View1_Process_2"].Rows[q]["vam1"].ToString());
                    objCommand2.Parameters.AddWithValue("@vam2", objDataSet.Tables["View1_Process_2"].Rows[q]["vam2"].ToString());
                    objCommand2.Parameters.AddWithValue("@vam3", objDataSet.Tables["View1_Process_2"].Rows[q]["vam3"].ToString());

                    objCommand2.Parameters.AddWithValue("@SUM_hogogh_mazaya", objDataSet.Tables["View1_Process_2"].Rows[q]["SUM_hogogh_mazaya"].ToString());
                    objCommand2.Parameters.AddWithValue("@SUM_MASHMOL_BIMEH", objDataSet.Tables["View1_Process_2"].Rows[q]["SUM_MASHMOL_BIMEH"].ToString());
                    objCommand2.Parameters.AddWithValue("@Haghe_bime_personal", objDataSet.Tables["View1_Process_2"].Rows[q]["Haghe_bime_personal"].ToString());
                    objCommand2.Parameters.AddWithValue("@moafiat_Haghe_bime_personal", objDataSet.Tables["View1_Process_2"].Rows[q]["moafiat_Haghe_bime_personal"].ToString());
                    objCommand2.Parameters.AddWithValue("@Haghe_bime_bikari", objDataSet.Tables["View1_Process_2"].Rows[q]["Haghe_bime_bikari"].ToString());
                    objCommand2.Parameters.AddWithValue("@moafiat_Haghe_bime_bikari", objDataSet.Tables["View1_Process_2"].Rows[q]["moafiat_Haghe_bime_bikari"].ToString());
                    objCommand2.Parameters.AddWithValue("@Haghe_bime_karfarma", objDataSet.Tables["View1_Process_2"].Rows[q]["Haghe_bime_karfarma"].ToString());
                    objCommand2.Parameters.AddWithValue("@moafiat_Haghe_bime_karfarma", objDataSet.Tables["View1_Process_2"].Rows[q]["moafiat_Haghe_bime_karfarma"].ToString());
                    objCommand2.Parameters.AddWithValue("@SUM_MASHMOL_MALIAT", objDataSet.Tables["View1_Process_2"].Rows[q]["SUM_MASHMOL_MALIAT"].ToString());
                    objCommand2.Parameters.AddWithValue("@moafiat_MASHMOL_MALIAT", objDataSet.Tables["View1_Process_2"].Rows[q]["moafiat_MASHMOL_MALIAT"].ToString());
                    objCommand2.Parameters.AddWithValue("@view_maliat", objDataSet.Tables["View1_Process_2"].Rows[q]["view_maliat"].ToString());
                    objCommand2.Parameters.AddWithValue("@ALL_kosorat", objDataSet.Tables["View1_Process_2"].Rows[q]["ALL_kosorat"].ToString());
                    objCommand2.Parameters.AddWithValue("@Khales", objDataSet.Tables["View1_Process_2"].Rows[q]["Khales"].ToString());
                    objCommand2.Parameters.AddWithValue("@type1", objDataSet.Tables["View1_Process_2"].Rows[q]["type1"].ToString());

                    objCommand2.Parameters.AddWithValue("@wt1", "کل روزهای کارکرد");
                    objCommand2.Parameters.AddWithValue("@wt2", "روزهای کارکرد");
                    objCommand2.Parameters.AddWithValue("@wt3", "حقوق روزانه");
                    objCommand2.Parameters.AddWithValue("@wt4", "حقوق ماهانه");
                    objCommand2.Parameters.AddWithValue("@wt5", "اضافه کار عادی");
                    objCommand2.Parameters.AddWithValue("@wt6", "اضافه کار تعطیلی");

                    objCommand2.Parameters.AddWithValue("@SUM_mazaya", objDataSet.Tables["View1_Process_2"].Rows[q]["SUM_mazaya"].ToString());
                    objCommand2.Parameters.AddWithValue("@bime2", objDataSet.Tables["View1_Process_2"].Rows[q]["bime2"].ToString());
                    objCommand2.Parameters.AddWithValue("@SUM_mazaya_maliat", objDataSet.Tables["View1_Process_2"].Rows[q]["SUM_mazaya_maliat"].ToString());
                    objConnection.Open();
                    objCommand2.ExecuteNonQuery();
                    objConnection.Close();
                }
            }

            //توافقی
            objDataSet.Tables.Remove("View_Process_2");

            database.Connection_Open();
            database.Fill("SELECT * FROM View_Process_2 WHERE ((idgroup=" + id_group + ") AND (idyear=" + id_year + ") AND (idmoon=" + id_moon + ") AND (type1=1))", objDataSet, "View_Process_2", true);
            database.Connection_Close();

            //ثبت
            if (objDataSet.Tables["View_Process_2"].Rows.Count > 0)
            {
                progressBar1.Minimum = 0;
                progressBar1.Maximum = objDataSet.Tables["View_Process_2"].Rows.Count - 1;

                for (int q = 0; q <= objDataSet.Tables["View_Process_2"].Rows.Count - 1; q++)
                {
                    progressBar1.Value = q;

                    SqlCommand objCommand2 = new SqlCommand();
                    objCommand2.Connection  = objConnection;
                    objCommand2.CommandText = "INSERT INTO Tbl_process (idgroup,idyear,idmoon,idpersonal,w1,w2,w3,w4,w5,w6,vam1,vam2,vam3,SUM_hogogh_mazaya,SUM_MASHMOL_BIMEH,Haghe_bime_personal,moafiat_Haghe_bime_personal,Haghe_bime_bikari,moafiat_Haghe_bime_bikari,Haghe_bime_karfarma,moafiat_Haghe_bime_karfarma,SUM_MASHMOL_MALIAT,moafiat_MASHMOL_MALIAT,view_maliat,ALL_kosorat,Khales,type1,wt1,wt2,wt3,wt4,wt5,wt6,SUM_mazaya,bime2,SUM_mazaya_maliat) VALUES (@idgroup,@idyear,@idmoon,@idpersonal,@w1,@w2,@w3,@w4,@w5,@w6,@vam1,@vam2,@vam3,@SUM_hogogh_mazaya,@SUM_MASHMOL_BIMEH,@Haghe_bime_personal,@moafiat_Haghe_bime_personal,@Haghe_bime_bikari,@moafiat_Haghe_bime_bikari,@Haghe_bime_karfarma,@moafiat_Haghe_bime_karfarma,@SUM_MASHMOL_MALIAT,@moafiat_MASHMOL_MALIAT,@view_maliat,@ALL_kosorat,@Khales,@type1,@wt1,@wt2,@wt3,@wt4,@wt5,@wt6,@SUM_mazaya,@bime2,@SUM_mazaya_maliat)";
                    objCommand2.CommandType = CommandType.Text;
                    objCommand2.Parameters.AddWithValue("@idgroup", objDataSet.Tables["View_Process_2"].Rows[q]["idgroup"].ToString());
                    objCommand2.Parameters.AddWithValue("@idyear", objDataSet.Tables["View_Process_2"].Rows[q]["idyear"].ToString());
                    objCommand2.Parameters.AddWithValue("@idmoon", objDataSet.Tables["View_Process_2"].Rows[q]["idmoon"].ToString());
                    objCommand2.Parameters.AddWithValue("@idpersonal", objDataSet.Tables["View_Process_2"].Rows[q]["tmpid"].ToString());

                    objCommand2.Parameters.AddWithValue("@w1", objDataSet.Tables["View_Process_2"].Rows[q]["w1"].ToString());
                    objCommand2.Parameters.AddWithValue("@w2", objDataSet.Tables["View_Process_2"].Rows[q]["w2"].ToString());
                    objCommand2.Parameters.AddWithValue("@w3", objDataSet.Tables["View_Process_2"].Rows[q]["w3"].ToString());
                    objCommand2.Parameters.AddWithValue("@w4", objDataSet.Tables["View_Process_2"].Rows[q]["w4"].ToString());
                    objCommand2.Parameters.AddWithValue("@w5", objDataSet.Tables["View_Process_2"].Rows[q]["w5"].ToString());
                    objCommand2.Parameters.AddWithValue("@w6", objDataSet.Tables["View_Process_2"].Rows[q]["w6"].ToString());

                    objCommand2.Parameters.AddWithValue("@vam1", objDataSet.Tables["View_Process_2"].Rows[q]["vam1"].ToString());
                    objCommand2.Parameters.AddWithValue("@vam2", objDataSet.Tables["View_Process_2"].Rows[q]["vam2"].ToString());
                    objCommand2.Parameters.AddWithValue("@vam3", objDataSet.Tables["View_Process_2"].Rows[q]["vam3"].ToString());

                    objCommand2.Parameters.AddWithValue("@SUM_hogogh_mazaya", objDataSet.Tables["View_Process_2"].Rows[q]["SUM_hogogh_mazaya"].ToString());
                    objCommand2.Parameters.AddWithValue("@SUM_MASHMOL_BIMEH", objDataSet.Tables["View_Process_2"].Rows[q]["SUM_MASHMOL_BIMEH"].ToString());
                    objCommand2.Parameters.AddWithValue("@Haghe_bime_personal", objDataSet.Tables["View_Process_2"].Rows[q]["Haghe_bime_personal"].ToString());
                    objCommand2.Parameters.AddWithValue("@moafiat_Haghe_bime_personal", objDataSet.Tables["View_Process_2"].Rows[q]["moafiat_Haghe_bime_personal"].ToString());
                    objCommand2.Parameters.AddWithValue("@Haghe_bime_bikari", objDataSet.Tables["View_Process_2"].Rows[q]["Haghe_bime_bikari"].ToString());
                    objCommand2.Parameters.AddWithValue("@moafiat_Haghe_bime_bikari", objDataSet.Tables["View_Process_2"].Rows[q]["moafiat_Haghe_bime_bikari"].ToString());
                    objCommand2.Parameters.AddWithValue("@Haghe_bime_karfarma", objDataSet.Tables["View_Process_2"].Rows[q]["Haghe_bime_karfarma"].ToString());
                    objCommand2.Parameters.AddWithValue("@moafiat_Haghe_bime_karfarma", objDataSet.Tables["View_Process_2"].Rows[q]["moafiat_Haghe_bime_karfarma"].ToString());
                    objCommand2.Parameters.AddWithValue("@SUM_MASHMOL_MALIAT", objDataSet.Tables["View_Process_2"].Rows[q]["SUM_MASHMOL_MALIAT"].ToString());
                    objCommand2.Parameters.AddWithValue("@moafiat_MASHMOL_MALIAT", objDataSet.Tables["View_Process_2"].Rows[q]["moafiat_MASHMOL_MALIAT"].ToString());
                    objCommand2.Parameters.AddWithValue("@view_maliat", objDataSet.Tables["View_Process_2"].Rows[q]["view_maliat"].ToString());
                    objCommand2.Parameters.AddWithValue("@ALL_kosorat", objDataSet.Tables["View_Process_2"].Rows[q]["ALL_kosorat"].ToString());
                    objCommand2.Parameters.AddWithValue("@Khales", objDataSet.Tables["View_Process_2"].Rows[q]["Khales"].ToString());
                    objCommand2.Parameters.AddWithValue("@type1", objDataSet.Tables["View_Process_2"].Rows[q]["type1"].ToString());

                    objCommand2.Parameters.AddWithValue("@wt1", "کل روزهای کارکرد");
                    objCommand2.Parameters.AddWithValue("@wt2", "روزهای کارکرد");
                    objCommand2.Parameters.AddWithValue("@wt3", "حقوق روزانه");
                    objCommand2.Parameters.AddWithValue("@wt4", "حقوق ماهانه");
                    objCommand2.Parameters.AddWithValue("@wt5", "اضافه کار عادی");
                    objCommand2.Parameters.AddWithValue("@wt6", "اضافه کار تعطیلی");

                    objCommand2.Parameters.AddWithValue("@SUM_mazaya", objDataSet.Tables["View_Process_2"].Rows[q]["SUM_mazaya"].ToString());
                    objCommand2.Parameters.AddWithValue("@bime2", objDataSet.Tables["View_Process_2"].Rows[q]["bime2"].ToString());
                    objCommand2.Parameters.AddWithValue("@SUM_mazaya_maliat", objDataSet.Tables["View_Process_2"].Rows[q]["SUM_mazaya_maliat"].ToString());

                    objConnection.Open();
                    objCommand2.ExecuteNonQuery();
                    objConnection.Close();
                }
            }
            MessageBox.Show("ثبت انجام شد", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            button2.Enabled = true;
            this.Hide();
        }
Exemple #19
0
        public void Form_Load_set_color()
        {
            DataSet objDataSet1 = new DataSet();

            Database.Connection_Open();
            Database.Fill("SELECT * FROM Color_Font_Set ORDER BY tmpid", objDataSet1, "Color_Font_Set", true);
            Database.Connection_Close();

            TypeConverter tc0       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor0 = (Color)tc0.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[6]["promp"].ToString());

            foreach (SplitContainer spc in this.Controls)
            {
                foreach (Control ct in spc.Panel2.Controls)
                {
                    if (ct.GetType() == typeof(Button))
                    {
                        TypeConverter tc      = TypeDescriptor.GetConverter(typeof(Font));
                        Font          newFont = (Font)tc.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[13]["promp"].ToString());
                        ct.Font = newFont;

                        TypeConverter tc1      = TypeDescriptor.GetConverter(typeof(Color));
                        Color         newColor = (Color)tc1.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[14]["promp"].ToString());
                        ct.ForeColor = newColor;
                    }
                }
            }
            this.BackColor = newColor0;

            TypeConverter tc2      = TypeDescriptor.GetConverter(typeof(Font));
            Font          newFont2 = (Font)tc2.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[2]["promp"].ToString());

            TypeConverter tc3       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor3 = (Color)tc3.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[8]["promp"].ToString());

            TypeConverter tc7      = TypeDescriptor.GetConverter(typeof(Font));
            Font          newFont7 = (Font)tc7.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[7]["promp"].ToString());

            TypeConverter tc8       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor8 = (Color)tc8.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[8]["promp"].ToString());

            TypeConverter tc9       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor9 = (Color)tc9.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[9]["promp"].ToString());

            TypeConverter tc10       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor10 = (Color)tc10.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[10]["promp"].ToString());

            TypeConverter tc11       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor11 = (Color)tc11.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[11]["promp"].ToString());

            TypeConverter tc12       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor12 = (Color)tc12.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[12]["promp"].ToString());

            DataGridViewCellStyle objAlignRightCellStyle1 = new DataGridViewCellStyle();

            objAlignRightCellStyle1.Font      = newFont2;
            objAlignRightCellStyle1.BackColor = newColor3;

            DataGridViewCellStyle objAlignRightCellStyle2 = new DataGridViewCellStyle();

            objAlignRightCellStyle2.BackColor = newColor9;
            objAlignRightCellStyle2.ForeColor = newColor10;

            DataGridViewCellStyle objAlignRightCellStyle3 = new DataGridViewCellStyle();

            objAlignRightCellStyle3.BackColor = newColor11;
            objAlignRightCellStyle3.ForeColor = newColor12;

            dataGridView1.Font            = newFont7;
            dataGridView1.BackgroundColor = newColor8;
            dataGridView1.ColumnHeadersDefaultCellStyle   = objAlignRightCellStyle1;
            dataGridView1.AlternatingRowsDefaultCellStyle = objAlignRightCellStyle2;
            dataGridView1.DefaultCellStyle = objAlignRightCellStyle3;

            objDataSet1.Clear();
        }
Exemple #20
0
        private void Form24_Load(object sender, EventArgs e)
        {
            DataBase.Connection_Open();
            DataBase.Fill("SELECT * FROM Tab_Shrkat ORDER BY tmpid ASC", objDataSet, "Tab_Shrkat1", true);
            DataBase.Connection_Close();

            comboBox3.Items.Clear();
            comboBox3.DataSource    = objDataSet.Tables["Tab_Shrkat1"];
            comboBox3.DisplayMember = "Groupname";
            comboBox3.ValueMember   = "tmpid";

            if (objDataSet.Tables["Tab_Shrkat1"].Rows.Count > 0)
            {
                comboBox3.SelectedIndex = 0;
                call_comboBox3_SelectedIndexChanged();

                PersianCalendar persian = new PersianCalendar();
                if (comboBox2.Items.Count > 0)
                {
                    int y = persian.GetYear(DateTime.Now);

                    for (int q = 0; q <= comboBox2.Items.Count - 1; q++)
                    {
                        comboBox2.SelectedIndex = q;
                        if (comboBox2.Text == y.ToString())
                        {
                            break;
                        }
                    }
                }

                int m = persian.GetMonth(DateTime.Now);
                comboBox1.SelectedIndex = m - 1;
            }

            DataBase.Connection_Open();
            DataBase.Fill("SELECT * FROM Tab_Shrkat ORDER BY tmpid ASC", objDataSet, "Tab_Shrkat2", true);
            DataBase.Connection_Close();

            comboBox6.Items.Clear();
            comboBox6.DataSource    = objDataSet.Tables["Tab_Shrkat2"];
            comboBox6.DisplayMember = "Groupname";
            comboBox6.ValueMember   = "tmpid";

            if (objDataSet.Tables["Tab_Shrkat2"].Rows.Count > 0)
            {
                comboBox6.SelectedIndex = 0;
                call_comboBox6_SelectedIndexChanged();

                PersianCalendar persian = new PersianCalendar();
                if (comboBox5.Items.Count > 0)
                {
                    int y = persian.GetYear(DateTime.Now);

                    for (int q = 0; q <= comboBox5.Items.Count - 1; q++)
                    {
                        comboBox5.SelectedIndex = q;
                        if (comboBox5.Text == y.ToString())
                        {
                            break;
                        }
                    }
                }

                int m = persian.GetMonth(DateTime.Now);
                comboBox4.SelectedIndex = m - 1;
            }
        }
Exemple #21
0
        public void Form_Load_set_color()
        {
            DataSet objDataSet1 = new DataSet();

            Database.Connection_Open();
            Database.Fill("SELECT * FROM Color_Font_Set ORDER BY tmpid", objDataSet1, "Color_Font_Set", true);
            Database.Connection_Close();

            TypeConverter tc0       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor0 = (Color)tc0.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[6]["promp"].ToString());

            this.BackColor = newColor0;

            TypeConverter tc2      = TypeDescriptor.GetConverter(typeof(Font));
            Font          newFont2 = (Font)tc2.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[2]["promp"].ToString());

            TypeConverter tc3       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor3 = (Color)tc3.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[8]["promp"].ToString());

            TypeConverter tc7      = TypeDescriptor.GetConverter(typeof(Font));
            Font          newFont7 = (Font)tc7.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[7]["promp"].ToString());

            TypeConverter tc8       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor8 = (Color)tc8.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[8]["promp"].ToString());

            TypeConverter tc9       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor9 = (Color)tc9.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[9]["promp"].ToString());

            TypeConverter tc10       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor10 = (Color)tc10.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[10]["promp"].ToString());

            TypeConverter tc11       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor11 = (Color)tc11.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[11]["promp"].ToString());

            TypeConverter tc12       = TypeDescriptor.GetConverter(typeof(Color));
            Color         newColor12 = (Color)tc12.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[12]["promp"].ToString());

            DataGridViewCellStyle objAlignRightCellStyle1 = new DataGridViewCellStyle();

            objAlignRightCellStyle1.Font      = newFont2;
            objAlignRightCellStyle1.BackColor = newColor3;

            DataGridViewCellStyle objAlignRightCellStyle2 = new DataGridViewCellStyle();

            objAlignRightCellStyle2.BackColor = newColor9;
            objAlignRightCellStyle2.ForeColor = newColor10;

            DataGridViewCellStyle objAlignRightCellStyle3 = new DataGridViewCellStyle();

            objAlignRightCellStyle3.BackColor = newColor11;
            objAlignRightCellStyle3.ForeColor = newColor12;

            dataGridViewZarayeb.Font            = newFont7;
            dataGridViewZarayeb.BackgroundColor = newColor8;
            dataGridViewZarayeb.ColumnHeadersDefaultCellStyle   = objAlignRightCellStyle1;
            dataGridViewZarayeb.AlternatingRowsDefaultCellStyle = objAlignRightCellStyle2;
            dataGridViewZarayeb.DefaultCellStyle = objAlignRightCellStyle3;

            dataGridViewMaliat.Font            = newFont7;
            dataGridViewMaliat.BackgroundColor = newColor8;
            dataGridViewMaliat.ColumnHeadersDefaultCellStyle   = objAlignRightCellStyle1;
            dataGridViewMaliat.AlternatingRowsDefaultCellStyle = objAlignRightCellStyle2;
            dataGridViewMaliat.DefaultCellStyle = objAlignRightCellStyle3;

            dataGridViewMoafiat.Font            = newFont7;
            dataGridViewMoafiat.BackgroundColor = newColor8;
            dataGridViewMoafiat.ColumnHeadersDefaultCellStyle   = objAlignRightCellStyle1;
            dataGridViewMoafiat.AlternatingRowsDefaultCellStyle = objAlignRightCellStyle2;
            dataGridViewMoafiat.DefaultCellStyle = objAlignRightCellStyle3;

            dataGridView1.Font            = newFont7;
            dataGridView1.BackgroundColor = newColor8;
            dataGridView1.ColumnHeadersDefaultCellStyle   = objAlignRightCellStyle1;
            dataGridView1.AlternatingRowsDefaultCellStyle = objAlignRightCellStyle2;
            dataGridView1.DefaultCellStyle = objAlignRightCellStyle3;

            objDataSet1.Clear();
        }
Exemple #22
0
        private void Bind_2_Grid_Good()
        {
            string Qry = "";

            string[] Search_Data;
            string   search = Txt_Search.Text;
            //int i;

            //bool first = true;
            DB_Base fix = new DB_Base();

            if (Txt_Search.Text.Trim() == "")
            {
                FormLoad();
            }
            else
            {
                //Search_Data = fix.FixPersianString(Txt_Search.Text).Split(' ');
                Search_Data = Txt_Search.Text.Split(' ');

                Qry = "SELECT tmpid,selectid,code,name,family,name_pedar,sex,cod_mely,sh_sh FROM tbl_personel WHERE (";

                //for (i = 0; i < Search_Data.Length; i++)
                //{
                //    if (Search_Data[i].Trim() != "")
                //    {
                //        //if (first == false)
                //        //    Qry += "And";
                //        //Qry += "(";
                //        if (Database.Is_Numeric(Search_Data[i]))
                //        {
                //            Qry += "([code] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([cod_mely] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([sh_sh] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([code_posti] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([sh_bimeh] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([sh_hesab] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([tedah_farzand] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([phon_manzel] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([phon_sabt] like '%" + Search_Data[i] + "%')";
                //            Qry += "Or ([sh_kart] like '%" + Search_Data[i] + "%')";
                //        }
                //        else if (Database.Is_Nominal(Search_Data[i]))
                //            search += Search_Data[i];
                //        //first = false;
                //    }
                //}

                Qry += "(code LIKE '%" + search + "%')";
                Qry += " OR (name LIKE '%" + search + "%')";
                Qry += " OR (family LIKE '%" + search + "%')";
                Qry += " OR (name_pedar LIKE '%" + search + "%')";
                Qry += " OR (sex like '%" + search + "%')";
                Qry += " OR (cod_mely like '%" + search + "%')";
                Qry += " OR (sh_sh like '%" + search + "%')";
                Qry += ")";
                Qry += " AND ((idgroup = " + id_group + ") AND (idyear = " + id_year + ") AND (idmoon = " + id_moon + "))";

                //Qry += ")";
                //MessageBox.Show(Qry);

                objDataSet1.Tables["tbl_personel"].Clear();

                Database.Connection_Open();
                Database.Fill(Qry, objDataSet1, "tbl_personel", true);
                Database.Connection_Close();

                grdAuthorTitles.AutoGenerateColumns = true;
                grdAuthorTitles.DataSource          = objDataSet1;
                grdAuthorTitles.DataMember          = "tbl_personel";
            }
        }