Esempio n. 1
0
        public ActionResult SavePermissions(PermissionDetailsModel objPermissionDetails)
        {
            eTracLoginModel ObjLoginModel = null;

            try
            {
                AlertMessageClass ObjAlertMessageClass = new AlertMessageClass();
                if (Session["eTrac"] != null)
                {
                    ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                    IsMapped IsMapped = _ICommonMethod.isUserMappedWithLocation(objPermissionDetails.UserIdToSave, (long)Session["eTrac_SelectedDasboardLocationID"]);
                    if (IsMapped.IsMappedLocation)
                    {
                        objPermissionDetails.UserId     = objPermissionDetails.UserIdToSave;
                        objPermissionDetails.CreatedBy  = ObjLoginModel.UserId;
                        objPermissionDetails.LocationId = ObjLoginModel.LocationID;
                        var Result = _ICommonMethod.UpdateUserPermissions(objPermissionDetails);
                        if (Result)
                        {
                            if (IsMapped.userTypeRes == 2 || IsMapped.userTypeRes == 6)
                            {
                                //Added By Bhushan Dod on 11/07/2016 for when roles assign to user then according to roles,Widget save by deafult.
                                _IGlobalAdmin.SaveByDefaultWidgetSetting(ObjLoginModel.LocationID, objPermissionDetails.UserIds, objPermissionDetails.UserIdToSave);
                            }

                            TempData["Message"]       = CommonMessage.UpdateSuccessMessage();
                            ViewBag.AlertMessageClass = ObjAlertMessageClass.Success;
                            return(Json(CommonMessage.UpdateSuccessMessage()));
                        }
                        else
                        {
                            TempData["Message"]       = CommonMessage.FailureMessage();
                            ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;
                            return(Json(CommonMessage.FailureMessage()));
                        }
                    }
                    else
                    {
                        return(Json("NotRegistered"));
                    }
                }
                else
                {
                    return(Json("Session Expired !"));
                }
            }
            catch (Exception ex)
            {
                return(Json(ex.Message));
            }
        }