예제 #1
0
        public ActionResult DisplayLocationData(int LocationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, String sidx = null, string txtSearch = null)
        {
            eTracLoginModel    ObjLoginModel       = null;
            GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager();
            var details = new LocationDetailsModel();

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (LocationId == null)
                {
                    LocationId = Convert.ToInt32(ObjLoginModel.LocationID);
                }
            }
            try
            {
                sord = string.IsNullOrEmpty(sord) ? "desc" : sord;
                sidx = string.IsNullOrEmpty(sidx) ? "LocationId" : sidx;
                var             obj_Common_B      = new Common_B();
                ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int));
                var             data = _GlobalAdminManager.LocationDetailByLocationID(LocationId);
                if (data.Count() > 0)
                {
                    var ListLocationModel = new ListLocationModel();
                    var serivces          = obj_Common_B.GetLocationServicesByLocationID(LocationId, 0);
                    foreach (var locList in data)
                    {
                        //var id = Cryptography.GetEncryptedData(locList.LocationId.ToString(), true);
                        ListLocationModel.LocationName        = locList.LocationName;
                        ListLocationModel.Address             = locList.Address1 + "," + locList.Address2;
                        ListLocationModel.City                = locList.City;
                        ListLocationModel.State               = locList.LocationState;
                        ListLocationModel.Country             = locList.LocationCountry;
                        ListLocationModel.Mobile              = locList.PhoneNo + " / " + locList.Mobile;
                        ListLocationModel.Description         = locList.Description;
                        ListLocationModel.ZipCode             = locList.ZipCode;
                        ListLocationModel.LocationSubTypeDesc = locList.LocationSubTypeDesc;
                        //ListLocationModel.LocationCode = locList.Loc;
                        ListLocationModel.LocationServices = serivces;
                    }
                    details.ListLocationModel = ListLocationModel;
                }
            }
            catch (Exception ex)
            {
            }
            return(View(details));
        }
