Exemplo n.º 1
0
        public Boolean ValidateLeaveType(Leave leave)
        {
            Regex   r    = new Regex("[a-zA-Z]");
            Boolean stat = true;

            try
            {
                if (leave.leaveID == "" || leave.leaveID.Trim().Length == 0)
                {
                    stat = false;
                }
                if (leave.description == "" || leave.description.Trim().Length == 0)
                {
                    stat = false;
                }
                if (leave.MaxAccrual <= 0 || r.IsMatch(leave.ahead.ToString()))
                {
                    stat = false;
                }
                if (leave.SanctionType == 0)
                {
                    stat = false;
                }
                if (leave.Gender == "" || leave.Gender.Trim().Length == 0)
                {
                    stat = false;
                }
                if (leave.ahead <= 0 || r.IsMatch(leave.ahead.ToString()))
                {
                    stat = false;
                }
            }
            catch (Exception ex)
            {
            }
            return(stat);
        }
Exemplo n.º 2
0
        public Boolean ValidateLeaveSanctionLimit(Leave leave)
        {
            Boolean stat = true;

            try
            {
                if (leave.leaveID == "" || leave.leaveID.Trim().Length == 0)
                {
                    stat = false;
                }
                if (leave.designation == "" || leave.designation.Trim().Length == 0)
                {
                    stat = false;
                }
                if (leave.MaxAccrual <= 0)
                {
                    stat = false;
                }
            }
            catch (Exception ex)
            {
            }
            return(stat);
        }
Exemplo n.º 3
0
        public Boolean validateLeaveType(Leave leave)
        {
            int     count  = 0;
            Boolean status = true;

            try
            {
                string        query = "select LeaveID from LeaveType where LeaveID='" + leave.leaveID + "'";
                SqlConnection conn  = new SqlConnection(Login.connString);
                SqlCommand    cmd   = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    status = false;
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 4
0
        public Boolean UpdateLeaveOfficeMapping(Leave leavesett)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "Update LeaveOfficeMapping set MaxDays='" + leavesett.MaxDays + "',OfficeID='" + leavesett.officeID + "' where LeaveID='" + leavesett.leaveID + "'and RowID='" + leavesett.rowid + "'";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "LeaveSanctionLimit", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }