private void btnDateSourceCancel_Click(object sender, EventArgs e) { mskDateSource.Text = System.IO.File.ReadAllText(Application.StartupPath + "\\DateSource.txt"); CLSValidityCheck.IsDate(mskDateSource); mskDateSource.ReadOnly = true; btnDateSourceCancel.Visible = false; DateSourceIsInUpdateMode = false; btnDateSourceUpdate.Image = Benis.Properties.Resources.Update_42; }
private void grdPayment_CellEndEdit(object sender, GridViewCellEventArgs e) { if (e.RowIndex != -1) { if (e.Column.Name == "Pay_Date") { if (!CLSValidityCheck.IsDate("13" + e.Value.ToString())) { grdPayment.Rows[e.RowIndex].Cells["Pay_Date"].Value = editingDate; MessageBox.Show("تاریخ وارد شده صحیح نیست"); } } } }
private void btnDateSourceUpdate_Click(object sender, EventArgs e) { if (!DateSourceIsInUpdateMode) { mskDateSource.ReadOnly = false; DateSourceIsInUpdateMode = true; btnDateSourceUpdate.Image = Benis.Properties.Resources.OK_42; btnDateSourceCancel.Visible = true; mskDateSource.Select(); mskDateSource.SelectAll(); } else { if (CLSValidityCheck.IsDate(mskDateSource) && mskDateSource.Value.ToString() != "") { if (Convert.ToInt16(mskDateSource.Text.Substring(6, 2)) == 1) { System.IO.File.WriteAllText(Application.StartupPath + "\\DateSource.txt", mskDateSource.Text.Trim()); mskDateSource.ReadOnly = true; DateSourceIsInUpdateMode = false; btnDateSourceCancel.Visible = false; btnDateSourceUpdate.Image = Benis.Properties.Resources.Update_42; lblUsageFromDate.Text = GetTermStart(Convert.ToInt16(lstTermNo.SelectedItem.Text)); lblUsageToDate.Text = GetTermStart(Convert.ToInt16(lstTermNo.SelectedItem.Text) + 1); } else { MessageBox.Show("مبدأ دوره بایستی از ابتدای ماه شروع گردد", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); } } else { MessageBox.Show("لطفاً یک مقدار معتبر برای تاریخ وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); } } }
private bool InsertUpdateAction() { if (CLSValidityCheck.IsInt(txtPayBalance) && CLSValidityCheck.IsDate(mskPayDate)) { string query = ""; if (modeIsUpdate) { query += "update tbl_payment set "; query += "Pay_Balance =" + txtPayBalance.Text.Trim() + ","; query += "Pay_Date = '" + (mskPayDate.Text.Trim()) + "'"; query += " where Cust_No = " + cmbCust.Text + " and Pay_Date = '" + original_Pay_Date + "' and Pay_Balance = " + original_Pay_Balance; } else { string Cntr_No = ""; try { Cntr_No = dataAccess.GetAccessDataSetByQuery("select Cntr_No from tbl_Cust where cust_No = " + cmbCust.Text).Tables[0].Rows[0]["Cntr_No"].ToString(); } catch { MessageBox.Show("مشتری با این شماره وجود ندارد", "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); return(false); } query += "insert into tbl_payment (cust_No,cntr_No,Pay_Date,Pay_Balance)"; query += " values (" + cmbCust.Text.Trim() + "," + Cntr_No + ",'" + mskPayDate.Text.Trim() + "'," + txtPayBalance.Text + ")"; } dataAccess.ExecuteAccess(query); if (!modeIsUpdate) { if (cmbCust.SelectedIndex < dtCust.Rows.Count - 1) { cmbCust.SelectedIndex++; } if (mskPayDate.Enabled) { mskPayDate.Select(); mskPayDate.SelectAll(); } else { txtPayBalance.Select(); txtPayBalance.SelectAll(); } } else { DialogResult = DialogResult.OK; //Close(); } } else { MessageBox.Show("لطفاً مقادیر وارد شده را تصحیح نمایید"); return(false); } return(true); }
private void mskPayDate_Leave(object sender, EventArgs e) { CLSValidityCheck.IsDate(mskPayDate); }