Пример #1
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);
        }