/// <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 SaveDashboardIndicators(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; // } //} list = bal.SaveDashboardIndicators(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); } bal.UpdateIndicatorsOtherDetail(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)); }