public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var merchant = await _db.Merchant
                           .Include(t => t.User)
                           .FirstOrDefaultAsync(m => m.Id == id);

            if (merchant == null)
            {
                return(NotFound());
            }

            var model = new MerchantViewModel
            {
                Id            = merchant.Id,
                UserId        = merchant.UserId,
                Name          = merchant.Name,
                Email         = merchant.User.Email,
                Address       = merchant.Address,
                WalletAddress = merchant.WalletAddress,
                Status        = merchant.Status
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> SaveMerchant([FromBody] MerchantViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.Values.SelectMany(v => v.Errors).FirstOrDefault().ErrorMessage));
            }

            try
            {
                var user = await _userManager.GetUserAsync(User);

                if (user == null)
                {
                    throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
                }

                await _merchantRepository.SaveMerchant(MerchantSecretTemp ?? model.MerchantSecret, model, user.Id);
            }
            catch (Exception e)
            {
                return(BadRequest(StatusMessage));
            }

            StatusMessage = "Merchant account successfully saved.";
            return(this.Ok(StatusMessage));
        }
Ejemplo n.º 3
0
        public IActionResult SaveEntity(BookViewModel bookVm)
        {
            var userid = _generalFunctionController.Instance.getClaimType(User, CommonConstants.UserClaims.Key);
            var model  = new MerchantViewModel();

            if (Guid.TryParse(userid, out var guid))
            {
                model = _merchantService.GetBysId(userid);
            }
            if (!ModelState.IsValid)
            {
                IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(new BadRequestObjectResult(allErrors));
            }
            else
            {
                if (model.KeyId != 0)
                {
                    if (bookVm.KeyId == 0)
                    {
                        _bookService.Add(bookVm);
                    }
                    else
                    {
                        _bookService.Update(bookVm);
                    }
                    _bookCategoryService.Save();
                    return(new OkObjectResult(bookVm));
                }
                else
                {
                    return(new BadRequestResult());
                }
            }
        }
    // GET: Default
    public ActionResult Index()
    {
        var merchant1 = new MerchantModel
        {
            AppId = 1,
            Name  = "Bob"
        };
        var merchant2 = new MerchantModel
        {
            AppId = 2,
            Name  = "Ted"
        };
        var merchant3 = new MerchantModel
        {
            AppId = 3,
            Name  = "Alice"
        };
        List <MerchantModel> list = new List <MerchantModel>();

        list.Add(merchant1);
        list.Add(merchant2);
        list.Add(merchant3);
        var model = new MerchantViewModel
        {
            Merchants = list
        };

        return(View(model));
    }
Ejemplo n.º 5
0
        public MerchantViewModel Convert(MerchantModel model, WeChatModels::ApplyProtocolWxResponse apply_protocol)
        {
            var viewModel = new MerchantViewModel();

            viewModel.Merchant = model;
            var idx = 0;

            (model.Address ?? "").Split('/').Select((name) =>
            {
                switch (idx)
                {
                case 0:
                    viewModel.Province = name;
                    break;

                case 1:
                    viewModel.City = name;
                    break;

                case 2:
                    viewModel.Area = name;
                    break;
                }
                idx++;
                return(name);
            }).ToList();
            viewModel.OwnerId         = model.EnjoyUser.Id;
            viewModel.ApplyProtocol   = apply_protocol;
            viewModel.StartTimeString = model.BeginTime.ToDateTimeFromUnixStamp().ToString("yyyy-MM-dd");
            viewModel.EndTimeString   = model.EndTime.ToDateTimeFromUnixStamp().ToString("yyyy-MM-dd");
            viewModel.Status          = model.Status;
            return(viewModel);
        }
Ejemplo n.º 6
0
        public ActionResult Campaign(string id)
        {
            User user = _session.eMatchUser;

            if (!user.TCAgreed)
            {
                return(RedirectToAction("Profile"));
            }

            ViewBag.User  = user.FirstName + " " + user.LastName;
            ViewBag.Title = "eMatch - My Campaign Manager";

            Profile  p = _user.GetProfile(user.Id);
            Campaign c = _offer.GetCampaignByProfileId(p.Id);

            MerchantViewModel mvm = new MerchantViewModel
            {
                Profile      = p,
                User         = user,
                Campaign     = c,
                CurrentOffer = (id != null ? _offer.GetOffer(id) : new Offer())
            };

            return(View(mvm));
        }