예제 #2
0
        public bool SetUserSelectedLocation(long LocationId, string LocationName)
        {
            try
            {
                if (Session["eTrac"] != null)
                {
                    Common_B        obj_Common_B        = new Common_B();
                    eTracLoginModel obj_eTracLoginModel = new eTracLoginModel();
                    obj_eTracLoginModel = (eTracLoginModel)Session["eTrac"];

                    //Added By Bhushan Dod on 24-April-2016 for maintaining log of active user by location if selected from loc ddl
                    _ILogin.ChangeLoginLogActiveStatus(obj_eTracLoginModel);

                    obj_eTracLoginModel.LocationID = LocationId;
                    obj_eTracLoginModel.Location   = LocationName;
                    //Added By Bhushan Dod on 24-April-2016 for maintaining log of active logid by location if selected from loc ddl
                    var objNewLogID = _ILogin.InsertLoginLog(obj_eTracLoginModel);
                    obj_eTracLoginModel.LogId = objNewLogID.LogId;

                    Session["eTrac"] = obj_eTracLoginModel;

                    Session["eTrac_SelectedDasboardLocationID"] = LocationId;
                    Session["eTrac_UserRoles"] = this.Get_UserAssignedRoles();

                    Session["eTrac_LocationServices"] = obj_Common_B.GetLocationServicesByLocationID(LocationId, obj_eTracLoginModel.UserRoleId);
                    Session["eTrac_DashboardWidget"]  = null;
                    Session["eTrac_DashboardWidget"]  = this.GetUserDashboardWidget();

                    if (obj_eTracLoginModel.UserRoleId == 1 || obj_eTracLoginModel.UserRoleId == 5)// 1 - GlobalAdmin ,2 IT Admin
                    {
                        Session["eTrac_UserRoles"] = Session["eTrac_LocationServices"];
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #3
0
        public ActionResult Index(eTracLoginModel eTracLogin)
        {
            try
            {
                //TimeZoneInfo nyTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
                //DateTime nyTime = GetLocalDateTime(DateTime.UtcNow, nyTimeZone);

                //if (nyTimeZone.IsDaylightSavingTime(nyTime))
                string loginMessage = "";
                if (ModelState.IsValid)
                {
                    eTracLoginModel result = _ILogin.AuthenticateUser(eTracLogin);
                    //result.RememberMe = eTracLogin.RememberMe;
                    if (result.UserId > 0)
                    {
                        this.CreateAuthenticateFormsTicket(result);
                        Common_B obj_Common_B = new Common_B();
                        Session["eTrac_SelectedDasboardLocationID"] = result.LocationID;
                        Session["eTrac_UserRoles"]        = this.Get_UserAssignedRoles();
                        Session["eTrac_DashboardWidget"]  = this.GetUserDashboardWidget();
                        Session["eTrac_LocationServices"] = obj_Common_B.GetLocationServicesByLocationID(result.LocationID, result.UserRoleId);
                        Session["eTrac_ProfileImage"]     = result.ProfileImage;
                        CallbackController.UserRoleId     = result.UserRoleId;
                        CallbackController.UserId         = result.UserId;
                        HomeController.UserRoleId         = result.UserRoleId;
                        HomeController.UserId             = result.UserId;
                        switch (result.UserRoleId)
                        {
                        case ((Int64)(UserType.GlobalAdmin)):
                            Session["eTrac_UserLocations"] = _ILogin.GetUserAssignedLocations(result.UserRoleId, result.UserId);
                            Session["eTrac_UserRoles"]     = Session["eTrac_LocationServices"]; // this line has been added by vijay bcz if usetype is GAdmin or ITAdmin then this type of users will be able too see all services which is assigned to this current location.
                            // QuickBookIndex();
                            return(RedirectToAction("Index", "GlobalAdmin"));

                            break;

                        case ((Int64)(UserType.ITAdministrator)):
                            Session["eTrac_UserLocations"] = _ILogin.GetUserAssignedLocations(result.UserRoleId, result.UserId);
                            Session["eTrac_UserRoles"]     = Session["eTrac_LocationServices"];
                            //QuickBookIndex();
                            return(RedirectToAction("Index", "ITAdministrator"));

                            break;

                        case ((Int64)(UserType.Administrator)):
                            Session["eTrac_UserLocations"] = _ILogin.GetAdminAssignedLocation(result.UserId);
                            // QuickBookIndex();
                            return(RedirectToAction("Index", "Administrator"));

                            break;

                        case ((Int64)(UserType.Manager)):
                            Session["eTrac_UserLocations"] = _ILogin.GetManagerAssignedLocation(result.UserId);

                            #region this code will execute only when manager declined vendor from vendor email verification page.
                            try
                            {
                                if (Request.Cookies["eTrack_VendorIdForEditAfterDeclinedByManager"] != null)
                                {
                                    string isVendorIDExists = Request.Cookies["eTrack_VendorIdForEditAfterDeclinedByManager"]["VendorID"];
                                    if (isVendorIDExists != null)
                                    {
                                        var abc = Cryptography.GetDecryptedData(isVendorIDExists, true);

                                        if (Convert.ToInt32(abc) > 0)
                                        {
                                            //string HostingPrefix = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["hostingPrefix"], System.Globalization.CultureInfo.InvariantCulture);
                                            //var adfadsf = HostingPrefix + "/Manager/EditRegisterVendor/?vdr=" + isVendorIDExists;
                                            //Response.Redirect(adfadsf);
                                            // QuickBookIndex();
                                            return(RedirectToAction("EditRegisterVendor", "Manager", new { vdr = isVendorIDExists }));
                                        }
                                    }
                                }
                            }
                            catch
                            {
                            }
                            #endregion     // by vijay sahu on 2 july 2015

                            #region This Code Will Execute if Vehicle Declined by Manager and after login redirect to edit vehicle
                            try
                            {
                                if (Request.Cookies["eTrac_VehicleIdForEditAfterDeclinedByManager"] != null)
                                {
                                    string isVehicleIDExists = Request.Cookies["eTrac_VehicleIdForEditAfterDeclinedByManager"]["QRCID"];
                                    if (isVehicleIDExists != null)
                                    {
                                        var abc = Cryptography.GetDecryptedData(isVehicleIDExists, true);

                                        if (Convert.ToInt32(abc) > 0)
                                        {
                                            //string HostingPrefix = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["hostingPrefix"], System.Globalization.CultureInfo.InvariantCulture);
                                            var redirectURL = HostingPrefix + "QRCSetup/VehicleRegistration/?qr=" + isVehicleIDExists;
                                            Response.Redirect(redirectURL);
                                            //return RedirectToAction("VehicleRegistration", "QRCSetup", new { qr = isVehicleIDExists });
                                        }
                                    }
                                }
                            }
                            catch
                            {
                            }
                            #endregion     // by Bhushan Dod on 22 September 2015
                            //QuickBookIndex();
                            return(RedirectToAction("Dashboard", "Manager"));

                            break;

                        case ((Int64)(UserType.Employee)):
                            Session["eTrac_UserLocations"] = _ILogin.GetEmployeeAssignedLocation(result.UserId);
                            //QuickBookIndex();
                            return(RedirectToAction("Index", "Employee"));

                            break;

                        case ((Int64)(UserType.Client)):
                            //Session["eTrac_UserLocations"] = _ILogin.GetEmployeeAssignedLocation(result.UserId);
                            //QuickBookIndex();
                            return(RedirectToAction("Index", "Client"));

                            break;
                        }
                    }//else { ModelState.AddModelError("", "User not found. Please check UserName or Password"); }
                    else
                    {
                        loginMessage = "User not found. Please check Username or Password";
                    }
                }//else { ModelState.AddModelError("", "Invalid UserName or Password"); }
                else
                {
                    loginMessage = "Invalid Username or Password";
                }
                ViewBag.Message = loginMessage; ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;
            }
            catch (Exception ex)
            {
                Exception_B.exceptionHandel_Runtime(ex, "public ActionResult Index(eTracLoginModel eTracLogin)", "from loginController", eTracLogin);
                ViewBag.Error = ex.Message; ViewBag.Message = "Something went wrong. Please contact support team."; ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;
            }//ModelState.AddModelError("", ex.Message);
            return(View("Index", eTracLogin));
        }