Beispiel #1
0
        public string UpdateLeaveBalance(List <EmployeeLeaveBalanceDetails> lstEmployeeLeaveBalanceDetails, bool isElCredit = false, bool isServiceCall = false)
        {
            string result      = "";
            long   LoginUserId = 0;

            try
            {
                using (var client = new EmployeeLeaveBalanceClient())
                {
                    if (isServiceCall == false)
                    {
                        LoginUserId = this.UserId;
                    }
                    else
                    {
                        LoginUserId = 0;
                    }
                    result = client.UpdateLeaveBalance(lstEmployeeLeaveBalanceDetails, LoginUserId, isElCredit);
                }

                EmailHelper emailHelper = new EmailHelper();
                try
                {
                    emailHelper.SendEmailforAddLeave(lstEmployeeLeaveBalanceDetails);
                }
                catch { }
            }
            catch
            {
                throw;
            }
            return(result);
        }
Beispiel #2
0
        public ActionResult EmployeeLeaveBalanceDetails(Int64 UserId)
        {
            IList <LeaveBalanceEmpProfile> lstProfile = new List <LeaveBalanceEmpProfile>();

            using (var client = new EmployeeLeaveBalanceClient())
            {
                lstProfile = client.GetLeaveBalanceEmpProfile(UserId);
            }

            return(PartialView("EmployeeLeaveBalanceProfilePartial", lstProfile));
        }
        public async Task Leave_Balance(IDialogContext context, IAwaitable <object> results, LuisResult result)
        {
            try
            {
                var activity = await results as Activity;
                GetEmployeeId(context);
                var employee_leave_balance          = new EmployeeLeaveBalanceClient();
                var employee_leave_balance_response = await employee_leave_balance.EmployeeLeaveBalanceDetails(token, Convert.ToInt32(empID));

                if (employee_leave_balance_response.ResponseJSON != null && employee_leave_balance_response != null && employee_leave_balance_response.ResponseJSON.Count != 0)
                {
                    List <EmployeeLeaveBalance> data = employee_leave_balance_response.ResponseJSON;
                    List <string> values             = new List <string>();
                    foreach (var dataresp in data)
                    {
                        values.Add("**Leave-Category**" + "---" + dataresp.LeaveCategoryName);
                        values.Add("**Balance**" + "---" + dataresp.ClosingBalance);
                        values.Add("------------------------------------------");
                        values.Add("------------------------------------------");
                    }
                    string employee_leave_balance_list_value = string.Join("<br/>\r\n", values);
                    await context.PostAsync(employee_leave_balance_list_value);

                    context.Done(true);
                }
                else
                {
                    await context.PostAsync("Data not found");
                }
            }
            catch (Exception ex)
            {
                string        filePath = AppDomain.CurrentDomain.BaseDirectory;
                StringBuilder sb       = new StringBuilder();
                sb.Append("InnerException : " + ex.InnerException);
                sb.Append("Leave_Balance");
                sb.Append(Environment.NewLine);
                sb.Append("Message : " + ex.Message);
                sb.Append(Environment.NewLine);
                System.IO.File.AppendAllText(System.IO.Path.Combine(filePath, "Exception_log.txt"), sb.ToString());
                sb.Clear();
                await context.PostAsync("Data not found");

                context.Done(true);
            }
        }
        private async Task DisplayHelpSelection(IDialogContext context, IAwaitable <HelpFormFlow> result)
        {
            var selection = await result;

            switch (selection.helpType.ToString())
            {
            case "List_of_Holidays":
            {
                this.GetEmployeeId(context);
                try
                {
                    var all_holiday_details = new AllHolidaysClient();
                    var holiday_response    = await all_holiday_details.AllHolidaysDetails(token, Convert.ToInt32(this.empID));

                    if (holiday_response != null && holiday_response.ResponseJSON != null)
                    {
                        List <HolidayList> data   = holiday_response.ResponseJSON;
                        List <string>      values = new List <string>();

                        foreach (var dataresp in data)
                        {
                            values.Add("**Holiday Name**" + ":::" + dataresp.HolidayName);
                            values.Add("**Holiday Date**" + ":::" + dataresp.ObservingDate.ToLongDateString());
                            values.Add("------------------------------------------");
                            values.Add("------------------------------------------");
                        }
                        string all_holiday_list_value = string.Join("<br/>\r\n", values);
                        await context.PostAsync(all_holiday_list_value);

                        context.Call(new ResumeAfter(), this.ResumeAfterTaskDialog);
                    }
                }
                catch (Exception ex)
                {
                    string        filePath = AppDomain.CurrentDomain.BaseDirectory;
                    StringBuilder sb       = new StringBuilder();
                    sb.Append("InnerException : " + ex.InnerException);
                    sb.Append("All_Holidays");
                    sb.Append(Environment.NewLine);
                    sb.Append("Message : " + ex.Message);
                    sb.Append(Environment.NewLine);
                    System.IO.File.AppendAllText(System.IO.Path.Combine(filePath, "Exception_log.txt"), sb.ToString());
                    sb.Clear();
                    await context.PostAsync("Data not found");

                    context.Done(true);
                }
            }
            break;

            case "Profile":
                context.Call(new Profile(), this.ResumeAfterTaskDialog);
                break;

            case "Working_Hours":
                context.Call(new WorkTime(), this.ResumeAfterTaskDialog);
                break;

            case "Apply_for_leave":
                context.Call(new ApplyingLeave(), this.ResumeAfterTaskDialog);
                break;

            case "Leave_Balance":
                try
                {
                    GetEmployeeId(context);
                    var employee_leave_balance          = new EmployeeLeaveBalanceClient();
                    var employee_leave_balance_response = await employee_leave_balance.EmployeeLeaveBalanceDetails(token, Convert.ToInt32(empID));

                    if (employee_leave_balance_response.ResponseJSON != null && employee_leave_balance_response != null && employee_leave_balance_response.ResponseJSON.Count != 0)
                    {
                        List <EmployeeLeaveBalance> data = employee_leave_balance_response.ResponseJSON;
                        List <string> values             = new List <string>();
                        foreach (var dataresp in data)
                        {
                            values.Add("**Leave-Category**" + "---" + dataresp.LeaveCategoryName);
                            values.Add("**Balance**" + "---" + dataresp.ClosingBalance);
                            values.Add("------------------------------------------");
                            values.Add("------------------------------------------");
                        }
                        string employee_leave_balance_list_value = string.Join("<br/>\r\n", values);
                        await context.PostAsync(employee_leave_balance_list_value);

                        context.Done(true);
                    }
                    else
                    {
                        await context.PostAsync("Data not found");
                    }
                }
                catch (Exception ex)
                {
                    string        filePath = AppDomain.CurrentDomain.BaseDirectory;
                    StringBuilder sb       = new StringBuilder();
                    sb.Append("InnerException : " + ex.InnerException);
                    sb.Append("Leave_Balance");
                    sb.Append(Environment.NewLine);
                    sb.Append("Message : " + ex.Message);
                    sb.Append(Environment.NewLine);
                    System.IO.File.AppendAllText(System.IO.Path.Combine(filePath, "Exception_log.txt"), sb.ToString());
                    sb.Clear();
                    await context.PostAsync("Data not found");

                    context.Done(true);
                }
                break;

            case "Attendance_Details":
                context.Call(new AttendanceDetails(), this.ResumeAfterTaskDialog);
                break;

            case "Apply_for_tour":
                try
                {
                    GetEmployeeId(context);
                    var Lkp_Code_LeaveEncashment = "TOUR";
                    var employee_eligibility_leave_encashment = new EmployeeEligibilityClient();
                    var employee_eligibility_response         = await employee_eligibility_leave_encashment.EmployeeEligibilityDetails(token, Convert.ToInt32(empID), Lkp_Code_LeaveEncashment);

                    if (employee_eligibility_response != null && employee_eligibility_response.ResponseJSON != null && employee_eligibility_response.ResponseJSON.LkpCode != null)
                    {
                        await context.PostAsync($"You Are Eligible for {employee_eligibility_response.ResponseJSON.LkpCode} according to policy ' {employee_eligibility_response.ResponseJSON.PolicyName}' ");

                        context.Call(new Tour(), this.ResumeAfterTaskDialog);
                    }
                    else
                    {
                        await context.PostAsync("You are not eligible");
                    }
                }
                catch (Exception ex)
                {
                    string        filePath = AppDomain.CurrentDomain.BaseDirectory;
                    StringBuilder sb       = new StringBuilder();
                    sb.Append("InnerException : " + ex.InnerException);
                    sb.Append("Apply Leave");
                    sb.Append(Environment.NewLine);
                    sb.Append("Message : " + ex.Message);
                    sb.Append(Environment.NewLine);
                    System.IO.File.AppendAllText(System.IO.Path.Combine(filePath, "Exception_log.txt"), sb.ToString());
                    sb.Clear();
                    await context.PostAsync("Data not found");

                    context.Done(true);
                }
                break;

            case "Payslip":
                context.Call(new Payroll(), this.ResumeAfterTaskDialog);
                break;
            }
        }