Ejemplo n.º 7
0
        public MerchantViewModel Add(MerchantViewModel MerchantViewModel)
        {
            var Merchant = Mapper.Map <MerchantViewModel, Merchant>(MerchantViewModel);

            _merchantRepository.Add(Merchant);
            _unitOfWork.Commit();
            return(MerchantViewModel);
        }
Ejemplo n.º 8
0
        public void Update(MerchantViewModel MerchantViewModel)
        {
            var temp = _merchantRepository.FindById(MerchantViewModel.KeyId);

            if (temp != null)
            {
                temp.Bank = MerchantViewModel.Bank;
            }
        }
        private NewMerchantCommand ReturnMerchantFilled(MerchantViewModel merchantViewModel)
        {
            merchantViewModel.IsOnline  = true;
            merchantViewModel.IsVisible = true;
            var newPaymentCommand = this.typeMapper.Map <NewMerchantCommand>(merchantViewModel);

            newPaymentCommand.Id = newPaymentCommand.Id != Guid.Empty ? newPaymentCommand.Id : Guid.NewGuid();

            return(newPaymentCommand);
        }
Ejemplo n.º 10
0
        public IActionResult Edit(MerchantViewModel merchantView)
        {
            var merchant = _mapper.Map <Merchant>(merchantView);

            _merchantRepository.Update(merchant);
            if (merchant != null)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
Ejemplo n.º 11
0
        public void CreatingEnjoyUserAndMerchant()
        {
            var verifyCode = _verifyCodeGenerator.GenerateNewVerifyCode();
            var signup     = new SignUpViewModel()
            {
                Mobile           = "13961576298",
                Password         = "******",
                ConfirmPassword  = "******",
                Signin           = false,
                VerificationCode = verifyCode
            };

            _enjoyAuthService.SignUp(signup);
            var merchant = new MerchantViewModel()
            {
                Province        = "四川",
                City            = "成都",
                Area            = "双流",
                OwnerId         = 1,
                Status          = AuditStatus.UnCommitted,
                StartTimeString = "2018-08-01",
                EndTimeString   = "2019-08-01",
                Merchant        = new MerchantModel()
                {
                    LogoUrl          = Guid.NewGuid().ToString(),
                    Address          = "四川省双流县",
                    AppId            = string.Empty,
                    BrandName        = "一品现捞",
                    AgreementMediaId = Guid.NewGuid().ToString(),
                    CategoryName     = "美食/小吃",
                    BeginTime        = DateTime.Now.ToUnixStampDateTime(),
                    CreateTime       = DateTime.Now.ToUnixStampDateTime(),
                    EndTime          = DateTime.Now.AddYears(3).ToUnixStampDateTime(),
                    Contact          = "13961576298",
                    EnjoyUser        = new EnjoyUserModel()
                    {
                        Id = 1
                    },
                    MerchantId          = _merchantid,
                    OperatorMediaId     = Guid.NewGuid().ToString(),
                    PrimaryCategoryId   = 12345,
                    Protocol            = Guid.NewGuid().ToString(),
                    Status              = AuditStatus.CHECKING,
                    Mobile              = "139615796298",
                    ErrMsg              = string.Empty,
                    UpdateTime          = DateTime.Now.ToUnixStampDateTime(),
                    SecondaryCategoryId = 333
                }
            };
            var result = this._merchantService.SaveOrUpdate(merchant.Merchant);

            Assert.AreEqual(result.ErrorCode, Constants.Success);
        }
Ejemplo n.º 12
0
        public async Task <IActionResult> Merchant()
        {
            MerchantViewModel model = null;

            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }

            var userMerchant = await _merchantRepository.GetByUser(user.Id);

            if (userMerchant == null)
            {
                return(View("Merchant/Create"));
            }

            var subscriptions = await _subscriptionsRepository.GetByUserId(user.Id);

            if (subscriptions == null ||
                subscriptions.Paid && subscriptions.Expired < DateTime.Now)
            {
                await _subscriptionsRepository.CreatePaymentAddress(user.Id);
            }

            decimal price = Convert.ToDecimal(_configuration["Subscription:" + subscriptions?.WalletType + ":Price"]);

            await Subscriptions(price);

            subscriptions = await _subscriptionsRepository.GetByUserId(user.Id);

            model = new MerchantViewModel
            {
                MerchantId     = userMerchant.MerchantId,
                MerchantSecret = Crypto.GetSha256Hash(userMerchant.MerchantSecret),
                RedirectUri    = userMerchant.RedirectUri,

                XPubKey         = userMerchant.XPubKey,
                EthereumAddress = userMerchant.EthereumAddress,

                Status     = subscriptions.Expired > DateTime.Now && subscriptions.Paid,
                Address    = subscriptions.Address,
                Expired    = subscriptions.Expired,
                WalletType = subscriptions.WalletType,
                Price      = price,

                StatusMessage = StatusMessage
            };

            return(View("Merchant/Index", model));
        }
