Click here to Skip to main content
15,885,216 members

Comments by pankajgarg1986 (Top 32 by date)

pankajgarg1986 16-Sep-16 7:47am View    
Deleted
my code for it
 public bool CheckLeaveStatus(int empid, DateTime date)
    {
        bool temp = false;
        int totalleave = 0;
        string qry = "select joining from profile where profileid=@id";
        MySqlParameter idP = new MySqlParameter("@id", empid);
        DataRow dr = MySqlHelper.ExecuteDataRow(Common.GetConnectionString(), qry, idP);
        if (dr != null)
        {
            DateTime joiningdate = Convert.ToDateTime(dr["joining"]);
            int legaldate = joiningdate.Day;
            if (legaldate <= 15)
            {
                totalleave += 2;
            }
            else
            {
                totalleave += 0;
            }
            //TimeSpan t1 = date - joiningdate;
            int monthspassed = Common.MonthDifference(date, joiningdate);
            if (monthspassed > 3)//then he is allowd to take leave
            {
                int startmonth = joiningdate.Month + 1;
                int endmonth = date.Month;
                int monthdiffernce = endmonth - startmonth;
                if (monthdiffernce > 24)
                {
                    monthdiffernce = 24;
                }
                int leaves = (monthdiffernce) * 2;
                int allowedleaves = leaves + totalleave;
                int availablelaves = allowedleaves - LeaveTaken(empid);
                if (availablelaves > 0)
                {
                    temp = true;
                }
            }
            DateTime previousdate = date.AddYears(-2);
        }
        return temp;
    }
    public void AddLeaves(int empid, DateTime date, string status)
    {
        if (status == "L")
        {
            string qry = "insert into leavestatus(empid,takenon)values(@empid,@takenon)";
            MySqlParameter idP = new MySqlParameter("@empid", empid);
            MySqlParameter takenonP = new MySqlParameter("@takenon", date);
            MySqlParameter[] p = { idP, takenonP };
            MySqlHelper.ExecuteNonQuery(Common.GetConnectionString(), qry, p);
        }
    }

pankajgarg1986 16-Sep-16 5:38am View    
i don't have idea pls suggest
pankajgarg1986 16-Sep-16 5:22am View    
every month employee can take 2 leaves and in a month if he takes less than 2 leaves suppose 1 then 1 leave is remaining this leave is valid for two years.he can take this leaves + 2 leaves in next months and so on. but these carry forward leaves can't be used after two years passed.
pankajgarg1986 16-Sep-16 4:51am View    
how can i calculate two years passed and employee can use not taken leave up to 2 years after that all leaves lapsed not carry forward.
pankajgarg1986 16-Sep-16 2:51am View    
i am using sql server with asp .net c#