/// <summary>
        /// Method to add/Update the Entity in the database.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public List <DashboardIndicatorsCustomModel> SaveDashboardIndicatorsV1(DashboardIndicators model)
        {
            var currentDateTime = GetInvariantCultureDateTime(Convert.ToInt32(model.FacilityId));

            using (var rep = UnitOfWork.DashboardIndicatorsRepository)
            {
                var type = "n";
                if (model.IndicatorID > 0)
                {
                    var current = rep.GetSingle(model.IndicatorID);
                    model.CreatedBy   = current.CreatedBy;
                    model.CreatedDate = current.CreatedDate;
                    //model.ExternalValue3 = current.ExternalValue3;
                    model.CorporateId = current.CorporateId;
                    type = "u";
                    rep.UpdateEntity(model, model.IndicatorID);
                }
                else
                {
                    type = "n";
                    rep.Create(model);
                }

                rep.CreateDashboardStructureV1(Convert.ToInt32(model.CorporateId), model.IndicatorNumber,
                                               model.SubCategory1, model.SubCategory2, currentDateTime.Year, model.ExpressionValue, type);

                var list = new List <DashboardIndicatorsCustomModel>();// GetDashboardIndicatorsListByCorporate(Convert.ToInt32(model.CorporateId), Convert.ToInt32(model.FacilityId));
                return(list);
            }
        }
 /// <summary>
 /// Deletes the indicator.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns></returns>
 public bool DeleteIndicator(DashboardIndicators model)
 {
     using (var rep = UnitOfWork.DashboardIndicatorsRepository)
     {
         rep.UpdateEntity(model, model.IndicatorID);
         return(true);
     }
 }
        /// <summary>
        /// Add New or Update the DashboardIndicators based on if we pass the DashboardIndicators ID in the DashboardIndicatorsViewModel object.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// returns the newly added or updated ID of DashboardIndicators row
        /// </returns>
        public ActionResult SaveDashboardIndicatorsV1(DashboardIndicators model)
        {
            var userId      = Helpers.GetLoggedInUserId();
            var currentDate = Helpers.GetInvariantCultureDateTime();
            var list        = new List <DashboardIndicatorsCustomModel>();

            //Check if Model is not null
            if (model != null)
            {
                model.CorporateId = Helpers.GetSysAdminCorporateID();
                using (var bal = new DashboardIndicatorsBal())
                {
                    if (model.IndicatorID == 0)
                    {
                        model.CreatedBy   = userId;
                        model.CreatedDate = currentDate;
                    }
                    using (var dashboardIndicatorDataBal = new DashboardIndicatorDataBal())
                    {
                        switch (model.IsActive)
                        {
                        case 0:
                            dashboardIndicatorDataBal.BulkInactiveDashboardIndicatorData(model.IndicatorNumber,
                                                                                         Helpers.GetSysAdminCorporateID());
                            break;

                        default:
                            dashboardIndicatorDataBal.BulkActiveDashboardIndicatorData(model.IndicatorNumber,
                                                                                       Helpers.GetSysAdminCorporateID());
                            break;
                        }
                    }
                    using (var oDashboardIndicatorDataBal = new DashboardIndicatorDataBal())
                    {
                        oDashboardIndicatorDataBal.GenerateIndicatorEffects(model);
                    }
                    list = bal.SaveDashboardIndicatorsV1(model);

                    //Add by shashank to check the Special case for the Indicator i.e. is the Target/Budget is static for indicator
                    //.... Should only Call for Dashboard type = Budget (Externalvalue1='1')
                    if (!string.IsNullOrEmpty(model.IndicatorNumber) && model.ExternalValue4.ToLower() == "true")
                    {
                        using (var ibal = new DashboardIndicatorDataBal())
                            ibal.SetStaticBudgetTargetIndciators(model);
                    }
                    using (var oDashboardIndicatorDataBal = new DashboardIndicatorDataBal())
                    {
                        oDashboardIndicatorDataBal.GenerateIndicatorEffects(model);
                        oDashboardIndicatorDataBal.UpdateCalculateIndicatorUpdate(model);
                    }
                    //Call the AddDashboardIndicators Method to Add / Update current DashboardIndicators
                    var orderByExpression = HtmlExtensions.GetOrderByExpression <DashboardIndicatorsCustomModel>("Dashboard");
                    list = HtmlExtensions.OrderByDir <DashboardIndicatorsCustomModel>(list, "ASC", orderByExpression);
                }
            }
            //Pass the ActionResult with List of DashboardIndicatorsViewModel object to Partial View DashboardIndicatorsList
            return(PartialView(PartialViews.DashboardIndicatorsList, list));
        }
 public bool UpdateIndicatorsOtherDetail(DashboardIndicators model)
 {
     using (var rep = UnitOfWork.DashboardIndicatorsRepository)
     {
         var result = rep.MakeIndicatorInActive(Convert.ToInt32(model.CorporateId), Convert.ToInt32(model.IsActive), model.IndicatorNumber, Convert.ToInt32(model.FacilityId),
                                                model.SubCategory1, model.SubCategory2);
         return(result);
     }
 }