Ejemplo n.º 13
0
        public MerchantViewModel GetBysId(string id)
        {
            var query = _merchantRepository.FindAll(p => p.UserBy);
            var _data = new MerchantViewModel();

            foreach (var item in query)
            {
                if ((item.UserFK.ToString()) == id)
                {
                    _data = Mapper.Map <Merchant, MerchantViewModel>(item);
                }
            }
            return(_data);
        }
Ejemplo n.º 14
0
        public IActionResult Index()
        {
            var ProductList = new SelectList(_unitOfWork.CountryRepo.GetAll().Where(c => (c.IsDeleted == false)).ToList(), "Id", "StrCountryName");

            ViewBag.ProductList = ProductList;

            MerchantViewModel merchantViewModel = new MerchantViewModel();

            merchantViewModel.Merchants  = _unitOfWork.MerchantRepo.GetAll();
            merchantViewModel.Terminals  = _unitOfWork.TerminalRepo.GetAll();
            merchantViewModel.Countries  = _unitOfWork.CountryRepo.GetAll();
            merchantViewModel.Currencies = _unitOfWork.CurrencyRepo.GetAll();

            return(View(merchantViewModel));
        }
Ejemplo n.º 15
0
        public async Task SaveMerchant(string merchantSecret, MerchantViewModel merchantModel, string userId)
        {
            var entry = await Get(m => m.Id == userId);

            if (Crypto.GetSha256Hash(entry.MerchantSecret) != merchantSecret)
            {
                entry.MerchantSecret = merchantSecret;
            }

            entry.XPubKey         = merchantModel.XPubKey;
            entry.EthereumAddress = merchantModel.EthereumAddress;
            entry.RedirectUri     = merchantModel.RedirectUri?.Trim();

            await Update(entry);
        }
        public async Task <IActionResult> Post([FromBody] MerchantViewModel merchantDTO)
        {
            try
            {
                if (this.environment.AllowPost())
                {
                    await this.merchantService.CreateAsync(merchantDTO);

                    return(Ok());
                }
                return(this.Unauthorized());
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
            }
        }
Ejemplo n.º 17
0
        public HomeController()
        {
            Options config = new Options
            {
                ApiKey    = "sandbox-pvY8iL8GbralWyf3rbzqqvP0SSouP6sQ",
                SecretKey = "sandbox-cVojNOhBjRqVjhhOThOFfv4cy35zKmC5",
                BaseUrl   = "https://sandbox-api.iyzipay.com"
            };

            option = config;


            MerchantVM = new MerchantViewModel()
            {
                SubMerchant = new SubMerchant()
            };
        }
Ejemplo n.º 18
0
        public ActionResult CreatePost(MerchantViewModel model)
        {
            //if (this.OS.WorkContext.GetState<IEnjoyUser>(EnjoyConstant.EnjoyCurrentUser) == null)
            //    return this.RedirectLocal("/access/sign");

            model.Merchant.EnjoyUser = this.Auth.GetAuthenticatedUser() as EnjoyUserModel;
            model.Merchant.Address   = string.Join("/", new string[] { model.Province, model.City, model.Area });
            model.Merchant.BeginTime = DateTime.UtcNow.ToUnixStampDateTime(); //model.StartTimeString.ToDateTime().ToUnixStampDateTime();
            model.Merchant.EndTime   = model.EndTimeString.ToDateTime().ToUnixStampDateTime();
            model.Merchant.Status    = AuditStatus.UnCommitted;
            if (model.Merchant.Id.Equals(0))
            {
                model.Merchant.CreateTime = DateTime.UtcNow.ToUnixStampDateTime();
            }
            model.Merchant.UpdateTime = DateTime.UtcNow.ToUnixStampDateTime();
            this.Merchant.SaveOrUpdate(model.Merchant);
            return(this.RedirectLocal("/merchant/mymerchant?datetime=" + DateTime.UtcNow.ToUnixStampDateTime()));
        }
