예제 #1
0
        public async Task <UserByRoleGetRes> GetUserDetailsByRole(UserByRoleGetReq userByRoleGetReq, string ticket)
        {
            UserByRoleGetRes userByRoleGetRes = new UserByRoleGetRes();

            userByRoleGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceUser:GetUserDetailsByRole"), userByRoleGetReq, typeof(UserByRoleGetRes), ticket);

            return(userByRoleGetRes);
        }
예제 #2
0
        public UserByRoleGetRes GetUserDetailsByRole([FromBody] UserByRoleGetReq request)
        {
            var response = new UserByRoleGetRes();

            if (request.RoleName.Count > 0)
            {
                response = _UserRepository.GetUserDetailsByRole(request);
                return(response);
            }
            else
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "User Role can not be blank";
                return(response);
            }
        }
        public JsonResult GetUsersByRole(string selectedRoleName)
        {
            try
            {
                UserByRoleGetRes response = new UserByRoleGetRes();
                UserByRoleGetReq request  = new UserByRoleGetReq();
                request.RoleName = new List <string>()
                {
                    selectedRoleName
                };
                response = loginProviders.GetUserDetailsByRole(request, token).Result;
                var UsersList = response.Users.Where(x => !string.IsNullOrWhiteSpace(x.FirstName) && !string.IsNullOrWhiteSpace(x.LastName)).Select(x => new AttributeValues {
                    AttributeValue_Id = x.UserId, Value = x.FirstName + " " + x.LastName
                }).Distinct().ToList();

                return(Json(new { UsersList = UsersList }));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #4
0
        public IActionResult GetUsersByRole(string SalesPerson, string CostingOfficer, string ProdAccountant, string FileHandler, string QRFID, string ModuleName, string BookingNumber)
        {
            try
            {
                UserDetailsViewModel model    = new UserDetailsViewModel();
                UserByRoleGetRes     response = new UserByRoleGetRes();
                UserByRoleGetReq     request  = new UserByRoleGetReq();
                request.RoleName = new List <string>()
                {
                    "Sales Officer", "Costing Officer", "Product Accountant", "Groups", "Operations_Management"
                };

                response = loginProviders.GetUsersByRole(request, token).Result;

                model.SalesOfficerList      = response.Users.Where(a => a.UserRole == "Sales Officer").ToList();
                model.CostingOfficerList    = response.Users.Where(a => a.UserRole == "Costing Officer").ToList();
                model.ProductAccountantList = response.Users.Where(a => a.UserRole == "Product Accountant").ToList();
                //model.FileHandlerList = response.Users.Where(a => a.UserRole == "Groups" || a.UserRole == "Operations_Management").Distinct().ToList();
                //model.FileHandlerList.ForEach(a => { a.UserRole = ""; a.UserRoleId = ""; });
                //model.FileHandlerList = model.FileHandlerList.Distinct().ToList();

                var FileHandlerList = response.Users.Where(a => a.UserRole == "Groups" || a.UserRole == "Operations_Management").Select(a => a.Email).Distinct().ToList();
                FileHandlerList.ForEach(a => model.FileHandlerList.Add(new UserDetails()
                {
                    Email = a
                }));

                model.SalesOfficer      = SalesPerson;
                model.CostingOfficer    = CostingOfficer;
                model.ProductAccountant = ProdAccountant;
                model.FileHandler       = FileHandler;

                CompanyOfficerGetRes officerGetRes = new CompanyOfficerGetRes();
                CompanyOfficerGetReq officerGetReq = new CompanyOfficerGetReq();
                if (ModuleName == "ops")
                {
                    ProductSRPHotelGetReq BookingReq = new ProductSRPHotelGetReq()
                    {
                        QRFID = BookingNumber
                    };
                    OpsBookingSummaryGetRes BookingRes = operationsProviders.GetOpsBookingSummary(BookingReq, token).Result;
                    if (BookingRes != null)
                    {
                        model.ContactPersonID   = BookingRes.OpsBookingSummaryDetails.ContactId;
                        model.EmailAddress      = BookingRes.OpsBookingSummaryDetails.ContactEmail;
                        model.MobileNo          = BookingRes.OpsBookingSummaryDetails.ContactTel;
                        officerGetReq.CompanyId = BookingRes.OpsBookingSummaryDetails.AgentId;
                    }
                }
                else
                {
                    NewQuoteViewModel quoteModel = new NewQuoteViewModel();
                    quoteModel.QRFID = QRFID;
                    cOCommonLibrary.GetCOTourInfoHeader(ref quoteModel, token);
                    model.ContactPersonID   = quoteModel.COHeaderViewModel.ContactPersonID;
                    model.EmailAddress      = quoteModel.COHeaderViewModel.EmailAddress;
                    model.MobileNo          = quoteModel.COHeaderViewModel.MobileNo;
                    officerGetReq.CompanyId = quoteModel.COHeaderViewModel.AgentID;
                }

                officerGetReq.UserRole  = "";
                officerGetRes           = agentProviders.GetCompanyContacts(officerGetReq, token).Result;
                model.ContactPersonList = officerGetRes.ContactDetails;
                model.ContactPersonList.ForEach(a => a.FIRSTNAME = a.CommonTitle + " " + a.FIRSTNAME + " " + a.LastNAME);

                return(PartialView("_ChangeUserForQuote", model));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
        public IActionResult ViewSalesPipelineRoles(string tabName)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(tabName))
                {
                    ViewBag.tabName = tabName;
                }

                SalesPipelineViewModel model = new SalesPipelineViewModel();

                #region Destination dropdown binding
                MasterTypeRequest objMasterTypeRequest = new MasterTypeRequest();
                objMasterTypeRequest.Property = "QRF Masters";
                objMasterTypeRequest.Name     = "QRF Destination";
                SalesProviders     objSalesProvider      = new SalesProviders(_configuration);
                MasterTypeResponse objMasterTypeResponse = objSalesProvider.GetGenericMasterForType(objMasterTypeRequest, token).Result;

                model.DestinationList = objMasterTypeResponse.PropertyList[0].Attribute[0].Values.Select(a => new AttributeValues
                {
                    AttributeValue_Id = a.AttributeValue_Id,
                    CityName          = a.Value.Contains("|") ? a.Value.Split("|")[0].Trim() : "",
                    Value             = a.Value.Contains("|") ? a.Value.Split("|")[1].Trim() : a.Value
                }).ToList();
                #endregion

                #region Role dropdown binding
                UserByRoleGetRes response = new UserByRoleGetRes();
                UserByRoleGetReq request  = new UserByRoleGetReq();
                request.RoleName = new List <string>()
                {
                    "Costing Officer", "Product Accountant"
                };
                response       = loginProviders.GetRoleIdByRoleName(request, token).Result;
                model.RoleList = response.Users.Select(x => new AttributeValues {
                    AttributeValue_Id = x.UserRoleId, Value = x.UserRole
                }).ToList();
                #endregion

                #region Sales Office dropdown binding
                CompanyOfficerGetRes res = new CompanyOfficerGetRes();
                res = agentProviders.GetSalesOfficesOfSystemCompany(token).Result;
                model.SalesOfficeList = res.Branches.Select(x => new AttributeValues {
                    AttributeValue_Id = x.Company_Id, Value = x.Company_Name
                }).ToList();
                #endregion

                #region Destination list binding
                SettingsGetReq request1  = new SettingsGetReq();
                SettingsGetRes response1 = new SettingsGetRes();
                request1.Type = "Destination";
                request1.LoggedInUserContact_Id = ckUserContactId;
                response1 = userAndRoleMgmtProviders.GetSalesPipelineRoles(request1, token).Result;
                model.RolesByDestinationList = response1.Values.ToList();
                model.RolesByDestinationList.Add(new Values());
                #endregion

                #region Sales office list binding
                SettingsGetReq request2  = new SettingsGetReq();
                SettingsGetRes response2 = new SettingsGetRes();
                request2.Type = "SalesOffice";
                request2.LoggedInUserContact_Id = ckUserContactId;
                response2 = userAndRoleMgmtProviders.GetSalesPipelineRoles(request2, token).Result;
                model.RolesBySalesOfficeList = response2.Values.ToList();
                model.RolesBySalesOfficeList.Add(new Values());
                #endregion

                return(PartialView("~/Areas/Settings/Views/UserAndRoleMgmt/_ViewSalesPipelineRoles.cshtml", model));
            }
            catch (Exception ex)
            {
                throw;
            }
        }