private void btnNew_Click(object sender, EventArgs e) { foreach (Control c in grpinfo_box.Controls) { if (c.GetType() == typeof(FiveCharTextBox) || c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(DateMaskedTextbox) || c.GetType() == typeof(CellPhoneTextBox) || c.GetType() == typeof(CurrencyTextBox)) { c.Enabled = true; c.Text = ""; } } img_axbox.Image = null; txtreg_date.Text = cur_date; txtstatus.SelectedIndex = 0; // Clear the book title and price fields... txtRecordPosition.Text = "رکورد جدید"; std st = new std(); st.reg_date = txtreg_date.Text; txtstdno.Text = st.Selectmaxid(); btnAdd.Enabled = false; btnMoveFirst.Enabled = false; btnMovePrevious.Enabled = false; btnMoveNext.Enabled = false; btnMoveLast.Enabled = false; btnNew.Visible = false; btnCancel.Visible = true; toolStripStatusLabel1.Text = "لطفا اطلاعات رکورد جدید را وارد نمایید"; txtreg_date.Focus(); }
private void cmddel_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { DialogResult dr; dr = MessageBox.Show("با حذف هنرجو تمامی کلاس های متعلق به ایشان نیز حذف می شوند، آیا از حذف هنرجو اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { int icol = 0; int irow = dataGridView1.CurrentRow.Index; string val = dataGridView1[icol, irow].Value.ToString(); std st = new std(); st.stdno = val; st.Delete(); if (btnfilter.Enabled == true) { btnfilter.PerformClick(); } else { DataTable dt = new DataTable(); dt = st.SelectForView(); dataGridView1.DataSource = dt; } } } }
private void fillBasicInfo() { DataTable dt = new DataTable(); std cu = new std(); cu.stdno = txtstdno.Text; dt = cu.Selectforedit(); if (dt.Rows.Count > 0) { txtstdno.Enabled = false; //idsearch.Enabled = false; grpBasicInfo.Enabled = true; // Clear any previous bindings & Add new bindings to the DataView object... foreach (Control c in grpBasicInfo.Controls) { if (c.GetType() == typeof(FiveCharTextBox) || c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(DateMaskedTextbox) || c.GetType() == typeof(CurrencyTextBox) || c.GetType() == typeof(CellPhoneTextBox)) { c.Text = dt.Rows[0][c.Name.Substring(3)].ToString(); } } // End of Clearing & Adding of Controls Binding txtname.Focus(); ShowPic(); } else { MessageBox.Show("شماره هنرجو در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void frmStdHisView_Load(object sender, EventArgs e) { groupBox1.Focus(); txtstdno.Focus(); txtstdno.SelectAll(); System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR"); InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp); dataGridView1.AutoGenerateColumns = true; DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); objAlternatingCellStyle.BackColor = Color.Khaki; dataGridView1.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; if (sabegheh == true) { btnfilter.PerformClick(); } else { std si = new std(); DataTable dtname = new DataTable(); dtname = si.Search("SELECT stdno,name FROM std"); txtname.DataSource = dtname; txtname.DisplayMember = "name"; txtname.ValueMember = "name"; txtstdno.DataBindings.Clear(); txtstdno.DataBindings.Add("Text", dtname, "stdno"); } //dataGridView1.Columns["mandeh"].HeaderText = "Column1"; //dataGridView1.Columns["mandeh"].Name = "Column1"; //dataGridView1.Columns["mandeh"].ReadOnly = true; }
private void frmGhabzDaryaft_Load(object sender, EventArgs e) { System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR"); InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp); cur_date = Date.currentDate_Getter(); newform(); Courses co = new Courses(); DataTable dtname = new DataTable(); dtname = co.Search("SELECT coursename FROM courses order by coursename"); txtartcourse.DataSource = dtname; txtartcourse.DisplayMember = "coursename"; txtartcourse.ValueMember = "coursename"; std st = new std(); DataTable dtstdname = new DataTable(); dtstdname = st.Search("SELECT name, stdno FROM std order by name"); txtname.DataSource = dtstdname; txtname.DisplayMember = "name"; txtname.ValueMember = "name"; txtstdno.DataBindings.Clear(); txtstdno.DataBindings.Add("Text", dtstdname, "stdno"); }
public void idsearch_Click() { //DataTable dt = new DataTable(); std cu = new std(); cu.stdno = txtstdno.Text; dt = cu.Selectforedit(); if (dt.Rows.Count > 0) { btnUpdate.Enabled = true; txtstdno.Enabled = false; grpinfo_box.Enabled = true; // Clear any previous bindings & Add new bindings to the DataView object... txtstatus.Text = dt.Rows[0]["status"].ToString(); txthesab.Text = dt.Rows[0]["hesab"].ToString(); txtmandeh.Text = txthesab.Text; txttashkhis.Text = txtstatus.Text; // End of Clearing & Adding of Controls Binding txtmandeh.Focus(); } else { MessageBox.Show("شماره هنرجو در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void fillInfo() { ghabz gh = new ghabz(); txtid.Text = gh.Selectmaxid(); DataTable lastmablagh = gh.Search("select top 1(mablagh) from ghabz order by id desc"); if (lastmablagh.Rows.Count > 0) { txtmablagh.Text = lastmablagh.Rows[0][0].ToString(); } else { txtmablagh.Text = "0"; } txtdate.Text = cur_date; txtsharh.Text = ""; std st = new std(); DataTable dtstdname = new DataTable(); dtstdname = st.Search("SELECT stdno,name FROM std where stdno=" + stdno); txtname.Text = dtstdname.Rows[0]["name"].ToString(); txtstdno.Text = dtstdname.Rows[0]["stdno"].ToString(); txtlastdate.Text = Date.returnLastDateOfaDate(txtdate.Text); groupBox1.Focus(); txtname.Focus(); }
public image(string std_no) { InitializeComponent(); std st = new std(); st.stdno = std_no; SqlDataReader dstdr; try { dstdr = st.Selectimg(); while (dstdr.Read()) { if (!dstdr.IsDBNull(0)) { byte[] photo1 = (byte[])dstdr[0]; MemoryStream ms = new MemoryStream(photo1); pictureBox1.Image = Image.FromStream(ms); } else { pictureBox1.Image = null; } } } catch (Exception) { MessageBox.Show("در اطلاعات این دانشجو عکس موجود نیست", "توجه ", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); } }
public void UpdateMandeh() { DataTable dt = SelectForEslah(); long sumbedehkari = 0, sumbestankari = 0, lastmandeh = 0; string tashkhisRow = ""; for (int i = 0; i < dt.Rows.Count; i++) { lastmandeh = 0; tashkhisRow = ""; sumbedehkari += long.Parse(dt.Rows[i]["bedehkari"].ToString()); sumbestankari += long.Parse(dt.Rows[i]["bestankari"].ToString()); lastmandeh = sumbestankari - sumbedehkari; if (lastmandeh > 0) { tashkhisRow = "�������"; } else if (lastmandeh <= 0) { tashkhisRow = "�����"; } UpdateAfterHamahangSazi(tashkhisRow, Math.Abs(lastmandeh), long.Parse(dt.Rows[i]["radif"].ToString()), dt.Rows[i]["stdno"].ToString(), i); } std sic = new std(); sic.stdno = this.stdno;; sic.hesab = Math.Abs(lastmandeh); sic.status = tashkhisRow; sic.UpdateAfterGhabz(); }
private void btnUpdate_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.sharh = txtsharh.Text; gh.Update(); MessageBox.Show("قبض با موفقیت ویرایش گردید"); this.Close(); }
private void addbtnTextChanged(object sender, EventArgs e) { if (sender == txtreg_date && txtreg_date.MaskCompleted && btnNew.Visible == false) { try { std st = new std(); st.reg_date = txtreg_date.Text; txtstdno.Text = st.Selectmaxid(); } catch { txtstdno.Text = ""; } } if (txtstdno.Text == "" || txtname.Text == "" || !txtreg_date.MaskCompleted) { btnAdd.Enabled = false; //btnUpdate.Enabled = false; } else if (btnNew.Visible == false) { btnAdd.Enabled = true; } else if (btnNew.Visible == true) { // btnUpdate.Enabled = true; } }
private void cmdedit_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { int col = 0; int row = dataGridView1.CurrentRow.Index; string val = dataGridView1[col, row].Value.ToString(); std st = new std(); DataTable datat = new DataTable(); st.stdno = val; datat = st.Selectforedit(); editstd es = new editstd(); es.txtstdno.Text = val; es.Search_Click(); es.ShowDialog(); if (btnfilter.Enabled == true) { btnfilter.PerformClick(); } else { DataTable dt = new DataTable(); dt = st.SelectForView(); dataGridView1.DataSource = dt; } } }
public void Search_Click() { Courses co = new Courses(); DataTable dtname = new DataTable(); dtname = co.Search("SELECT coursename FROM courses"); txtartcourse.DataSource = dtname; txtartcourse.DisplayMember = "coursename"; txtartcourse.ValueMember = "coursename"; std st = new std(); DataTable dtstdname = new DataTable(); dtstdname = st.Search("SELECT name, stdno FROM std order by name"); txtstdname.DataSource = dtstdname; txtstdname.DisplayMember = "name"; txtstdname.ValueMember = "name"; txtstdno.DataBindings.Clear(); txtstdno.DataBindings.Add("Text", dtstdname, "stdno"); teachers te = new teachers(); DataTable dttename = new DataTable(); dttename = te.Search("SELECT name FROM teachers"); txtteacher.DataSource = dttename; txtteacher.DisplayMember = "name"; txtteacher.ValueMember = "name"; DataTable dt = new DataTable(); classes cu = new classes(); cu.classno = long.Parse(txtclassno.Text); dt = cu.Selectforedit(); if (dt.Rows.Count > 0) { btnUpdate.Enabled = true; txtclassno.Enabled = false; //idsearch.Enabled = false; grpinfo_box.Enabled = true; // Clear any previous bindings & Add new bindings to the DataView object... foreach (Control c in grpinfo_box.Controls) { if (c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(TimeMaskedTextbox) || c.GetType() == typeof(DateMaskedTextbox)) { c.Text = dt.Rows[0][c.Name.Substring(3)].ToString(); } } // End of Clearing & Adding of Controls Binding txtartcourse.Focus(); } else { MessageBox.Show("مشخصه کلاس در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void FillDataSetAndView() { // Initialize a new instance of the DataSet object... std st = new std(); datat = st.Select(); // Set our CurrencyManager object // to the DataView object... objCurrencyManager = (CurrencyManager)(this.BindingContext[datat]); }
private void frmGhabzView_Load(object sender, EventArgs e) { System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR"); InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp); cur_date = Date.currentDate_Getter(); Courses co = new Courses(); DataTable dtname = new DataTable(); dtname = co.Search("SELECT coursename FROM courses order by coursename"); txtartcourse.DataSource = dtname; txtartcourse.DisplayMember = "coursename"; txtartcourse.ValueMember = "coursename"; std st = new std(); DataTable dtstdname = new DataTable(); dtstdname = st.Search("SELECT name FROM std order by name"); txtname.DataSource = dtstdname; txtname.DisplayMember = "name"; txtname.ValueMember = "name"; txtartcourse.Text = ""; txtname.Text = ""; checkBox1.Checked = true; btnfilter.PerformClick(); grdDataViewer.AutoGenerateColumns = true; string[] col_headers = { "شماره قبض", "ش هنرجویی", "نام و نام خانوادگی", "کلاس", "تاریخ", "تاریخ پایان تسویه", "ماه تسویه", "هزینه دوره", "مبلغ دریافتی", "توضیحات" }; int[] col_width = { 70, 60, 120, 90, 80, 80, 70, 70, 70, 180 }; for (int i = 0; i < col_headers.Length; i++) { grdDataViewer.Columns[i].HeaderText = col_headers[i].ToString(); grdDataViewer.Columns[i].Width = col_width[i]; } DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); objAlternatingCellStyle.BackColor = Color.Khaki; grdDataViewer.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); dataGridViewCellStyle1.Format = "N0"; dataGridViewCellStyle1.NullValue = null; grdDataViewer.Columns["mablagh"].DefaultCellStyle = dataGridViewCellStyle1; grdDataViewer.Columns["paid"].DefaultCellStyle = dataGridViewCellStyle1; }
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(); }
public void idsearch_Click() { Courses co = new Courses(); DataTable dtname = new DataTable(); dtname = co.Search("SELECT coursename FROM courses order by coursename"); txtartcourse.DataSource = dtname; txtartcourse.DisplayMember = "coursename"; txtartcourse.ValueMember = "coursename"; std st = new std(); DataTable dtstdname = new DataTable(); dtstdname = st.Search("SELECT name, stdno FROM std order by name"); txtname.DataSource = dtstdname; txtname.DisplayMember = "name"; txtname.ValueMember = "name"; txtstdno.DataBindings.Clear(); txtstdno.DataBindings.Add("Text", dtstdname, "stdno"); ghabz gh = new ghabz(); gh.id = txtid.Text; DataTable dt = gh.Selectforedit(); if (dt.Rows.Count > 0) { btnUpdate.Enabled = true; txtid.Enabled = false; groupBox1.Enabled = true; // Clear any previous bindings & Add new bindings to the DataView object... foreach (Control c in groupBox1.Controls) { if (c.GetType() == typeof(FiveCharTextBox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(DateMaskedTextbox) || c.GetType() == typeof(CurrencyTextBox) || c.GetType() == typeof(NormalTextbox)) { if (c != txtlastdate && c != txtmandeh && c != txtlastcheck) { c.Text = dt.Rows[0][c.Name.Substring(3)].ToString(); } } } txtlastdate.Text = dt.Rows[0]["lastdate"].ToString(); txtlastcheck.Text = dt.Rows[0]["lastcheck"].ToString(); // End of Clearing & Adding of Controls Binding txtstdno.Focus(); } else { MessageBox.Show("شماره قبض در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void pictureBox1_Click(object sender, EventArgs e) { DialogResult m; m = MessageBox.Show("آیا از حذف تصویر هنرجو اطمینان دارید ؟ ", "تایید", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (m == DialogResult.Yes) { std st = new std(); st.stdno = txtstdno.Text; st.Updateforpic(); ShowPosition(); } }
public void idsearch_Click() { std st = new std(); DataTable dtstdname = new DataTable(); dtstdname = st.Search("SELECT stdno, name FROM std order by name"); txtstdname.DataSource = dtstdname; txtstdname.DisplayMember = "name"; txtstdname.ValueMember = "name"; txtstdno.DataBindings.Clear(); txtstdno.DataBindings.Add("Text", dtstdname, "stdno"); hozoorclass gha = new hozoorclass(); gha.stdno = OLD_STDNO; gha.classno = long.Parse(OLD_CLASSNO); gha.date = OLD_DATE; DataTable dt = gha.Selectforedit(); if (dt.Rows.Count > 0) { btnUpdate.Enabled = true; txtstdno.Enabled = false; groupBox1.Enabled = true; // Clear any previous bindings & Add new bindings to the DataView object... foreach (Control c in groupBox1.Controls) { if (c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(DateMaskedTextbox)) { c.Text = dt.Rows[0][c.Name.Substring(3)].ToString(); } } if (dt.Rows[0]["status"].ToString() == "حاضر") { rdoHazer.Checked = true; } else { rdoGhayeb.Checked = true; } // End of Clearing & Adding of Controls Binding btnUpdate.Enabled = true; txtstdname.Focus(); } else { MessageBox.Show("مشخصات در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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); }
private void frmMain_Shown(object sender, EventArgs e) { // fill the quick search bar std st = new std(); DataTable dtstdname = new DataTable(); //dtstdname = st.Search("SELECT name, stdno FROM std where (stdno in (select stdno from classes where payan_date is null OR payan_date=N'')) order by name") dtstdname = st.Search("SELECT name, stdno FROM std"); txtQuickSearchName.DataSource = dtstdname; txtQuickSearchName.DisplayMember = "name"; txtQuickSearchName.ValueMember = "name"; txtQuickSearchStdno.DataBindings.Clear(); txtQuickSearchStdno.DataBindings.Add("Text", dtstdname, "stdno"); }
private void btnfilter_Click(object sender, EventArgs e) { Boolean check = false; string SQL = "select stdno, reg_date,name,father,idno,job,degree,course,tel, mob,hesab, status,address,resume from std where "; string SQL2 = "select * from std where "; check = false; if (txtstdname.Text != "") { SQL = SQL + "name like N'%" + txtstdname.Text.Trim() + "%'AND "; SQL2 = SQL2 + "name like N'%" + txtstdname.Text.Trim() + "%'AND "; checkBox1.Checked = false; check = true; } if (checkBox1.Checked) { SQL = SQL + "(stdno in (select stdno from classes where payan_date is null OR payan_date=N''))AND "; check = true; } if (check == true) { SQL = SQL.Remove(SQL.Length - 4); SQL2 = SQL2.Remove(SQL2.Length - 4); } std st = new std(); DataTable dt = new DataTable(); dt = st.Search(SQL); dataGridView1.DataSource = dt; if (dataGridView1.RowCount == 0) { cmddel.Enabled = false; cmdedit.Enabled = false; } else { cmddel.Enabled = true; cmdedit.Enabled = true; } }
private void pictureBox1_Click(object sender, EventArgs e) { DialogResult m; m = MessageBox.Show("آیا از حذف تصویر هنرجو اطمینان دارید ؟ ", "تایید", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (m == DialogResult.Yes) { //objCommand.CommandText = "update letter set let_img=NULL WHERE id='" + idtxt.Text.Trim() + "'"; //objCommand.ExecuteNonQuery(); std st = new std(); st.stdno = txtstdno.Text; st.Updateforpic(); ShowPosition(); } }
private void txtstdname_TextChanged(object sender, EventArgs e) { if (txtstdname.Text == "" && !checkBox1.Checked) { btnfilter.Enabled = false; std pm = new std(); DataTable dt = new DataTable(); dt = pm.SelectForView(); dataGridView1.DataSource = dt; } else { btnfilter.Enabled = true; } }
private void frmHozoorView_Load(object sender, EventArgs e) { System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR"); InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp); cur_date = Date.currentDate_Getter(); Courses co = new Courses(); DataTable dtname = new DataTable(); dtname = co.Search("SELECT coursename FROM courses order by coursename"); txtartcourse.DataSource = dtname; txtartcourse.DisplayMember = "coursename"; txtartcourse.ValueMember = "coursename"; std st = new std(); DataTable dtstdname = new DataTable(); dtstdname = st.Search("SELECT name FROM std order by name"); txtname.DataSource = dtstdname; txtname.DisplayMember = "name"; txtname.ValueMember = "name"; txtartcourse.Text = ""; txtname.Text = ""; checkBox1.Checked = true; btnfilter.PerformClick(); grdDataViewer.AutoGenerateColumns = true; string[] col_headers = { "ردیف", "مشخصه هنرجو", "نام و نام خانوادگی", "مشخصه کلاس", "رشته هنری", "تاریخ", "روز", "وضعیت" }; int[] col_width = { 60, 70, 120, 70, 90, 80, 80, 77 }; for (int i = 0; i < col_headers.Length; i++) { grdDataViewer.Columns[i].HeaderText = col_headers[i].ToString(); grdDataViewer.Columns[i].Width = col_width[i]; } DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); objAlternatingCellStyle.BackColor = Color.Khaki; grdDataViewer.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; }
private void UpdateGridview() { std st = new std(); DataTable dt = new DataTable(); if (checkBox1.Checked) { dt = st.SelectForSMStavalod(); } else { dt = st.SelectTavalod(); } txttedadegirandeha.Text = "0"; dataGridView1.DataSource = dt; dataGridView1.AutoGenerateColumns = true; dtforprint = st.Select(); //if (dataGridView1.RowCount == 0) //{ // cmddel.Enabled = false; // cmdedit.Enabled = false; //} string[] col_headers = { "تیک ارسال", "شماره", "نام و نام خانوادگی", "تلفن همراه", "تاریخ تولد" }; //int[] col_width = { 25, 50, 80, 130, 80, 90, 80, 80, 80, 80, 80, 120, 95 }; for (int i = 0; i < col_headers.Length; i++) { dataGridView1.Columns[i].HeaderText = col_headers[i].ToString(); // dataGridView1.Columns[i].Width = col_width[i]; } dataGridView1.Columns["stdno"].Visible = false; DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); objAlternatingCellStyle.BackColor = Color.Khaki; dataGridView1.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; DataGridViewCellStyle objAlternatingCellStyle1 = new DataGridViewCellStyle(); objAlternatingCellStyle1.BackColor = Color.LightBlue; dataGridView1.Columns["mob"].DefaultCellStyle = objAlternatingCellStyle1; // dataGridView1.Columns["tel"].DefaultCellStyle = objAlternatingCellStyle1; }
private void btnUpdate_Click(object sender, EventArgs e) { std stdn = new std(); stdn.stdno = txtstdno.Text; if (!stdn.SelectfornameCheck().Equals(txtstdname.Text)) { MessageBox.Show("نام هنرجو با شماره پرونده مطابقت ندارد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); txtstdname.Focus(); return; } classes cl = new classes(); cl.classno = long.Parse(txtclassno.Text.Trim()); cl.teacher = txtteacher.Text; cl.stdname = txtstdname.Text; cl.stdno = txtstdno.Text; cl.artcourse = txtartcourse.Text; cl.clday = txtclday.Text.Trim(); cl.clFromTime = txtclFromTime.Text; cl.clToTime = txtclToTime.Text; cl.method = txtmethod.Text.Trim(); cl.open_date = txtopen_date.Text; if (cl.CheckExists()) { DialogResult dr; dr = MessageBox.Show("کلاسی با این مشخصات پایه در سیستم موجود می باشد، آیا از ایجاد این کلاس و تداخل آنها اطمینان دارید؟", "خطای تداخل", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.Yes) { cl.Update(); this.Close(); } else { txtartcourse.Focus(); } } else { cl.Update(); this.Close(); } }
private void btnAdd_Click(object sender, EventArgs e) { std stdn = new std(); stdn.stdno = txtstdno.Text; if (!stdn.SelectfornameCheck().Equals(txtstdname.Text)) { MessageBox.Show("نام هنرجو با شماره پرونده مطابقت ندارد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); txtstdname.Focus(); return; } // Inserting the Data to the DataBase hozoorclass si = new hozoorclass(); si.stdno = txtstdno.Text; si.stdname = txtstdname.Text; si.classno = long.Parse(dataGridView1.CurrentRow.Cells["classno"].Value.ToString()); si.artcourse = txtartcourse.Text; si.date = txtdate.Text; si.day = txtday.Text; if (rdoHazer.Checked) { si.status = "حاضر"; } else if (rdoGhayeb.Checked) { si.status = "غائب"; } si.oldstdno = long.Parse(OLD_STDNO); si.oldclassno = long.Parse(OLD_CLASSNO); si.olddate = OLD_DATE; si.Update(); ////////////////////////////////////////////////////////////////////////////////////////////////// // Display a message that the record was added... MessageBox.Show("عملیات ویرایش حضور و غیاب هنرجو با موفقیت انجام شد"); this.Close(); }
private void classview_Load(object sender, EventArgs e) { System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR"); InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp); cur_date = Date.currentDate_Getter(); Courses co = new Courses(); DataTable dtname = new DataTable(); dtname = co.Search("SELECT coursename FROM courses order by coursename"); txtartcourse.DataSource = dtname; txtartcourse.DisplayMember = "coursename"; txtartcourse.ValueMember = "coursename"; std st = new std(); DataTable dtstdname = new DataTable(); dtstdname = st.Search("SELECT name FROM std order by name"); txtstdname.DataSource = dtstdname; txtstdname.DisplayMember = "name"; txtstdname.ValueMember = "name"; teachers te = new teachers(); DataTable dttename = new DataTable(); dttename = te.Search("SELECT name FROM teachers order by name"); txtteacher.DataSource = dttename; txtteacher.DisplayMember = "name"; txtteacher.ValueMember = "name"; txtartcourse.Text = ""; txtteacher.Text = ""; txtstdname.Text = ""; txtday.Text = ""; cmddel.Enabled = true; cmdedit.Enabled = true; checkBox1.Checked = true; }
private void cmdadd_Click(object sender, EventArgs e) { addstd as2 = new addstd(); //as2.cur_date = currentDate; as2.ShowDialog(); if (btnfilter.Enabled == true) { btnfilter.PerformClick(); } else { std st = new std(); DataTable dt = new DataTable(); dt = st.SelectForView(); dataGridView1.DataSource = dt; } }