Ejemplo n.º 19
0
        public async Task <IActionResult> Create(MerchantViewModel merchantModel)
        {
            if (ModelState.IsValid)
            {
                Merchant merchant = new Merchant
                {
                    Name    = merchantModel.Name,
                    OuterId = merchantModel.OuterId,
                    Status  = merchantModel.Status,
                    Created = DateTime.UtcNow
                };

                await _merchantRepository.Insert(merchant);

                return(RedirectToAction("List"));
            }

            return(View());
        }
        public async Task <IActionResult> GetMerchantOperatorListAsJson([FromQuery] Guid merchantId,
                                                                        CancellationToken cancellationToken)
        {
            try
            {
                String accessToken = await this.HttpContext.GetTokenAsync("access_token");

                MerchantModel merchantModel = await this.ApiClient.GetMerchant(accessToken, this.User.Identity as ClaimsIdentity, merchantId, cancellationToken);

                MerchantViewModel viewModel = this.ViewModelFactory.ConvertFrom(merchantModel);

                return(this.Json(Helpers.GetDataForDataTable(this.Request.Form, viewModel.Operators)));
            }
            catch (Exception e)
            {
                Logger.LogError(e);
                return(this.Json(Helpers.GetErrorDataForDataTable <String>("Error getting merchant operators")));
            }
        }
        /// <summary>
        /// Converts from.
        /// </summary>
        /// <param name="merchantModel">The merchant model.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">merchantModel</exception>
        public MerchantViewModel ConvertFrom(MerchantModel merchantModel)
        {
            if (merchantModel == null)
            {
                throw new ArgumentNullException(nameof(merchantModel));
            }

            MerchantViewModel viewModel = new MerchantViewModel();

            viewModel.EstateId           = merchantModel.EstateId;
            viewModel.MerchantId         = merchantModel.MerchantId;
            viewModel.MerchantName       = merchantModel.MerchantName;
            viewModel.Balance            = merchantModel.Balance;
            viewModel.SettlementSchedule = (Int32)merchantModel.SettlementSchedule;
            viewModel.AvailableBalance   = merchantModel.AvailableBalance;
            viewModel.Addresses          = this.ConvertFrom(merchantModel.Addresses);
            viewModel.Contacts           = this.ConvertFrom(merchantModel.Contacts);
            viewModel.Operators          = this.ConvertFrom(merchantModel.Operators);
            viewModel.Devices            = this.ConvertFrom(merchantModel.Devices);

            return(viewModel);
        }
