Example #1
0
        public Boolean insertLeaveCompOff(leavecompoff lco)
        {
            Boolean status    = true;
            string  utString  = "";
            string  updateSQL = "";

            try
            {
                updateSQL = "insert into LeaveEarning (EmployeeID,LeaveID,Date,Status,CreateTime,CreateUser)" +
                            "values (" +
                            "'" + lco.EmployeeID + "'," +
                            "'CO','" +
                            lco.cdate + "'," + 1 + "," +
                            "GETDATE()" + "," +
                            "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "LeaveEarning", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Example #2
0
        public List <leavecompoff> getLeaveOBDetails(int empid)
        {
            leavecompoff        lob;
            List <leavecompoff> lobList = new List <leavecompoff>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = " select a.RowID,a.LeaveID,a.Date " +
                                      ",a.Status from LeaveEarning a" +
                                      "  where a.EmployeeID='" + empid + "' and a.Status=1 order by Createtime desc";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    lob         = new leavecompoff();
                    lob.RowID   = reader.GetInt32(0);
                    lob.LeaveID = reader.GetString(1);
                    lob.cdate   = reader.GetDateTime(2);
                    //lob.LeaveStatus = reader.GetInt32(3);
                    lob.Status = reader.GetInt32(3);
                    lobList.Add(lob);
                }
                conn.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error querying leavecompoff Data");
            }
            return(lobList);
        }