Beispiel #1
0
        public object[] SendRequestForVacations_ServerEvent(string sCategory, string sFrom, string sTo, string sRequested, string sYear)
        {
            object[] oReturn  = new object[4];
            string   mailList = "";

            try
            {
                DataSet ds = new DataSet();
                if (sTo == "")
                {
                    sTo = sFrom;
                }
                if ((sCategory == "1") || (sCategory == "7"))
                {
                    ds = CUserVacations.SetVacationRequest(CUserInfo.UserId, sFrom, sTo, Convert.ToInt32(sYear), Convert.ToInt32(sCategory));
                }
                else if (sCategory == "4")
                {
                    ds = CUserVacations.SetVacationRequest(CUserInfo.UserId, sFrom, sTo, DateTime.Now.Year, Convert.ToInt32(sCategory));
                }
                else if (sCategory == "6")
                {
                    ds = CUserVacations.SeUserCompensatoryDay(CUserInfo.UserId, sFrom, sTo, Convert.ToInt32(sYear));
                }
                string UserName = CUserInfo.FirstName + " " + CUserInfo.LastName;
                mailList = GetParentsLeaders(CUserInfo.SystemId, CUserInfo.UserId);
                string mailResult = CUserVacations.SendRequestVacationEmail(mailList, sFrom, sTo, sYear, sRequested, UserName, sCategory);
                oReturn[0] = "Done.";
                oReturn[1] = mailResult;
                oReturn[2] = CUser.GetUserVacationsAndDaysOff(CUserInfo.UserId, Convert.ToInt32(sYear));
                oReturn[3] = sCategory;
            }
            catch (Exception e)
            {
                oReturn[0] = null;
                oReturn[1] = "Error getting Company List.\n\n" + e.Message + "\n\nStack Trace:\n" + e.StackTrace;
            }
            return(oReturn);
        }