Ejemplo n.º 22
0
        public IActionResult ImportFiles(IList <IFormFile> files)
        {
            var userid   = _generalFunctionController.Instance.getClaimType(User, CommonConstants.UserClaims.Key);
            var merchant = new MerchantViewModel();

            if (Guid.TryParse(userid, out var guid))
            {
                merchant = _merchantService.GetBysId(userid);
            }

            if (files != null && files.Count > 0)
            {
                List <string> fileName = new List <string>();
                for (int i = 0; i < files.Count; i++)
                {
                    var file      = files[i];
                    var extension = Path.GetExtension(file.FileName);
                    var filename  = DateTime.Now.ToString("yyyyMMddHHmmss");
                    filename = (filename + extension).ToString();
                    string folder = _hostingEnvironment.WebRootPath + $@"\images\merchant\" + merchant.MerchantCompanyName + "\\books";
                    if (!Directory.Exists(folder))
                    {
                        Directory.CreateDirectory(folder);
                    }
                    string filePath = Path.Combine(folder, filename);
                    fileName.Add(Path.Combine($@"\images\merchant\" + merchant.MerchantCompanyName + "\\books", filename).Replace($@"\", $@"/"));

                    using (FileStream fs = System.IO.File.Create(filePath))
                    {
                        file.CopyTo(fs);
                        fs.Flush();
                    }
                }
                _bookService.Save();
                return(new OkObjectResult(fileName));
            }
            return(new NoContentResult());
        }
Ejemplo n.º 23
0
        public IActionResult SaveEntity(List <BooksInDetailViewModel> listBooksInDetailVms)
        {
            var bookVm = new BooksInViewModel();
            var userid = _generalFunctionController.Instance.getClaimType(User, CommonConstants.UserClaims.Key);
            var model  = new MerchantViewModel();

            if (Guid.TryParse(userid, out var guid))
            {
                model = _merchantService.GetBysId(userid);
            }
            if (!ModelState.IsValid)
            {
                IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(new BadRequestObjectResult(allErrors));
            }
            else
            {
                if (model != null)
                {
                    bookVm.MerchantFK = model.KeyId;
                    _booksInService.Add(bookVm);
                    _booksInService.Save();
                    var booksInFK = _booksInService.GetLastest();
                    foreach (var i in listBooksInDetailVms)
                    {
                        i.BooksInFK = booksInFK;
                        _booksInDetailService.Add(i);
                        _bookService.UpdateBookQtyByBooksIn(i.BookFK, i.Qty);
                    }
                    _booksInDetailService.Save();
                    return(new OkObjectResult(bookVm));
                }
                else
                {
                    return(new BadRequestResult());
                }
            }
        }
Ejemplo n.º 24
0
        public ActionResult Merchant(MerchantViewModel model)
        {
            StringBuilder sbTable = new StringBuilder();

            sbTable.Append("<table class='list-tb' cellspacing='0' cellpadding='0'>");
            sbTable.Append("<thead>");
            sbTable.Append("<tr>");
            sbTable.Append("<th>商户代码</th>");
            sbTable.Append("<th>商户名称</th>");
            sbTable.Append("<th>POS机ID</th>");
            sbTable.Append("<th>营业执照编号</th>");
            sbTable.Append("<th>商户地址</th>");
            sbTable.Append("<th>法人</th>");
            sbTable.Append("<th>法人身份证</th>");
            sbTable.Append("<th>联系人</th>");
            sbTable.Append("<th>联系方式</th>");
            sbTable.Append("<th>联系地址</th>");
            sbTable.Append("<th>绑定银行卡账号</th>");
            sbTable.Append("<th>持卡人</th>");
            sbTable.Append("<th>开户行</th>");
            sbTable.Append("<th>激活时间</th>");
            sbTable.Append("<th>注销时间</th>");
            sbTable.Append("<th>业务员</th>");
            sbTable.Append("</tr>");
            sbTable.Append("</thead>");
            sbTable.Append("<tbody>");
            sbTable.Append("{content}");
            sbTable.Append("</tbody>");
            sbTable.Append("</table>");

            if (Request.HttpMethod == "GET")
            {
                #region GET
                sbTable.Replace("{content}", "<tr><td colspan=\"16\"></td></tr>");

                model.TableHtml = sbTable.ToString();
                return(View(model));

                #endregion
            }
            else
            {
                #region POST
                StringBuilder sql = new StringBuilder(" select b.ClientCode,b.YYZZ_Name,d.DeviceId,b.YYZZ_RegisterNo,b.YYZZ_Address,b.FR_Name,b.FR_IdCardNo,b.ContactName,b.ContactPhoneNumber,b.ContactAddress,c.BankAccountNo,c.BankAccountName,c.BankName,a.DepositPayTime,a.ReturnTime,e.FullName from [dbo].[MerchantPosMachine] a ");
                sql.Append(" left join[dbo].[Merchant] b on a.MerchantId = b.Id");
                sql.Append(" left join[dbo].[BankCard] c on a.BankCardId = c.Id");
                sql.Append(" left join[dbo].[PosMachine] d on a.PosMachineId = d.Id  ");
                sql.Append(" left join[dbo].[SysUser] e on b.SalesmanId = e.Id  ");

                sql.Append(" where 1=1 ");

                if (!string.IsNullOrEmpty(model.ClientCode))
                {
                    sql.Append(" and  b.ClientCode='" + model.ClientCode + "'");
                }
                if (model.StartTime != null)
                {
                    sql.Append(" and  a.DepositPayTime >='" + CommonUtils.ConverToShortDateStart(model.StartTime.Value) + "'");;
                }
                if (model.EndTime != null)
                {
                    sql.Append(" and  a.DepositPayTime <='" + CommonUtils.ConverToShortDateEnd(model.EndTime.Value) + "'");
                }

                sql.Append(" order by a.DepositPayTime desc ");


                DataTable     dtData         = DatabaseFactory.GetIDBOptionBySql().GetDataSet(sql.ToString()).Tables[0].ToStringDataTable();
                StringBuilder sbTableContent = new StringBuilder();
                for (int r = 0; r < dtData.Rows.Count; r++)
                {
                    sbTableContent.Append("<tr>");
                    for (int c = 0; c < dtData.Columns.Count; c++)
                    {
                        string td_value = "";

                        switch (c)
                        {
                        default:
                            td_value = dtData.Rows[r][c].ToString().Trim();
                            break;
                        }

                        sbTableContent.Append("<td>" + td_value + "</td>");
                    }

                    sbTableContent.Append("</tr>");
                }

                sbTable.Replace("{content}", sbTableContent.ToString());

                ReportTable reportTable = new ReportTable(sbTable.ToString());

                if (model.Operate == Enumeration.OperateType.Serach)
                {
                    return(Json(ResultType.Success, reportTable, ""));
                }
                else
                {
                    NPOIExcelHelper.HtmlTable2Excel(reportTable.Html, "商户信息登记报表");

                    return(Json(ResultType.Success, ""));
                }
                #endregion
            }
        }
Ejemplo n.º 25
0
        public ActionResult NoActiveAccount(MerchantViewModel model)
        {
            StringBuilder sbTable = new StringBuilder();

            sbTable.Append("<table class='list-tb' cellspacing='0' cellpadding='0'>");
            sbTable.Append("<thead>");
            sbTable.Append("<tr>");
            sbTable.Append("<th style=\"width:50%\">商户代码</th>");
            sbTable.Append("<th style=\"width:50%\">POS机ID</th>");
            sbTable.Append("</tr>");
            sbTable.Append("</thead>");
            sbTable.Append("<tbody>");
            sbTable.Append("{content}");
            sbTable.Append("</tbody>");
            sbTable.Append("</table>");

            if (Request.HttpMethod == "GET")
            {
                #region GET
                sbTable.Replace("{content}", "<tr><td colspan=\"2\"></td></tr>");

                model.TableHtml = sbTable.ToString();
                return(View(model));

                #endregion
            }
            else
            {
                #region POST
                StringBuilder sql = new StringBuilder(" select b.ClientCode,d.DeviceId from [dbo].[MerchantPosMachine] a ");
                sql.Append(" left join[dbo].[Merchant] b on a.MerchantId = b.Id ");
                sql.Append(" ");
                sql.Append(" left join[dbo].[PosMachine] d on a.PosMachineId = d.Id  ");
                sql.Append(" where 1=1 and a.[Status]=2 ");

                if (!string.IsNullOrEmpty(model.ClientCode))
                {
                    sql.Append(" and  b.ClientCode='" + model.ClientCode + "'");
                }
                if (model.StartTime != null)
                {
                    sql.Append(" and  a.DepositPayTime >='" + CommonUtils.ConverToShortDateStart(model.StartTime.Value) + "'");;
                }
                if (model.EndTime != null)
                {
                    sql.Append(" and  a.DepositPayTime <='" + CommonUtils.ConverToShortDateEnd(model.EndTime.Value) + "'");
                }

                sql.Append(" order by a.DepositPayTime desc ");


                DataTable     dtData         = DatabaseFactory.GetIDBOptionBySql().GetDataSet(sql.ToString()).Tables[0].ToStringDataTable();
                StringBuilder sbTableContent = new StringBuilder();
                for (int r = 0; r < dtData.Rows.Count; r++)
                {
                    sbTableContent.Append("<tr>");
                    for (int c = 0; c < dtData.Columns.Count; c++)
                    {
                        string td_value = "";

                        switch (c)
                        {
                        default:
                            td_value = dtData.Rows[r][c].ToString().Trim();
                            break;
                        }

                        sbTableContent.Append("<td>" + td_value + "</td>");
                    }

                    sbTableContent.Append("</tr>");
                }

                sbTable.Replace("{content}", sbTableContent.ToString());

                ReportTable reportTable = new ReportTable(sbTable.ToString());

                if (model.Operate == Enumeration.OperateType.Serach)
                {
                    return(Json(ResultType.Success, reportTable, ""));
                }
                else
                {
                    NPOIExcelHelper.HtmlTable2Excel(reportTable.Html, "商户账号(未激活)");

                    return(Json(ResultType.Success, ""));
                }
                #endregion
            }
        }
 public async Task <IActionResult> UpdateMerchant(MerchantViewModel viewModel,
                                                  CancellationToken cancellationToken)
 {
     return(this.View("MerchantDetails", viewModel));
 }
Ejemplo n.º 27
0
        public ActionResult DepositRent(MerchantViewModel model)
        {
            StringBuilder sbTable = new StringBuilder();

            sbTable.Append("<table class='list-tb' cellspacing='0' cellpadding='0'>");
            sbTable.Append("<thead>");
            sbTable.Append("<tr>");
            sbTable.Append("<th>商户代码</th>");
            sbTable.Append("<th>商户名称</th>");
            sbTable.Append("<th>POS机ID</th>");
            sbTable.Append("<th>地址</th>");
            sbTable.Append("<th>联系人</th>");
            sbTable.Append("<th>联系电话</th>");
            sbTable.Append("<th>押金金额</th>");
            sbTable.Append("<th>租金金额</th>");
            sbTable.Append("<th>缴费时间</th>");
            sbTable.Append("<th>合计</th>");
            sbTable.Append("</tr>");
            sbTable.Append("</thead>");
            sbTable.Append("<tbody>");
            sbTable.Append("{content}");
            sbTable.Append("</tbody>");
            sbTable.Append("</table>");

            if (Request.HttpMethod == "GET")
            {
                #region GET
                sbTable.Replace("{content}", "<tr><td colspan=\"10\"></td></tr>");

                model.TableHtml = sbTable.ToString();
                return(View(model));

                #endregion
            }
            else
            {
                #region POST
                StringBuilder sql = new StringBuilder("select c.ClientCode,c.YYZZ_Name,b.InsuranceOrderId,b.CarOwner,b.CommercialPrice,b.CompulsoryPrice,b.TravelTaxPrice,a.Price,b.MerchantCommission,a.SubmitTime,a.PayTime,a.CancleTime,a.Status from  [dbo].[Order]  a ");
                sql.Append(" inner join [dbo].[OrderToCarInsure]  b on a.Id=b.Id ");
                sql.Append(" left join [dbo].[Merchant] c on a.MerchantId=c.Id ");

                sql.Append(" where 1=1 ");



                if (!string.IsNullOrEmpty(model.ClientCode))
                {
                    sql.Append(" and  b.ClientCode='" + model.ClientCode + "'");
                }
                if (model.StartTime != null)
                {
                    sql.Append(" and  a.SubmitTime >='" + CommonUtils.ConverToShortDateStart(model.StartTime.Value) + "'");;
                }
                if (model.EndTime != null)
                {
                    sql.Append(" and  a.SubmitTime <='" + CommonUtils.ConverToShortDateEnd(model.EndTime.Value) + "'");
                }

                sql.Append(" order by a.SubmitTime desc ");


                DataTable     dtData         = DatabaseFactory.GetIDBOptionBySql().GetDataSet(sql.ToString()).Tables[0].ToStringDataTable();
                StringBuilder sbTableContent = new StringBuilder();
                for (int r = 0; r < dtData.Rows.Count; r++)
                {
                    sbTableContent.Append("<tr>");
                    for (int c = 0; c < dtData.Columns.Count; c++)
                    {
                        string td_value = "";

                        switch (c)
                        {
                        case 12:
                            td_value = GetOrderStatusName(dtData.Rows[r][c].ToString().Trim());
                            break;

                        default:
                            td_value = dtData.Rows[r][c].ToString().Trim();
                            break;
                        }

                        sbTableContent.Append("<td>" + td_value + "</td>");
                    }

                    sbTableContent.Append("</tr>");
                }

                sbTable.Replace("{content}", sbTableContent.ToString());

                ReportTable reportTable = new ReportTable(sbTable.ToString());

                if (model.Operate == Enumeration.OperateType.Serach)
                {
                    return(Json(ResultType.Success, reportTable, ""));
                }
                else
                {
                    NPOIExcelHelper.HtmlTable2Excel(reportTable.Html, "商户提现报表");

                    return(Json(ResultType.Success, ""));
                }
                #endregion
            }
        }
 public async Task CreateAsync(MerchantViewModel merchantDTO)
 {
     var newPaymentCommand = ReturnMerchantFilled(merchantDTO);
     await mediatorHandler.SendCommand <NewMerchantCommand>(newPaymentCommand);
 }
 public ActionResult Index(MerchantViewModel model)
 {
     return(View(model));
 }
Ejemplo n.º 30
0
 public async Task ResiterMerchant(MerchantViewModel merchantViewModel)
 {
     var registerCommand = _Mapper.Map <MerchantCommands>(merchantViewModel);
     await _Bus.SendCommand(registerCommand);
 }