Exemplo n.º 1
0
        //This procedures calculate MonthEnd Balance Movements to the Correct Period
        public JsonResult OnPostAccBalanceUpdate([FromBody] ActCostPeriod ActCostPeriod)
        {
            string PeriodNo = ActCostPeriod.Period;

            if (HttpContext.User.IsInRole("Admin"))
            {
                if (!PeriodExists(PeriodNo))
                {
                    return(new JsonResult("This period does not exist. Update not Run"));
                }
                try
                {
                    _context.Database.ExecuteSqlCommand("Step3_AccBalanceMovementUpdate");
                    return(new JsonResult("Balance Movements Updated Successfully for " + ActCostPeriod.Period));
                }
                catch (DbUpdateConcurrencyException e)
                {
                    return(new JsonResult("Update not run. Error Message is: " + e.InnerException.Message));
                }
            }
            return(new JsonResult("You do not rights to run this update"));
        }
Exemplo n.º 2
0
        //This procedures Archives the Employee Table for the Correct Period
        public JsonResult OnPostEmloyeeUpdate([FromBody] ActCostPeriod ActCostPeriod)
        {
            string PeriodNo = ActCostPeriod.Period;

            if (HttpContext.User.IsInRole("Admin"))
            {
                if (!PeriodExists(PeriodNo))
                {
                    return(new JsonResult("This period does not exist. Update not Run"));
                }
                try
                {
                    _context.Database.ExecuteSqlCommand("Step2_EmployeeArchive @p0",
                                                        parameters: new[] { PeriodNo });
                    return(new JsonResult("Employee Table Archived Updated Successfully for " + ActCostPeriod.Period));
                }
                catch (DbUpdateConcurrencyException e)
                {
                    return(new JsonResult("Update not run. Error Message is: " + e.InnerException.Message));
                }
            }
            return(new JsonResult("You do not rights to run this update"));
        }