Exemplo n.º 1
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            std stdn = new std();

            stdn.stdno = txtstdno.Text;
            if (!stdn.SelectfornameCheck().Equals(txtname.Text))
            {
                MessageBox.Show("نام هنرجو با شماره پرونده مطابقت ندارد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtname.Focus();
                return;
            }


            ghabz gh = new ghabz();

            gh.id        = txtid.Text;
            gh.stdno     = txtstdno.Text;
            gh.name      = txtname.Text.Trim();
            gh.artcourse = txtartcourse.Text.Trim();
            gh.date      = txtdate.Text;
            gh.lastcheck = txtlastcheck.Text;
            gh.lastdate  = txtlastdate.Text;
            gh.mablagh   = long.Parse(txtmablagh.Text);
            gh.paid      = long.Parse(txtpaid.Text);
            gh.sharh     = txtsharh.Text;
            gh.Update();

            if (!stdno.Equals(txtstdno.Text))
            {
                std_history st = new std_history();
                st.ghabz_id = txtid.Text;
                st.stdno    = stdno; // old stdno
                st.Delete();

                pardakht();
                Daryaft();
            }
            else
            {
                std_history sh = new std_history();
                sh.ghabz_id   = txtid.Text;
                sh.stdno      = txtstdno.Text;;
                sh.sharh      = "شهریه " + txtlastcheck.Text + "-" + txtsharh.Text;
                sh.date       = txtdate.Text;
                sh.bedehkari  = long.Parse(txtmablagh.Text);
                sh.bestankari = long.Parse(txtmablagh.Text);
                sh.UpdateAfterEslahGhabz();
            }

            MessageBox.Show("قبض با موفقیت ویرایش گردید");

            this.Close();
        }
Exemplo n.º 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            std_history sh = new std_history();

            sh.stdno = txtstdno.Text;
            DataTable dt = sh.Search("select sum (bedehkari- bestankari) as bedsum from std_history where (stdno=N'" + txtstdno.Text + "' and radif>1)");

            long   sumbed        = 0;
            long   newmandeh     = long.Parse(txtmandeh.Text);
            long   mandehafter   = 0;
            string tashkhisafter = "";

            if (txttashkhis.Text.Equals("بستانکار"))
            {
                newmandeh = -newmandeh;
            }

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["bedsum"].ToString().Trim().Equals("") || dt.Rows[0]["bedsum"].ToString().Trim().Equals("NULL"))
                {
                    sumbed = 0;
                }
                else
                {
                    sumbed = long.Parse(dt.Rows[0]["bedsum"].ToString());
                }

                //sumbed = Math.Abs(sumbed);

                mandehafter = newmandeh - sumbed;

                if (mandehafter >= 0)
                {
                    sh.bestankari = 0;
                    sh.bedehkari  = mandehafter;
                    tashkhisafter = "بدهکار";
                }
                else
                {
                    sh.bedehkari  = 0;
                    sh.bestankari = Math.Abs(mandehafter);
                    tashkhisafter = "بستانکار";
                }

                sh.tashkhis = tashkhisafter;
                sh.mandeh   = Math.Abs(mandehafter);
                sh.UpdateAfterMandehChanged();
            }
            this.Close();
        }
Exemplo n.º 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string position;

            std st = new std();

            st.stdno     = txtstdno.Text.Trim();
            st.reg_date  = txtreg_date.Text;
            st.name      = txtname.Text.Trim();
            st.father    = txtfather.Text.Trim();
            st.idno      = txtidno.Text.Trim();
            st.degree    = txtdegree.Text.Trim();
            st.course    = txtcourse.Text.Trim();
            st.birthdate = txtbirthdate.Text;
            st.job       = txtjob.Text.Trim();
            st.tel       = txttel.Text.Trim();
            st.mob       = txtmob.Text.Trim();
            st.address   = txtaddress.Text.Trim();
            st.resume    = txtresume.Text.Trim();
            st.status    = txtstatus.Text;
            st.hesab     = long.Parse(txthesab.Text);
            st.flag      = flag;
            st.photo     = photo;
            st.Add();


            std_history sickh = new std_history();

            sickh.ghabz_id = "-";
            sickh.sharh    = "مانده اولیه";
            sickh.date     = cur_date;
            sickh.stdno    = txtstdno.Text;
            sickh.tashkhis = txtstatus.Text.Trim();
            sickh.mandeh   = long.Parse(txthesab.Text);
            sickh.Add_firstly();

            FillDataSetAndView();
            BindFields();
            // Set the record position
            // to the one that you saved...
            objCurrencyManager.Position = objCurrencyManager.Count - 1;
            // Show the current record position...
            ShowPosition();
            // Display a message that the record was added...
            toolStripStatusLabel1.Text = "عملیات درج رکورد با موفقیت انجام شد";

            // Save the current record position...
            position = objCurrencyManager.Position.ToString();

            btnNew_Click(null, null);
        }
