Example #1
0
        private async Task Halfdays(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            year = activity.Text;

            var empID = context.UserData.GetValue <int>("empID");

            if (empID != null && empID != null)
            {
                var token = "ok";


                if (token == null)
                {
                    await context.PostAsync("Need to Login to access data");

                    // context.Call(new UserLogin(), ResumeAfteNullToken);
                    await context.PostAsync("Please Type **'Hello'** to Login ");

                    context.Done(true);
                }
                if (token != null)
                {
                    var Dimattendancemonthly        = new DimattendancemonthlyClient();
                    var DimattendancemonthlyDetails = await Dimattendancemonthly.DimattendancemonthlyDetails(token, empID, month, year);

                    if (DimattendancemonthlyDetails != null && DimattendancemonthlyDetails.ResponseJSON != null &&
                        DimattendancemonthlyDetails.ResponseJSON.PayrollMonth != null)
                    {
                        await context.PostAsync($"Your present days in payroll month {DimattendancemonthlyDetails.ResponseJSON.PayrollMonth}" +
                                                $" are {DimattendancemonthlyDetails.ResponseJSON.MissPunch} ");

                        context.Done(true);
                    }
                    else
                    {
                        await context.PostAsync("Data not found ");

                        context.Done(true);
                    }
                }
            }
            else
            {
                await context.PostAsync("Need to Login to access data");

                await context.PostAsync("Please Type **'Hello'** to Login ");

                context.Done(true);
            }
        }
        private async Task Halfdays(IDialogContext context, IAwaitable <object> result)
        {
            GetEmployeeId(context);
            var activity = await result as Activity;

            year = activity.Text;



            try
            {
                var Dimattendancemonthly        = new DimattendancemonthlyClient();
                var DimattendancemonthlyDetails = await Dimattendancemonthly.DimattendancemonthlyDetails(token, empID, month, year);

                if (DimattendancemonthlyDetails != null && DimattendancemonthlyDetails.ResponseJSON != null &&
                    DimattendancemonthlyDetails.ResponseJSON.PayrollMonth != null)
                {
                    await context.PostAsync($"Your Lop in payroll month {DimattendancemonthlyDetails.ResponseJSON.PayrollMonth}" +
                                            $" are {DimattendancemonthlyDetails.ResponseJSON.LOP_Absent} ");

                    //context.Call(new ResumeAfter(), this.ResumeAfterTaskDialog);
                    context.Done(true);
                }
                else
                {
                    await context.PostAsync("Data not found ");

                    context.Done(true);
                }
            }
            catch (Exception ex)
            {
                string        filePath = AppDomain.CurrentDomain.BaseDirectory;
                StringBuilder sb       = new StringBuilder();
                sb.Append("InnerException : " + ex.InnerException);
                sb.Append("LopDetails");
                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);
            }
        }
Example #3
0
        private async Task Halfdays(IDialogContext context, IAwaitable <object> result)
        {
            try
            {
                var activity = await result as Activity;
                year = activity.Text;
                var token = "ok";


                var empID = context.UserData.GetValue <string>("empID");

                var Dimattendancemonthly        = new DimattendancemonthlyClient();
                var DimattendancemonthlyDetails = await Dimattendancemonthly.DimattendancemonthlyDetails(token, Convert.ToInt32(empID), month, year);

                if (DimattendancemonthlyDetails != null && DimattendancemonthlyDetails.ResponseJSON != null &&
                    DimattendancemonthlyDetails.ResponseJSON.PayrollMonth != null)
                {
                    await context.PostAsync($"Your total gross hours in payroll month {DimattendancemonthlyDetails.ResponseJSON.PayrollMonth}" +
                                            $" are {DimattendancemonthlyDetails.ResponseJSON.TotalGrossHours} ");

                    context.Done(true);
                }
                else
                {
                    await context.PostAsync("Data not found ");

                    context.Done(true);
                }
            }
            catch (Exception ex)
            {
                string        filePath = AppDomain.CurrentDomain.BaseDirectory;
                StringBuilder sb       = new StringBuilder();
                sb.Append("InnerException : " + ex.InnerException);
                sb.Append("Total gross Hours");
                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);
            }
        }
Example #4
0
        private async Task Halfdays(IDialogContext context, IAwaitable <object> result)
        {
            try
            {
                var activity = await result as Activity;
                year = activity.Text;
                // StateClient stateClient = activity.GetStateClient();
                // BotData userData = await stateClient.BotState.GetUserDataAsync(activity.ChannelId, activity.From.Id);
                {
                    var token = "ok";


                    if (token == null)
                    {
                        await context.PostAsync("Need to Login to access data");

                        // context.Call(new UserLogin(), ResumeAfteNullToken);
                        await context.PostAsync("Please Type **'Hello'** to Login ");

                        context.Done(true);
                    }
                    if (token != null)
                    {
                        // StateClient empCode1 = activity.GetStateClient();
                        //  BotData empCodeu = await empCode1.BotState.GetUserDataAsync(activity.ChannelId, activity.From.Id);
                        //  var ob = JObject.Parse(empCodeu.Data.ToString());
                        //  var empID = (int)obj["empID"];
                        var empID = context.UserData.GetValue <int>("empID");
                        var Dimattendancemonthly        = new DimattendancemonthlyClient();
                        var DimattendancemonthlyDetails = await Dimattendancemonthly.DimattendancemonthlyDetails(token, empID, month, year);

                        if (DimattendancemonthlyDetails != null && DimattendancemonthlyDetails.ResponseJSON != null &&
                            DimattendancemonthlyDetails.ResponseJSON.PayrollMonth != null)
                        {
                            await context.PostAsync($"Your half days in payroll month {DimattendancemonthlyDetails.ResponseJSON.PayrollMonth}" +
                                                    $" are {DimattendancemonthlyDetails.ResponseJSON.HalfDay} ");

                            //context.Call(new ResumeAfter(), this.ResumeAfterTaskDialog);
                            context.Done(true);
                        }
                        else
                        {
                            await context.PostAsync("Data not found ");

                            context.Done(true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string filePath = AppDomain.CurrentDomain.BaseDirectory;
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("InnerException : " + ex.InnerException);
                sb.Append("Halfdays");
                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);
            }
        }