Ejemplo n.º 1
0
 private void FrmAdvanceAddEdit_Load(object sender, EventArgs e)
 {
     SetMyControls();
     if (S1 == "&Add")
     {
         DtDate.Enabled           = false;
         DtDate.EditValue         = DateTime.Now;
         DtDateforMonth.EditValue = DateTime.Now;
         txtAdvanceNo.Text        = GetNewLoanPassNo().PadLeft(6, '0');
         txtType.Text             = "A";
         DtDateforMonth.Focus();
     }
     if (S1 == "Edit")
     {
         DtDate.Enabled  = false;
         txtType.Enabled = false;
         txtEmpCode.Focus();
         var ds = ProjectFunctions.GetDataSet(" SELECT     ExMst.ExNo, ExMst.ExId, ExMst.ExDate, ExMst.ExEmpCode, ExMst.ExAmt, ExMst.ExTag, ExMst.ExDatePost, empmst.EmpName FROM ExMst LEFT OUTER JOIN empmst ON ExMst.ExEmpCode = empmst.EmpCode WHERE ExId='" + ExId + "'");
         txtAdvanceNo.Text        = ds.Tables[0].Rows[0]["ExNo"].ToString();
         DtDate.EditValue         = Convert.ToDateTime(ds.Tables[0].Rows[0]["ExDate"]);
         DtDateforMonth.EditValue = Convert.ToDateTime(ds.Tables[0].Rows[0]["ExDatePost"]);
         txtEmpCode.Text          = ds.Tables[0].Rows[0]["ExEmpCode"].ToString();
         txtEmpCodeDesc.Text      = ds.Tables[0].Rows[0]["EmpName"].ToString();
         txtType.Text             = ds.Tables[0].Rows[0]["ExTag"].ToString();
         txtAmount.Text           = ds.Tables[0].Rows[0]["ExAmt"].ToString();
     }
 }
Ejemplo n.º 2
0
        private bool ValidateData()
        {
            if (DtDate.Text.Trim().Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid Date");
                DtDate.Focus();
                return(false);
            }
            if (DtDateforMonth.Text.Trim().Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid Date Of Month");
                DtDateforMonth.Focus();
                return(false);
            }
            if (txtEmpCode.Text.Trim().Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid EmpName");
                txtEmpCode.Focus();
                return(false);
            }
            if (txtEmpCodeDesc.Text.Trim().Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid EmpName");
                txtEmpCode.Focus();
                return(false);
            }

            if (txtAmount.Text.Length == 0)
            {
                txtAmount.Text = "0";
            }

            if (txtType.Text == "A" || txtType.Text == "C" || txtType.Text == "F")
            {
            }
            else
            {
                ProjectFunctions.SpeakError("Valid Values are Advance(A),Fine(F),Coupon(C)");
                txtType.Focus();
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        private bool ValidateData()
        {
            if (DtDate.Text.Trim().Length == 0)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Invalid Date", "Save", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                DtDate.Focus();
                return(false);
            }
            if (Convert.ToDateTime(DtDate.Text).Date > DateTime.Now.Date)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Wrong Date Selected", "Save", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                DtDate.Focus();
                return(false);
            }
            if (DtDateforMonth.Text.Trim().Length == 0)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Invalid Date Of Month", "Save", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                DtDateforMonth.Focus();
                return(false);
            }
            if (txtEmpCode.Text.Trim().Length == 0)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Invalid EmpName", "Save", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                txtEmpCode.Focus();
                return(false);
            }
            if (txtEmpCodeDesc.Text.Trim().Length == 0)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Invalid EmpName", "Save", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                txtEmpCode.Focus();
                return(false);
            }
            if (S1 == "Add")
            {
                DataSet ds = ProjectFunctions.GetDataSet("Select * from ExMst Where ExEmpCode='" + txtEmpCode.Text + "' And ExDate='" + Convert.ToDateTime(DtDate.Text).ToString("yyyy-MM-dd") + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("Advance Already Feeded", "Save", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    txtEmpCode.Focus();
                    return(false);
                }
            }

            if (txtAmount.Text.Length == 0)
            {
                txtAmount.Text = "0";
            }
            if (txtSalary.Text.Length == 0)
            {
                txtSalary.Text = "0";
            }

            if (txtType.Text == "A" || txtType.Text == "C" || txtType.Text == "F" || txtType.Text == "L" | txtType.Text == "T")
            {
            }
            else
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Valid Values are Advance(a),Fine(F),Coupon(C),Lunch(L),Telephone(T)", "Save", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                txtType.Focus();
                return(false);
            }

            return(true);
        }