Exemplo n.º 4
0
        private void Daryaft()
        {
            std_history sh = new std_history();

            // Elame bedehkari
            sh.ghabz_id   = txtid.Text;
            sh.stdno      = txtstdno.Text;;
            sh.sharh      = "پرداخت وجه از بابت شهریه " + txtlastcheck.Text + "-" + txtsharh.Text;
            sh.date       = txtdate.Text;
            sh.bestankari = long.Parse(txtpaid.Text);
            //sh.tashkhis = status_after;
            //sh.mandeh = long.Parse(hesab_after);
            sh.Add();
        }
Exemplo n.º 5
0
        private void pardakht()
        {
            std_history sh = new std_history();

            // Elame bedehkari
            sh.ghabz_id  = txtid.Text;
            sh.stdno     = txtstdno.Text;;
            sh.sharh     = "شهریه " + txtlastcheck.Text + "-" + txtsharh.Text;
            sh.date      = txtdate.Text;
            sh.bedehkari = long.Parse(txtmablagh.Text);
            //sh.tashkhis = status_after;
            //sh.mandeh = long.Parse(hesab_after);
            sh.Add();
        }
Exemplo n.º 6
0
        private void fillHistoryInfo()
        {
            std_history sickh = new std_history();
            DataTable   dt    = new DataTable();

            sickh.stdno = txtstdno.Text;
            dt          = sickh.Select();
            grdDataViewHistory.DataSource = dt;

            grdDataViewHistory.Columns[0].HeaderText = "ردیف";
            grdDataViewHistory.Columns[0].Width      = 50;
            grdDataViewHistory.Columns[1].HeaderText = "کد قبض";
            grdDataViewHistory.Columns[1].Width      = 70;
            grdDataViewHistory.Columns[2].HeaderText = "شماره هنرجو";
            grdDataViewHistory.Columns[2].Width      = 100;
            grdDataViewHistory.Columns[3].HeaderText = "شرح";
            grdDataViewHistory.Columns[3].Width      = 210;
            grdDataViewHistory.Columns[4].HeaderText = "تاریخ";
            grdDataViewHistory.Columns[4].Width      = 70;
            grdDataViewHistory.Columns[5].HeaderText = "بدهکار";
            grdDataViewHistory.Columns[5].Width      = 80;
            grdDataViewHistory.Columns[6].HeaderText = "بستانکار";
            grdDataViewHistory.Columns[6].Width      = 80;
            grdDataViewHistory.Columns[7].HeaderText = "تشخیص";
            grdDataViewHistory.Columns[7].Width      = 80;
            grdDataViewHistory.Columns[8].HeaderText = "مانده";
            grdDataViewHistory.Columns[8].Width      = 80;


            if (grdDataViewHistory.Rows.Count > 0)
            {
                grdDataViewHistory.CurrentCell = grdDataViewHistory.Rows[grdDataViewHistory.Rows.Count - 1].Cells[0];
            }

            DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();

            dataGridViewCellStyle1.BackColor = Color.LightBlue;
            dataGridViewCellStyle1.Font      = new Font("tahoma", 8, FontStyle.Bold);
            dataGridViewCellStyle1.Format    = "N0";
            dataGridViewCellStyle1.NullValue = null;
            grdDataViewHistory.Columns["bedehkari"].DefaultCellStyle  = dataGridViewCellStyle1;
            grdDataViewHistory.Columns["bestankari"].DefaultCellStyle = dataGridViewCellStyle1;
            grdDataViewHistory.Columns["mandeh"].DefaultCellStyle     = dataGridViewCellStyle1;
        }
