Exemplo n.º 1
0
 public BudgetDetails GetListOfCostCodeAfterTransferBudgetDetails(long?LocationId, long?UserId, int?pageIndex, int?numberOfRows, string sortColumnName, string sortOrderBy, long?locationId, string textSearch, string statusType)
 {
     try
     {
         var db = new workorderEMSEntities();
         var objBudgetDetails = new BudgetDetails();
         int pageindex        = Convert.ToInt32(pageIndex) - 1;
         int pageSize         = Convert.ToInt32(numberOfRows);
         var Results          = new List <BudgetForLocationModel>();
         var obj      = new BudgetForLocationModel();
         var DataGrid = db.spGetBudgetCostCodeMapping(LocationId).Select(a => new BudgetForLocationModel()
         {
             CostCode        = a.CLM_CCD_CostCode,
             AssignedAmount  = a.BCM_BudgetAmount,
             Description     = a.CCD_Description,
             AssignedPercent = a.BCM_BudgetPercent,
             RemainingAmount = a.BCM_BalanceAmount,
             Year            = a.BCM_BudgetYear,
             BudgetAmount    = a.BLM_BudgetAmount,
             BCM_Id          = a.BCM_Id,
             CLM_Id          = a.CLM_Id,
             BudgetStatus    = "O",
             BudgetSource    = a.BCM_BudgetSource
         }).ToList();
         Results = DataGrid.Where(a => a.BudgetSource != "BUDGETED" && a.BudgetSource != null).ToList();
         int totRecords = Results.Count();
         var totalPages = (int)Math.Ceiling((float)totRecords / (float)numberOfRows);
         //Results = Results.OrderByDescending(s => s.CostCode);
         objBudgetDetails.pageindex = pageindex;
         objBudgetDetails.total     = totalPages;
         objBudgetDetails.records   = totRecords;
         objBudgetDetails.rows      = Results.ToList();
         return(objBudgetDetails);
     }
     catch (Exception ex)
     {
         Exception_B.Exception_B.exceptionHandel_Runtime(ex, "public BudgetDetails GetListBudgetDetails(long? LocationId, long? UserId, int? pageIndex, int? numberOfRows, string sortColumnName, string sortOrderBy, long? locationId, string textSearch, string statusType)", "Exception While Getting List of Cost Code.", null);
         throw;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Created By : Ashwajit Bansod
        /// Created For : To Save Transfer amount of cost code to database
        /// Created Date : Aug-28-2018
        /// </summary>
        /// <param name="objBudgetForLocationModel"></param>
        /// <returns></returns>
        public bool SaveTransferAmount(BudgetForLocationModel objBudgetForLocationModel)
        {
            bool   IsSaved = false;
            string Action  = "";

            try
            {
                if (objBudgetForLocationModel.LocationId > 0 && objBudgetForLocationModel.BudgetAmount > 0 && objBudgetForLocationModel.Year > 0)
                {
                    if (objBudgetForLocationModel.BudgetSource == "OVERDUE")
                    {
                        Action = "O";
                    }
                    if (objBudgetForLocationModel.BudgetSource == "INTRA")
                    {
                        Action = "I";
                    }
                    if (objBudgetForLocationModel.BudgetSource == "TRANSFERED")
                    {
                        Action = "T";
                    }
                    var savedData = _workorderems.spSetBudgetCostCodeMappingForTransfer(Action, objBudgetForLocationModel.BCM_Id, objBudgetForLocationModel.CLM_Id,
                                                                                        objBudgetForLocationModel.BCM_CLM_TransferId,
                                                                                        objBudgetForLocationModel.AssignedPercent, objBudgetForLocationModel.BudgetAmount,
                                                                                        objBudgetForLocationModel.BudgetSource, objBudgetForLocationModel.Year);
                    IsSaved = true;
                }
                else
                {
                    IsSaved = false;
                }
            }
            catch (Exception ex)
            {
                Exception_B.Exception_B.exceptionHandel_Runtime(ex, "public bool SaveCostCodeTransferAmount(BudgetForLocationModel objBudgetForLocationModel)", "Exception While saving Budget Amount to transfer to cost code.", null);
                throw;
            }
            return(IsSaved);
        }