Beispiel #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool GenerateIndicatorEffects(DashboardIndicators model)
 {
     using (var rep = UnitOfWork.DashboardIndicatorDataRepository)
     {
         rep.GenerateIndicatorEffects(Convert.ToString(model.CorporateId),
                                      Convert.ToString(model.IndicatorNumber));
     }
     return(true);
 }
Beispiel #6
0
        /// <summary>
        /// Sets the static budget target.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public bool SetStaticBudgetTargetIndciators(DashboardIndicators model)
        {
            var currentDateTime = GetInvariantCultureDateTime(Convert.ToInt32(model.FacilityId));

            using (var rep = UnitOfWork.DashboardIndicatorDataRepository)
            {
                rep.SetStaticBudgetTarget(model.IndicatorNumber, Convert.ToString(model.CorporateId),
                                          Convert.ToString(model.FacilityId),
                                          currentDateTime.Year.ToString(), "1", Convert.ToString(model.CreatedBy), model.SubCategory1,
                                          model.SubCategory2);
            }
            return(true);
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateCalculateIndicatorUpdate(DashboardIndicators model)
        {
            var currentDateTime = GetInvariantCultureDateTime(Convert.ToInt32(model.FacilityId));

            using (var rep = UnitOfWork.DashboardIndicatorDataRepository)
            {
                for (int i = 1; i <= 2; i++)
                {
                    rep.UpdateCalculateIndicatorUpdate(Convert.ToString(model.CorporateId),
                                                       Convert.ToString(model.FacilityId), model.IndicatorNumber, i.ToString(), currentDateTime.Year.ToString(),
                                                       model.SubCategory1, model.SubCategory2);
                }
            }
            return(true);
        }
        /// <summary>
        /// Method to add/Update the Entity in the database.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public List <DashboardIndicatorsCustomModel> SaveDashboardIndicators(DashboardIndicators model)
        {
            var currentDateTime = GetInvariantCultureDateTime(Convert.ToInt32(model.FacilityId));

            using (var rep = UnitOfWork.DashboardIndicatorsRepository)
            {
                if (model.IndicatorID > 0)
                {
                    var current = rep.GetSingle(model.IndicatorID);
                    model.CreatedBy   = current.CreatedBy;
                    model.CreatedDate = current.CreatedDate;
                    //model.ExternalValue3 = current.ExternalValue3;
                    model.CorporateId = current.CorporateId;
                    rep.UpdateEntity(model, model.IndicatorID);
                }
                else
                {
                    rep.Create(model);

                    /*
                     * The below Method is called twice.
                     * Firstly for THE CURRENT YEAR, it is putting data for the new indicator in DashboardIndicatorData and ManualDashboard
                     * Secondly for THE PREVIOUS YEAR, doing the same.
                     */
                    rep.CreateDashboardStructure(Convert.ToInt32(model.CorporateId), model.IndicatorNumber,
                                                 model.SubCategory1, model.SubCategory2, currentDateTime.Year);

                    //The below for the data entries for the previous year.
                    rep.CreateDashboardStructure(Convert.ToInt32(model.CorporateId), model.IndicatorNumber,
                                                 model.SubCategory1, model.SubCategory2, currentDateTime.Year - 1);
                }

                //rep.CreateDashboardStructure(Convert.ToInt32(model.CorporateId), model.IndicatorNumber,
                //    model.SubCategory1, model.SubCategory2, DateTime.Now.Year, model.ExpressionValue,type);

                var list = new List <DashboardIndicatorsCustomModel>();// GetDashboardIndicatorsListByCorporate(Convert.ToInt32(model.CorporateId), Convert.ToInt32(model.FacilityId));
                return(list);
            }
        }
Beispiel #9
0
        private void UpdateFilteredData()
        {
            if (IndicatorCollection == null)
            {
                IndicatorCollection = new DashboardIndicators();
            }
            else
            {
                IndicatorCollection.Clean();
            }

            var statistics = StorageModel.GetFilteredCashPlayerStatistic();

            if (statistics == null)
            {
                return;
            }

            IndicatorCollection.UpdateSource(statistics);

            RaisePropertyChanged(nameof(IndicatorCollection));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CorporateTest"/> class.
 /// </summary>
 public DashboardIndicatorsTest()
 {
     model = new DashboardIndicators();
 }