Exemplo n.º 7
0
        private void btndel_Click_1(object sender, EventArgs e)
        {
            if (grdDataViewer.CurrentRow != null)
            {
                DialogResult dr;
                dr = MessageBox.Show("آیا از حذف این قبض اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (dr == DialogResult.Yes)
                {
                    int    icol = 0;
                    int    irow = grdDataViewer.CurrentRow.Index;
                    string val  = grdDataViewer[icol, irow].Value.ToString();

                    ghabz gha = new ghabz();
                    gha.id = val;
                    gha.Delete();

                    std_history st = new std_history();
                    st.ghabz_id = val;
                    st.stdno    = grdDataViewer["stdno", irow].Value.ToString();
                    st.Delete();

                    if (btnfilter.Enabled == true)
                    {
                        btnfilter.PerformClick();
                    }
                    else
                    {
                        ghabz     pm = new ghabz();
                        DataTable dt = new DataTable();
                        dt = pm.Select();
                        grdDataViewer.DataSource = dt;
                    }
                }
            }
        }
Exemplo n.º 8
0
        private void btnfilter_Click(object sender, EventArgs e)
        {
            try
            {
                Boolean check = false;

                string SQL = "select * from std_history where ";
                check = false;


                if (txtstdno.Text != "")
                {
                    SQL   = SQL + "stdno=N'" + txtstdno.Text.Trim() + "'AND ";
                    check = true;
                }


                if (txtfrom_date.MaskCompleted)
                {
                    SQL   = SQL + "date>=N'" + txtfrom_date.Text.Trim() + "'AND ";
                    check = true;
                }

                if (txttodate.MaskCompleted)
                {
                    SQL   = SQL + "date<=N'" + txttodate.Text.Trim() + "'AND ";
                    check = true;
                }

                if (check == true)
                {
                    SQL = SQL.Remove(SQL.Length - 4);
                }

                std_history sickh = new std_history();
                DataTable   dt    = new DataTable();
                dt = sickh.Search(SQL);

                ///////////////////////////////////////////////////////////////////
                dataGridView1.DataSource = dt;

                dataGridView1.Columns[0].HeaderText = "ردیف";
                dataGridView1.Columns[0].Width      = 50;
                dataGridView1.Columns[1].HeaderText = "کد قبض";
                dataGridView1.Columns[1].Width      = 70;
                dataGridView1.Columns[2].HeaderText = "شماره هنرجو";
                dataGridView1.Columns[2].Width      = 100;
                dataGridView1.Columns[3].HeaderText = "شرح";
                dataGridView1.Columns[3].Width      = 170;
                dataGridView1.Columns[4].HeaderText = "تاریخ";
                dataGridView1.Columns[4].Width      = 70;
                dataGridView1.Columns[5].HeaderText = "بدهکار";
                dataGridView1.Columns[5].Width      = 80;
                dataGridView1.Columns[6].HeaderText = "بستانکار";
                dataGridView1.Columns[6].Width      = 80;
                dataGridView1.Columns[7].HeaderText = "تشخیص";
                dataGridView1.Columns[7].Width      = 80;
                dataGridView1.Columns[8].HeaderText = "مانده";
                dataGridView1.Columns[8].Width      = 80;

                std si = new std();
                si.stdno     = txtstdno.Text;
                txtname.Text = si.Selectforedit().Rows[0]["name"].ToString();

                if (dataGridView1.Rows.Count > 0)
                {
                    dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
                }

                DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
                dataGridViewCellStyle1.BackColor = Color.LightBlue;
                dataGridViewCellStyle1.Font      = new Font("tahoma", 8, FontStyle.Bold);
                dataGridViewCellStyle1.Format    = "N0";
                dataGridViewCellStyle1.NullValue = null;
                dataGridView1.Columns["bedehkari"].DefaultCellStyle  = dataGridViewCellStyle1;
                dataGridView1.Columns["bestankari"].DefaultCellStyle = dataGridViewCellStyle1;
                dataGridView1.Columns["mandeh"].DefaultCellStyle     = dataGridViewCellStyle1;
            }

            catch (Exception)
            {
                MessageBox.Show("اطلاعاتی موجود نمی باشد!!!");
                txtstdno.Text = "";
            }
        }