public DistributorManagementModel GetDistributorsModel(int distributorId)
        {
            var distributor = entity.Distributors.Where(x => x.DistributorId == distributorId).FirstOrDefault();

            DistributorManagementModel model = new DistributorManagementModel()
            {
                DistributorId     = distributor.DistributorId,
                BranchOfficeId    = distributor.BranchOfficeId,
                BranchOfficeName  = distributor.BranchOffices != null ? distributor.BranchOffices.BranchOfficeName + "(" + distributor.BranchOffices.BranchOfficeCode + ")" : string.Empty,
                DistributorCode   = distributor.DistributorCode,
                DistributorName   = distributor.DistributorName,
                NativeCountryId   = distributor.NativeCountryId,
                NativeCountryName = string.Empty,
                ZoneId            = distributor.ZoneId,
                ZoneName          = distributor.Zones != null ? distributor.Zones.ZoneName : string.Empty,
                DistrictId        = distributor.DistrictId,
                DistrictName      = distributor.Districts != null ? distributor.Districts.DistrictName : string.Empty,
                Address           = distributor.Address,
                Phone             = distributor.Phone,
                Email             = distributor.Email,
                FaxNo             = distributor.FaxNo,
                PanNo             = distributor.PanNo,
                Web          = distributor.Web,
                Status       = Convert.ToInt32(distributor.Status),
                TimeZoneId   = distributor.TimeZoneId,
                TimeZoneName = string.Empty,
                isSystem     = distributor.isSystem,
                CreatedBy    = distributor.CreatedBy,
                CreatedDate  = distributor.CreatedDate,
            };

            #region UserDetails

            View_DistributorDetails userDetails = GetDefaultUsersDetails(distributorId);
            if (userDetails != null)
            {
                model.FullName        = userDetails.FullName;
                model.UserName        = userDetails.UserName;
                model.Password        = userDetails.Password;
                model.ConfirmPassword = userDetails.Password;
                model.UserEmail       = userDetails.Email;
                model.UserAddress     = userDetails.Address;
                model.UserMobileNo    = userDetails.MobileNumber;
                model.UserPhoneNo     = userDetails.Phone;
            }
            #endregion


            model.Countries     = new SelectList(agentManagementProvider.GetCountry(), "CountryId", "CountryName", distributor.NativeCountryId);
            model.StatusOption  = new SelectList(agentManagementProvider.GetStatus(), "id", "Name", distributor.Status);
            model.Zones         = new SelectList(agentManagementProvider.GetZoneList(), "ZoneId", "ZoneName", distributor.ZoneId);
            model.Districts     = new SelectList(agentManagementProvider.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName", distributor.DistrictId);
            model.TimeZones     = new SelectList(agentManagementProvider.GetTimeZoneList(), "RecordID", "StandardName", distributor.TimeZoneId);
            model.BranchOffices = new SelectList(GetBranchOffices(), "BranchOfficeId", "BranchOfficeName", distributor.BranchOfficeId);

            return(model);
        }
Ejemplo n.º 2
0
        // ***********************************************************************************
        ////// Setting of session For Specific user login
        // ***********************************************************************************
        public void SetSessionsObject(Guid userId)
        {
            Agents        ainfo = null;
            TravelSession obj   = new TravelSession();
            aspnet_Users  tu    = GetUserInfo(userId);

            try
            {
                ainfo = GetAgentInfo(tu.UserId);
            }
            catch (Exception)
            {
            }

            UsersDetails udinfo = GetUserDetailsInfo(userId);

            if (udinfo.UserTypeId == 5)
            {
                BranchOfficeManagementProvider branchOfficeManagementProvider = new BranchOfficeManagementProvider();
                View_BranchDetails             branchOffices = branchOfficeManagementProvider.GetBranchOfficeByUserId(userId);

                obj.LoginTypeName = branchOffices.BranchOfficeName;
                obj.AgentCode     = branchOffices.BranchOfficeName;
                obj.LoginTypeId   = branchOffices.BranchOfficeId;
            }
            else if (udinfo.UserTypeId == 6)
            {
                DistributorManagementProvider distributorManagementProvider = new DistributorManagementProvider();
                View_DistributorDetails       distributors = distributorManagementProvider.GetDistributorByUserId(userId);

                obj.LoginTypeName = distributors.DistributorName;
                obj.AgentCode     = distributors.DistributorName;
                obj.LoginTypeId   = distributors.DistributorId;
            }
            else if (udinfo.UserTypeId == 7)
            {
                obj.Id         = userId;
                obj.LoginName  = tu.UserName;
                obj.AppUserId  = udinfo.AppUserId;
                obj.UserTypeId = udinfo.UserTypeId;
                obj.ProductId  = GetUserProductId(obj.AppUserId);
            }

            obj.Id         = userId;
            obj.LoginName  = tu.UserName;
            obj.AppUserId  = udinfo.AppUserId;
            obj.UserTypeId = udinfo.UserTypeId;
            obj.ProductId  = GetUserProductId(obj.AppUserId);

            HttpContext.Current.Session["TravelPortalSessionInfo"] = obj;
        }
        public DistributorManagementModel GetDistributorsDetailsModel(int distributorId)
        {
            var distributor = entity.Distributors.Where(x => x.DistributorId == distributorId).FirstOrDefault();

            DistributorManagementModel model = new DistributorManagementModel()
            {
                DistributorId     = distributor.DistributorId,
                BranchOfficeId    = distributor.BranchOfficeId,
                BranchOfficeName  = distributor.BranchOffices != null ? distributor.BranchOffices.BranchOfficeName + "(" + distributor.BranchOffices.BranchOfficeCode + ")" : string.Empty,
                DistributorCode   = distributor.DistributorCode,
                DistributorName   = distributor.DistributorName,
                NativeCountryId   = distributor.NativeCountryId,
                NativeCountryName = distributor.Countries != null ? distributor.Countries.CountryName + "(" + distributor.Countries.CountryCode + ")" : string.Empty,
                ZoneId            = distributor.ZoneId,
                ZoneName          = distributor.Zones != null ? distributor.Zones.ZoneName : string.Empty,
                DistrictId        = distributor.DistrictId,
                DistrictName      = distributor.Districts != null ? distributor.Districts.DistrictName : string.Empty,
                Address           = distributor.Address,
                Phone             = distributor.Phone,
                Email             = distributor.Email,
                FaxNo             = distributor.FaxNo,
                PanNo             = distributor.PanNo,
                Web          = distributor.Web,
                Status       = Convert.ToInt32(distributor.Status),
                TimeZoneId   = distributor.TimeZoneId,
                TimeZoneName = distributor.TimeZones != null ? distributor.TimeZones.TimeZoneID : string.Empty,
                isSystem     = distributor.isSystem,
                CreatedBy    = distributor.CreatedBy,
                CreatedDate  = distributor.CreatedDate,
            };


            #region UserDetails

            View_DistributorDetails userDetails = GetDefaultUsersDetails(distributorId);

            model.FullName        = userDetails.FullName;
            model.UserName        = userDetails.UserName;
            model.Password        = userDetails.Password;
            model.ConfirmPassword = userDetails.Password;
            model.UserEmail       = userDetails.Email;
            model.UserAddress     = userDetails.Address;
            model.UserMobileNo    = userDetails.MobileNumber;
            model.UserPhoneNo     = userDetails.Phone;

            #endregion

            return(model);
        }
        public View_DistributorDetails GetDefaultUsersDetails(int distributorId)
        {
            View_DistributorDetails result = entity.View_DistributorDetails.Where(x => x.DistributorId == distributorId).FirstOrDefault();

            return(result);
        }