private void btnAdd_Click(object sender, EventArgs e) { string position; teachers te = new teachers(); te.teacherno = int.Parse(txtteacherno.Text.Trim()); te.artcourse = txtartcourse.Text; te.name = txtname.Text.Trim(); te.tel = txttel.Text.Trim(); te.resume = txtresume.Text.Trim(); te.flag = flag; te.photo = photo; te.Add(); 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 btnfilter_Click(object sender, EventArgs e) { Boolean check = false; string SQL = "select teacherno, name, artcourse, tel, resume from teachers where "; check = false; if (txtteacher.Text != "") { SQL = SQL + "name like N'%" + txtteacher.Text.Trim() + "%'AND "; check = true; } if (txtartcourse.Text != "") { SQL = SQL + "artcourse like N'%" + txtartcourse.Text.Trim() + "%'AND "; check = true; } if (check == true) { SQL = SQL.Remove(SQL.Length - 4); } teachers te = new teachers(); DataTable dt = new DataTable(); dt = te.Search(SQL); dataGridView1.DataSource = dt; }
private void btnUpdate_Click(object sender, EventArgs e) { // Declare local variables and objects... int intPosition = objCurrencyManager.Position; teachers te = new teachers(); te.teacherno = int.Parse(txtteacherno.Text.Trim()); te.artcourse = txtartcourse.Text; te.name = txtname.Text.Trim(); te.tel = txttel.Text.Trim(); te.resume = txtresume.Text.Trim(); te.flag = flag; te.photo = photo; te.Update(); // Close the connection... // Fill the DataSet and bind the fields... FillDataSetAndView(); BindFields(); // Set the record position // to the one that you saved... objCurrencyManager.Position = intPosition; // Show the current record position... ShowPosition(); // Display a message that the record was updated... toolStripStatusLabel1.Text = "عملیات ویرایش رکورد با موفقیت انجام شد"; }
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 teacherview_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"; 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"; DataTable dt = new DataTable(); dt = te.SelectforView(); cmddel.Enabled = true; cmdedit.Enabled = true; txtteacher.Text = ""; txtartcourse.Text = ""; dataGridView1.DataSource = dt; dataGridView1.AutoGenerateColumns = true; if (dataGridView1.RowCount == 0) { cmddel.Enabled = false; cmdedit.Enabled = false; } string[] col_headers = { "ردیف", "نام و نام خانوادگی", "رشته هنری", "تلفن", "سوابق هنری" }; int[] col_width = { 67, 130, 110, 100, 200 }; for (int i = 0; i < col_headers.Length; i++) { dataGridView1.Columns[i].HeaderText = col_headers[i].ToString(); dataGridView1.Columns[i].Width = col_width[i]; } DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); objAlternatingCellStyle.BackColor = Color.Khaki; dataGridView1.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; }
private void FillDataSetAndView() { // Initialize a new instance of the DataSet object... teachers te = new teachers(); datat = te.Select(); // Set our CurrencyManager object // to the DataView object... objCurrencyManager = (CurrencyManager)(this.BindingContext[datat]); }
private void cmdadd_Click(object sender, EventArgs e) { addteacher at = new addteacher(); at.ShowDialog(); teachers st = new teachers(); DataTable dt = new DataTable(); dt = st.SelectforView(); dataGridView1.DataSource = dt; }
private void pictureBox1_Click(object sender, EventArgs e) { DialogResult m; m = MessageBox.Show("آیا از حذف تصویراستاد اطمینان دارید ؟ ", "تایید", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (m == DialogResult.Yes) { teachers te = new teachers(); te.teacherno = int.Parse(txtteacherno.Text); te.Updateforpic(); ShowPosition(); } }
private void btnUpdate_Click(object sender, EventArgs e) { teachers te = new teachers(); te.teacherno = int.Parse(txtteacherno.Text.Trim()); te.name = txtname.Text.Trim(); te.artcourse = txtartcourse.Text; te.tel = txttel.Text.Trim(); te.resume = txtresume.Text.Trim(); te.flag = flag; te.photo = photo; te.Update(); this.Close(); }
private void frmGhabzPardakht_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(); teachers te = new teachers(); DataTable dttename = new DataTable(); dttename = te.Search("SELECT name FROM teachers order by name"); txtname.DataSource = dttename; txtname.DisplayMember = "name"; txtname.ValueMember = "name"; }
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(); teachers te = new teachers(); te.teacherno = int.Parse(txtteacherno.Text); te.Updateforpic(); ShowPosition(); } }
private void addbtnTextChanged(object sender, EventArgs e) { if (txtteacher.Text == "" && txtartcourse.Text == "") { btnfilter.Enabled = false; teachers te = new teachers(); DataTable dt = new DataTable(); dt = te.SelectforView(); dataGridView1.DataSource = dt; } else { btnfilter.Enabled = true; } }
private void btnteacher_Click(object sender, EventArgs e) { int cmbPos = txtteacher.SelectedIndex; addteacher ac = new addteacher(); ac.ShowDialog(); teachers te = new teachers(); DataTable dttename = new DataTable(); dttename = te.Search("SELECT name,stdno FROM teachers"); txtteacher.DataSource = dttename; txtteacher.DisplayMember = "name"; txtteacher.ValueMember = "name"; txtteacher.SelectedIndex = cmbPos; }
private void frmPaymentsView_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(); teachers te = new teachers(); DataTable dttename = new DataTable(); dttename = te.Search("SELECT name FROM teachers order by name"); txtname.DataSource = dttename; txtname.DisplayMember = "name"; txtname.ValueMember = "name"; txtname.Text = ""; checkBox1.Checked = true; btnfilter.PerformClick(); grdDataViewer.AutoGenerateColumns = true; string[] col_headers = { "شماره قبض", "نام و نام خانوادگی", "تاریخ صدور", "ماه تسویه", "مبلغ", "شرح قبض" }; int[] col_width = { 100, 120, 90, 100, 90, 150 }; 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; }
private void ShowPosition() { // Display the current position // and the number of records txtRecordPosition.Text = (objCurrencyManager.Position + 1) + " of " + objCurrencyManager.Count; toolStripStatusLabel1.Text = "آماده عملیات"; txtteacherno.Enabled = false; teachers te = new teachers(); te.teacherno = int.Parse(txtteacherno.Text); SqlDataReader dstdr; try { dstdr = te.Selectimg(); while (dstdr.Read()) { if (!dstdr.IsDBNull(0)) { byte[] photo1 = (byte[])dstdr[0]; MemoryStream ms = new MemoryStream(photo1); img_axbox.Image = Image.FromStream(ms); pictureBox1.Enabled = true; } else { img_axbox.Image = null; pictureBox1.Enabled = false; } } } catch (Exception) { MessageBox.Show("در اطلاعات این استاد عکس موجود نیست", "توجه ", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); } flag = false; }
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 UpdateGridview() { teachers st = new teachers(); DataTable dt, dt2 = new DataTable(); dt = st.SelectForSMS(); 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[1].Visible = false; DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); objAlternatingCellStyle.BackColor = Color.Khaki; dataGridView1.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; DataGridViewCellStyle objAlternatingCellStyle1 = new DataGridViewCellStyle(); objAlternatingCellStyle1.BackColor = Color.LightBlue; dataGridView1.Columns[3].DefaultCellStyle = objAlternatingCellStyle1; // dataGridView1.Columns["tel"].DefaultCellStyle = objAlternatingCellStyle1; }
private void frmHozoorByTeacherview_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(); teachers st = new teachers(); DataTable dtteachername = new DataTable(); dtteachername = st.Search("SELECT name FROM teachers order by name"); txtteacher.DataSource = dtteachername; txtteacher.DisplayMember = "name"; txtteacher.ValueMember = "name"; txtteacher.Text = ""; DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); objAlternatingCellStyle.BackColor = Color.Khaki; grdDataViewer.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; }
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"; DataTable dt = new DataTable(); teachers cu = new teachers(); cu.teacherno = int.Parse(txtteacherno.Text); dt = cu.Selectforedit(); if (dt.Rows.Count > 0) { btnUpdate.Enabled = true; txtteacherno.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.Text = dt.Rows[0][c.Name.Substring(3)].ToString(); } } // End of Clearing & Adding of Controls Binding txtname.Focus(); } else { MessageBox.Show("مشخصه استاد در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void idsearch_Click() { teachers te = new teachers(); DataTable dttename = new DataTable(); dttename = te.Search("SELECT name FROM teachers order by name"); txtname.DataSource = dttename; txtname.DisplayMember = "name"; txtname.ValueMember = "name"; payments pa = new payments(); pa.id = txtid.Text; DataTable dt = pa.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.Text = dt.Rows[0][c.Name.Substring(3)].ToString(); } } // End of Clearing & Adding of Controls Binding txtdate.Focus(); } else { MessageBox.Show("شماره قبض در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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(); teachers te = new teachers(); DataTable datat = new DataTable(); te.teacherno = int.Parse(val); datat = te.Selectforedit(); editteacher es = new editteacher(); es.txtteacherno.Text = val; es.Search_Click(); es.ShowDialog(); DataTable dt = new DataTable(); dt = te.SelectforView(); dataGridView1.DataSource = dt; } }
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(); teachers te = new teachers(); te.teacherno = int.Parse(val); te.Delete(); DataTable dt = new DataTable(); dt = te.SelectforView(); dataGridView1.DataSource = dt; } } }
private void addclass_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"); txtartcourse.DataSource = dtname; txtartcourse.DisplayMember = "coursename"; txtartcourse.ValueMember = "coursename"; teachers te = new teachers(); DataTable dttename = new DataTable(); dttename = te.Search("SELECT name FROM teachers"); txtteacher.DataSource = dttename; txtteacher.DisplayMember = "name"; txtteacher.ValueMember = "name"; FillDataSetAndView(); if (objCurrencyManager.Count == 0) { 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.Enabled = false; } } txtopen_date.Text = cur_date; btnAdd.Enabled = false; btnMoveFirst.Enabled = false; btnMovePrevious.Enabled = false; btnMoveNext.Enabled = false; btnMoveLast.Enabled = false; btnUpdate.Enabled = false; btnNew.Visible = true; txtRecordPosition.Text = "No Record"; toolStripStatusLabel1.Text = "آماده ایجاد رکورد جدید"; } else { BindFields(); objCurrencyManager.Position = objCurrencyManager.Count - 1; ShowPosition(); btnAdd.Enabled = false; } 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"); }
private void addbtnTextChanged(object sender, EventArgs e) { if (sender == txtopen_date && txtopen_date.MaskCompleted && btnNew.Visible == false) { try { long.Parse(txtopen_date.Text.Substring(0, 4).Trim()); classes cls = new classes(); cls.open_date = txtopen_date.Text; long codeCounter = cls.Selectmaxid(); txtclassno.Text = codeCounter.ToString(); } catch { txtclassno.Text = ""; } } if (sender == txtclFromTime && txtclFromTime.MaskCompleted && btnNew.Visible == false) { try { TimeSpan dtime = TimeSpan.Parse(txtclFromTime.Text); TimeSpan add30 = TimeSpan.Parse("00:30"); txtclToTime.Text = dtime.Add(add30).ToString(); } catch { MessageBox.Show("لطفا ساعت کلاس را به صورت صحیح وارد نمایید"); } } if (sender == txtartcourse && txtartcourse.Text != "" && btnNew.Visible == false) { teachers te = new teachers(); DataTable tedt = new DataTable(); tedt = te.Search("select name from teachers where artcourse=N'" + txtartcourse.Text + "'"); if (tedt.Rows.Count > 0) { txtteacher.Text = tedt.Rows[0][0].ToString(); } } if (txtclassno.Text == "" || txtartcourse.Text == "" || txtteacher.Text == "" || txtstdname.Text == "" || txtclday.Text == "" || !txtclFromTime.MaskCompleted || !txtclToTime.MaskCompleted || !txtopen_date.MaskCompleted) { btnAdd.Enabled = false; btnUpdate.Enabled = false; } else if (btnNew.Visible == false) { btnAdd.Enabled = true; } else if (btnNew.Visible == true) { btnUpdate.Enabled = true; } }
void updategridview() { ServiceReference1.SendSoapClient smsx = new Rohab.ServiceReference1.SendSoapClient(); byte[] status = new byte[] { }; ServiceReference1.ArrayOfLong aroflo = new Rohab.ServiceReference1.ArrayOfLong(); ServiceReference1.MessagesBL[] msg = {}; int msgCount = 0; try { msgCount = smsx.GetInboxCount("9369611913", "19130", false) + smsx.GetInboxCount("9369611913", "19130", true); msg = smsx.getMessages("9369611913", "19130", 1, "30004966300049", 0, msgCount); } catch (Exception) { MessageBox.Show("مشکل در دریافت اطلاعات. لطفا دوباره تلاش کنید"); return; } dataGridView1.DataSource = msg; foreach (DataGridViewColumn dc in dataGridView1.Columns) { dc.Visible = false; } dataGridView1.Columns["MsgID"].HeaderText = "شناسه"; dataGridView1.Columns["MsgID"].Visible = true; dataGridView1.Columns["Body"].HeaderText = "متن پیام"; dataGridView1.Columns["Body"].Visible = true; dataGridView1.Columns["SendDate"].HeaderText = "تاریخ"; dataGridView1.Columns["SendDate"].Visible = true; dataGridView1.Columns["Sender"].HeaderText = "از شماره"; dataGridView1.Columns["Sender"].Visible = true; dataGridView1.Columns["IsRead"].HeaderText = "خوانده شده"; dataGridView1.Columns["IsRead"].Visible = true; dataGridView1.Columns["Udh"].HeaderText = "از طرف"; dataGridView1.Columns["Udh"].Visible = true; //DataGridViewTextBoxColumn dcnew = new DataGridViewTextBoxColumn(); //dcnew.Name = "sendername"; //dcnew.HeaderText = "نام فرستنده"; //dcnew.Width = 70; //dcnew.ReadOnly = false; //int index = dataGridView1.Columns.Add(dcnew); for (int i = 0; i < dataGridView1.RowCount; i++) { try { std stdda = new std(); string sendername = stdda.GetSenderName(dataGridView1.Rows[i].Cells["Sender"].Value.ToString()); if (string.IsNullOrEmpty(sendername)) { teachers tch = new teachers(); sendername = tch.GetSenderName(dataGridView1.Rows[i].Cells["Sender"].Value.ToString()); } if (string.IsNullOrEmpty(sendername)) { contact cnt = new contact(); sendername = cnt.GetSenderName(dataGridView1.Rows[i].Cells["Sender"].Value.ToString()); } dataGridView1.Rows[i].Cells[7].Value = sendername == string.Empty ? "ناشناس" : sendername; //----------------------- // tarikh shamsi dataGridView1.Rows[i].Cells["SendDate"].Value = Date.Shamsi(dataGridView1.Rows[i].Cells["SendDate"].Value.ToString().Substring(0, 10)); } catch (Exception) { } } // dataGridView1.Refresh(); // Boolean check = false; //string SQL = "select [smsid],[type],[tarikh],[tahvilgirande],[shomaremaghsad],[matnsms],[tahvilshod] from sms where "; //check = false; //// SQL = SQL + "[type] like N'%" + txttype.Text.Trim() + "%'AND "; //if (txttarikh.Text != "13 / /") //{ // SQL = SQL + "[tarikh] like N'%" + txttarikh.Text.Trim() + "%'AND "; // check = true; //} //SQL = SQL.Remove(SQL.Length - 4) + " order by tarikh DESC"; //sms cl = new sms(); //DataTable dt = new DataTable(); //dt = cl.Search(SQL); //dataGridView1.DataSource = dt; //string[] col_headers = { "مشخصه", "ارسال به", "تاریخ", "نام گیرنده", "موبایل", "متن پیام", "تحویل شد" }; //// int[] col_width = { 70, 80, 100, 70, 110, 80, 80, 80, 100, 80, 78 }; //for (int i = 0; i < col_headers.Length; i++) //{ // dataGridView1.Columns[i].HeaderText = col_headers[i].ToString(); // // dataGridView1.Columns[i].Width = col_width[i]; //} //DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); //objAlternatingCellStyle.BackColor = Color.Khaki; //dataGridView1.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; }