示例#1
0
        public async Task <IActionResult> Edit(EditViewModel model)
        {
            // Check if user.BusinessProfile is null.
            // If not null, get all informations
            // If null, do this -->

            var user = await _userManager.GetUserAsync(User);

            if (ModelState.IsValid)
            {
                var businessProfile = new BusinessProfile()
                {
                    Id           = user.Id,
                    Address      = model.Address,
                    BusinessName = model.BusinessName,
                    BusinessType = model.BusinessType,
                    CVR          = model.CVR,
                    Firstname    = model.Firstname,
                    Lastname     = model.Lastname,
                    Industry     = model.Industry,
                    Position     = model.Position
                };
                await _dbContext.BusinessProfile.AddAsync(businessProfile);

                await _dbContext.SaveChangesAsync();

                return(View(model));
            }
            return(View(model));
        }
        public async Task <IActionResult> Edit(int id, [Bind("BusinessProfileId,VenueId,BusinessName,UserId")] BusinessProfile businessProfile)
        {
            if (id != businessProfile.BusinessProfileId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(businessProfile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BusinessProfileExists(businessProfile.BusinessProfileId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", businessProfile.UserId);
            return(View(businessProfile));
        }
示例#3
0
        private static BusinessProfile Mapper(IDataReader reader)
        {
            BusinessProfile model         = new BusinessProfile();
            int             startingIndex = 0;

            model.Id     = reader.GetSafeInt32(startingIndex++);
            model.UserId = reader.GetSafeInt32(startingIndex++);
            model.Name   = reader.GetSafeString(startingIndex++);
            model.ProjectedAnnualBusinessIncome = reader.GetSafeInt32(startingIndex++);
            model.AnnualBusinessIncome          = reader.GetSafeInt32(startingIndex++);
            model.YearsInBusiness = reader.GetSafeInt32(startingIndex++);
            model.ImageUrl        = reader.GetSafeString(startingIndex++);
            model.AddressId       = reader.GetSafeInt32(startingIndex++);
            model.DateCreated     = reader.GetSafeDateTime(startingIndex++);
            model.DateModified    = reader.GetSafeDateTime(startingIndex++);
            model.CreatedBy       = reader.GetSafeInt32(startingIndex++);
            model.ModifiedBy      = reader.GetSafeInt32(startingIndex++);
            model.BusinessTypeId  = new BusinessTypeId();
            BusinessTypeId businessTypes = new BusinessTypeId();

            model.BusinessTypeId.Id   = reader.GetSafeInt32(startingIndex++);
            model.BusinessTypeId.Name = reader.GetSafeString(startingIndex++);
            model.BusinessStageId     = new BusinessStageId();
            BusinessStageId businessStages = new BusinessStageId();

            model.BusinessStageId.Id   = reader.GetSafeInt32(startingIndex++);
            model.BusinessStageId.Name = reader.GetSafeString(startingIndex++);
            model.IndustryTypes        = new IndustryTypeId();
            IndustryTypeId industry = new IndustryTypeId();

            model.IndustryTypes.Id   = reader.GetSafeInt32(startingIndex++);
            model.IndustryTypes.Name = reader.GetSafeString(startingIndex++);

            return(model);
        }
示例#4
0
        public Paged <BusinessProfile> Paginate(int pageIndex, int pageSize)
        {
            Paged <BusinessProfile> pagedList            = null;
            List <BusinessProfile>  businessProfilesList = null;
            int totalCount = 0;

            _dataProvider.ExecuteCmd("dbo.BusinessProfiles_SelectAll_Paginated", inputParamMapper : delegate(SqlParameterCollection param)
            {
                param.AddWithValue("@PageIndex", pageIndex);
                param.AddWithValue("@PageSize", pageSize);
            },
                                     singleRecordMapper : delegate(IDataReader reader, short set)
            {
                BusinessProfile model = new BusinessProfile();
                model = Mapper(reader);
                if (totalCount == 0)
                {
                    totalCount = reader.GetSafeInt32(18);
                }
                if (businessProfilesList == null)
                {
                    businessProfilesList = new List <BusinessProfile>();
                }
                businessProfilesList.Add(model);
            }
                                     );
            if (businessProfilesList != null)
            {
                pagedList = new Paged <BusinessProfile>(businessProfilesList, pageIndex, pageSize, totalCount);
            }
            return(pagedList);
        }
示例#5
0
 public bool UpdateBusinessProfile(BusinessProfile profile, string customerNumber) => _organisationService.SaveOrganisationProfile(new CustomerProfile
 {
     CustomerId = profile.CustomerId,
     Id         = profile.Id,
     Name       = profile.Name,
     Rows       = profile.Rows
 }, customerNumber, Ticket);
        public ActionResult <ItemResponse <BusinessProfile> > GetById(int id)
        {
            int          iCode    = 200;
            BaseResponse response = null;

            try
            {
                BusinessProfile BusinessProfiles = _service.GetById(id);

                if (BusinessProfiles == null)
                {
                    iCode    = 404;
                    response = new ErrorResponse("Application Resource not found");
                }
                else
                {
                    response = new ItemResponse <BusinessProfile>()
                    {
                        Item = BusinessProfiles
                    };
                }
            }
            catch (Exception ex)
            {
                iCode = 500;
                base.Logger.LogError(ex.ToString());

                response = new ErrorResponse($"Generic Error: {ex.Message}");
            }
            return(StatusCode(iCode, response));
        }
        public async Task <IActionResult> Edit([Bind("BusinessID,BusinessName,BusinessType,StreetAddress,CityStateZip,BusinessBio,Promotions,Link,ApplicationUserId,Image1")] BusinessProfile businessProfile)
        {
            //if (id != businessProfile.BusinessID)
            //{
            //    return NotFound();
            //}

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(businessProfile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BusinessProfileExists(businessProfile.BusinessID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Details)));
            }
            return(View(businessProfile));
        }
示例#8
0
        public void UpdateBusinessProfile(BusinessProfileViewModel businessVM, string path)
        {
            business = new BusinessProfile
            {
                BusinessId   = businessVM.BusinessId,
                BusinessName = businessVM.BusinessName,
                Categories   = businessVM.Categories,
                About        = businessVM.About,
                UserName     = businessVM.UserName,
                Location     = businessVM.Location,
                ImageName    = path,
                City         = businessVM.City,
                //ClosedorMoved = businessVM.ClosedorMoved,
                // OpeningHours = businessVM.OpeningHours,
                Phone   = businessVM.Phone,
                Website = businessVM.Website,
                // Location = businessVM.Location,
                Email      = businessVM.Email,
                CategoryId = businessVM.CategoryId,
                isBusiness = true,
            };

            businessRepository.Update(business);
            db.SaveChanges();
        }
        public IActionResult GetBusinessProfile(string key)
        {
            try
            {
                string          pathlink    = _config["Micro-API_WeAccount:Path"];
                BusinessProfile responseval = new BusinessProfile();
                WebRequest      tRequest    = WebRequest.Create(pathlink + "business/getprofile/d976337a-ae44-11ea-b90b-42010a940007");
                tRequest.Method      = "get";
                tRequest.ContentType = "application/json";
                tRequest.Headers.Add("Weacct-Apim-Subscription-Key", "dcmGV25hZFzc3VudDM6cGzdCdvQ=");
                tRequest.Credentials = CredentialCache.DefaultCredentials;

                // Get the response.
                WebResponse responseapi = tRequest.GetResponse();

                using (Stream dataStream = responseapi.GetResponseStream())
                {
                    StreamReader tReader = new StreamReader(dataStream);
                    // Read the content.
                    String sResponseFromServer = tReader.ReadToEnd();
                    responseval = JsonConvert.DeserializeObject <BusinessProfile>(sResponseFromServer);
                }

                return(WriteJson(new
                {
                    responsecode = ((int)Common.Abstract.ResponseCode.SuccessTransaction).ToString(),
                    responsedata = responseval
                }));
            }
            catch (Exception ex)
            {
                return(WriteJson(new { responsecode = ((int)Common.Abstract.ResponseCode.ErrorTransaction).ToString(), errormessage = ex.Message }));
            }
        }
示例#10
0
        private void FetchConfigurationDetails()
        {
            MonetaSettings  = SettingsService.MonetaSettings;
            BusinessProfile = new BusinessProfile(SettingsService.BusinessProfile);

            //MonetaDirectory = SettingsService.GetFutureAccessFolder(FutureAccessToken.MonetaFolderToken).Result;
            //BackupDirectory = SettingsService.GetFutureAccessFolder(FutureAccessToken.BackupFolderToken).Result;
        }
示例#11
0
        public ActionResult DeleteConfirmed(int id)
        {
            BusinessProfile businessProfile = db.BusinessProfiles.Find(id);

            db.BusinessProfiles.Remove(businessProfile);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public IActionResult getUserDetails()
        {
            var AccessToken = Request.Headers["Access-token"].ToString();

            var UserID = _db.LoginTokens.Where(s => s.Token == AccessToken).Select(p => p.UserId).SingleOrDefault();

            if (UserID != null)
            {
                var user = _db.Users.Where(s => s.Id == UserID && s.UserTypeId != 1).Include(s => s.UserType).SingleOrDefault();
                if (user != null)
                {
                    BusinessProfile businessProfile = null;
                    if (user.UserTypeId == 2)
                    {
                        businessProfile = _db.BusinessProfile.Where(s => s.UserId == UserID).Include(s => s.BusinessType).SingleOrDefault();
                    }
                    var transactions = userTransaction.getUserTransaction((int)UserID);

                    var AllUserTransActions = new List <TransactionResponse>();
                    foreach (var item in transactions)
                    {
                        AllUserTransActions.Add(new TransactionResponse
                        {
                            TransactionAmount = item.TransactionAmount,
                            TransactionId     = item.TransactionId,
                            TransactionName   = item.TransactionName,
                            TransactionType   = item.TransactionType.TransactionTypeName
                        });
                    }

                    var userDetails = new UserDetails
                    {
                        user = new UserResponse
                        {
                            UserName      = user.UserName,
                            UserType      = user.UserType.Name,
                            CreditBalance = user.CreditBalance,
                            BusinessType  = user.UserTypeId == 2 ? businessProfile.BusinessType.BusinessName : null,
                            ContactName   = user.UserTypeId == 2 ? businessProfile.ContactName : null,
                            ContactPhone  = user.UserTypeId == 2 ? businessProfile.ContactPhone : null,
                            PDFName       = user.UserTypeId == 2 ? businessProfile.PdfName : null,
                        },
                        transactions = AllUserTransActions
                    };
                    return(Ok(new Response
                    {
                        ResponseCode = 0,
                        ResponseMessage = "Success",
                        ResponseResults = userDetails
                    }));
                }
                return(BadRequest(badRequest));
            }
            return(Unauthorized(notAuthorized));
        }
示例#13
0
        public async Task <AppUser> AddAppUser(Account account, string userType)
        {
            if (await _userManager.FindByIdAsync(account.Id) == null)
            {
                return(null);
            }

            var appUser = new AppUser()
            {
                AccountId   = account.Id,
                DisplayName = account.UserName,
                UserType    = userType
            };

            _context.Add(appUser);


            if (await _context.SaveChangesAsync() > 0)
            {
                switch (userType)
                {
                case "Member":
                    var newMember = new MemberProfile()
                    {
                        AppUserId = appUser.Id
                    };
                    _context.Add(newMember);
                    if (await _context.SaveChangesAsync() > 0)
                    {
                        appUser.UserProfileId = newMember.Id;
                        return(appUser);
                    }
                    break;

                case "Business":
                    var newBusiness = new BusinessProfile()
                    {
                        AppUserId = appUser.Id
                    };
                    _context.Add(newBusiness);
                    if (await _context.SaveChangesAsync() > 0)
                    {
                        appUser.UserProfileId = newBusiness.Id;
                        return(appUser);
                    }
                    break;

                default:
                    return(appUser);
                }
            }

            return(null);
        }
示例#14
0
        public ActionResult Edit([Bind(Include = "BusinessId,BusinessName,BusinessIndustry,ShortBusinessDescription,LongBusinessDescription,State,City,StreetAddress,EmailAddress,PhoneNumber,Image")] BusinessProfile businessProfile)
        {
            if (ModelState.IsValid)
            {
                db.Entry(businessProfile).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IndustryId = new SelectList(db.Industries, "IndustryId", "IndustryName");
            return(View(businessProfile));
        }
示例#15
0
        public BusinessProfile GetById(int id)
        {
            BusinessProfile model = null;

            _dataProvider.ExecuteCmd("dbo.BusinessProfiles_SelectById", inputParamMapper : delegate(SqlParameterCollection parms)
            {
                parms.AddWithValue("@Id", id);
            }, singleRecordMapper : delegate(IDataReader reader, short set)
            {
                model = Mapper(reader);
            });
            return(model);
        }
        public async Task <IActionResult> Create([Bind("BusinessID,BusinessName,BusinessType,StreetAddress,CityStateZip,BusinessBio,Promotions,Link")] BusinessProfile businessProfile)
        {
            if (ModelState.IsValid)
            {
                businessProfile.ApplicationUserId = User.FindFirstValue(ClaimTypes.NameIdentifier);
                _context.Add(businessProfile);
                await _context.SaveChangesAsync();

                //return RedirectToAction("Index");
            }
            SendSimpleMessage();
            return(View("Details", businessProfile));
        }
示例#17
0
        private void lblBusinessName_Click(object sender, EventArgs e)
        {
            //profile viwer added
            ViewerService.AddProfileViewer(new Entities.ProfileViewer(offerGlobal.Business, LoggedData.LoggedJobSeeker));


            var business  = BusinessService.SearchByBusinessName(offerGlobal.Business.Name);
            int offersNum = JobOfferService.GetOffersByBusinessName(offerGlobal.Business.Name).Count;
            // MessageBox.Show(business.Name);
            BusinessProfile b1 = new BusinessProfile(business, offersNum);

            b1.Show();
        }
        public async Task <IActionResult> Create([Bind("BusinessProfileId,VenueId,BusinessName,UserId")] BusinessProfile businessProfile)
        {
            if (ModelState.IsValid)
            {
                _context.Add(businessProfile);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", businessProfile.UserId);

            return(View(businessProfile));
        }
示例#19
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BusinessProfile businessProfile = db.BusinessProfiles.Find(id);

            if (businessProfile == null)
            {
                return(HttpNotFound());
            }
            return(View(businessProfile));
        }
示例#20
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BusinessProfile businessProfile = db.BusinessProfiles.Find(id);

            if (businessProfile == null)
            {
                return(HttpNotFound());
            }

            ViewBag.IndustryId = new SelectList(db.Industries, "IndustryId", "IndustryName");
            return(View(businessProfile));
        }
 public async Task <IActionResult> Map(int?id)
 {
     {
         if (id == null)
         {
             //not sure how to revise this for Core.  This code should alert user in thr case there is no user logged in.
             //return HttpStatusCode.BadRequest;
         }
         BusinessProfile businessProfile = _context.BusinessProfile.Find(id);
         if (businessProfile == null)
         {
             return(NotFound());
         }
         ViewBag.ApplicationUserId = new SelectList(_context.Users, "Id", "UserRole", businessProfile.ApplicationUser);
         ViewBag.CustomerAddress   = businessProfile.StreetAddress;
         ViewBag.CustomerZip       = businessProfile.CityStateZip;
         return(View(businessProfile));
     }
 }
示例#22
0
        public async Task <BusinessProfileResponse> SaveAsync(BusinessProfile businessProfile)
        {
            Account account = new Account();

            account.User               = businessProfile.Email;
            account.Password           = businessProfile.Password;
            account.RolId              = 1;
            account.SubscriptionPlanId = 1; // Por defecto tiene el plan free
            account.BusinessProfile    = businessProfile;
            account.Rol = _rolRepository.FindByIdAsync(2).Result;

            try
            {
                if (businessProfile.Owner) // si eres propietario
                {
                    Provider provider = new Provider();
                    provider.BusinessName = "";
                    provider.Address      = "";
                    provider.Description  = "";
                    provider.Email        = "";
                    provider.Field        = "";
                    provider.Region       = "";

                    await _providerRepository.AddAsyn(provider);

                    businessProfile.Provider   = provider;
                    businessProfile.ProviderId = provider.Id;
                }

                await _businessRepository.AddAsyn(businessProfile);

                await _accountRepository.AddAsyn(account);

                await _unitOfWork.CompleteAsync();

                return(new BusinessProfileResponse(businessProfile));
            }
            catch (Exception ex)
            {
                return(new BusinessProfileResponse($"An error ocurred while saving the businessProfile: {ex.Message}"));
            }
        }
        public BusinessProfile getbusinessprofilebyid(string businessid)
        {
            try
            {
                BusinessProfile response = new BusinessProfile();
                using (BusinessProfileRepository BusinessProfileRepositor = new BusinessProfileRepository())
                    response = BusinessProfileRepositor.SelectFirstDataWithCondition(a => a.UID.ToString().ToUpper() == businessid.ToString().ToUpper());

                if (response == null)
                {
                    throw new Exception("ไม่พบข้อมูลธุรกิจ");
                }

                return(response);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#24
0
        public void CreateBusinessprofile(BusinessProfileViewModel businessVM)
        {
            business = new BusinessProfile
            {
                BusinessId   = businessVM.BusinessId,
                BusinessName = businessVM.BusinessName,
                Categories   = businessVM.Categories,
                About        = businessVM.About,
                City         = businessVM.City,
                // ClosedorMoved = businessVM.ClosedorMoved,
                // OpeningHours = businessVM.OpeningHours,
                Phone      = businessVM.Phone,
                Website    = businessVM.Website,
                Location   = businessVM.Location,
                Email      = businessVM.Email,
                UserName   = businessVM.UserName,
                CategoryId = businessVM.CategoryId,
                isBusiness = false,
                ImageName  = "Default.png",
            };

            businessRepository.Insert(business);
            db.SaveChanges();
        }
示例#25
0
 public BusinessProfileResponse(BusinessProfile BusinessProfile) : this(true, string.Empty, BusinessProfile)
 {
 }
示例#26
0
        public async Task <IActionResult> GetBusinessProfile(string accountId)
        {
            _logger.LogInformation(LoggingEvents.HttpGet, "Begin method " + this.GetType().Name + "." + MethodBase.GetCurrentMethod().ReflectedType.Name);
            _logger.LogDebug(LoggingEvents.HttpGet, "accountId: {accountId}");

            List <LegalEntity> legalEntities;

            var expand = new List <string> {
                "primarycontactid"
            };
            var account = (_dynamicsClient.Accounts.Get(filter: "", expand: expand).Value.FirstOrDefault()).ToViewModel();

            _logger.LogDebug(LoggingEvents.HttpGet, "Account details: " + JsonConvert.SerializeObject(account));

            // get legal entities
            var entityFilter = $"_adoxio_account_value eq {accountId}";
            var expandList   = new List <string> {
                "adoxio_ShareholderAccountID"
            };

            try
            {
                legalEntities = _dynamicsClient.Adoxiolegalentities.Get(filter: entityFilter, expand: expandList).Value
                                .Select(le =>
                {
                    var legalEntity = le.ToViewModel();
                    var entity      = new ViewModels.LegalEntity
                    {
                        AdoxioLegalEntity = legalEntity,
                        Account           = le.AdoxioShareholderAccountID == null ? account : le.AdoxioShareholderAccountID.ToViewModel(),
                    };
                    entity.corporateDetailsFilesExists      = FileUploadExists(entity.Account.id, entity.Account.name, "Corporate Information").Result;
                    entity.organizationStructureFilesExists = FileUploadExists(entity.Account.id, entity.Account.name, "Organization Structure").Result;
                    entity.keyPersonnelFilesExists          = FileUploadExists(entity.Account.id, entity.Account.name, "Key Personnel").Result;
                    entity.financialInformationFilesExists  = FileUploadExists(entity.Account.id, entity.Account.name, "Financial Information").Result;
                    entity.shareholderFilesExists           = FileUploadExists(entity.Account.id, entity.Account.name, "Central Securities Register").Result;
                    var tiedHouse = _dynamicsClient.AdoxioTiedhouseconnections
                                    .Get(filter: $"_adoxio_accountid_value eq {entity.Account.id}")
                                    .Value.FirstOrDefault();
                    if (tiedHouse != null)
                    {
                        entity.TiedHouse = tiedHouse.ToViewModel();
                    }
                    entity.ChildEntities = GetLegalEntityChildren(entity.AdoxioLegalEntity.id);
                    return(entity);
                })
                                .ToList();
            }
            catch (OdataerrorException odee)
            {
                _logger.LogError(LoggingEvents.Error, "Error getting legal entities for the account {accountId}.");
                _logger.LogError("Request:");
                _logger.LogError(odee.Request.Content);
                _logger.LogError("Response:");
                _logger.LogError(odee.Response.Content);
                return(null);
            }

            var profile = new BusinessProfile
            {
                Account       = account,
                LegalEntities = legalEntities
            };

            var isComplete = legalEntities.Select(le =>
            {
                var valid = new ProfileValidation
                {
                    LegalEntityId = le.AdoxioLegalEntity.id,
                    IsComplete    = (le.IsComplete())
                };
                return(valid);
            }).ToList();

            _logger.LogDebug(LoggingEvents.HttpGet, "BusinessProfile.isComplete: " +
                             JsonConvert.SerializeObject(isComplete, Formatting.Indented, new JsonSerializerSettings {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            }));
            return(Json(isComplete));
        }
 public void Update(BusinessProfile businessProfile)
 {
     throw new NotImplementedException();
 }
示例#28
0
 public Task <BusinessProfileResponse> UpdateAsync(int id, BusinessProfile businessProfile)
 {
     throw new NotImplementedException();
 }
示例#29
0
 public BusinessProfileResponse(bool success, string message, BusinessProfile businessProfile) : base(success, message)
 {
     BusinessProfile = businessProfile;
 }
示例#30
0
 public bool UpdateBusinessProfile(BusinessProfile businessProfile)
 {
     BusinessProfile = businessProfile;
     return(StoreRoamingData(RoamingDataKey.MonetaBusinessProfile.ToString(), BusinessProfile));
 }