public ActionResult NotificationSettings(int PropID = 0, string PropName = "") { if (Session["CustomerID"] != null && (int)Session["CustomerID"] != 0) { if (PropID != 0) { Session["SelectedPropertyID"] = PropID; Session["SelectedProperty"] = PropName; } if (Nmv == null) { Nmv = new Models.NotificationSettingsViewModels(); //get the settings Nmv.NotificationSettingObj.UnitID = (int)Session["SelectedPropertyID"]; Nmv.NotificationSettingObj.CustomerID = (int)Session["CustomerID"]; Nmv.NotificationSettingObj.GetNotificationSettings(GlobalVariables.GetConnection()); } if (Session["SelectedPropertyID"] != null && (int)Session["SelectedPropertyID"] != 0) { return(View(Nmv)); } else { Nmv.PropListViewModel = new Models.ServiceChargeBudgetViewModel(); Nmv.PropListViewModel.PropertyList = Models.PropertyMethods.GetAllOwnedProperties((int)Session["CustomerID"]); //vm.ViewName = "InsurancesView"; //vm.ControllerName = "PropertyDetails"; return(View(Nmv)); } //return View(Nmv); } else { return(View("NotLoggedIn")); } }
public ActionResult UpdateNotificationSettings(Models.NotificationSettingsViewModels SettingsObj) { SettingsObj.NotificationSettingObj.UnitID = (int)Session["SelectedPropertyID"]; SettingsObj.NotificationSettingObj.CustomerID = (int)Session["CustomerID"]; SettingsObj.HideAllConfirmations(); SettingsObj.CompareNotificationSettings(); //pass the full view model System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(SettingsObj.UpdateSettings)); t.Start(); ////Below works out which settings have been changed so that correct messages can be displayed //if(!SettingsObj.RepairNotificationStatic && SettingsObj.NotificationSettingObj.NewRepairNotification) //{ // SettingsObj.RepairNotificationReceiveMessage = true; // SettingsObj.RepairNotificationCancelMessage = false; // SettingsObj.RepairNotificationStatic = SettingsObj.NotificationSettingObj.NewRepairNotification; //}else if(SettingsObj.RepairNotificationStatic && !SettingsObj.NotificationSettingObj.NewRepairNotification) //{ // SettingsObj.RepairNotificationReceiveMessage = true; // SettingsObj.RepairNotificationCancelMessage = false; // SettingsObj.RepairNotificationStatic = SettingsObj.NotificationSettingObj.NewRepairNotification; //} //if (!SettingsObj.ChargeNotificationStatic && SettingsObj.NotificationSettingObj.NewAccountCharge) //{ // SettingsObj.ChargeNotificationReceiveMessage = true; // SettingsObj.ChargeNotificationCancelMessage = false; // SettingsObj.ChargeNotificationStatic = SettingsObj.NotificationSettingObj.NewAccountCharge; //} //else if (SettingsObj.ChargeNotificationStatic && !SettingsObj.NotificationSettingObj.NewRepairNotification) //{ // SettingsObj.ChargeNotificationCancelMessage = true; // SettingsObj.ChargeNotificationReceiveMessage = false; // SettingsObj.ChargeNotificationStatic = SettingsObj.NotificationSettingObj.NewAccountCharge; //} //if (!SettingsObj.PaymentNotificationStatic && SettingsObj.NotificationSettingObj.NewAccountPayment) //{ // SettingsObj.PaymentNotificationReceiveMessage = true; // SettingsObj.PaymentNotificationCancelMessage = false; // SettingsObj.PaymentNotificationStatic = SettingsObj.NotificationSettingObj.NewAccountPayment; //} //else if (SettingsObj.PaymentNotificationStatic && !SettingsObj.NotificationSettingObj.NewRepairNotification) //{ // SettingsObj.PaymentNotificationCancelMessage = true; // SettingsObj.PaymentNotificationReceiveMessage = false; // SettingsObj.PaymentNotificationStatic = SettingsObj.NotificationSettingObj.NewAccountPayment; //} //if (!SettingsObj.BudgetNotificationStatic && SettingsObj.NotificationSettingObj.NewSCBudget) //{ // SettingsObj.BudgetNotificationReceiveMessage = true; // SettingsObj.BudgetNotificationCancelMessage = false; // SettingsObj.BudgetNotificationStatic = SettingsObj.NotificationSettingObj.NewSCBudget; //} //else if (SettingsObj.BudgetNotificationStatic && !SettingsObj.NotificationSettingObj.NewRepairNotification) //{ // SettingsObj.BudgetNotificationCancelMessage = true; // SettingsObj.BudgetNotificationReceiveMessage = false; // SettingsObj.BudgetNotificationStatic = SettingsObj.NotificationSettingObj.NewSCBudget; //} //if (!SettingsObj.BudgetNotificationStatic && SettingsObj.NotificationSettingObj.NewSCBudget) //{ // SettingsObj.BudgetNotificationReceiveMessage = true; // SettingsObj.BudgetNotificationCancelMessage = false; // SettingsObj.BudgetNotificationStatic = SettingsObj.NotificationSettingObj.NewSCBudget; //} //else if (SettingsObj.BudgetNotificationStatic && !SettingsObj.NotificationSettingObj.NewRepairNotification) //{ // SettingsObj.BudgetNotificationCancelMessage = true; // SettingsObj.BudgetNotificationReceiveMessage = false; // SettingsObj.BudgetNotificationStatic = SettingsObj.NotificationSettingObj.NewSCBudget; //} return(View("NotificationSettings", SettingsObj)); }