Exemple #1
0
        /// <summary>
        /// Saves the dashboard indicator data custom.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public int SaveDashboardIndicatorDataCustom(DashboardIndicatorData model)
        {
            var logId = model.CreatedBy;

            using (var rep = UnitOfWork.DashboardIndicatorDataRepository)
            {
                if (model.ID > 0)
                {
                    var current = rep.GetSingle(model.ID);
                    model.CreatedBy   = current.CreatedBy;
                    model.CreatedDate = current.CreatedDate;
                    model.CorporateId = current.CorporateId;

                    if (model.StatisticData == null)
                    {
                        model.StatisticData = "0.0000";
                    }
                    rep.UpdateEntity(model, model.ID);
                }
                else
                {
                    rep.Create(model);
                }

                /*rep.UpdateCalculativeIndicatorData(model.IndicatorNumber, Convert.ToString(model.CorporateId), Convert.ToString(model.FacilityId),
                 *  model.Year, model.ExternalValue1, Convert.ToString(logId), model.SubCategory1, model.SubCategory2);*/
                return(model.ID);
            }
        }
Exemple #2
0
        /// <summary>
        /// Add New or Update the DashboardIndicatorData based on if we pass the DashboardIndicatorData ID in the DashboardIndicatorDataViewModel object.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// returns the newly added or updated ID of DashboardIndicatorData row
        /// </returns>
        public ActionResult SaveDashboardIndicatorData(DashboardIndicatorData model)
        {
            var userId      = Helpers.GetLoggedInUserId();
            var currentDate = Helpers.GetInvariantCultureDateTime();
            var list        = new List <DashboardIndicatorDataCustomModel>();

            //Check if Model is not null
            if (model != null)
            {
                model.CorporateId = Helpers.GetSysAdminCorporateID();
                model.IsActive    = true;
                using (var bal = new DashboardIndicatorDataBal())
                {
                    if (model.ID == 0)
                    {
                        model.CreatedBy   = userId;
                        model.CreatedDate = currentDate;
                    }

                    //Call the AddDashboardIndicatorData Method to Add / Update current DashboardIndicatorData
                    list = bal.SaveDashboardIndicatorData(model);
                }
            }
            //Pass the ActionResult with List of DashboardIndicatorDataViewModel object to Partial View DashboardIndicatorDataList
            return(PartialView(PartialViews.DashboardIndicatorDataList, list));
        }
Exemple #3
0
 /// <summary>
 /// Sets the static budget target.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns></returns>
 public bool SetStaticBudgetTarget(DashboardIndicatorData model)
 {
     using (var rep = UnitOfWork.DashboardIndicatorDataRepository)
     {
         rep.SetStaticBudgetTarget(model.IndicatorNumber, Convert.ToString(model.CorporateId),
                                   Convert.ToString(model.FacilityId),
                                   model.Year, model.ExternalValue1, Convert.ToString(model.CreatedBy), model.SubCategory1,
                                   model.SubCategory2);
     }
     return(true);
 }
Exemple #4
0
 /// <summary>
 /// Updates the indicators data in manual dashboard.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns></returns>
 public bool UpdateIndicatorsDataInManualDashboard(DashboardIndicatorData model)
 {
     using (var rep = UnitOfWork.DashboardIndicatorDataRepository)
     {
         rep.UpdateCalculativeIndicatorData(model.IndicatorNumber, Convert.ToString(model.CorporateId),
                                            Convert.ToString(model.FacilityId),
                                            model.Year, model.ExternalValue1, Convert.ToString(model.CreatedBy), model.SubCategory1,
                                            model.SubCategory2);
     }
     return(true);
 }
Exemple #5
0
        /// <summary>
        /// Get the details of the current DashboardIndicatorData in the view model by ID
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="type"></param>
        /// <returns></returns>
        public JsonResult GetDashboardIndicatorDataDetails(int id, int type)
        {
            var model = new DashboardIndicatorData {
                IsActive = true, ID = 0
            };

            if (type == 1 && id > 0)
            {
                //Call the AddDashboardIndicatorData Method to Add / Update current DashboardIndicatorData
                using (var bal = new DashboardIndicatorDataBal())
                    model = bal.GetDashboardIndicatorDataById(id);
            }

            //Pass the ActionResult with the current DashboardIndicatorDataViewModel object as model to PartialView DashboardIndicatorDataAddEdit
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
        /// <summary>
        /// Method to add/Update the Entity in the database.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public List <DashboardIndicatorDataCustomModel> SaveDashboardIndicatorData(DashboardIndicatorData model)
        {
            using (var rep = UnitOfWork.DashboardIndicatorDataRepository)
            {
                if (model.ID > 0)
                {
                    var current = rep.GetSingle(model.ID);
                    model.CreatedBy   = current.CreatedBy;
                    model.CreatedDate = current.CreatedDate;
                    model.CorporateId = current.CorporateId;
                    rep.UpdateEntity(model, model.ID);
                }
                else
                {
                    rep.Create(model);
                }

                var list = GetDashboardIndicatorDataList(Convert.ToInt32(model.CorporateId), Convert.ToInt32(model.FacilityId));
                return(list);
            }
        }
        public void CheckActiveInactive()
        {
            model.IndicatorNumber = "227";
            model.CorporateId     = 12;
            model.FacilityId      = 17;
            model.IsActive        = 1;
            model.SubCategory1    = "0";
            model.SubCategory2    = "0";
            using (var dashbal = new DashboardIndicatorsBal())
            {
                //dashbal.MakeIndicatorInActive(model);

                using (var mBal = new ManualDashboardBal())
                {
                    IEnumerable <DashboardIndicatorData> mList
                        = mBal.GetIndicatorsDataForIndicatorNumber(Convert.ToInt32(model.CorporateId), Convert.ToInt32(model.FacilityId),
                                                                   "2016", model.IndicatorNumber, "1", "0", "0");
                    Assert.IsNotNull(mList);

                    dashbal.UpdateIndicatorsOtherDetail(model);

                    IEnumerable <DashboardIndicatorData> mList1
                        = mBal.GetIndicatorsDataForIndicatorNumber(Convert.ToInt32(model.CorporateId), Convert.ToInt32(model.FacilityId),
                                                                   "2016", model.IndicatorNumber, "1", "0", "0");

                    DashboardIndicatorData dashboardObj = mList.FirstOrDefault();
                    if (dashboardObj != null)
                    {
                        Assert.AreEqual(dashboardObj.IsActive, false);
                    }
                    model.IsActive = 0;
                    dashbal.UpdateIndicatorsOtherDetail(model);
                    //if (Convert.ToBoolean(mList.))
                    // {
                    //     model.IsActive = 1;
                    //     dashbal.MakeIndicatorInActive(model);
                    // }
                }
            }
        }