コード例 #1
0
        public ActionResult MerchantIndex()
        {
            var model = new MerchantModel
            {
                Id              = GetParams <int>("id"),
                Name            = GetParams <string>("name"),
                Shortname       = GetParams <string>("shortname"),
                Branch          = GetParams <string>("branch"),
                Logo            = GetParams <string>("logo"),
                Introduction    = GetParams <string>("introduction"),
                Contact         = GetParams <string>("contact"),
                Telphone        = GetParams <string>("telphone"),
                Mobliephone     = GetParams <string>("mobliephone"),
                Businesslicence = GetParams <string>("businesslicence"),
                Legalperson     = GetParams <string>("legalperson"),
                DistrictId      = GetParams <int>("districtid"),
                Address         = GetParams <string>("address"),
                Longitude       = GetParams <decimal>("longitude"),
                Latitude        = GetParams <decimal>("latitude"),
                Cash            = GetParams <decimal>("cash"),
                Point           = GetParams <decimal>("point"),
                Status          = GetParams <int>("status"),
                Createtime      = GetParams <DateTime>("createtime"),
                Updatetime      = GetParams <DateTime>("updatetime"),
            };

            return(View(model));
        }
コード例 #2
0
    // 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));
    }
コード例 #3
0
            public void OrderPostCurrencyNotValidTest(object currency)
            {
                var assetPair       = "BTCUSD";
                var currentCurrency = currency.ToString();

                MarkupModel markUp = new MarkupModel(50, 30);

                var merchant = new MerchantModel(markUp);
                var response = lykkePayApi.assetPairRates.PostAssetPairRates(assetPair, merchant, markUp);

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK), "Unexpected status code");
                var postModel = JsonConvert.DeserializeObject <PostAssetsPairRatesModel>(response.Content);

                Assert.That(postModel.LykkeMerchantSessionId, Is.Not.Null, "LykkeMerchantSessionId not present in response");

                // order request below

                var orderRequest = new OrderRequestModel()
                {
                    currency = currentCurrency, amount = 10, exchangeCurrency = "BTC", successURL = successURL, errorURL = errorURL, progressURL = progressURL, orderId = TestData.GenerateNumbers(5), markup = new PostMarkup(markUp, 0)
                };
                var orderRequestJson = JsonConvert.SerializeObject(orderRequest);

                merchant = new MerchantModel(orderRequestJson);

                var orderResponse = lykkePayApi.order.PostOrder(merchant, orderRequestJson, postModel.LykkeMerchantSessionId);

                Assert.That(orderResponse.StatusCode, Is.EqualTo(HttpStatusCode.NotFound), "Unexpected status code in case currency not valid");
            }
コード例 #4
0
        GetPurchaseStatusResponse(string transactionId)
        {
            var request = new RestRequest(resource, Method.GET);

            request.AddUrlSegment("transactionId", transactionId);
            string urlToSign     = client.BaseUrl + request.Resource;
            var    merchantModel = new MerchantModel(urlToSign.Replace("https:", "http:"));

            request.AddHeader("Lykke-Merchant-Id", merchantModel.LykkeMerchantId);
            request.AddHeader("Lykke-Merchant-Sign", merchantModel.LykkeMerchantSign);
            if (merchantModel.LykkeMerchantSessionId != null)
            {
                request.AddHeader("Lykke-Merchant-Session-Id", merchantModel.LykkeMerchantSessionId);
            }

            var response = client.Execute(request);

            try
            {
                var data = JsonConvert.DeserializeObject <PostPurchaseResponseModel>(response.Content);
                return(response, data);
            }
            catch (JsonReaderException)
            {
                return(response, null);
            }
        }
        public ActionResult SelectPaidToDate(MerchantPaidUpModel WebMerchant)
        {
            if (ModelState.IsValid)
            {
                // Attempt to update the merchant paid to date
                try
                {
                    bool updateStatus = MerchantServiceInstance.UpdateMerchantPaidTo(WebMerchant);

                    if (updateStatus == true)
                    {
                        return(RedirectToAction("SelectMerchantForPayment"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Failed to update the merchant");
                    }
                }
                catch (Exception Ex)
                {
                    ModelState.AddModelError("", Common.StandardExceptionErrorMessage(Ex));
                }
            }
            // If we got this far, something failed, redisplay form
            int           id           = Convert.ToInt32(WebMerchant.ID);
            MerchantModel WebMerchantD = MerchantServiceInstance.GetMerchant(id);

            return(View(WebMerchantD));
        }
        public ActionResult Edit(MerchantModel WebMerchant)
        {
            if (ModelState.IsValid)
            {
                // Attempt to add the merchant
                try
                {
                    bool createStatus = MerchantServiceInstance.UpdateMerchant(WebMerchant);

                    if (createStatus == true)
                    {
                        return(RedirectToAction("SelectMerchantForEdit"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Failed to update the merchant");
                    }
                }
                catch (Exception Ex)
                {
                    ModelState.AddModelError("", Common.StandardExceptionErrorMessage(Ex));
                }
            }
            // If we got this far, something failed, redisplay form

            return(View(WebMerchant));
        }
コード例 #7
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);
        }
コード例 #8
0
        public async Task <ActionResult> AddOrEditMerchantDialog(string id = null)
        {
            var merchant = new MerchantModel();

            bool isNewMerchant = id == null;

            if (!isNewMerchant)
            {
                merchant = await _payMerchantClient.Api.GetByIdAsync(id);
            }

            var viewModel = new AddOrEditMerchantDialogViewModel
            {
                Caption       = isNewMerchant ? "Add merchant" : "Edit merchant",
                IsNewMerchant = id == null,
                ApiKey        = merchant.ApiKey,
                Id            = id,
                LwId          = merchant.LwId,
                Name          = merchant.Name,
                DisplayName   = merchant.DisplayName,
                Email         = merchant.Email
            };

            return(View(viewModel));
        }
コード例 #9
0
    public Int64 GetValueFindByText(string Text)
    {
        MerchantModel _model = new MerchantModel();
        Merchant      p      = _model.FindMerchant(Text);

        ////var p = ddlMercharList.Items.FindByText
        ////    (from m in ddlMercharList.Items.AsQueryable()
        ////         where m.MerchantNameDetail.Equals(searchText)
        ////         select m.MID).SingleOrDefault();
        //string p = ddlMercharList.Items.FindByText(searchText).Value.ToString();
        if (p.MID != 0)
        {
            return(Convert.ToInt64(p.MID));//ddlMercharList.Items.FindByText(searchText).Value);
        }
        else
        {
            return(0);
        }
        //MerchantModel obj = new MerchantModel();

        //var mid = (from m in obj.GetAllMerchants()
        //          where m.MerchantNameDetail == Text
        //          select m.MID).SingleOrDefault();

        //return 0;
    }
コード例 #10
0
            public void PostAssetPairPercentDiffValuesPositiveTest(object percent)
            {
                var p = double.Parse(percent.ToString(), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture);

                var doubleToString = p.ToString();;

                if (!doubleToString.Contains("."))
                {
                    doubleToString = p.ToString() + ".0";
                }

                string markUp = $"{{\"markup\": {{\"percent\":{doubleToString}, \"pips\": 0}}}}";

                var expectedAsk = ExpectedAsk(p, 0, testAsset);
                var expectedBid = ExpectedBid(p, 0, testAsset);

                var merchant = new MerchantModel(markUp);

                var response = lykkePayApi.assetPairRates.PostAssetsPairRates(testAsset, merchant, markUp);

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK), "Unexpected status code");
                var postModel = JsonConvert.DeserializeObject <PostAssetsPairRatesModel>(response.Content);

                Assert.Multiple(() =>
                {
                    Assert.That(postModel.LykkeMerchantSessionId, Is.Not.Null, "LykkeMerchantSessionId not present in response");
                    Assert.That(postModel.ask, Is.EqualTo(expectedAsk), "Actual ask is not equal to expected");
                    Assert.That(postModel.bid, Is.EqualTo(expectedBid), "Actual bid is not equal to expected");
                });
            }
コード例 #11
0
    public int UpdateMerchantInfo(MerchantModel merchant)
    {
        int actionResult = 0;

        try
        {
            OpenConnection();

            ArrayList arlSqlParameter = new ArrayList();
            arlSqlParameter.Add(new SqlParameter("@MerchantId", merchant.MerchantId));
            arlSqlParameter.Add(new SqlParameter("@MerchantName", merchant.MerchantName));
            arlSqlParameter.Add(new SqlParameter("@LogInId", merchant.LoginId));
            arlSqlParameter.Add(new SqlParameter("@Password", merchant.Password));
            arlSqlParameter.Add(new SqlParameter("@IsActive", merchant.IsActive));
            arlSqlParameter.Add(new SqlParameter("@UpdatedBy", merchant.UpdatedBy));

            actionResult = this.ExecuteActionQuery("[kp].[USP_UpdateMerchantinfo]", arlSqlParameter);
            return(actionResult);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            CloseConnection();
        }
    }
コード例 #12
0
        /// <summary>
        ///  启用/禁用
        /// </summary>
        /// <param name="accountStatus"></param>
        /// <returns></returns>
        public JsonRsp SetStatus(long[] Ids, int status)
        {
            if (Ids == null)
            {
                return(new JsonRsp {
                    success = false, retmsg = "请选择要操作的数据"
                });
            }
            MerchantTypeModel user  = new MerchantTypeModel();
            MerchantModel     model = new MerchantModel();

            model.Status     = status;
            model.UpdateId   = AdminId;
            model.UpdateUser = AdminName;
            model.UpdateIP   = Util.GetLocalIP();
            model.UpdateTime = DateTime.Now;
            OQL q = OQL.From(model)
                    .Update(model.Status, model.UpdateId, model.UpdateUser, model.UpdateIP, model.UpdateIP)
                    .Where(cmp => cmp.Comparer(model.ID, "IN", Ids))       //为了安全,不带Where条件是不会全部删除数据的
                    .END;
            int returnvalue = EntityQuery <MerchantTypeModel> .Instance.ExecuteOql(q);

            return(new JsonRsp {
                success = returnvalue > 0, code = returnvalue
            });
        }
コード例 #13
0
        PostPurchaseResponse(MerchantModel merchantModel, PostConvertTransferModel purchaseModel)
        {
            var request = new RestRequest(resource, Method.POST);
            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.NullValueHandling = NullValueHandling.Ignore;
            string jsonBody = JsonConvert.SerializeObject(purchaseModel, Formatting.Indented, settings);

            merchantModel.Sign(jsonBody);

            request.AddParameter("application/json", jsonBody, "application/json", ParameterType.RequestBody);
            request.AddHeader("Lykke-Merchant-Id", merchantModel.LykkeMerchantId);
            request.AddHeader("Lykke-Merchant-Sign", merchantModel.LykkeMerchantSign);
            if (merchantModel.LykkeMerchantSessionId != null)
            {
                request.AddHeader("Lykke-Merchant-Session-Id", merchantModel.LykkeMerchantSessionId);
            }

            var response = client.Execute(request);

            try
            {
                var data = JsonConvert.DeserializeObject <PostConvertTransferResponseModel>(response.Content);
                return(response, data);
            }
            catch (JsonReaderException)
            {
                return(response, null);
            }
        }
コード例 #14
0
 public static MerchantPO ToPO(this MerchantModel item)
 {
     if (item == null)
     {
         return(null);
     }
     return(new MerchantPO
     {
         Id = item.Id,
         Name = item.Name,
         Shortname = item.Shortname,
         Branch = item.Branch,
         Logo = item.Logo,
         Introduction = item.Introduction,
         Contact = item.Contact,
         Telphone = item.Telphone,
         Mobliephone = item.Mobliephone,
         Businesslicence = item.Businesslicence,
         Legalperson = item.Legalperson,
         DistrictId = item.DistrictId,
         Address = item.Address,
         Longitude = item.Longitude,
         Latitude = item.Latitude,
         Cash = item.Cash,
         Point = item.Point,
         Status = item.Status,
         Createtime = item.Createtime,
         Updatetime = item.Updatetime,
     });
 }
コード例 #15
0
ファイル: Merchant.cs プロジェクト: awolfnet/OliveFramework
        public void AddMerchant(string merchantName, string merchantContact, string merchantWebsite, string merchantDescription, List <IDText> merchantSellProductList, uint marketID, uint?ownerID, int?typeID)
        {
            MerchantModel merchant = new MerchantModel();

            merchant.contact     = merchantContact;
            merchant.description = merchantDescription;
            merchant.name        = merchantName;
            merchant.website     = merchantWebsite;
            merchant.marketid    = marketID;
            merchant.aid         = ownerID;
            merchant.mtypeid     = typeID;

            db.BeginTransaction();
            db.InsertSingleLine <MerchantModel>("merchant", merchant);

            uint merchantID = db.GetLastInsertID();

            foreach (IDText idtext in merchantSellProductList)
            {
                MerchantSellModel merchantSell = new MerchantSellModel();
                merchantSell.merchantid = merchantID;
                merchantSell.productid  = idtext.id;
                db.InsertSingleLine <MerchantSellModel>("merchantsell", merchantSell);
            }

            db.CommitTransaction();
        }
コード例 #16
0
ファイル: Merchant.cs プロジェクト: awolfnet/OliveFramework
        public void ModifyMerchant(uint merchantID, string merchantName, string merchantContact, string merchantWebsite, string merchantDescription, List <IDText> merchantSellProductList, uint marketID, uint?ownerID)
        {
            MerchantModel merchant = new MerchantModel();

            merchant.contact     = merchantContact;
            merchant.description = merchantDescription;
            merchant.name        = merchantName;
            merchant.website     = merchantWebsite;
            merchant.marketid    = null;
            merchant.aid         = ownerID;

            string where = string.Format("merchant.merchantid={0}", merchantID);

            db.BeginTransaction();
            db.UpdateSingleLine <MerchantModel>("merchant", merchant, where);

            //uint merchantID = db.GetLastInsertID();

            /*
             * foreach (IDText idtext in merchantSellProductList)
             * {
             *  MerchantSellModel merchantSell = new MerchantSellModel();
             *  merchantSell.merchantid = merchantID;
             *  merchantSell.productid = idtext.id;
             *  db.InsertSingleLine<MerchantSellModel>("merchantsell", merchantSell);
             * }
             */

            db.CommitTransaction();
        }
        public async Task <IActionResult> GetOperatorListAsJson(Guid merchantId, CancellationToken cancellationToken)
        {
            try
            {
                String accessToken = await this.HttpContext.GetTokenAsync("access_token");

                EstateModel estate = await this.ApiClient.GetEstate(accessToken, this.User.Identity as ClaimsIdentity, cancellationToken);

                List <OperatorListViewModel> operatorViewModels = this.ViewModelFactory.ConvertFrom(estate.EstateId, estate.Operators);

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

                List <OperatorListViewModel> availableOperators = new List <OperatorListViewModel>();
                foreach (OperatorListViewModel operatorListViewModel in operatorViewModels)
                {
                    if (merchantModel.Operators.SingleOrDefault(o => o.OperatorId == operatorListViewModel.OperatorId) == null)
                    {
                        availableOperators.Add(operatorListViewModel);
                    }
                }

                return(this.Json(availableOperators));
            }
            catch (Exception e)
            {
                Logger.LogError(e);
                return(this.Json(new List <OperatorListViewModel>()));
            }
        }
コード例 #18
0
        public static CardCounponModel Convert(this CardCounponViewModel viewModel, MerchantModel merchant)
        {
            var model = new CardCounponModel()
            {
                BrandName      = viewModel.Choose <ICardCoupon>().BaseInfo.Title,
                CreatedTime    = viewModel.CreatedTime,
                LastUpdateTime = DateTime.UtcNow.ToUnixStampDateTime(),
                ErrMsg         = string.Empty,
                Id             = viewModel.Id,
                Merchant       = merchant,
                Quantity       = (int)viewModel.Choose <ICardCoupon>().BaseInfo.Sku.Quantity,
                State          = viewModel.State,
                Type           = viewModel.CardType,
                WxNo           = viewModel.WxNo
            };

            viewModel.Choose <ICardCoupon>().AdvancedInfo.WitFixedSettings(viewModel.CardType);
            viewModel.Choose <ICardCoupon>().BaseInfo.WithFixedSettings(viewModel.CardType, merchant);

            model.CardCoupon = viewModel.Choose();
            model.CardCoupon.Set((ctx) =>
            {
                ctx.CardType = viewModel.CardType;
                ctx.CardId   = viewModel.WxNo;
            });
            var json = model.CardCoupon.SerializeToJson();

            return(model);
        }
コード例 #19
0
    public DataTable InsertNewMerchant(MerchantModel merchant)
    {
        DataTable dt = new DataTable();

        try
        {
            OpenConnection();
            ArrayList arlSqlParameter = new ArrayList();
            arlSqlParameter.Add(new SqlParameter("@MerchantName", merchant.MerchantName));
            arlSqlParameter.Add(new SqlParameter("@LoginId", merchant.LoginId));
            arlSqlParameter.Add(new SqlParameter("@Password", merchant.Password));
            arlSqlParameter.Add(new SqlParameter("@PostedBy", merchant.PostedBy));
            arlSqlParameter.Add(new SqlParameter("@IsActive", merchant.IsActive));
            dt = this.ExecuteQuery("[kp].[USP_InsertNewMerchant]", arlSqlParameter);
            return(dt);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            CloseConnection();
        }
    }
コード例 #20
0
 /// <summary>
 /// 更新医生model
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public async Task <bool> UpdateAsync(MerchantModel model)
 {
     using (var conn = MySqlHelper.GetConnection())
     {
         return((await conn.UpdateAsync(model)) > 0);
     }
 }
コード例 #21
0
            public void PostAssetPairPipsDiffValuesBidRoundingTest(object expectedBid, object roundedBid)
            {
                var assetPairRates = lykkePayApi.assetPairRates.GetAssetPairRates(testAsset).GetResponseObject();

                var bid         = assetPairRates.bid;
                var deltaSpread = new Decimal(new AzureUtils(LocalConfig.GetLocalConfig().AzureDeltaSpread)
                                              .GetCloudTable("Merchants")
                                              .GetSearchResult("ApiKey", "BILETTERTESTKEY")
                                              .GetCellByKnowRowKeyAndKnownCellValue("DeltaSpread", "bitteller.test.1").DoubleValue.Value);

                var newBid  = assetPairRates.bid - assetPairRates.bid * deltaSpread / 100;
                var percent = (-decimal.Parse(expectedBid.ToString()) + newBid - newBid * 0.1m /*lykkays percent*/ - newBid * 0 /*lykkays pips*/) * 100 / newBid;
                var perc    = percent.ToString(CultureInfo.InvariantCulture);

                string markUp = $"{{\"markup\": {{\"percent\":{perc}, \"pips\": 0}}}}";

                var merchant = new MerchantModel(markUp);

                var response = lykkePayApi.assetPairRates.PostAssetsPairRates(testAsset, merchant, markUp);

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK), "Unexpected status code");
                var postModel = JsonConvert.DeserializeObject <PostAssetsPairRatesModel>(response.Content);

                Assert.Multiple(() =>
                {
                    Assert.That(postModel.LykkeMerchantSessionId, Is.Not.Null, "LykkeMerchantSessionId not present in response");
                    Assert.That(postModel.bid, Is.EqualTo(decimal.Parse(roundedBid.ToString())), "Actual bid is not equal to expected");
                });
            }
コード例 #22
0
 /// <summary>
 /// save
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public JsonRsp Save(MerchantModel model)
 {
     model.TenantId = TenantId;
     if (model.ID == 0)
     {
         model.CreateId   = AdminId;
         model.CreateUser = AdminName;
         model.CreateIP   = Util.GetLocalIP();
         model.CreateTime = DateTime.Now;
         return(Add(model));
     }
     else
     {
         if (model.TenantId != TenantId)
         {
             return(new JsonRsp {
                 success = false, code = -1, retmsg = "数据验证失败"
             });
         }
         model.UpdateId   = AdminId;
         model.UpdateUser = AdminName;
         model.UpdateIP   = Util.GetLocalIP();
         model.UpdateTime = DateTime.Now;
         return(Update(model));
     }
 }
コード例 #23
0
            public void OrderResponseValidateTest()
            {
                var assetPair = "BTCUSD";

                MarkupModel markUp = new MarkupModel(50, 30);

                var merchant = new MerchantModel(markUp);
                var response = lykkePayApi.assetPairRates.PostAssetPairRates(assetPair, merchant, markUp);

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK), "Unexpected status code");
                var postModel = JsonConvert.DeserializeObject <PostAssetsPairRatesModel>(response.Content);

                Assert.That(postModel.LykkeMerchantSessionId, Is.Not.Null, "LykkeMerchantSessionId not present in response");

                // order request below

                var orderRequest = new OrderRequestModel()
                {
                    currency = "USD", amount = 10, exchangeCurrency = "BTC", successURL = successURL, errorURL = errorURL, progressURL = progressURL, orderId = TestData.GenerateNumbers(5), markup = new PostMarkup(markUp, 0)
                };
                var orderRequestJson = JsonConvert.SerializeObject(orderRequest);

                merchant = new MerchantModel(orderRequestJson);

                var orderResponse = lykkePayApi.order.PostOrderModel(merchant, orderRequestJson, postModel.LykkeMerchantSessionId);

                Assert.That(orderResponse.currency, Is.EqualTo(orderRequest.exchangeCurrency), "Unexpected currency in order response");
                Assert.That(orderResponse.exchangeRate * orderResponse.amount, Is.EqualTo(orderRequest.amount), "Exchange rate * amount in order response not equals to request amount");
            }
コード例 #24
0
        /// <summary>
        /// 删
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonRsp Remove(MerchantModel model)
        {
            int returnvalue = EntityQuery <MerchantModel> .Instance.Delete(model);

            return(new JsonRsp {
                success = returnvalue > 0, code = returnvalue
            });
        }
コード例 #25
0
        private void SetMerchantHeadersForGetRequest(ref IRestRequest request)
        {
            string urlToSign = client.BaseUrl + request.Resource;
            var    merchant  = new MerchantModel(urlToSign.Replace("https:", "http:"));

            request.AddHeader("Lykke-Merchant-Id", merchant.LykkeMerchantId);
            request.AddHeader("Lykke-Merchant-Sign", merchant.LykkeMerchantSign);
        }
コード例 #26
0
ファイル: Merchant.cs プロジェクト: awolfnet/OliveFramework
        public MerchantModel GetMerchantInfo(uint merchantID)
        {
            string where = string.Format(" `merchantid`={0}", merchantID);

            MerchantModel merchantInfo = db.SelectData <MerchantModel>("merchant", where)[0];

            return(merchantInfo);
        }
コード例 #27
0
        /// <summary>
        /// 增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonRsp Add(MerchantModel model)
        {
            int returnvalue = EntityQuery <MerchantModel> .Instance.Insert(model);

            return(new JsonRsp {
                success = returnvalue > 0, code = returnvalue
            });
        }
        public ActionResult SetAgent(int id)
        {
            MerchantModel        WebMerchant = MerchantServiceInstance.GetMerchant(id);
            MerchantPricingModel ToShow      = new MerchantPricingModel();

            ToShow.ID           = WebMerchant.ID;
            ToShow.MerchantName = WebMerchant.MerchantName;
            return(View(ToShow));
        }
コード例 #29
0
        public async Task <MerchantModel> AddAsync(MerchantModel model)
        {
            var merchant = _mapper.Map <Merchant>(model);

            _unitOfWork.MerchantRepository.Add(merchant);
            await _unitOfWork.SaveAsync();

            return(_mapper.Map <MerchantModel>(merchant));
        }
        public ActionResult SelectPaidToDate(int id)
        {
            MerchantModel WebMerchant = MerchantServiceInstance.GetMerchant(id);

            // want to compute a suggested date based on
            // billing frequency
            //ViewData["SuggestedDate"] = WebMerchant.
            return(View(WebMerchant));
        }
コード例 #31
0
        protected void StatusView_PreRender(object sender, EventArgs e)
        {
            MerchantModel editMerchant = new MerchantModel();
            Int32 merchantRecordId;
            UnderwritingResultModel underwritingResult = new UnderwritingResultModel();

            try
            {
                rptrStatusChanges.DataBind();

                merchantRecordId = Convert.ToInt32(hMerchantRecordId.Value);

                if (lblStatusDescription.Text.ToLower() == "pre-enrolled")
                {
                    phQuickActions.Visible = false;
                    lblMerchantActionMessage.Text = "No Actions can be performed on a Pre-Enrolled merchant.";
                }
                else if (lblStatusDescription.Text.ToLower() == "enrolled")
                {
                    phDenyMerchant.Visible = true;
                    phDenyDisallowed.Visible = false;
                    lblDenyDisallowed.Text = "";

                    phSuspendMerchant.Visible = false;
                    phSuspendDisallowed.Visible = true;
                    lblSuspendDisallowed.Text = "This merchant is still in Enrolled status.  You cannot Suspend a merchant until they are Active.";

                    phReinstateMerchant.Visible = false;
                    phReinstateDisallowed.Visible = true;
                    lblReinstateDisallowed.Text = "You can only Reinstate a merchant if they are in Suspended Status.";

                    phCancelMerchant.Visible = true;
                    phCancelDisallowed.Visible = false;
                    lblCancelDisallowed.Text = "";

                    using (ApplicationDbContext ctx = new ApplicationDbContext())
                    {
                        if (ctx.Merchants.Any(m => m.RecordId == merchantRecordId))
                        {
                            editMerchant = ctx.Merchants.First(m => m.RecordId == merchantRecordId);

                            if (ctx.UnderwritingResults.Any(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true))
                            {
                                underwritingResult = ctx.UnderwritingResults.First(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true);

                                if (editMerchant.UnderwritingStatus.StatusDescription == "Pending")
                                {
                                    phApproveMerchant.Visible = false;
                                    phApproveDisallowed.Visible = true;
                                    lblApprovalDisallowed.Text = "The Underwriting Status for this merchant is still Pending.  In order to Approve this merchant, the Underwriting Status must be Approved.";
                                }
                                else if (editMerchant.UnderwritingStatus.StatusDescription == "Approved")
                                {
                                    phApproveMerchant.Visible = true;
                                    phApproveDisallowed.Visible = false;
                                    lblApprovalDisallowed.Text = "";
                                }
                                else if (editMerchant.UnderwritingStatus.StatusDescription == "Denied")
                                {
                                    phApproveMerchant.Visible = false;
                                    phApproveDisallowed.Visible = true;
                                    lblApprovalDisallowed.Text = "The Underwriting Status for this merchant is Denied.  In order to Approve this merchant, the Underwriting Status must be Approved.";
                                }
                                else
                                {
                                    phApproveMerchant.Visible = false;
                                    phApproveDisallowed.Visible = true;
                                    lblApprovalDisallowed.Text = "The Underwriting Status for this merchant is Outdated.  In order to Approve this merchant, please renew the Underwriting results.";
                                }

                            }
                            else
                            {
                                phApproveMerchant.Visible = false;
                                phApproveDisallowed.Visible = true;
                                lblApprovalDisallowed.Text = "This merchant has not been underwritten.  In order to Approve this merchant, please Underwrite them first.";

                            }
                        }
                    }
                }
                else if (lblStatusDescription.Text.ToLower() == "active")
                {
                    phApproveMerchant.Visible = false;
                    phApproveDisallowed.Visible = true;
                    lblApprovalDisallowed.Text = "This merchant is already Active.";

                    phDenyMerchant.Visible = false;
                    phDenyDisallowed.Visible = true;
                    lblDenyDisallowed.Text = "This merchant is already Active.  You can Suspend or Cancel them if necessary.";

                    phSuspendMerchant.Visible = true;
                    phSuspendDisallowed.Visible = false;
                    lblSuspendDisallowed.Text = "";

                    phReinstateMerchant.Visible = false;
                    phReinstateDisallowed.Visible = true;
                    lblReinstateDisallowed.Text = "You can only Reinstate a merchant if they are in Suspended Status.";

                    phCancelMerchant.Visible = true;
                    phCancelDisallowed.Visible = false;
                    lblCancelDisallowed.Text = "";
                }
                else if (lblStatusDescription.Text.ToLower() == "suspended")
                {
                    phApproveMerchant.Visible = false;
                    phApproveDisallowed.Visible = true;
                    lblApprovalDisallowed.Text = "This merchant is Suspended.  To end the merchant's suspension, Reinstate them.";

                    phDenyMerchant.Visible = false;
                    phDenyDisallowed.Visible = true;
                    lblDenyDisallowed.Text = "This merchant cannot be Denied.  You can Cancel them if necessary.";

                    phSuspendMerchant.Visible = false;
                    phSuspendDisallowed.Visible = true;
                    lblSuspendDisallowed.Text = "This merchant is already suspended.";

                    phReinstateMerchant.Visible = true;
                    phReinstateDisallowed.Visible = false;
                    lblReinstateDisallowed.Text = "";

                    phCancelMerchant.Visible = true;
                    phCancelDisallowed.Visible = false;
                    lblCancelDisallowed.Text = "";
                }
                else if (lblStatusDescription.Text.ToLower() == "cancelled")
                {
                    phQuickActions.Visible = false;
                    lblMerchantActionMessage.Text = "No Actions can be performed on a Cancelled merchant.";
                }
                else if (lblStatusDescription.Text.ToLower() == "denied")
                {
                    phQuickActions.Visible = false;
                    lblMerchantActionMessage.Text = "No Actions can be performed on a Denied merchant.";
                }
            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "StatusView_PreRender");
            }
        }
コード例 #32
0
        protected void tabStripMerchantDetail_TabClick(object sender, RadTabStripEventArgs e)
        {
            MerchantModel editMerchant = new MerchantModel();
            Int32 merchantRecordId;
            UnderwritingResultModel underwritingResult = new UnderwritingResultModel();

            try
            {
                merchantRecordId = Convert.ToInt32(hMerchantRecordId.Value);

                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    editMerchant = ctx.Merchants.First(m => m.RecordId == merchantRecordId);

                    if (ctx.UnderwritingResults.Any(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true))
                    {
                        underwritingResult = ctx.UnderwritingResults.First(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true);

                        if (underwritingResult.UnderwritingDecision == "Pending" || String.IsNullOrEmpty(underwritingResult.UnderwritingDecision))
                        {
                            if (underwritingResult.UnderwriterUser.Id == Page.User.Identity.GetUserId())
                            {
                                pnlUnderwritingHistory.Visible = false;
                                pnlNewUnderwriting.Visible = false;
                                pnlNewUnderwriting2.Visible = true;
                                pnlUnderwritingButtons.Visible = false;
                                pnlUnderwritingAdvancedButtons.Visible = true;
                                btnUnderwritingCancel.Visible = true;
                                btnUnderwritingComplete.Visible = true;
                                btnUnderwritingSave.Visible = true;
                                btnAddNewUnderwriting.Visible = false;

                                //Enable and Fill Radio Button Fields
                                rblUWCorpInfoVerifiedResult.Enabled = true;
                                rblUWBusLicStatusResult.Enabled = true;
                                rblUWEINVerifiedResult.Enabled = true;
                                rblUWPrincipalVerifiedResult.Enabled = true;
                                rblUWCardSalesIndicatorsVerifiedResult.Enabled = true;
                                rblUWBankingInfoVerifiedResult.Enabled = true;
                                rblUWMCCVerifiedResult.Enabled = true;
                                rblUWBVIVerifiedResult.Enabled = true;
                                rblUWTaxLiensVerifiedResult.Enabled = true;
                                rblUWRiskIndicatorVerifiedResult.Enabled = true;

                                rblUWCorpInfoVerifiedResult.SelectedValue = underwritingResult.CorpInfoResult.ToString();
                                rblUWBusLicStatusResult.SelectedValue = underwritingResult.BusLicStatusResult.ToString();
                                rblUWEINVerifiedResult.SelectedValue = underwritingResult.EINResult.ToString();
                                rblUWPrincipalVerifiedResult.SelectedValue = underwritingResult.PrincipalResult.ToString();
                                rblUWCardSalesIndicatorsVerifiedResult.SelectedValue = underwritingResult.CardSalesIndicatorResult.ToString();
                                rblUWBankingInfoVerifiedResult.SelectedValue = underwritingResult.BankingInfoResult.ToString();
                                rblUWMCCVerifiedResult.SelectedValue = underwritingResult.MCCResult.ToString();
                                rblUWBVIVerifiedResult.SelectedValue = underwritingResult.BVIResult.ToString();
                                rblUWTaxLiensVerifiedResult.SelectedValue = underwritingResult.TaxLiensResult.ToString();
                                rblUWRiskIndicatorVerifiedResult.SelectedValue = underwritingResult.RiskIndicatorResult.ToString();

                                //Enable and Fill Text Area Fields
                                txtUWCorpInfoVerifiedNotes.Enabled = true;
                                txtUWBUsLicStatusVerifiedNotes.Enabled = true;
                                txtUWEINVerifiedNotes.Enabled = true;
                                txtUWPrincipalVerifiedNotes.Enabled = true;
                                txtUWCardSalesIndicatorsVerifiedNotes.Enabled = true;
                                txtUWBankingInfoVerifiedNotes.Enabled = true;
                                txtUWMCCVerifiedNotes.Enabled = true;
                                txtUWBVIVerifiedNotes.Enabled = true;
                                txtUWTaxLiensVerifiedNotes.Enabled = true;
                                txtUWRiskIndicatorVerifiedNotes.Enabled = true;

                                txtUWCorpInfoVerifiedNotes.Text = underwritingResult.CorpInfoNotes;
                                txtUWBUsLicStatusVerifiedNotes.Text = underwritingResult.BusLicStatusNotes;
                                txtUWEINVerifiedNotes.Text = underwritingResult.EINNotes;
                                txtUWPrincipalVerifiedNotes.Text = underwritingResult.PrincipalNotes;
                                txtUWCardSalesIndicatorsVerifiedNotes.Text = underwritingResult.CardSalesIndicatorNotes;
                                txtUWBankingInfoVerifiedNotes.Text = underwritingResult.BankingInfoNotes;
                                txtUWMCCVerifiedNotes.Text = underwritingResult.MCCNotes;
                                txtUWBVIVerifiedNotes.Text = underwritingResult.BVINotes;
                                txtUWTaxLiensVerifiedNotes.Text = underwritingResult.TaxLiensNotes;
                                txtUWRiskIndicatorVerifiedNotes.Text = underwritingResult.RiskIndicatorNotes;

                                //Disable Begin Button
                                btnBeginUnderwritingUpdate.Enabled = false;

                                //Fill Underwriter Initials
                                txtUnderwriterInitials.Text = underwritingResult.UnderwriterInitials;
                                txtUnderwriterInitials.Enabled = false;

                                lblUnderwritingMessage2.Text = "The current Underwriting Process is still in progress.  Please complete or cancel this process to view Underwriting History.";
                            }
                            else
                            {
                                btnAddNewUnderwriting.Enabled = false;
                            }
                        }
                    }

                    if (e.Tab.Text == "Underwriting")
                    {
                        pnlBasicButtons.Visible = false;
                        pnlMessagingButtons.Visible = false;
                        pnlUnderwritingButtons.Visible = true;
                        pnlUserButtons.Visible = false;
                    }
                    else if (e.Tab.Text == "Email Messages")
                    {
                        pnlBasicButtons.Visible = false;
                        pnlMessagingButtons.Visible = false;
                        pnlUnderwritingButtons.Visible = false;
                        pnlUserButtons.Visible = false;
                    }
                    else if (e.Tab.Text == "Profile")
                    {
                        pnlMessagingButtons.Visible = false;
                        pnlUnderwritingButtons.Visible = false;

                        RadTabStrip tabStripMerchantProfile = (RadTabStrip)ProfileView.FindControl("tabStripMerchantProfile");

                        if (tabStripMerchantProfile.SelectedTab.Text == "Status")
                        {
                            pnlBasicButtons.Visible = false;
                            pnlUserButtons.Visible = false;

                            if (editMerchant.UnderwritingStatus.StatusDescription == "Pending")
                            {
                                phApproveMerchant.Visible = false;
                                phApproveDisallowed.Visible = true;
                                lblApprovalDisallowed.Text = "The Underwriting Status for this merchant is still Pending.  In order to Approve this merchant, the Underwriting Status must be Approved.";
                            }
                            else if (editMerchant.UnderwritingStatus.StatusDescription == "Approved")
                            {
                                phApproveMerchant.Visible = true;
                                phApproveDisallowed.Visible = false;
                                lblApprovalDisallowed.Text = "";
                            }
                            else if (editMerchant.UnderwritingStatus.StatusDescription == "Denied")
                            {
                                phApproveMerchant.Visible = false;
                                phApproveDisallowed.Visible = true;
                                lblApprovalDisallowed.Text = "The Underwriting Status for this merchant is Denied.  In order to Approve this merchant, the Underwriting Status must be Approved.";
                            }
                            else
                            {
                                phApproveMerchant.Visible = false;
                                phApproveDisallowed.Visible = true;
                                lblApprovalDisallowed.Text = "The Underwriting Status for this merchant is Outdated.  In order to Approve this merchant, please renew the Underwriting results.";
                            }
                        }
                        else if (tabStripMerchantProfile.SelectedTab.Text == "Users")
                        {
                            pnlBasicButtons.Visible = false;
                            pnlUserButtons.Visible = true;
                        }
                        else
                        {
                            pnlBasicButtons.Visible = true;
                        }
                    }
                    else
                    {
                        pnlBasicButtons.Visible = true;
                        pnlMessagingButtons.Visible = false;
                        pnlUnderwritingButtons.Visible = false;
                        pnlUserButtons.Visible = false;

                    }
                }

            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "tabStripMerchantDetail_TabClick");
            }
        }
コード例 #33
0
        private void DetermineAdvancePlanChanges(MerchantModel editMerchant, ArrayList arrAdvancePlanChanges)
        {
            //Advance Plan Changes
            if (ddlActivePlan.SelectedText != editMerchant.AdvancePlan.PlanName)
            {
                string oldValue = "";

                oldValue = editMerchant.AdvancePlan.PlanName;

                arrAdvancePlanChanges.Add(new MerchantChanges("Advance Plan", oldValue, ddlActivePlan.SelectedText));
            }
        }
コード例 #34
0
        private void DetermineBankingChanges(MerchantModel editMerchant, ArrayList arrBankingChanges)
        {
            //Banking Changes
            if (editMerchant.BankAccount != null)
            {
                if (editMerchant.BankAccount.Bank != null)
                {
                    if (txtBankName.Text != _newLogic.Coalesce(editMerchant.BankAccount.Bank.BankName))
                    {
                        string oldValue = "";

                        oldValue = editMerchant.BankAccount.Bank.BankName;

                        arrBankingChanges.Add(new MerchantChanges("Bank Name", oldValue, txtBankName.Text));
                    }
                }
                else if (txtBankName.Text != "")
                {
                    string oldValue = "";

                    arrBankingChanges.Add(new MerchantChanges("Bank Name", oldValue, txtBankName.Text));
                }

            }
            else if (txtBankName.Text != "")
            {
                string oldValue = "";

                arrBankingChanges.Add(new MerchantChanges("Bank Name", oldValue, txtBankName.Text));
            }

            if (editMerchant.BankAccount != null)
            {
                if (editMerchant.BankAccount.Bank != null)
                {
                    if (txtBankCity.Text != _newLogic.Coalesce(editMerchant.BankAccount.Bank.BankCity))
                    {
                        string oldValue = "";

                        oldValue = editMerchant.BankAccount.Bank.BankCity;

                        arrBankingChanges.Add(new MerchantChanges("Bank City", oldValue, txtBankCity.Text));
                    }
                }
                else if (txtBankCity.Text != "")
                {
                    string oldValue = "";

                    arrBankingChanges.Add(new MerchantChanges("Bank City", oldValue, txtBankName.Text));
                }
            }
            else if (txtBankCity.Text != "")
            {
                string oldValue = "";

                arrBankingChanges.Add(new MerchantChanges("Bank City", oldValue, txtBankCity.Text));
            }

            if (editMerchant.BankAccount != null)
            {
                if (editMerchant.BankAccount.Bank != null)
                {
                    if (txtBankPhone.TextWithLiterals != _newLogic.Coalesce(editMerchant.BankAccount.Bank.BankPhone))
                    {
                        string oldValue = "";

                        oldValue = editMerchant.BankAccount.Bank.BankPhone;

                        arrBankingChanges.Add(new MerchantChanges("Bank Phone", oldValue, txtBankPhone.TextWithLiterals));
                    }
                }
                else if (txtBankPhone.Text != "")
                {
                    string oldValue = "";

                    arrBankingChanges.Add(new MerchantChanges("Bank Phone", oldValue, txtBankPhone.TextWithLiterals));
                }
            }
            else if (txtBankPhone.Text != "")
            {
                string oldValue = "";

                arrBankingChanges.Add(new MerchantChanges("Bank Phone", oldValue, txtBankPhone.Text));
            }

            if (editMerchant.BankAccount != null)
            {
                if (editMerchant.BankAccount.Bank != null)
                {
                    if (editMerchant.BankAccount.Bank.BankState != null)
                    {
                        if (ddlBankState.SelectedValue != _newLogic.Coalesce(editMerchant.BankAccount.Bank.BankState.RecordId))
                        {
                            string oldValue = "";

                            oldValue = editMerchant.BankAccount.Bank.BankState.Name.ToString();

                            arrBankingChanges.Add(new MerchantChanges("Bank State", oldValue, ddlBankState.SelectedText));
                        }
                    }
                    else if (editMerchant.BankAccount.Bank.BankState == null && ddlBankState.SelectedValue != "")
                    {
                        string oldValue = "";

                        arrBankingChanges.Add(new MerchantChanges("Bank State", oldValue, ddlBankState.SelectedText));
                    }
                }
                else if (editMerchant.BankAccount.Bank == null && ddlBankState.SelectedValue != "")
                {
                    string oldValue = "";

                    arrBankingChanges.Add(new MerchantChanges("Bank State", oldValue, ddlBankState.SelectedText));
                }
            }
            else if (ddlBankState.SelectedValue != "")
            {
                string oldValue = "";

                arrBankingChanges.Add(new MerchantChanges("Bank State", oldValue, ddlBankState.SelectedText));
            }

            if (txtDebitCardNumber.Enabled)
            {
                if (editMerchant.DebitCard != null)
                {
                    if (editMerchant.DebitCard.DebitCardNumber != null)
                    {
                        if (txtDebitCardNumber.Text != ShowDebitCard(editMerchant.DebitCard.DebitCardNumber, editMerchant.DebitCard.RecordId))
                        {
                            string oldValue = "";

                            oldValue = MaskDebitCard(editMerchant.DebitCard.DebitCardNumber, editMerchant.DebitCard.RecordId);

                            arrBankingChanges.Add(new MerchantChanges("Debit Card", oldValue, txtDebitCardNumber.Text));
                        }
                    }
                    else if (txtDebitCardNumber.Text != "")
                    {
                        string oldValue = "";

                        arrBankingChanges.Add(new MerchantChanges("Debit Card", oldValue, txtDebitCardNumber.Text));
                    }
                }
                else if (txtDebitCardNumber.Text != "")
                {
                    string oldValue = "";

                    arrBankingChanges.Add(new MerchantChanges("Debit Card", oldValue, txtDebitCardNumber.Text));
                }
            }

            if (txtAccountNumber.Enabled)
            {
                if (editMerchant.BankAccount != null)
                {
                    if (editMerchant.BankAccount.AccountNumber != null)
                    {
                        if (txtAccountNumber.Text != ShowAccountNumber(editMerchant.BankAccount.AccountNumber, editMerchant.BankAccount.RecordId))
                        {
                            string oldValue = "";

                            oldValue = MaskAccountNumber(editMerchant.BankAccount.AccountNumber, editMerchant.BankAccount.RecordId);

                            arrBankingChanges.Add(new MerchantChanges("Account Number", oldValue, txtAccountNumber.Text));
                        }
                    }
                    else if (txtAccountNumber.Text != "")
                    {
                        string oldValue = "";

                        arrBankingChanges.Add(new MerchantChanges("Account Number", oldValue, txtAccountNumber.Text));
                    }
                }
                else if (txtAccountNumber.Text != "")
                {
                    string oldValue = "";

                    arrBankingChanges.Add(new MerchantChanges("Account Number", oldValue, txtAccountNumber.Text));
                }
            }

            if (editMerchant.DebitCard != null)
            {
                if (ddlExpMonth.SelectedValue != _newLogic.Coalesce(editMerchant.DebitCard.DebitCardExpMonth))
                {
                    string oldValue = "";

                    oldValue = editMerchant.DebitCard.DebitCardExpMonth.ToString();

                    arrBankingChanges.Add(new MerchantChanges("Exp Month", oldValue, ddlExpMonth.SelectedValue));
                }
            }
            else if (ddlExpMonth.SelectedValue != "")
            {
                string oldValue = "";

                arrBankingChanges.Add(new MerchantChanges("Exp Month", oldValue, ddlExpMonth.SelectedValue));
            }

            if (editMerchant.DebitCard != null)
            {
                if (ddlExpYear.SelectedValue != _newLogic.Coalesce(editMerchant.DebitCard.DebitCardExpYear))
                {
                    string oldValue = "";

                    oldValue = editMerchant.DebitCard.DebitCardExpYear.ToString();

                    arrBankingChanges.Add(new MerchantChanges("Exp Year", oldValue, ddlExpYear.SelectedValue));
                }
            }
            else if (ddlExpYear.SelectedValue != "")
            {
                string oldValue = "";

                arrBankingChanges.Add(new MerchantChanges("Exp Year", oldValue, ddlExpYear.SelectedValue));
            }

            if (editMerchant.BankAccount != null)
            {
                if (txtRoutingNumber.Text != _newLogic.Coalesce(editMerchant.BankAccount.RoutingNumber))
                {
                    string oldValue = "";

                    oldValue = editMerchant.BankAccount.RoutingNumber;

                    arrBankingChanges.Add(new MerchantChanges("Routing Number", oldValue, txtRoutingNumber.Text));
                }
            }
            else if (txtRoutingNumber.Text != "")
            {
                string oldValue = "";

                arrBankingChanges.Add(new MerchantChanges("Routing Number", oldValue, txtRoutingNumber.Text));
            }
        }
コード例 #35
0
        private void DetermineBusinessChanges(MerchantModel editMerchant, ArrayList arrBusinessChanges)
        {
            if (editMerchant.LegalOrgType != null)
            {
                if (Convert.ToInt32(ddlLegalOrgType.SelectedValue) != editMerchant.LegalOrgType.RecordId)
                {
                    string oldValue = "";

                    oldValue = editMerchant.LegalOrgType.LegalOrgTypeName;

                    arrBusinessChanges.Add(new MerchantChanges("Legal Org Type", oldValue, ddlLegalOrgType.SelectedText));
                }
            }
            else if (editMerchant.LegalOrgType == null && ddlLegalOrgType.SelectedValue != "")
            {
                string oldValue = "";

                arrBusinessChanges.Add(new MerchantChanges("Legal Org Type", oldValue, ddlLegalOrgType.SelectedText));
            }

            if (editMerchant.LegalOrgState != null)
            {
                if (Convert.ToInt32(ddlLegalOrgState.SelectedValue) != editMerchant.LegalOrgState.RecordId)
                {
                    string oldValue = "";

                    oldValue = editMerchant.LegalOrgState.Name;

                    arrBusinessChanges.Add(new MerchantChanges("Legal Org State", oldValue, ddlLegalOrgState.SelectedText));
                }
            }
            else if (editMerchant.LegalOrgState == null && ddlLegalOrgState.SelectedValue != "")
            {
                string oldValue = "";

                arrBusinessChanges.Add(new MerchantChanges("Legal Org State", oldValue, ddlLegalOrgState.SelectedText));
            }

            if (editMerchant.MerchantType != null)
            {
                if (rblMerchantType.SelectedValue != editMerchant.MerchantType.MerchantTypeName)
                {
                    string oldValue = "";

                    oldValue = editMerchant.MerchantType.MerchantTypeName;

                    arrBusinessChanges.Add(new MerchantChanges("Merchant Type", oldValue, rblMerchantType.SelectedValue));
                }
            }
            else if (editMerchant.MerchantType == null && rblMerchantType.SelectedValue != "")
            {
                string oldValue = "";

                arrBusinessChanges.Add(new MerchantChanges("Merchant Type", oldValue, rblMerchantType.SelectedValue));
            }

            if (editMerchant.Mcc != null)
            {
                if (ddlMCC.SelectedValue != editMerchant.Mcc.RecordId.ToString())
                {
                    string oldValue = "";

                    oldValue = editMerchant.Mcc.MerchantCategoryCode;

                    arrBusinessChanges.Add(new MerchantChanges("MCC", oldValue, ddlMCC.SelectedText));
                }
            }
            else if (editMerchant.Mcc == null && ddlMCC.SelectedValue != "")
            {
                string oldValue = "";

                arrBusinessChanges.Add(new MerchantChanges("MCC", oldValue, ddlMCC.SelectedValue));
            }

            if (txtCorpName.Text != _newLogic.Coalesce(editMerchant.CorpName))
            {
                string oldValue = "";

                oldValue = editMerchant.CorpName;

                arrBusinessChanges.Add(new MerchantChanges("Legal Name", oldValue, txtCorpName.Text));
            }

            if (txtDBAName.Text != _newLogic.Coalesce(editMerchant.DbaName))
            {
                string oldValue = "";

                oldValue = editMerchant.DbaName;

                arrBusinessChanges.Add(new MerchantChanges("DBA Name", oldValue, txtDBAName.Text));
            }

            if (txtCorpAddress.Text != _newLogic.Coalesce(editMerchant.Business.Address.Address))
            {
                string oldValue = "";

                oldValue = editMerchant.Business.Address.Address;

                arrBusinessChanges.Add(new MerchantChanges("Business Address", oldValue, txtCorpAddress.Text));
            }

            if (txtCorpCity.Text != _newLogic.Coalesce(editMerchant.Business.Address.City))
            {
                string oldValue = "";

                oldValue = editMerchant.Business.Address.City;

                arrBusinessChanges.Add(new MerchantChanges("Business City", oldValue, txtCorpCity.Text));
            }

            if (editMerchant.Business.Address.State != null)
            {
                if (ddlCorpState.SelectedValue != editMerchant.Business.Address.State.RecordId.ToString())
                {
                    string oldValue = "";

                    oldValue = editMerchant.Business.Address.State.Name;

                    arrBusinessChanges.Add(new MerchantChanges("Business State", oldValue, ddlCorpState.SelectedText));
                }
            }
            else if (ddlCorpState.SelectedValue != "")
            {
                string oldValue = "";

                arrBusinessChanges.Add(new MerchantChanges("Business State", oldValue, ddlCorpState.SelectedText));
            }

            if (txtCorpZip.Text != _newLogic.Coalesce(editMerchant.Business.Address.Zip))
            {
                string oldValue = "";

                oldValue = editMerchant.Business.Address.Zip;

                arrBusinessChanges.Add(new MerchantChanges("Business Zip", oldValue, txtCorpZip.Text));
            }

            if (txtBusLicNumber.Text != _newLogic.Coalesce(editMerchant.BusLicNumber))
            {
                string oldValue = "";

                oldValue = editMerchant.BusLicNumber;

                arrBusinessChanges.Add(new MerchantChanges("Business License #", oldValue, txtBusLicNumber.Text));
            }

            if (txtBusLicType.Text != _newLogic.Coalesce(editMerchant.BusLicType))
            {
                string oldValue = "";

                oldValue = editMerchant.BusLicType;

                arrBusinessChanges.Add(new MerchantChanges("License Type", oldValue, txtBusLicType.Text));
            }

            if (txtBusLicIssuer.Text != _newLogic.Coalesce(editMerchant.BusLicIssuer))
            {
                string oldValue = "";

                oldValue = editMerchant.BusLicIssuer;

                arrBusinessChanges.Add(new MerchantChanges("License Issuer", oldValue, txtBusLicIssuer.Text));
            }

            if (ddlLicenseDateYear.SelectedIndex != -1 && ddlLicenseDateMonth.SelectedIndex != -1 && ddlLicenseDateDay.SelectedIndex != -1)
            {
                Int32 year = Convert.ToInt32(ddlLicenseDateYear.SelectedValue);
                Int32 month = Convert.ToInt32(ddlLicenseDateMonth.SelectedValue);
                Int32 day = Convert.ToInt32(ddlLicenseDateDay.SelectedValue);
                DateTime busLicDate;

                if (DateTime.TryParse(year + "-" + month + "-" + day, out busLicDate))
                {
                    if (editMerchant.BusLicDate.HasValue)
                    {
                        if (_newLogic.Coalesce(busLicDate) != _newLogic.Coalesce(editMerchant.BusLicDate.Value))
                        {
                            string oldValue = "";

                            oldValue = editMerchant.BusLicDate.HasValue ? editMerchant.BusLicDate.Value.ToString("MM/dd/yyyy") : "";

                            arrBusinessChanges.Add(new MerchantChanges("License Date", oldValue, busLicDate.ToString("MM/dd/yyyy")));
                        }
                    }
                    else
                    {
                        string oldValue = "";

                        arrBusinessChanges.Add(new MerchantChanges("License Date", oldValue, busLicDate.ToString("MM/dd/yyyy")));
                    }
                }
            }

            if (txtFedTaxId.Text != _newLogic.Coalesce(editMerchant.FedTaxId))
            {
                string oldValue = "";

                oldValue = editMerchant.FedTaxId;

                arrBusinessChanges.Add(new MerchantChanges("Federal Tax ID", oldValue, txtFedTaxId.Text));
            }

            if (txtBusEmail.Text != _newLogic.Coalesce(editMerchant.Business.Email))
            {
                string oldValue = "";

                oldValue = editMerchant.Business.Email;

                arrBusinessChanges.Add(new MerchantChanges("Email", oldValue, txtBusEmail.Text));
            }

            if (txtBusPhone.Text != _newLogic.Coalesce(editMerchant.Business.HomePhone))
            {
                string oldValue = "";

                oldValue = editMerchant.Business.HomePhone;

                arrBusinessChanges.Add(new MerchantChanges("Phone", oldValue, txtBusPhone.Text));
            }

            if (txtBusFax.Text != _newLogic.Coalesce(editMerchant.Business.Fax))
            {
                string oldValue = "";

                oldValue = editMerchant.Business.Fax;

                arrBusinessChanges.Add(new MerchantChanges("Fax", oldValue, txtBusFax.Text));
            }

            if (txtMerchandiseSold.Text != _newLogic.Coalesce(editMerchant.MerchandiseSold))
            {
                string oldValue = "";

                oldValue = editMerchant.MerchandiseSold;

                arrBusinessChanges.Add(new MerchantChanges("Merchandise Sold", oldValue, txtMerchandiseSold.Text));
            }

            if (txtYearsInBus.Text != _newLogic.Coalesce(editMerchant.YearsInBusiness))
            {
                string oldValue = "";

                oldValue = editMerchant.YearsInBusiness.ToString();

                arrBusinessChanges.Add(new MerchantChanges("Years In Business", oldValue, txtYearsInBus.Text));
            }

            if (txtMonthsInBus.Text != _newLogic.Coalesce(editMerchant.MonthsInBusiness))
            {
                string oldValue = "";

                oldValue = editMerchant.MonthsInBusiness.ToString();

                arrBusinessChanges.Add(new MerchantChanges("Months In Business", oldValue, txtMonthsInBus.Text));
            }

            if (rblSeasonal.SelectedValue != _newLogic.Coalesce(editMerchant.SeasonalSales))
            {
                string oldValue = "";

                oldValue = editMerchant.SeasonalSales.ToString();

                arrBusinessChanges.Add(new MerchantChanges("Seasonal Sales", oldValue, rblSeasonal.SelectedValue));
            }

            //Get String of months selected for seasonal sales
            string seasonalMonths = "";

            seasonalMonths = StringifySeasonalMonths(seasonalMonths);

            if (seasonalMonths != _newLogic.Coalesce(editMerchant.SeasonalMonths))
            {
                string oldValue = "";

                oldValue = editMerchant.SeasonalMonths;

                arrBusinessChanges.Add(new MerchantChanges("Seasonal Months", oldValue, seasonalMonths));
            }
        }
コード例 #36
0
        private void SaveContactChanges(MerchantModel editMerchant)
        {
            try
            {
                foreach (RepeaterItem rItem in rptrContactChanges.Items)
                {
                    Label lblFieldName = (Label)rItem.FindControl("lblFieldName2");
                    Label lblNewValue = (Label)rItem.FindControl("lblNewValue2");
                    CheckBox cbConfirmed = (CheckBox)rItem.FindControl("cbConfirmed2");

                    if (lblFieldName != null && lblNewValue != null && cbConfirmed != null)
                    {
                        if (lblFieldName.Text == "FirstName")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.FirstName, lblNewValue.Text);

                                    editMerchant.Contact.FirstName = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.FirstName = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactFirstName.Text = editMerchant.Contact.FirstName;
                                }
                                else
                                {
                                    txtContactFirstName.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "LastName")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.LastName, lblNewValue.Text);

                                    editMerchant.Contact.LastName = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.LastName = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactLastName.Text = editMerchant.Contact.LastName;
                                }
                                else
                                {
                                    txtContactLastName.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "Email")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.Email, lblNewValue.Text);

                                    editMerchant.Contact.Email = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.Email = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactEmail.Text = editMerchant.Contact.Email;
                                }
                                else
                                {
                                    txtContactEmail.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "Phone")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.HomePhone, lblNewValue.Text);

                                    editMerchant.Contact.HomePhone = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.HomePhone = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactPhone.Text = editMerchant.Contact.HomePhone;
                                }
                                else
                                {
                                    txtContactPhone.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "Fax")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.Fax, lblNewValue.Text);

                                    editMerchant.Contact.Fax = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.Fax = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactFax.Text = editMerchant.Contact.Fax;
                                }
                                else
                                {
                                    txtContactFax.Text = "";
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                string userId = "";

                if (Request.IsAuthenticated)
                {
                    userId = Page.User.Identity.GetUserId();
                }
                _newLogic.WriteExceptionToDB(ex, "SaveContactChanges", 0, editMerchant.RecordId, userId);
            }
        }
コード例 #37
0
        protected Boolean SubmitForm()
        {
            StringBuilder formattedHtml = new StringBuilder();
            StringBuilder formattedInternalHtml = new StringBuilder();
            string seasonalMonths = "";

            try
            {
                foreach (ListItem item in cblSeasonal.Items)
                {
                    if (item.Selected)
                    {
                        seasonalMonths += item.Value + " - ";
                    }
                }

                if (seasonalMonths.Length > 3)
                {
                    seasonalMonths = seasonalMonths.Substring(0, seasonalMonths.Length - 3);
                }
            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "AdminSubmitForm - Get Seasonal Months");
            }

            try
            {
                //Instanciate new model objects for each piece of data to be created
                MerchantModel newMerchant = new MerchantModel();
                MerchantPrincipalModel newMerchantPrincipal = new MerchantPrincipalModel();
                ContactModel newMerchantPrincipalContact = new ContactModel();
                AddressModel newMerchantPrincipalContactAddress = new AddressModel();
                ContactModel newContact = new ContactModel();
                ContactModel newBusiness = new ContactModel();
                AddressModel newBusinessAddress = new AddressModel();
                ProcessorModel newProcessor = new ProcessorModel();
                DebitCardModel newDebitCard = new DebitCardModel();
                BankModel newBankModel = new BankModel();
                BankAccountModel newBankAccountModel = new BankAccountModel();

                //Set base merchant information in newMerchant object
                if (txtMerchantId.Text != "") { newMerchant.MerchantId = txtMerchantId.Text; }
                if (txtCorpName.Text != "") { newMerchant.CorpName = txtCorpName.Text; }
                if (txtDBAName.Text != "") { newMerchant.DbaName = txtDBAName.Text; }
                if (txtBusLicNumber.Text != "") { newMerchant.BusLicNumber = txtBusLicNumber.Text; }
                if (txtBusLicType.Text != "") { newMerchant.BusLicType = txtBusLicType.Text; }
                if (txtBusLicIssuer.Text != "") { newMerchant.BusLicIssuer = txtBusLicIssuer.Text; }
                if (radBusLicDate.SelectedDate.HasValue) { newMerchant.BusLicDate = Convert.ToDateTime(radBusLicDate.SelectedDate); }
                if (txtFedTaxId.Text != "") { newMerchant.FedTaxId = txtFedTaxId.Text; }
                if (txtMerchandiseSold.Text != "") { newMerchant.MerchandiseSold = txtMerchandiseSold.Text; }
                if (txtYearsInBus.Text != "") { newMerchant.YearsInBusiness = Convert.ToInt32(txtYearsInBus.Text); }
                if (txtMonthsInBus.Text != "") { newMerchant.MonthsInBusiness = Convert.ToInt32(txtMonthsInBus.Text); }
                if (rblSeasonal.SelectedValue != "") { newMerchant.SeasonalSales = Convert.ToBoolean(rblSeasonal.SelectedValue); }
                if (seasonalMonths != "") { newMerchant.SeasonalMonths = seasonalMonths; }
                if (txtSwipedPct.Text != "") { newMerchant.SwipedPct = Convert.ToInt32(txtSwipedPct.Text); }
                if (txtAvgMonthlySales.Text != "") { newMerchant.AvgMonthlySales = Convert.ToDecimal(txtAvgMonthlySales.Text); }
                if (txtHighestMonthlySales.Text != "") { newMerchant.HighestMonthlySales = Convert.ToDecimal(txtHighestMonthlySales.Text); }
                if (txtAvgWeeklySales.Text != "") { newMerchant.AvgWeeklySales = Convert.ToDecimal(txtAvgWeeklySales.Text); }
                if (rblHighRisk.SelectedValue != "") { newMerchant.HighRisk = Convert.ToBoolean(rblHighRisk.SelectedValue); }
                if (txtHighRiskWho.Text != "") { newMerchant.HighRiskWho = txtHighRiskWho.Text; }
                if (radHighRiskDate.SelectedDate.HasValue) { newMerchant.HighRiskDate = Convert.ToDateTime(radHighRiskDate.SelectedDate); }
                if (rblBankruptcy.SelectedValue != "") { newMerchant.Bankruptcy = Convert.ToBoolean(rblBankruptcy.SelectedValue); }
                if (radBankruptcyDate.SelectedDate.HasValue) { newMerchant.BankruptcyDate = Convert.ToDateTime(radBankruptcyDate.SelectedDate); }

                //Add Legal Org State to merchant
                if (ddlLegalOrgState.SelectedValue != "")
                {
                    Int32 legalOrgStateId = Convert.ToInt32(ddlLegalOrgState.SelectedValue);
                    newMerchant.LegalOrgState = _globalCtx.GeoStates.Where(gs => gs.RecordId == legalOrgStateId).FirstOrDefault();
                }

                //Add Legal Org Type to merchant
                if (ddlLegalOrgType.SelectedValue != "")
                {
                    Int32 legalOrgTypeId = Convert.ToInt32(ddlLegalOrgType.SelectedValue);
                    newMerchant.LegalOrgType = _globalCtx.LegalOrgTypes.Where(lot => lot.RecordId == legalOrgTypeId).FirstOrDefault();
                }

                //Add Merchant Type to Merchant
                if (rblMerchantType.SelectedValue != "") { newMerchant.MerchantType = _globalCtx.MerchantTypes.Where(mt => mt.MerchantTypeName == rblMerchantType.SelectedValue).FirstOrDefault(); }

                //Add MCC to merchant
                if (ddlMCC.SelectedValue != "")
                {
                    Int32 mccId = Convert.ToInt32(ddlMCC.SelectedValue);
                    newMerchant.Mcc = _globalCtx.MerchantCategoryCodes.Where(mcc => mcc.RecordId == mccId).FirstOrDefault();
                }

                //Add Business Contact info - Email, Phone, Fax
                if (txtBusEmail.Text != "") { newBusiness.Email = txtBusEmail.Text; }
                if (txtBusFax.Text != "") { newBusiness.Fax = txtBusFax.Text; }
                if (txtBusPhone.Text != "") { newBusiness.HomePhone = txtBusPhone.Text; }

                _globalCtx.Contacts.Add(newBusiness);

                //Add Business Contact Addess
                if (txtCorpAddress.Text != "") { newBusinessAddress.Address = txtCorpAddress.Text; }
                if (txtCorpCity.Text != "") { newBusinessAddress.City = txtCorpCity.Text; }
                if (ddlCorpState.SelectedValue != "")
                {
                    Int32 businessAddressStateId = Convert.ToInt32(ddlCorpState.SelectedValue);
                    newBusinessAddress.State = _globalCtx.GeoStates.Where(gs => gs.RecordId == businessAddressStateId).FirstOrDefault();
                }
                if (txtCorpZip.Text != "") { newBusinessAddress.Zip = txtCorpZip.Text; }

                _globalCtx.Addresses.Add(newBusinessAddress);

                //Add new Business Contact Address to new Business
                newBusiness.Address = newBusinessAddress;

                //Add new Contact to new Merchant
                newMerchant.Business = newBusiness;

                //Add new Contact
                if (txtContactFirstName.Text != "") { newContact.FirstName = txtContactFirstName.Text; }
                if (txtContactLastName.Text != "") { newContact.LastName = txtContactLastName.Text; }
                if (txtContactEmail.Text != "") { newContact.Email = txtContactEmail.Text; }
                if (txtContactPhone.Text != "") { newContact.HomePhone = txtContactPhone.Text; }
                if (txtContactFax.Text != "") { newContact.Fax = txtContactFax.Text; }

                _globalCtx.Contacts.Add(newContact);

                //Add new contact to new Merchant
                newMerchant.Contact = newContact;

                //Add new Merchant Principal
                if (txtPrincipalDLNumber.Text != "") { newMerchantPrincipal.PrincipalDLNumber = PWDTK.StringToUtf8Bytes(txtPrincipalDLNumber.Text); }
                if (ddlPrincipalDLState.SelectedValue != "")
                {
                    Int32 dlStateId = Convert.ToInt32(ddlPrincipalDLState.SelectedValue);
                    newMerchantPrincipal.PrincipalDLState = _globalCtx.GeoStates.Where(gs => gs.RecordId == dlStateId).FirstOrDefault();
                }
                if (radPrincipalDoB.SelectedDate.HasValue) { newMerchantPrincipal.PrincipalDoB = Convert.ToDateTime(radPrincipalDoB.SelectedDate); }
                if (txtPrincipalPctOwn.Text != "") { newMerchantPrincipal.PrincipalPctOwn = Convert.ToInt32(txtPrincipalPctOwn.Text); }

                _globalCtx.MerchantPrincipal.Add(newMerchantPrincipal);

                //Create new contact for Merchant Principal
                if (txtPrincipalFirstName.Text != "") { newMerchantPrincipalContact.FirstName = txtPrincipalFirstName.Text; }
                if (txtPrincipalLastName.Text != "") { newMerchantPrincipalContact.LastName = txtPrincipalLastName.Text; }
                if (txtPrincipalMI.Text != "") { newMerchantPrincipalContact.MiddleInitial = txtPrincipalMI.Text; }
                if (txtPrincipalTitle.Text != "") { newMerchantPrincipalContact.Title = txtPrincipalTitle.Text; }
                if (txtPrincipalCellPhone.Text != "") { newMerchantPrincipalContact.CellPhone = txtPrincipalCellPhone.Text; }
                if (txtPrincipalHomePhone.Text != "") { newMerchantPrincipalContact.HomePhone = txtPrincipalHomePhone.Text; }

                _globalCtx.Contacts.Add(newMerchantPrincipalContact);

                //Create new address for Merchant principal Contact
                if (txtPrincipalAddress.Text != "") { newMerchantPrincipalContactAddress.Address = txtPrincipalAddress.Text; }
                if (txtPrincipalCity.Text != "") { newMerchantPrincipalContactAddress.City = txtPrincipalCity.Text; }
                if (ddlPrincipalState.SelectedValue != "")
                {
                    Int32 mpcStateId = Convert.ToInt32(ddlPrincipalState.SelectedValue);
                    newMerchantPrincipalContactAddress.State = _globalCtx.GeoStates.Where(gs => gs.RecordId == mpcStateId).FirstOrDefault();
                }
                if (txtPrincipalZip.Text != "") { newMerchantPrincipalContactAddress.Zip = txtPrincipalZip.Text; }

                _globalCtx.Addresses.Add(newMerchantPrincipalContactAddress);

                //Add new address to Merchant Principal Contact
                newMerchantPrincipalContact.Address = newMerchantPrincipalContactAddress;

                //Add new Contact to Merchant Principal
                newMerchantPrincipal.Contact = newMerchantPrincipalContact;

                //Add new Principal to the new merchant
                newMerchant.MerchantPrincipal = newMerchantPrincipal;

                //Check if merchant processor already exists, if so link to merchant.  If not, create it and add to merchant.
                if (txtCardProcessor.Text != "")
                {
                    if (_globalCtx.Processor.Where(p => p.ProcessorName == txtCardProcessor.Text.Trim()).ToList().Count > 0)
                    {
                        newMerchant.Processor = _globalCtx.Processor.First(p => p.ProcessorName == txtCardProcessor.Text.Trim());
                    }
                    else
                    {
                        newProcessor.ProcessorName = txtCardProcessor.Text.Trim();
                        _globalCtx.Processor.Add(newProcessor);
                        newMerchant.Processor = newProcessor;
                    }
                }

                _globalCtx.Banks.Add(newBankModel);

                newBankAccountModel.Bank = newBankModel;
                newDebitCard.Bank = newBankModel;

                _globalCtx.BankAccounts.Add(newBankAccountModel);
                _globalCtx.DebitCards.Add(newDebitCard);

                newMerchant.BankAccount = newBankAccountModel;
                newMerchant.DebitCard = newDebitCard;

                //Set Merchant Status to "Admin Registered"
                newMerchant.MerchantStatus = _globalCtx.MerchantStatuses.FirstOrDefault(ms => ms.StatusDescription == "Pre-Enrolled");

                //Set Underwriting Status to "Pending"
                newMerchant.UnderwritingStatus = _globalCtx.UnderwritingStatuses.FirstOrDefault(ms => ms.StatusDescription == "Pending");

                newMerchant.AdvancePlan = _globalCtx.AdvancePlans.First(ap => ap.DefaultPlan == true);

                //Add new Merchant to context
                _globalCtx.Merchants.Add(newMerchant);

                //Add new merchant to selected User
                if (txtSelectedUserName.Text != "")
                {
                    var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(_globalCtx));
                    ApplicationUser selectedUser = manager.FindByName(txtSelectedUserName.Text);
                    if (selectedUser != null)
                    {
                        selectedUser.Merchant = newMerchant;

                        //Save Context and Update DB
                        _globalCtx.SaveChanges();
                    }
                }
                else
                {
                    lblSubmissionMessage.Text = "Please select a User to join with this merchant.";
                    return false;
                }
            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "AdminSubmitForm - Add Data to DB");
                return false;
            }

            return true;
        }
コード例 #38
0
        private void DetermineMerchantAccountChanges(MerchantModel editMerchant, ArrayList arrMerchantAccountChanges)
        {
            //Merchant Account Changes
            if (editMerchant.SwipedPct != null)
            {
                if (txtSwipedPct.Text != _newLogic.Coalesce(editMerchant.SwipedPct))
                {
                    string oldValue = "";

                    oldValue = editMerchant.SwipedPct.ToString() + " %";

                    arrMerchantAccountChanges.Add(new MerchantChanges("Swiped %", oldValue, txtSwipedPct.Text + " %"));
                }
            }
            else if (txtSwipedPct.Text != "")
            {
                string oldValue = "";

                arrMerchantAccountChanges.Add(new MerchantChanges("Swiped %", oldValue, txtSwipedPct.Text + " %"));
            }

            if (editMerchant.AvgMonthlySales.HasValue)
            {
                if (Convert.ToDecimal(txtAvgMonthlySales.Text) != editMerchant.AvgMonthlySales)
                {
                    string oldValue = "";

                    oldValue = "$" + editMerchant.AvgMonthlySales.ToString();

                    arrMerchantAccountChanges.Add(new MerchantChanges("Avg Monthly Sales", oldValue, "$" + txtAvgMonthlySales.Text));
                }
            }
            else if (txtAvgMonthlySales.Text != "")
            {
                string oldValue = "";

                arrMerchantAccountChanges.Add(new MerchantChanges("Avg Monthly Sales", oldValue, "$" + txtAvgMonthlySales.Text));
            }

            if (editMerchant.HighestMonthlySales != null)
            {
                if (Convert.ToDecimal(txtHighestMonthlySales.Text) != editMerchant.HighestMonthlySales)
                {
                    string oldValue = "";

                    oldValue = "$" + editMerchant.HighestMonthlySales.ToString();

                    arrMerchantAccountChanges.Add(new MerchantChanges("Highest Monthly Sales", oldValue, "$" + txtHighestMonthlySales.Text));
                }
            }
            else if (txtHighestMonthlySales.Text != "")
            {
                string oldValue = "";

                arrMerchantAccountChanges.Add(new MerchantChanges("Highest Monthly Sales", oldValue, "$" + txtHighestMonthlySales.Text));
            }

            if (editMerchant.AvgWeeklySales != null)
            {
                if (Convert.ToDecimal(txtAvgWeeklySales.Text) != editMerchant.AvgWeeklySales)
                {
                    string oldValue = "";

                    oldValue = "$" + editMerchant.AvgWeeklySales.ToString();

                    arrMerchantAccountChanges.Add(new MerchantChanges("Avg Weekly Sales", oldValue, "$" + txtAvgWeeklySales.Text));
                }
            }
            else if (txtAvgWeeklySales.Text != "")
            {
                string oldValue = "";

                arrMerchantAccountChanges.Add(new MerchantChanges("Avg Weekly Sales", oldValue, "$" + txtAvgWeeklySales.Text));
            }

            if (editMerchant.Processor != null)
            {
                if (txtCardProcessor.Text != editMerchant.Processor.ProcessorName)
                {
                    string oldValue = "";

                    oldValue = editMerchant.Processor.ProcessorName;

                    arrMerchantAccountChanges.Add(new MerchantChanges("Processor", oldValue, txtCardProcessor.Text));
                }
            }
            else if (editMerchant.Processor == null && txtCardProcessor.Text != "")
            {
                string oldValue = "";

                arrMerchantAccountChanges.Add(new MerchantChanges("Processor", oldValue, txtCardProcessor.Text));
            }

            if (txtMerchantId.Text != _newLogic.Coalesce(editMerchant.MerchantId))
            {
                string oldValue = "";

                oldValue = editMerchant.MerchantId ?? "";

                arrMerchantAccountChanges.Add(new MerchantChanges("Merchant Id", oldValue, txtMerchantId.Text));
            }

            if (rblHighRisk.SelectedValue.ToLower() != _newLogic.Coalesce(editMerchant.HighRisk).ToLower())
            {
                string oldValue = "";

                oldValue = editMerchant.HighRisk.ToString() ?? "";

                arrMerchantAccountChanges.Add(new MerchantChanges("High Risk", oldValue, rblHighRisk.SelectedValue));
            }

            if (rblHighRisk.SelectedValue == "True")
            {
                if (txtHighRiskWho.Text != _newLogic.Coalesce(editMerchant.HighRiskWho))
                {
                    string oldValue = "";

                    oldValue = editMerchant.HighRiskWho ?? "";

                    arrMerchantAccountChanges.Add(new MerchantChanges("High Risk Who", oldValue, txtHighRiskWho.Text));
                }

                if (ddlHighRiskYear.SelectedIndex != -1 && ddlHighRiskMonth.SelectedIndex != -1 && ddlHighRiskDay.SelectedIndex != -1)
                {
                    Int32 year = Convert.ToInt32(ddlHighRiskYear.SelectedValue);
                    Int32 month = Convert.ToInt32(ddlHighRiskMonth.SelectedValue);
                    Int32 day = Convert.ToInt32(ddlHighRiskDay.SelectedValue);

                    DateTime highRiskDate;

                    if (DateTime.TryParse(year + "-" + month + "-" + day, out highRiskDate))
                    {
                        if (_newLogic.Coalesce(highRiskDate) != _newLogic.Coalesce(editMerchant.HighRiskDate))
                        {
                            string oldValue = "";

                            oldValue = editMerchant.HighRiskDate.HasValue ? editMerchant.HighRiskDate.Value.ToString("MM/dd/yyyy") : "";

                            arrMerchantAccountChanges.Add(new MerchantChanges("High Risk Date", oldValue, highRiskDate.ToString("MM/dd/yyyy")));
                        }
                    }
                }
            }

            if (rblBankruptcy.SelectedValue.ToLower() != _newLogic.Coalesce(editMerchant.Bankruptcy).ToLower())
            {
                string oldValue = "";

                oldValue = editMerchant.Bankruptcy.ToString() ?? "";

                arrMerchantAccountChanges.Add(new MerchantChanges("Bankruptcy", oldValue, rblBankruptcy.SelectedValue));
            }

            if (rblBankruptcy.SelectedValue == "True")
            {
                if (ddlBankruptcyYear.SelectedIndex != -1 && ddlBankruptcyMonth.SelectedIndex != -1 && ddlBankruptcyDay.SelectedIndex != -1)
                {
                    Int32 year = Convert.ToInt32(ddlBankruptcyYear.SelectedValue);
                    Int32 month = Convert.ToInt32(ddlBankruptcyMonth.SelectedValue);
                    Int32 day = Convert.ToInt32(ddlBankruptcyDay.SelectedValue);
                    DateTime bankruptcyDate;

                    if (DateTime.TryParse(year + "-" + month + "-" + day, out bankruptcyDate))
                    {
                        if (_newLogic.Coalesce(bankruptcyDate) != _newLogic.Coalesce(editMerchant.BankruptcyDate))
                        {
                            string oldValue = "";

                            oldValue = editMerchant.BankruptcyDate.HasValue ? editMerchant.BankruptcyDate.Value.ToString("MM/dd/yyyy") : "";

                            arrMerchantAccountChanges.Add(new MerchantChanges("Bankruptcy Date", oldValue, bankruptcyDate.ToString("MM/dd/yyyy")));
                        }
                    }
                }
            }
        }
コード例 #39
0
        private void DeterminePrincipalChanges(MerchantModel editMerchant, ArrayList arrPrincipalChanges)
        {
            //Principal Changes
            if (txtPrincipalFirstName.Text != _newLogic.Coalesce(editMerchant.MerchantPrincipal.Contact.FirstName))
            {
                string oldValue = "";

                oldValue = editMerchant.MerchantPrincipal.Contact.FirstName;

                arrPrincipalChanges.Add(new MerchantChanges("First Name", oldValue, txtPrincipalFirstName.Text));
            }

            if (txtPrincipalLastName.Text != _newLogic.Coalesce(editMerchant.MerchantPrincipal.Contact.LastName))
            {
                string oldValue = "";

                oldValue = editMerchant.MerchantPrincipal.Contact.LastName;

                arrPrincipalChanges.Add(new MerchantChanges("Last Name", oldValue, txtPrincipalLastName.Text));
            }

            if (txtPrincipalMI.Text != _newLogic.Coalesce(editMerchant.MerchantPrincipal.Contact.MiddleInitial))
            {
                string oldValue = "";

                oldValue = editMerchant.MerchantPrincipal.Contact.MiddleInitial;

                arrPrincipalChanges.Add(new MerchantChanges("M.I.", oldValue, txtPrincipalMI.Text));
            }

            if (ddlBirthYear.SelectedIndex != -1 && ddlBirthMonth.SelectedIndex != -1 && ddlBirthDay.SelectedIndex != -1)
            {
                Int32 year = Convert.ToInt32(ddlBirthYear.SelectedValue);
                Int32 month = Convert.ToInt32(ddlBirthMonth.SelectedValue);
                Int32 day = Convert.ToInt32(ddlBirthDay.SelectedValue);
                DateTime birthDate;

                if (DateTime.TryParse(year + "-" + month + "-" + day, out birthDate))
                {
                    if (_newLogic.Coalesce(birthDate) != _newLogic.Coalesce(editMerchant.MerchantPrincipal.PrincipalDoB))
                    {
                        string oldValue = "";

                        oldValue = editMerchant.MerchantPrincipal.PrincipalDoB.HasValue ? editMerchant.MerchantPrincipal.PrincipalDoB.Value.ToString("MM/dd/yyyy") : "";

                        arrPrincipalChanges.Add(new MerchantChanges("D.O.B.", oldValue, birthDate.ToString("MM/dd/yyyy")));
                    }
                }
            }

            if (txtPrincipalSSN.Enabled)
            {
                if (editMerchant.MerchantPrincipal.PrincipalSsn != null)
                {
                    if (txtPrincipalSSN.TextWithLiterals != ShowSsn(editMerchant.MerchantPrincipal.PrincipalSsn, editMerchant.MerchantPrincipal.RecordId))
                    {
                        string oldValue = "";

                        oldValue = ShowSsn(editMerchant.MerchantPrincipal.PrincipalSsn, editMerchant.MerchantPrincipal.RecordId);

                        arrPrincipalChanges.Add(new MerchantChanges("S.S.N.", "***-**-" + oldValue.Substring(oldValue.Length - 4, 4), txtPrincipalSSN.TextWithLiterals));
                    }
                }
                else if (txtPrincipalSSN.Text != "")
                {
                    string oldValue = "";

                    arrPrincipalChanges.Add(new MerchantChanges("S.S.N.", oldValue, txtPrincipalSSN.TextWithLiterals));
                }
            }

            if (editMerchant.MerchantPrincipal.PrincipalPctOwn != null)
            {
                if (Convert.ToDecimal(txtPrincipalPctOwn.Text) != editMerchant.MerchantPrincipal.PrincipalPctOwn)
                {
                    string oldValue = "";

                    oldValue = editMerchant.MerchantPrincipal.PrincipalPctOwn.ToString() + " %";

                    arrPrincipalChanges.Add(new MerchantChanges("% Ownership", oldValue, txtPrincipalPctOwn.Text + " %"));
                }
            }
            else if (txtPrincipalPctOwn.Text != "")
            {
                string oldValue = "";

                arrPrincipalChanges.Add(new MerchantChanges("% Ownership", oldValue, txtPrincipalPctOwn.Text + " %"));
            }

            if (txtPrincipalTitle.Text != _newLogic.Coalesce(editMerchant.MerchantPrincipal.Contact.Title))
            {
                string oldValue = "";

                oldValue = editMerchant.MerchantPrincipal.Contact.Title;

                arrPrincipalChanges.Add(new MerchantChanges("Title", oldValue, txtPrincipalTitle.Text));
            }

            if (txtPrincipalDLNumber.Enabled)
            {
                if (editMerchant.MerchantPrincipal.PrincipalDLNumber != null)
                {
                    if (txtPrincipalDLNumber.Text != ShowDLNumber(editMerchant.MerchantPrincipal.PrincipalDLNumber, editMerchant.MerchantPrincipal.RecordId))
                    {
                        string oldValue = "";

                        oldValue = MaskDLNumber(editMerchant.MerchantPrincipal.PrincipalDLNumber, editMerchant.MerchantPrincipal.RecordId);

                        arrPrincipalChanges.Add(new MerchantChanges("DL Number", oldValue, txtPrincipalDLNumber.Text));
                    }
                }
                else if (txtPrincipalDLNumber.Text != "")
                {
                    string oldValue = "";

                    arrPrincipalChanges.Add(new MerchantChanges("DL Number", oldValue, txtPrincipalDLNumber.Text));
                }
            }

            if (editMerchant.MerchantPrincipal.PrincipalDLState != null)
            {
                if (ddlPrincipalDLState.SelectedValue != editMerchant.MerchantPrincipal.PrincipalDLState.RecordId.ToString())
                {
                    string oldValue = "";

                    oldValue = editMerchant.MerchantPrincipal.PrincipalDLState.RecordId.ToString();

                    arrPrincipalChanges.Add(new MerchantChanges("DL State", oldValue, ddlPrincipalDLState.SelectedText));
                }
            }
            else if (editMerchant.MerchantPrincipal.PrincipalDLState == null && ddlPrincipalDLState.SelectedValue != "")
            {
                string oldValue = "";

                arrPrincipalChanges.Add(new MerchantChanges("DL State", oldValue, ddlPrincipalDLState.SelectedText));
            }

            if (editMerchant.MerchantPrincipal.Contact != null)
            {
                if (editMerchant.MerchantPrincipal.Contact.Address == null)
                {
                    if (txtPrincipalAddress.Text != "")
                    {
                        string oldValue = "";

                        arrPrincipalChanges.Add(new MerchantChanges("Address", oldValue, txtPrincipalAddress.Text));
                    }

                    if (txtPrincipalCity.Text != "")
                    {
                        string oldValue = "";

                        arrPrincipalChanges.Add(new MerchantChanges("City", oldValue, txtPrincipalCity.Text));
                    }

                    if (txtPrincipalZip.Text != "")
                    {
                        string oldValue = "";

                        arrPrincipalChanges.Add(new MerchantChanges("Zip", oldValue, txtPrincipalZip.Text));
                    }

                    if (ddlPrincipalState.SelectedIndex != -1)
                    {
                        string oldValue = "";

                        arrPrincipalChanges.Add(new MerchantChanges("State", oldValue, ddlPrincipalState.SelectedText));
                    }
                }
                else
                {
                    if (txtPrincipalAddress.Text != _newLogic.Coalesce(editMerchant.MerchantPrincipal.Contact.Address.Address))
                    {
                        string oldValue = "";

                        oldValue = editMerchant.MerchantPrincipal.Contact.Address.Address;

                        arrPrincipalChanges.Add(new MerchantChanges("Address", oldValue, txtPrincipalAddress.Text));
                    }

                    if (txtPrincipalCity.Text != _newLogic.Coalesce(editMerchant.MerchantPrincipal.Contact.Address.City))
                    {
                        string oldValue = "";

                        oldValue = editMerchant.MerchantPrincipal.Contact.Address.City;

                        arrPrincipalChanges.Add(new MerchantChanges("City", oldValue, txtPrincipalCity.Text));
                    }

                    if (txtPrincipalZip.Text != _newLogic.Coalesce(editMerchant.MerchantPrincipal.Contact.Address.Zip))
                    {
                        string oldValue = "";

                        oldValue = editMerchant.MerchantPrincipal.Contact.Address.Zip;

                        arrPrincipalChanges.Add(new MerchantChanges("Zip", oldValue, txtPrincipalZip.Text));
                    }

                    if (editMerchant.MerchantPrincipal.Contact.Address.State != null)
                    {
                        if (ddlPrincipalState.SelectedValue != editMerchant.MerchantPrincipal.Contact.Address.State.RecordId.ToString())
                        {
                            string oldValue = "";

                            oldValue = editMerchant.MerchantPrincipal.Contact.Address.State.Name.ToString();

                            arrPrincipalChanges.Add(new MerchantChanges("State", oldValue, ddlPrincipalState.SelectedText));
                        }
                    }
                    else if (ddlPrincipalState.SelectedValue != "")
                    {
                        string oldValue = "";

                        arrPrincipalChanges.Add(new MerchantChanges("State", oldValue, ddlPrincipalState.SelectedText));
                    }
                }

            }

            if (txtPrincipalHomePhone.Text != _newLogic.Coalesce(editMerchant.MerchantPrincipal.Contact.HomePhone))
            {
                string oldValue = "";

                oldValue = editMerchant.MerchantPrincipal.Contact.HomePhone;

                arrPrincipalChanges.Add(new MerchantChanges("Home Phone", oldValue, txtPrincipalHomePhone.Text));
            }

            if (txtPrincipalCellPhone.Text != _newLogic.Coalesce(editMerchant.MerchantPrincipal.Contact.CellPhone))
            {
                string oldValue = "";

                oldValue = editMerchant.MerchantPrincipal.Contact.CellPhone;

                arrPrincipalChanges.Add(new MerchantChanges("Cell Phone", oldValue, txtPrincipalCellPhone.Text));
            }
        }
コード例 #40
0
        private void SaveAdvancePlanChanges(MerchantModel editMerchant, ApplicationDbContext ctx)
        {
            try
            {

                foreach (RepeaterItem rItem in rptrAdvancePlanChanges.Items)
                {
                    Label lblFieldName = (Label)rItem.FindControl("lblFieldName5");
                    Label lblNewValue = (Label)rItem.FindControl("lblNewValue5");
                    CheckBox cbConfirmed = (CheckBox)rItem.FindControl("cbConfirmed5");

                    if (lblFieldName != null && lblNewValue != null && cbConfirmed != null)
                    {
                        if (lblFieldName.Text == "Advance Plan")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.AdvancePlan.PlanName, lblNewValue.Text.Trim());

                                editMerchant.AdvancePlan = ctx.AdvancePlans.First(ap => ap.PlanName == lblNewValue.Text);
                            }
                            else
                            {
                                ddlActivePlan.SelectedValue = editMerchant.AdvancePlan.RecordId.ToString();
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                string userId = "";

                if (Request.IsAuthenticated)
                {
                    userId = Page.User.Identity.GetUserId();
                }
                _newLogic.WriteExceptionToDB(ex, "SaveAdvancePlanChanges", 0, editMerchant.RecordId, userId);
            }
        }
コード例 #41
0
        private void SaveBankingChanges(MerchantModel editMerchant, ApplicationDbContext ctx)
        {
            try
            {
                foreach (RepeaterItem rItem in rptrBankingChanges.Items)
                {
                    Label lblFieldName = (Label)rItem.FindControl("lblFieldName3");
                    Label lblNewValue = (Label)rItem.FindControl("lblNewValue3");
                    CheckBox cbConfirmed = (CheckBox)rItem.FindControl("cbConfirmed3");

                    if (lblFieldName != null && lblNewValue != null && cbConfirmed != null)
                    {
                        if (lblFieldName.Text == "Bank Name")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BankAccount.Bank.BankName, lblNewValue.Text);

                                editMerchant.BankAccount.Bank.BankName = lblNewValue.Text.Trim();
                            }
                            else
                            {
                                txtBankName.Text = editMerchant.BankAccount.Bank.BankName;
                            }
                        }

                        if (lblFieldName.Text == "Bank City")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BankAccount.Bank.BankCity, lblNewValue.Text);

                                editMerchant.BankAccount.Bank.BankCity = lblNewValue.Text.Trim();
                            }
                            else
                            {
                                txtBankCity.Text = editMerchant.BankAccount.Bank.BankCity;
                            }
                        }

                        if (lblFieldName.Text == "Bank Phone")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BankAccount.Bank.BankPhone, lblNewValue.Text);

                                editMerchant.BankAccount.Bank.BankPhone = lblNewValue.Text.Trim();
                            }
                            else
                            {
                                txtBankPhone.Text = editMerchant.BankAccount.Bank.BankPhone;
                            }
                        }

                        if (lblFieldName.Text == "Bank State")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BankAccount.Bank.BankState.Name, lblNewValue.Text);

                                editMerchant.BankAccount.Bank.BankState = ctx.GeoStates.First(gs => gs.Name == lblNewValue.Text);
                            }
                            else
                            {
                                ddlBankState.SelectedValue = editMerchant.BankAccount.Bank.BankState.RecordId.ToString();
                            }
                        }

                        if (lblFieldName.Text == "Debit Card")
                        {
                            if (cbConfirmed.Checked)
                            {
                                string oldDebitCard = MaskDebitCard(editMerchant.DebitCard.DebitCardNumber, editMerchant.DebitCard.RecordId);

                                Logic.Crypt crypto1 = new Logic.Crypt();
                                crypto1.CryptType = "Card";
                                crypto1.CryptData = Convert.ToBase64String(PWDTK.StringToUtf8Bytes(lblNewValue.Text));
                                crypto1.Purpose = "9c443c6a-87d5-47cc-9c4d-abf6a2bd2e06";
                                crypto1.AdditionalData = editMerchant.DebitCard.RecordId.ToString();

                                byte[] newDebitCard = crypto1.Protect();

                                editMerchant.DebitCard.DebitCardNumber = newDebitCard;
                                editMerchant.DebitCard.DebitCardFirst6 = txtDebitCardNumber.Text.Substring(0, 6);
                                editMerchant.DebitCard.DebitCardLast4 = txtDebitCardNumber.Text.Substring(txtDebitCardNumber.Text.Length - 4, 4);
                                editMerchant.DebitCard.RemainingDigits = Convert.ToInt16(txtDebitCardNumber.Text.Length - 10);

                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, oldDebitCard, MaskDebitCard(newDebitCard, editMerchant.DebitCard.RecordId));
                            }
                            else
                            {
                                txtDebitCardNumber.Text = MaskDebitCard(editMerchant.DebitCard.DebitCardNumber, editMerchant.DebitCard.RecordId);
                            }

                            txtDebitCardNumber.Enabled = false;
                        }

                        if (lblFieldName.Text == "Account Number")
                        {
                            if (cbConfirmed.Checked)
                            {
                                string oldAccNum = MaskAccountNumber(editMerchant.BankAccount.AccountNumber, editMerchant.BankAccount.RecordId);

                                Logic.Crypt crypto2 = new Logic.Crypt();
                                crypto2.CryptType = "Account";
                                crypto2.CryptData = Convert.ToBase64String(PWDTK.StringToUtf8Bytes(lblNewValue.Text.Trim()));
                                crypto2.Purpose = "4742b06b-9e12-48cf-9034-aadb15dc7a58";
                                crypto2.AdditionalData = editMerchant.BankAccount.RecordId.ToString();

                                byte[] newAccNum = crypto2.Protect();

                                editMerchant.BankAccount.AccountNumber = newAccNum;
                                editMerchant.BankAccount.AccountNumberLast4 = txtAccountNumber.Text.Substring(txtAccountNumber.Text.Length - 4, 4);
                                editMerchant.BankAccount.RemainingDigits = Convert.ToInt16(txtAccountNumber.Text.Length - 4);

                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, oldAccNum, MaskAccountNumber(newAccNum, editMerchant.BankAccount.RecordId));
                            }
                            else
                            {
                                txtAccountNumber.Text = MaskAccountNumber(editMerchant.BankAccount.AccountNumber, editMerchant.BankAccount.RecordId);
                            }

                            txtAccountNumber.Enabled = false;
                        }

                        if (lblFieldName.Text == "Exp Month")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.DebitCard.DebitCardExpMonth, lblNewValue.Text);

                                editMerchant.DebitCard.DebitCardExpMonth = lblNewValue.Text;
                            }
                            else
                            {
                                ddlExpMonth.SelectedValue = editMerchant.DebitCard.DebitCardExpMonth.ToString();
                            }

                            ddlExpMonth.Enabled = false;
                        }

                        if (lblFieldName.Text == "Exp Year")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.DebitCard.DebitCardExpYear, lblNewValue.Text);

                                editMerchant.DebitCard.DebitCardExpYear = lblNewValue.Text;
                            }
                            else
                            {
                                ddlExpYear.SelectedValue = editMerchant.DebitCard.DebitCardExpYear.ToString();
                            }

                            ddlExpYear.Enabled = false;
                        }

                        if (lblFieldName.Text == "Routing Number")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BankAccount.RoutingNumber, lblNewValue.Text);

                                editMerchant.BankAccount.RoutingNumber = lblNewValue.Text.Trim();
                            }
                            else
                            {
                                txtRoutingNumber.Text = editMerchant.BankAccount.RoutingNumber;
                            }

                            txtRoutingNumber.Enabled = false;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                string userId = "";

                if (Request.IsAuthenticated)
                {
                    userId = Page.User.Identity.GetUserId();
                }
                _newLogic.WriteExceptionToDB(ex, "SaveBankingChanges", 0, editMerchant.RecordId, userId);
            }
        }
コード例 #42
0
        private void SaveBusinessChanges(MerchantModel editMerchant, ApplicationDbContext ctx)
        {
            try
            {
                foreach (RepeaterItem rItem in rptrBusinessChanges.Items)
                {
                    Label lblFieldName = (Label)rItem.FindControl("lblFieldName0");
                    Label lblNewValue = (Label)rItem.FindControl("lblNewValue0");
                    CheckBox cbConfirmed = (CheckBox)rItem.FindControl("cbConfirmed0");

                    if (lblFieldName != null && lblNewValue != null && cbConfirmed != null)
                    {
                        if (lblFieldName.Text == "Legal Org Type")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.LegalOrgType.LegalOrgTypeName, lblNewValue.Text);

                                editMerchant.LegalOrgType = ctx.LegalOrgTypes.First(lot => lot.LegalOrgTypeName == lblNewValue.Text);
                            }
                            else
                            {
                                ddlLegalOrgType.SelectedValue = editMerchant.LegalOrgType.RecordId.ToString();
                            }
                        }

                        if (lblFieldName.Text == "Legal Org State")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.LegalOrgState.Name, lblNewValue.Text);

                                editMerchant.LegalOrgState = ctx.GeoStates.First(gs => gs.Name == lblNewValue.Text);
                            }
                            else
                            {
                                ddlLegalOrgState.SelectedValue = editMerchant.LegalOrgState.RecordId.ToString();
                            }
                        }

                        if (lblFieldName.Text == "Merchant Type")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantType.MerchantTypeName, lblNewValue.Text);

                                editMerchant.MerchantType = ctx.MerchantTypes.First(mt => mt.MerchantTypeName == lblNewValue.Text);
                            }
                            else
                            {
                                rblMerchantType.SelectedValue = editMerchant.MerchantType.MerchantTypeName;
                            }
                        }

                        if (lblFieldName.Text == "MCC")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Mcc.MerchantCategoryCode, lblNewValue.Text);

                                editMerchant.Mcc = ctx.MerchantCategoryCodes.First(mcc => mcc.MerchantCategoryCode == lblNewValue.Text);
                            }
                            else
                            {
                                ddlMCC.SelectedValue = editMerchant.Mcc.RecordId.ToString();
                            }
                        }

                        if (lblFieldName.Text == "Legal Name")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.CorpName, lblNewValue.Text);

                                editMerchant.CorpName = lblNewValue.Text;
                            }
                            else
                            {
                                txtCorpName.Text = editMerchant.CorpName;
                            }
                        }

                        if (lblFieldName.Text == "DBA Name")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.DbaName, lblNewValue.Text);

                                editMerchant.DbaName = lblNewValue.Text;
                            }
                            else
                            {
                                txtDBAName.Text = editMerchant.DbaName;
                            }
                        }

                        if (lblFieldName.Text == "Business Address")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Business.Address.Address, lblNewValue.Text);

                                editMerchant.Business.Address.Address = lblNewValue.Text;
                            }
                            else
                            {
                                txtCorpAddress.Text = editMerchant.Business.Address.Address;
                            }
                        }

                        if (lblFieldName.Text == "Business City")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Business.Address.City, lblNewValue.Text);

                                editMerchant.Business.Address.City = lblNewValue.Text;
                            }
                            else
                            {
                                txtCorpCity.Text = editMerchant.Business.Address.City;
                            }
                        }

                        if (lblFieldName.Text == "Business State")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Business.Address.State.Name, lblNewValue.Text);

                                editMerchant.Business.Address.State = ctx.GeoStates.First(gs => gs.Name == lblNewValue.Text);
                            }
                            else
                            {
                                ddlCorpState.SelectedValue = editMerchant.Business.Address.State.RecordId.ToString();
                            }
                        }

                        if (lblFieldName.Text == "Business Zip")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Business.Address.Zip, lblNewValue.Text);

                                editMerchant.Business.Address.Zip = lblNewValue.Text;
                            }
                            else
                            {
                                txtCorpZip.Text = editMerchant.Business.Address.Zip;
                            }
                        }

                        if (lblFieldName.Text == "Business License #")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BusLicNumber, lblNewValue.Text);

                                editMerchant.BusLicNumber = lblNewValue.Text;
                            }
                            else
                            {
                                txtBusLicNumber.Text = editMerchant.BusLicNumber;
                            }
                        }

                        if (lblFieldName.Text == "License Type")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BusLicType, lblNewValue.Text);

                                editMerchant.BusLicType = lblNewValue.Text;
                            }
                            else
                            {
                                txtBusLicType.Text = editMerchant.BusLicType;
                            }
                        }

                        if (lblFieldName.Text == "License Issuer")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BusLicIssuer, lblNewValue.Text);

                                editMerchant.BusLicIssuer = lblNewValue.Text;
                            }
                            else
                            {
                                txtBusLicIssuer.Text = editMerchant.BusLicIssuer;
                            }
                        }

                        if (lblFieldName.Text == "License Date")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BusLicDate.ToString(), lblNewValue.Text);

                                editMerchant.BusLicDate = Convert.ToDateTime(lblNewValue.Text);
                            }
                            else
                            {
                                if (editMerchant.BusLicDate.HasValue)
                                {
                                    ddlLicenseDateYear.SelectedValue = editMerchant.BusLicDate.Value.Year.ToString();
                                    ddlLicenseDateMonth.SelectedValue = editMerchant.BusLicDate.Value.Month.ToString();
                                    ddlLicenseDateDay.SelectedValue = editMerchant.BusLicDate.Value.Day.ToString();
                                }
                                else
                                {
                                    ddlLicenseDateYear.SelectedIndex = -1;
                                    ddlLicenseDateMonth.SelectedIndex = -1;
                                    ddlLicenseDateDay.SelectedIndex = -1;
                                }
                            }
                        }

                        if (lblFieldName.Text == "Federal Tax ID")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.FedTaxId, lblNewValue.Text);

                                editMerchant.FedTaxId = lblNewValue.Text;
                            }
                            else
                            {
                                txtFedTaxId.Text = editMerchant.FedTaxId;
                            }
                        }

                        if (lblFieldName.Text == "Email")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Business.Email, lblNewValue.Text);

                                editMerchant.Business.Email = lblNewValue.Text;
                            }
                            else
                            {
                                txtBusEmail.Text = editMerchant.Business.Email;
                            }
                        }

                        if (lblFieldName.Text == "Phone")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Business.HomePhone, lblNewValue.Text);

                                editMerchant.Business.HomePhone = lblNewValue.Text;
                            }
                            else
                            {
                                txtBusPhone.Text = editMerchant.Business.HomePhone;
                            }
                        }

                        if (lblFieldName.Text == "Fax")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Business.Fax, lblNewValue.Text);

                                editMerchant.Business.Fax = lblNewValue.Text;
                            }
                            else
                            {
                                txtBusFax.Text = editMerchant.Business.Fax;
                            }
                        }

                        if (lblFieldName.Text == "Merchandise Sold")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchandiseSold, lblNewValue.Text);

                                editMerchant.MerchandiseSold = lblNewValue.Text;
                            }
                            else
                            {
                                txtMerchandiseSold.Text = editMerchant.MerchandiseSold;
                            }
                        }

                        if (lblFieldName.Text == "Years In Business")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.YearsInBusiness.ToString(), lblNewValue.Text);

                                editMerchant.YearsInBusiness = Convert.ToInt16(lblNewValue.Text);
                            }
                            else
                            {
                                txtYearsInBus.Text = editMerchant.YearsInBusiness.ToString();
                            }
                        }

                        if (lblFieldName.Text == "Months In Business")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MonthsInBusiness.ToString(), lblNewValue.Text);

                                editMerchant.MonthsInBusiness = Convert.ToInt16(lblNewValue.Text);
                            }
                            else
                            {
                                txtMonthsInBus.Text = editMerchant.MonthsInBusiness.HasValue ? editMerchant.MonthsInBusiness.Value.ToString("d2") : "";
                            }
                        }

                        if (lblFieldName.Text == "Seasonal Sales")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.SeasonalSales.ToString(), lblNewValue.Text);

                                editMerchant.SeasonalSales = Convert.ToBoolean(lblNewValue.Text);
                            }
                            else
                            {
                                if (editMerchant.SeasonalSales.HasValue)
                                {
                                    rblSeasonal.SelectedValue = editMerchant.SeasonalSales.ToString();
                                }
                                else
                                {
                                    rblSeasonal.SelectedIndex = -1;
                                }
                            }
                        }

                        if (lblFieldName.Text == "Seasonal Months")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.SeasonalMonths, lblNewValue.Text);

                                editMerchant.SeasonalMonths = lblNewValue.Text;
                            }
                            else
                            {
                                if (!String.IsNullOrEmpty(editMerchant.SeasonalMonths))
                                {
                                    foreach (string month in editMerchant.SeasonalMonths.Split('-'))
                                    {
                                        ListItem li = cblSeasonal.Items.FindByValue(month.Replace(" ", ""));

                                        if (li != null)
                                        {
                                            li.Selected = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                string userId = "";

                if (Request.IsAuthenticated)
                {
                    userId = Page.User.Identity.GetUserId();
                }
                _newLogic.WriteExceptionToDB(ex, "SaveBusinessChanges", 0, editMerchant.RecordId, userId);
            }
        }
コード例 #43
0
        public void BeginNewUnderwriting()
        {
            MerchantModel editMerchant = new MerchantModel();
            UnderwritingResultModel underwritingResult = new UnderwritingResultModel();
            UnderwritingResultModel oldUnderwritingResult = new UnderwritingResultModel();
            String userId = "";
            Int32 merchantRecordId;

            try
            {
                txtUnderwriterInitials.Enabled = false;

                merchantRecordId = Convert.ToInt32(hMerchantRecordId.Value);
                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    editMerchant = ctx.Merchants.First(m => m.RecordId == merchantRecordId);

                    if (ctx.UnderwritingResults.Any(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true))
                    {
                        oldUnderwritingResult = ctx.UnderwritingResults.Where(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true).First();
                        oldUnderwritingResult.Active = false;
                    }

                    underwritingResult.Brand = editMerchant.Brand;
                    underwritingResult.Merchant = editMerchant;
                    underwritingResult.Timestamp = DateTime.UtcNow;
                    underwritingResult.Active = true;
                    underwritingResult.UnderwriterInitials = txtUnderwriterInitials.Text;
                    if (Request.IsAuthenticated)
                    {
                        userId = Page.User.Identity.GetUserId();
                        underwritingResult.UnderwriterUser = ctx.Users.First(u => u.Id == userId);
                    }

                    ctx.UnderwritingResults.Add(underwritingResult);

                    ctx.SaveChanges();
                }

                btnBeginUnderwritingUpdate.Enabled = false;
                pnlUnderwritingButtons.Visible = true;
                btnAddNewUnderwriting.Visible = false;
                btnUnderwritingContinue.Visible = true;
                btnUnderwritingCancel2.Visible = true;

                //Connect to LexisNexis to get automated results
                AutomatedUnderwriting(editMerchant.RecordId, underwritingResult.RecordId);

                ////Enable Radio Button Fields
                //rblUWCorpInfoVerifiedResult.Enabled = true;
                //rblUWBusLicStatusResult.Enabled = true;
                //rblUWEINVerifiedResult.Enabled = true;
                //rblUWPrincipalVerifiedResult.Enabled = true;
                //rblUWCardSalesIndicatorsVerifiedResult.Enabled = true;
                //rblUWBankingInfoVerifiedResult.Enabled = true;
                //rblUWMCCVerifiedResult.Enabled = true;
                //rblUWBVIVerifiedResult.Enabled = true;
                //rblUWTaxLiensVerifiedResult.Enabled = true;
                //rblUWRiskIndicatorVerifiedResult.Enabled = true;

                ////Enable Text Area Fields
                //txtUWCorpInfoVerifiedNotes.Enabled = true;
                //txtUWBUsLicStatusVerifiedNotes.Enabled = true;
                //txtUWEINVerifiedNotes.Enabled = true;
                //txtUWPrincipalVerifiedNotes.Enabled = true;
                //txtUWCardSalesIndicatorsVerifiedNotes.Enabled = true;
                //txtUWBankingInfoVerifiedNotes.Enabled = true;
                //txtUWMCCVerifiedNotes.Enabled = true;
                //txtUWBVIVerifiedNotes.Enabled = true;
                //txtUWTaxLiensVerifiedNotes.Enabled = true;
                //txtUWRiskIndicatorVerifiedNotes.Enabled = true;

            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "BeginUnderwriting", 0, 0, userId);
            }
        }
コード例 #44
0
        protected void btnUnderwritingSave_Click(object sender, EventArgs e)
        {
            MerchantModel editMerchant = new MerchantModel();
            UnderwritingResultModel underwritingResult = new UnderwritingResultModel();
            UnderwritingResultModel oldUnderwritingResult = new UnderwritingResultModel();
            Int32 merchantRecordId;

            try
            {
                merchantRecordId = Convert.ToInt32(hMerchantRecordId.Value);
                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    editMerchant = ctx.Merchants.First(m => m.RecordId == merchantRecordId);

                    underwritingResult = ctx.UnderwritingResults.Where(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true).First();

                    underwritingResult.CorpInfoResult = Convert.ToInt16(rblUWCorpInfoVerifiedResult.SelectedValue);
                    underwritingResult.CorpInfoNotes = txtUWCorpInfoVerifiedNotes.Text;

                    underwritingResult.BusLicStatusResult = Convert.ToInt16(rblUWBusLicStatusResult.SelectedValue);
                    underwritingResult.BusLicStatusNotes = txtUWBUsLicStatusVerifiedNotes.Text;

                    underwritingResult.EINResult = Convert.ToInt16(rblUWEINVerifiedResult.SelectedValue);
                    underwritingResult.EINNotes = txtUWEINVerifiedNotes.Text;

                    underwritingResult.PrincipalResult = Convert.ToInt16(rblUWPrincipalVerifiedResult.SelectedValue);
                    underwritingResult.PrincipalNotes = txtUWPrincipalVerifiedNotes.Text;

                    underwritingResult.CardSalesIndicatorResult = Convert.ToInt16(rblUWCardSalesIndicatorsVerifiedResult.SelectedValue);
                    underwritingResult.CardSalesIndicatorNotes = txtUWCardSalesIndicatorsVerifiedNotes.Text;

                    underwritingResult.BankingInfoResult = Convert.ToInt16(rblUWBankingInfoVerifiedResult.SelectedValue);
                    underwritingResult.BankingInfoNotes = txtUWBankingInfoVerifiedNotes.Text;

                    underwritingResult.MCCResult = Convert.ToInt16(rblUWMCCVerifiedResult.SelectedValue);
                    underwritingResult.MCCNotes = txtUWMCCVerifiedNotes.Text;

                    underwritingResult.BVIResult = Convert.ToInt16(rblUWBVIVerifiedResult.SelectedValue);
                    underwritingResult.BVINotes = txtUWBVIVerifiedNotes.Text;

                    underwritingResult.TaxLiensResult = Convert.ToInt16(rblUWTaxLiensVerifiedResult.SelectedValue);
                    underwritingResult.TaxLiensNotes = txtUWTaxLiensVerifiedNotes.Text;

                    underwritingResult.RiskIndicatorResult = Convert.ToInt16(rblUWRiskIndicatorVerifiedResult.SelectedValue);
                    underwritingResult.RiskIndicatorNotes = txtUWRiskIndicatorVerifiedNotes.Text;

                    underwritingResult.UnderwritingDecision = "Pending";
                    editMerchant.UnderwritingStatus = ctx.UnderwritingStatuses.First(us => us.StatusDescription == "Pending");

                    ctx.SaveChanges();
                    UpdateStatusLabel();

                    lblUnderwritingMessage.Text = "Underwriting results have been successfully saved.";
                }

            }
            catch (System.Exception ex)
            {
                lblUnderwritingMessage.Text = "Underwriting results could not be saved.  Please try again or contact your system administrator.";
                _newLogic.WriteExceptionToDB(ex, "btnUnderwritingSave_Click");
            }
        }
コード例 #45
0
        protected void gridUnderwritingHistory_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                TableCell cell = (TableCell)dataItem["Active"];
                Label lblActive = (Label)dataItem.FindControl("lblActive");
                Image imgActive = (Image)dataItem.FindControl("imgActive");

                if (lblActive.Text == "True")
                {
                    imgActive.ImageUrl = "Images/star.png";
                    imgActive.ToolTip = "Current Active Underwriting Results";
                    imgActive.AlternateText = "Current Active Underwriting Results";
                }
                else
                {
                    imgActive.Visible = false;
                }
            }

            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem editItem = (GridEditableItem)e.Item;

                Label lblEditFormCorpInfoResult = (Label)editItem.FindControl("lblEditFormCorpInfoResult");
                Image imgCorpInfoResult = (Image)editItem.FindControl("imgCorpInfoResult");
                switch (lblEditFormCorpInfoResult.Text)
                {
                    case "0":
                        imgCorpInfoResult.ImageUrl = "Images/uw-pending.gif";
                        imgCorpInfoResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgCorpInfoResult.ImageUrl = "Images/uw-pass.gif";
                        imgCorpInfoResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgCorpInfoResult.ImageUrl = "Images/uw-fail.gif";
                        imgCorpInfoResult.ToolTip = "Fail";
                        break;
                    default:
                        imgCorpInfoResult.Visible = false;
                        break;
                }

                Label lblEditFormOFACMatchResult = (Label)editItem.FindControl("lblEditFormOFACMatchResult");
                Image imgOFACMatchResult = (Image)editItem.FindControl("imgOFACMatchResult");
                switch (lblEditFormOFACMatchResult.Text)
                {
                    case "0":
                        imgOFACMatchResult.ImageUrl = "Images/uw-pending.gif";
                        imgOFACMatchResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgOFACMatchResult.ImageUrl = "Images/uw-pass.gif";
                        imgOFACMatchResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgOFACMatchResult.ImageUrl = "Images/uw-fail.gif";
                        imgOFACMatchResult.ToolTip = "Fail";
                        break;
                    default:
                        imgCorpInfoResult.Visible = false;
                        break;
                }

                Label lblEditFormBusLicStatusResult = (Label)editItem.FindControl("lblEditFormBusLicStatusResult");
                Image imgBusLicStatusResult = (Image)editItem.FindControl("imgBusLicStatusResult");
                switch (lblEditFormBusLicStatusResult.Text)
                {
                    case "0":
                        imgBusLicStatusResult.ImageUrl = "Images/uw-pending.gif";
                        imgBusLicStatusResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgBusLicStatusResult.ImageUrl = "Images/uw-pass.gif";
                        imgBusLicStatusResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgBusLicStatusResult.ImageUrl = "Images/uw-fail.gif";
                        imgBusLicStatusResult.ToolTip = "Fail";
                        break;
                    default:
                        imgBusLicStatusResult.Visible = false;
                        break;
                }

                Label lblEditFormEINResult = (Label)editItem.FindControl("lblEditFormEINResult");
                Image imgEINResult = (Image)editItem.FindControl("imgEINResult");
                switch (lblEditFormEINResult.Text)
                {
                    case "0":
                        imgEINResult.ImageUrl = "Images/uw-pending.gif";
                        imgEINResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgEINResult.ImageUrl = "Images/uw-pass.gif";
                        imgEINResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgEINResult.ImageUrl = "Images/uw-fail.gif";
                        imgEINResult.ToolTip = "Fail";
                        break;
                    default:
                        imgEINResult.Visible = false;
                        break;
                }

                Label lblEditFormPrincipalResult = (Label)editItem.FindControl("lblEditFormPrincipalResult");
                Image imgPrincipalResult = (Image)editItem.FindControl("imgPrincipalResult");
                switch (lblEditFormPrincipalResult.Text)
                {
                    case "0":
                        imgPrincipalResult.ImageUrl = "Images/uw-pending.gif";
                        imgPrincipalResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgPrincipalResult.ImageUrl = "Images/uw-pass.gif";
                        imgPrincipalResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgPrincipalResult.ImageUrl = "Images/uw-fail.gif";
                        imgPrincipalResult.ToolTip = "Fail";
                        break;
                    default:
                        imgPrincipalResult.Visible = false;
                        break;
                }

                Label lblEditFormCardSalesIndicatorResult = (Label)editItem.FindControl("lblEditFormCardSalesIndicatorResult");
                Image imgCardSalesIndicatorResult = (Image)editItem.FindControl("imgCardSalesIndicatorResult");
                switch (lblEditFormCardSalesIndicatorResult.Text)
                {
                    case "0":
                        imgCardSalesIndicatorResult.ImageUrl = "Images/uw-pending.gif";
                        imgCardSalesIndicatorResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgCardSalesIndicatorResult.ImageUrl = "Images/uw-pass.gif";
                        imgCardSalesIndicatorResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgCardSalesIndicatorResult.ImageUrl = "Images/uw-fail.gif";
                        imgCardSalesIndicatorResult.ToolTip = "Fail";
                        break;
                    default:
                        imgCardSalesIndicatorResult.Visible = false;
                        break;
                }

                Label lblEditFormBankingInfoResult = (Label)editItem.FindControl("lblEditFormBankingInfoResult");
                Image imgBankingInfoResult = (Image)editItem.FindControl("imgBankingInfoResult");
                switch (lblEditFormBankingInfoResult.Text)
                {
                    case "0":
                        imgBankingInfoResult.ImageUrl = "Images/uw-pending.gif";
                        imgBankingInfoResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgBankingInfoResult.ImageUrl = "Images/uw-pass.gif";
                        imgBankingInfoResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgBankingInfoResult.ImageUrl = "Images/uw-fail.gif";
                        imgBankingInfoResult.ToolTip = "Fail";
                        break;
                    default:
                        imgBankingInfoResult.Visible = false;
                        break;
                }

                Label lblEditFormMCCResult = (Label)editItem.FindControl("lblEditFormMCCResult");
                Image imgMCCResult = (Image)editItem.FindControl("imgMCCResult");
                switch (lblEditFormMCCResult.Text)
                {
                    case "0":
                        imgMCCResult.ImageUrl = "Images/uw-pending.gif";
                        imgMCCResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgMCCResult.ImageUrl = "Images/uw-pass.gif";
                        imgMCCResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgMCCResult.ImageUrl = "Images/uw-fail.gif";
                        imgMCCResult.ToolTip = "Fail";
                        break;
                    default:
                        imgMCCResult.Visible = false;
                        break;
                }

                Label lblEditFormBVIResult = (Label)editItem.FindControl("lblEditFormBVIResult");
                Image imgBVIResult = (Image)editItem.FindControl("imgBVIResult");
                switch (lblEditFormBVIResult.Text)
                {
                    case "0":
                        imgBVIResult.ImageUrl = "Images/uw-pending.gif";
                        imgBVIResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgBVIResult.ImageUrl = "Images/uw-pass.gif";
                        imgBVIResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgBVIResult.ImageUrl = "Images/uw-fail.gif";
                        imgBVIResult.ToolTip = "Fail";
                        break;
                    default:
                        imgBVIResult.Visible = false;
                        break;
                }

                Label lblEditFormTaxLiensResult = (Label)editItem.FindControl("lblEditFormTaxLiensResult");
                Image imgTaxLiensResult = (Image)editItem.FindControl("imgTaxLiensResult");
                switch (lblEditFormTaxLiensResult.Text)
                {
                    case "0":
                        imgTaxLiensResult.ImageUrl = "Images/uw-pending.gif";
                        imgTaxLiensResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgTaxLiensResult.ImageUrl = "Images/uw-pass.gif";
                        imgTaxLiensResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgTaxLiensResult.ImageUrl = "Images/uw-fail.gif";
                        imgTaxLiensResult.ToolTip = "Fail";
                        break;
                    default:
                        imgTaxLiensResult.Visible = false;
                        break;
                }

                Label lblEditFormRiskIndicatorResult = (Label)editItem.FindControl("lblEditFormRiskIndicatorResult");
                Image imgRiskIndicatorResult = (Image)editItem.FindControl("imgRiskIndicatorResult");
                switch (lblEditFormRiskIndicatorResult.Text)
                {
                    case "0":
                        imgRiskIndicatorResult.ImageUrl = "Images/uw-pending.gif";
                        imgRiskIndicatorResult.ToolTip = "Pending";
                        break;
                    case "1":
                        imgRiskIndicatorResult.ImageUrl = "Images/uw-pass.gif";
                        imgRiskIndicatorResult.ToolTip = "Pass";
                        break;
                    case "2":
                        imgRiskIndicatorResult.ImageUrl = "Images/uw-fail.gif";
                        imgRiskIndicatorResult.ToolTip = "Fail";
                        break;
                    default:
                        imgRiskIndicatorResult.Visible = false;
                        break;
                }

                HyperLink linkTempXmlFile = (HyperLink)editItem.FindControl("linkTempXmlFile");

                MerchantModel editMerchant = new MerchantModel();
                Int32 merchantRecordId;

                merchantRecordId = Convert.ToInt32(hMerchantRecordId.Value);

                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    MerchantModel merchant = ctx.Merchants.First(m => m.RecordId == merchantRecordId);

                    if (merchant != null)
                    {
                        if (ctx.UnderwritingResults.Any(x => x.Active == true && x.Merchant.RecordId == merchant.RecordId))
                        {
                            UnderwritingResultModel uwActiveResults = ctx.UnderwritingResults.FirstOrDefault(x => x.Active == true && x.Merchant.RecordId == merchant.RecordId);

                            if (uwActiveResults != null)
                            {
                                string fileName = "rawxml_" + Guid.NewGuid() + ".xml";

                                if (!File.Exists(Server.MapPath("~/TempUWFiles/" + fileName)))
                                {
                                    using (File.Create(Server.MapPath("~/TempUWFiles/" + fileName))) { }

                                    File.WriteAllText(Server.MapPath("~/TempUWFiles/" + fileName), uwActiveResults.LexisNexisResults.LexisNexisRawResult.XmlContent);
                                }

                                linkTempXmlFile.NavigateUrl = "~/TempUWFiles/" + fileName;

                            }
                        }
                    }
                }

            }
        }
コード例 #46
0
        protected void btnUnderwritingComplete_Click(object sender, EventArgs e)
        {
            MerchantModel editMerchant = new MerchantModel();
            UnderwritingResultModel underwritingResult = new UnderwritingResultModel();
            UnderwritingResultModel oldUnderwritingResult = new UnderwritingResultModel();
            Int32 merchantRecordId;
            String adminId;

            try
            {
                merchantRecordId = Convert.ToInt32(hMerchantRecordId.Value);
                adminId = Context.User.Identity.GetUserId();

                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    editMerchant = ctx.Merchants.First(m => m.RecordId == merchantRecordId);

                    underwritingResult = ctx.UnderwritingResults.Where(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true).First();

                    underwritingResult.CorpInfoResult = Convert.ToInt16(rblUWCorpInfoVerifiedResult.SelectedValue);
                    underwritingResult.CorpInfoNotes = txtUWCorpInfoVerifiedNotes.Text;

                    underwritingResult.BusLicStatusResult = Convert.ToInt16(rblUWBusLicStatusResult.SelectedValue);
                    underwritingResult.BusLicStatusNotes = txtUWBUsLicStatusVerifiedNotes.Text;

                    underwritingResult.EINResult = Convert.ToInt16(rblUWEINVerifiedResult.SelectedValue);
                    underwritingResult.EINNotes = txtUWEINVerifiedNotes.Text;

                    underwritingResult.PrincipalResult = Convert.ToInt16(rblUWPrincipalVerifiedResult.SelectedValue);
                    underwritingResult.PrincipalNotes = txtUWPrincipalVerifiedNotes.Text;

                    underwritingResult.CardSalesIndicatorResult = Convert.ToInt16(rblUWCardSalesIndicatorsVerifiedResult.SelectedValue);
                    underwritingResult.CardSalesIndicatorNotes = txtUWCardSalesIndicatorsVerifiedNotes.Text;

                    underwritingResult.BankingInfoResult = Convert.ToInt16(rblUWBankingInfoVerifiedResult.SelectedValue);
                    underwritingResult.BankingInfoNotes = txtUWBankingInfoVerifiedNotes.Text;

                    underwritingResult.MCCResult = Convert.ToInt16(rblUWMCCVerifiedResult.SelectedValue);
                    underwritingResult.MCCNotes = txtUWMCCVerifiedNotes.Text;

                    underwritingResult.BVIResult = Convert.ToInt16(rblUWBVIVerifiedResult.SelectedValue);
                    underwritingResult.BVINotes = txtUWBVIVerifiedNotes.Text;

                    underwritingResult.TaxLiensResult = Convert.ToInt16(rblUWTaxLiensVerifiedResult.SelectedValue);
                    underwritingResult.TaxLiensNotes = txtUWTaxLiensVerifiedNotes.Text;

                    underwritingResult.RiskIndicatorResult = Convert.ToInt16(rblUWRiskIndicatorVerifiedResult.SelectedValue);
                    underwritingResult.RiskIndicatorNotes = txtUWRiskIndicatorVerifiedNotes.Text;

                    underwritingResult.OFACMatchResult = Convert.ToInt16(rblUWOFACMatchVerifiedResult.SelectedValue);
                    underwritingResult.OFACMatchNotes = txtUWOFACMatchVerifiedNotes.Text;

                    if (underwritingResult.CorpInfoResult == 1
                        && underwritingResult.BusLicStatusResult == 1
                        && underwritingResult.EINResult == 1
                        && underwritingResult.PrincipalResult == 1
                        && underwritingResult.CardSalesIndicatorResult == 1
                        && underwritingResult.BankingInfoResult == 1
                        && underwritingResult.MCCResult == 1
                        && underwritingResult.BVIResult == 1
                        && underwritingResult.TaxLiensResult == 1
                        && underwritingResult.RiskIndicatorResult == 1
                        && underwritingResult.OFACMatchResult == 1
                        )
                    {
                        underwritingResult.UnderwritingDecision = "Pass";
                        editMerchant.UnderwritingStatus = ctx.UnderwritingStatuses.First(us => us.StatusDescription == "Approved");
                    }
                    else
                    {
                        underwritingResult.UnderwritingDecision = "Fail";
                        editMerchant.UnderwritingStatus = ctx.UnderwritingStatuses.First(us => us.StatusDescription == "Denied");

                        if (editMerchant.MerchantStatus.StatusDescription == "Enrolled")
                        {
                            editMerchant.MerchantStatus = ctx.MerchantStatuses.First(ms => ms.StatusDescription == "Denied");
                            editMerchant.DenialNotes = "Underwriting Decline.  See Underwriting Results for more information.";
                            editMerchant.DeniedBy = ctx.Users.First(u => u.Id == adminId);
                            editMerchant.DeniedDate = DateTime.UtcNow;
                            editMerchant.ApprovedAdvanceAmount = 0;
                            editMerchant.AvailableAdvanceAmount = 0;

                            //Send Email
                            Logic.Messaging messaging = new Logic.Messaging();
                            Boolean emailSent = false;
                            var template = messaging.GetTemplate("DeniedEnrollment");

                            if (template != null)
                            {
                                String html = messaging.GetTemplateHtml(template);

                                foreach (EmailTemplateVariableModel variable in messaging.GetRequiredVariables(template))
                                {
                                    if (editMerchant.MerchantPrincipal != null && editMerchant.MerchantPrincipal.Contact != null)
                                    {
                                        if (variable.VariableName == "MERCHANT_FIRST_NAME")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.MerchantPrincipal.Contact.FirstName);
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.MerchantPrincipal.Contact.FirstName);
                                        }
                                        if (variable.VariableName == "MERCHANT_LAST_NAME")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.MerchantPrincipal.Contact.LastName);
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.MerchantPrincipal.Contact.LastName);
                                        }
                                    }
                                    else
                                    {
                                        if (variable.VariableName == "MERCHANT_FIRST_NAME")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                        if (variable.VariableName == "MERCHANT_LAST_NAME")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                    }
                                    if (variable.VariableName == "MERCHANT_NAME")
                                    {
                                        html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.CorpName);
                                        html = html.Replace("<$" + variable.VariableName + ">", editMerchant.CorpName);
                                    }
                                    if (editMerchant.Business.Address != null)
                                    {
                                        if (variable.VariableName == "MERCHANT_ADDRESS")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.Business.Address.Address ?? "");
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.Business.Address.Address ?? "");
                                        }
                                        if (variable.VariableName == "MERCHANT_CITY")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.Business.Address.City ?? "");
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.Business.Address.City ?? "");
                                        }
                                        if (variable.VariableName == "MERCHANT_ZIP")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.Business.Address.Zip ?? "");
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.Business.Address.Zip ?? "");
                                        }
                                        if (editMerchant.Business.Address.State != null)
                                        {
                                            if (variable.VariableName == "MERCHANT_STATE")
                                            {
                                                html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.Business.Address.State.Name ?? "");
                                                html = html.Replace("<$" + variable.VariableName + ">", editMerchant.Business.Address.State.Name ?? "");
                                            }
                                        }
                                        else
                                        {
                                            if (variable.VariableName == "MERCHANT_STATE")
                                            {
                                                html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                                html = html.Replace("<$" + variable.VariableName + ">", "");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (variable.VariableName == "MERCHANT_ADDRESS")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                        if (variable.VariableName == "MERCHANT_CITY")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                        if (variable.VariableName == "MERCHANT_STATE")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                        if (variable.VariableName == "MERCHANT_ZIP")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                    }
                                    if (variable.VariableName == "DENY_NOTES")
                                    {
                                        html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.DenialNotes);
                                        html = html.Replace("<$" + variable.VariableName + ">", editMerchant.DenialNotes);
                                    }
                                }

                                if (ctx.Users.Any(u => u.Merchant.RecordId == editMerchant.RecordId))
                                {
                                    IQueryable<ApplicationUser> userList = ctx.Users.Where(u => u.Merchant.RecordId == editMerchant.RecordId);

                                    if (userList != null)
                                    {
                                        foreach (ApplicationUser thisUser in userList)
                                        {
                                            if (html != null)
                                            {
                                                emailSent = messaging.SendEmail(thisUser.Email, template.EmailSubject, html, template, editMerchant, thisUser);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            editMerchant.MerchantStatus = ctx.MerchantStatuses.First(ms => ms.StatusDescription == "Suspended");

                            MerchantSuspensionModel suspension = new MerchantSuspensionModel();

                            suspension.Merchant = ctx.Merchants.First(m => m.RecordId == editMerchant.RecordId);
                            suspension.OtherReasonNotes = "Failed Underwriting. See Undewriting Results for more information.";
                            suspension.SuspendedBy = ctx.Users.First(u => u.Id == adminId);
                            suspension.SuspensionReason = ctx.MerchantSuspensionReasons.First(msr => msr.ReasonName == "Failed Underwriting Result");
                            suspension.Timestamp = DateTime.UtcNow;

                            ctx.MerchantSuspensions.Add(suspension);

                            //Send Email
                            Logic.Messaging messaging = new Logic.Messaging();
                            Boolean emailSent = false;
                            var template = messaging.GetTemplate("MerchantSuspended");

                            String suspendNotes = "Failed Underwriting.  Contact Customer Service for more information.";

                            if (template != null)
                            {
                                String html = messaging.GetTemplateHtml(template);

                                foreach (EmailTemplateVariableModel variable in messaging.GetRequiredVariables(template))
                                {
                                    if (editMerchant.MerchantPrincipal != null && editMerchant.MerchantPrincipal.Contact != null)
                                    {
                                        if (variable.VariableName == "MERCHANT_FIRST_NAME")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.MerchantPrincipal.Contact.FirstName);
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.MerchantPrincipal.Contact.FirstName);
                                        }
                                        if (variable.VariableName == "MERCHANT_LAST_NAME")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.MerchantPrincipal.Contact.LastName);
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.MerchantPrincipal.Contact.LastName);
                                        }
                                    }
                                    else
                                    {
                                        if (variable.VariableName == "MERCHANT_FIRST_NAME")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                        if (variable.VariableName == "MERCHANT_LAST_NAME")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                    }
                                    if (variable.VariableName == "MERCHANT_NAME")
                                    {
                                        html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.CorpName);
                                        html = html.Replace("<$" + variable.VariableName + ">", editMerchant.CorpName);
                                    }
                                    if (editMerchant.Business.Address != null)
                                    {
                                        if (variable.VariableName == "MERCHANT_ADDRESS")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.Business.Address.Address ?? "");
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.Business.Address.Address ?? "");
                                        }
                                        if (variable.VariableName == "MERCHANT_CITY")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.Business.Address.City ?? "");
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.Business.Address.City ?? "");
                                        }
                                        if (variable.VariableName == "MERCHANT_ZIP")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.Business.Address.Zip ?? "");
                                            html = html.Replace("<$" + variable.VariableName + ">", editMerchant.Business.Address.Zip ?? "");
                                        }
                                        if (editMerchant.Business.Address.State != null)
                                        {
                                            if (variable.VariableName == "MERCHANT_STATE")
                                            {
                                                html = html.Replace("&lt;$" + variable.VariableName + "&gt;", editMerchant.Business.Address.State.Name ?? "");
                                                html = html.Replace("<$" + variable.VariableName + ">", editMerchant.Business.Address.State.Name ?? "");
                                            }
                                        }
                                        else
                                        {
                                            if (variable.VariableName == "MERCHANT_STATE")
                                            {
                                                html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                                html = html.Replace("<$" + variable.VariableName + ">", "");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (variable.VariableName == "MERCHANT_ADDRESS")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                        if (variable.VariableName == "MERCHANT_CITY")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                        if (variable.VariableName == "MERCHANT_STATE")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                        if (variable.VariableName == "MERCHANT_ZIP")
                                        {
                                            html = html.Replace("&lt;$" + variable.VariableName + "&gt;", "");
                                            html = html.Replace("<$" + variable.VariableName + ">", "");
                                        }
                                    }
                                    if (variable.VariableName == "SUSPEND_NOTES")
                                    {
                                        html = html.Replace("&lt;$" + variable.VariableName + "&gt;", suspendNotes);
                                        html = html.Replace("<$" + variable.VariableName + ">", suspendNotes);
                                    }
                                }

                                if (ctx.Users.Any(u => u.Merchant.RecordId == editMerchant.RecordId))
                                {
                                    IQueryable<ApplicationUser> userList = ctx.Users.Where(u => u.Merchant.RecordId == editMerchant.RecordId);

                                    if (userList != null)
                                    {
                                        foreach (ApplicationUser thisUser in userList)
                                        {
                                            if (html != null)
                                            {
                                                emailSent = messaging.SendEmail(thisUser.Email, template.EmailSubject, html, template, editMerchant, thisUser);
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        ctx.SaveChanges();
                    }

                    ctx.SaveChanges();
                    UpdateStatusLabel();
                    gridUnderwritingHistory.Rebind();

                }

                pnlNewUnderwriting.Visible = false;
                pnlNewUnderwriting2.Visible = false;
                pnlUnderwritingHistory.Visible = true;
                pnlUnderwritingButtons.Visible = true;
                pnlUnderwritingAdvancedButtons.Visible = false;

                btnUnderwritingCancel.Visible = false;
                btnUnderwritingCancel2.Visible = false;
                btnUnderwritingTryAgain.Visible = false;
                btnUnderwritingComplete.Visible = false;
                btnUnderwritingSave.Visible = false;
                btnAddNewUnderwriting.Visible = true;
                btnUnderwritingContinue.Visible = false;

            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "btnUnderwritingComplete_Click");
            }
        }
コード例 #47
0
        protected void DashboardView_PreRender(object sender, EventArgs e)
        {
            MerchantModel editMerchant = new MerchantModel();
            Int32 merchantRecordId;

            try
            {
                merchantRecordId = Convert.ToInt32(hMerchantRecordId.Value);

                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    MerchantModel merchant = ctx.Merchants.First(m => m.RecordId == merchantRecordId);

                    if (merchant != null)
                    {
                        if (merchant.MerchantStatus != null) { txtMDStatus.Text = merchant.MerchantStatus.StatusDescription; }
                        if (merchant.UnderwritingStatus != null) { txtMDUnderwritingStatus.Text = merchant.UnderwritingStatus.StatusDescription; }
                        txtMDApprovedAmount.Text = "$" + merchant.ApprovedAdvanceAmount.ToString();
                        txtMDAvailableAmount.Text = "$" + merchant.AvailableAdvanceAmount.ToString();

                        if (ctx.Advances
                            .Any(a => a.Merchant.RecordId == merchant.RecordId
                                && a.Status.StatusDescription == "Approved"
                                && a.FundingStatus.StatusDescription == "Approved"))
                        {
                            txtMDTotalAdvances.Text = "$" + ctx.Advances
                                .Where(a => a.Merchant.RecordId == merchant.RecordId
                                && a.Status.StatusDescription == "Approved"
                                && a.FundingStatus.StatusDescription == "Approved")
                                .Sum(a => a.PrincipalAmount).ToString();
                        }
                        else { txtMDTotalAdvances.Text = "$0.00"; }

                        if (ctx.Advances
                            .Any(a => a.Merchant.RecordId == merchant.RecordId
                                && a.Status.StatusDescription == "Approved"
                                && a.FundingStatus.StatusDescription == "Approved"))
                        {
                            txtMDTotalAdvanceFees.Text = "$" + ctx.Advances
                                .Where(a => a.Merchant.RecordId == merchant.RecordId
                                && a.Status.StatusDescription == "Approved"
                                && a.FundingStatus.StatusDescription == "Approved")
                                .Sum(a => a.FeeAmount).ToString();
                        }
                        else { txtMDTotalAdvanceFees.Text = "$0.00"; }

                        if (ctx.Advances
                            .Any(a => a.Merchant.RecordId == merchant.RecordId
                                && a.Status.StatusDescription == "Approved"
                                && a.FundingStatus.StatusDescription == "Approved"))
                        {
                            txtMDTotalRepaid.Text = "$" + ctx.Advances
                                .Where(a => a.Merchant.RecordId == merchant.RecordId
                                && a.Status.StatusDescription == "Approved"
                                && a.FundingStatus.StatusDescription == "Approved")
                                .Sum(a => (a.PrincipalAmount + a.FeeAmount) - (a.PrincipalBalance + a.FeeBalance)).ToString();
                        }
                        else { txtMDTotalRepaid.Text = "$0.00"; }

                        if (ctx.Advances
                            .Any(a => a.Merchant.RecordId == merchant.RecordId
                                && a.Status.StatusDescription == "Approved"
                                && a.FundingStatus.StatusDescription == "Approved"))
                        {
                            txtMDTotalDue.Text = "$" + ctx.Advances
                                .Where(a => a.Merchant.RecordId == merchant.RecordId
                                && a.Status.StatusDescription == "Approved"
                                && a.FundingStatus.StatusDescription == "Approved")
                                .Sum(a => (a.PrincipalBalance + a.FeeBalance)).ToString();
                        }
                        else { txtMDTotalDue.Text = "$0.00"; }

                        if (ctx.AdvancePayments
                            .Any(ap => ap.Advance.Merchant.RecordId == merchant.RecordId
                                && ap.Advance.Status.StatusDescription == "Approved"
                                && ap.Advance.FundingStatus.StatusDescription == "Approved"
                                && ap.Status.StatusDescription != "Pending"))
                        {
                            txtMDLastPaymentDate.Text = ctx.AdvancePayments
                                .Where(ap => ap.Advance.Merchant.RecordId == merchant.RecordId
                                && ap.Advance.Status.StatusDescription == "Approved"
                                && ap.Advance.FundingStatus.StatusDescription == "Approved"
                                && ap.Status.StatusDescription != "Pending")
                                .OrderByDescending(ap => ap.Timestamp)
                                .First().Timestamp.ToShortDateString();
                        }
                        else { txtMDLastPaymentDate.Text = "N/A"; }

                        if (ctx.AdvancePayments
                            .Any(ap => ap.Advance.Merchant.RecordId == merchant.RecordId
                            && ap.Advance.Status.StatusDescription == "Approved"
                            && ap.Advance.FundingStatus.StatusDescription == "Approved"
                            && ap.Status.StatusDescription != "Pending"))
                        {
                            txtMDLastPaymentAmount.Text = "$" + ctx.AdvancePayments
                                .Where(ap => ap.Advance.Merchant.RecordId == merchant.RecordId
                                && ap.Advance.Status.StatusDescription == "Approved"
                                && ap.Advance.FundingStatus.StatusDescription == "Approved"
                                && ap.Status.StatusDescription != "Pending")
                                .OrderByDescending(ap => ap.Timestamp)
                                .First().ActualTotalAmount.Value.ToString();
                        }
                        else { txtMDLastPaymentAmount.Text = "N/A"; }

                        if (ctx.Advances
                            .Any(a => a.Merchant.RecordId == merchant.RecordId
                            && (a.Status.StatusDescription == "Pending"
                                || a.FundingStatus.StatusDescription == "Pending"
                                || a.FundingStatus.StatusDescription == "Rejected"
                                || a.FundingStatus.StatusDescription == "Need Alternate Funding Method")
                                ))
                        {
                            txtMDPendingAdvances.Text = "$" + ctx.Advances
                                .Where(a => a.Merchant.RecordId == merchant.RecordId
                                && (a.Status.StatusDescription == "Pending" || a.FundingStatus.StatusDescription == "Pending" || a.FundingStatus.StatusDescription == "Rejected" || a.FundingStatus.StatusDescription == "Need Alternate Funding Method"))
                                .Sum(a => a.PrincipalBalance).ToString();
                        }
                        else { txtMDPendingAdvances.Text = "$0.00"; }

                        if (ctx.Advances
                            .Any(a => a.Merchant.RecordId == merchant.RecordId
                            && a.Status.StatusDescription == "Approved"
                            && a.FundingStatus.StatusDescription == "Approved"))
                        {
                            txtMDNextPaymentAmount.Text = "$" + ctx.Advances
                                .Where(a => a.Merchant.RecordId == merchant.RecordId
                                && a.Status.StatusDescription == "Approved"
                                && a.FundingStatus.StatusDescription == "Approved")
                                .Sum(a => a.NextPaymentAmount).ToString();
                        }
                        else { txtMDNextPaymentAmount.Text = "$0.00"; }

                        if (merchant.MerchantStatus.StatusDescription == "Suspended")
                        {
                            phSuspension.Visible = true;

                            if (ctx.MerchantSuspensions.Any(ms => ms.Merchant.RecordId == merchant.RecordId
                                && ms.ReinstatedBy == null
                                && ms.ReinstatedDate == null
                                && ms.ReinstateNotes == null
                                ))
                            {
                                var suspension = ctx.MerchantSuspensions
                                    .OrderByDescending(ms => ms.Timestamp)
                                    .First(ms => ms.Merchant.RecordId == merchant.RecordId
                                    && ms.ReinstatedBy == null
                                    && ms.ReinstatedDate == null
                                    && ms.ReinstateNotes == null);

                                txtSuspensionReason.Text = suspension.SuspensionReason.ReasonName;
                                txtSuspensionNotes.Text = suspension.OtherReasonNotes;
                                txtSuspensionAdmin.Text = suspension.SuspendedBy.UserName;
                                txtSuspensionTimestamp.Text = suspension.Timestamp.ToShortDateString();
                            }
                        }
                        else
                        {
                            phSuspension.Visible = false;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "DashboardView_PreRender");
            }
        }
コード例 #48
0
        protected void btnUnderwritingContinue_Click(object sender, EventArgs e)
        {
            pnlUnderwritingHistory.Visible = false;
            pnlNewUnderwriting.Visible = false;
            pnlNewUnderwriting2.Visible = true;
            pnlUnderwritingButtons.Visible = false;
            pnlUnderwritingAdvancedButtons.Visible = true;
            btnUnderwritingComplete.Visible = true;
            btnUnderwritingSave.Visible = true;
            btnUnderwritingCancel.Visible = true;

            MerchantModel editMerchant = new MerchantModel();
            UnderwritingResultModel underwritingResult = new UnderwritingResultModel();
            UnderwritingResultModel oldUnderwritingResult = new UnderwritingResultModel();
            Int32 merchantRecordId;

            try
            {
                merchantRecordId = Convert.ToInt32(hMerchantRecordId.Value);

                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    editMerchant = ctx.Merchants.First(m => m.RecordId == merchantRecordId);
                    var underwritingSchema = editMerchant.AdvancePlan.UnderwritingSchema;

                    underwritingResult = ctx.UnderwritingResults.FirstOrDefault(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true);

                    if (underwritingResult != null)
                    {
                        if (underwritingResult.LexisNexisResults != null)
                        {
                            if (underwritingResult.LexisNexisResults.MccMatch != null)
                            {
                                if (underwritingResult.LexisNexisResults.MccMatch == true)
                                {
                                    txtUWMCCVerifiedNotes.Text = "Match and Approved";
                                    rblUWMCCVerifiedResult.SelectedValue = "1";
                                }
                                else if (underwritingResult.LexisNexisResults.MccMatch == false)
                                {
                                    txtUWMCCVerifiedNotes.Text = "Mismatch";
                                    rblUWMCCVerifiedResult.SelectedValue = "2";
                                    rblUWMCCVerifiedResult.Enabled = false;
                                }
                                else
                                {
                                    txtUWMCCVerifiedNotes.Text = "";
                                    rblUWMCCVerifiedResult.SelectedValue = "0";
                                }
                            }

                            if (underwritingResult.LexisNexisResults.OFAC != null)
                            {
                                if (underwritingResult.LexisNexisResults.OFAC == false)
                                {
                                    rblUWOFACMatchVerifiedResult.SelectedValue = "1";
                                    txtUWOFACMatchVerifiedNotes.Text = "No OFAC Match Found";
                                }
                                else
                                {
                                    if (underwritingSchema.OFACDecline == true)
                                    {
                                        rblUWOFACMatchVerifiedResult.SelectedValue = "2";
                                        txtUWOFACMatchVerifiedNotes.Text = "Match Found | " + underwritingResult.LexisNexisResults.OFACMatchData;
                                        rblUWOFACMatchVerifiedResult.Enabled = false;
                                    }
                                    else
                                    {
                                        rblUWOFACMatchVerifiedResult.SelectedValue = "1";
                                        txtUWOFACMatchVerifiedNotes.Text = "Match Found, but Allowed | " + underwritingResult.LexisNexisResults.OFACMatchData;
                                    }
                                }
                            }

                            if (underwritingResult.LexisNexisResults.BVI != null)
                            {
                                if (underwritingResult.LexisNexisResults.BVI < underwritingSchema.BVIDeclineLimit)
                                {
                                    txtUWBVIVerifiedNotes.Text = "Fail: " + underwritingResult.LexisNexisResults.BVI + " < " + underwritingSchema.BVIDeclineLimit;
                                    rblUWBVIVerifiedResult.SelectedValue = "2";
                                    rblUWBVIVerifiedResult.Enabled = false;
                                }
                                else if (underwritingResult.LexisNexisResults.BVI == underwritingSchema.BVIReviewLimit)
                                {
                                    txtUWBVIVerifiedNotes.Text = "Manual Approval Required: " + underwritingResult.LexisNexisResults.BVI + " = " + underwritingSchema.BVIReviewLimit;
                                    rblUWBVIVerifiedResult.SelectedValue = "0";
                                }
                                else
                                {
                                    txtUWBVIVerifiedNotes.Text = "Pass: "******" > " + underwritingSchema.BVIReviewLimit;
                                    rblUWBVIVerifiedResult.SelectedValue = "1";
                                }
                            }

                            if (underwritingResult.LexisNexisResults.RecentLienType != null)
                            {
                                if (underwritingResult.LexisNexisResults.RecentLienType.TypeName.ToLower().Contains("tax"))
                                {
                                    if (underwritingSchema.DeclineOnTaxLien)
                                    {
                                        txtUWTaxLiensVerifiedNotes.Text = "Fail: " + underwritingResult.LexisNexisResults.RecentLienType.TypeName;
                                        rblUWTaxLiensVerifiedResult.SelectedValue = "2";
                                        rblUWTaxLiensVerifiedResult.Enabled = false;
                                    }
                                    else
                                    {
                                        txtUWTaxLiensVerifiedNotes.Text = "Tax Lien Found, but Allowed: " + underwritingResult.LexisNexisResults.RecentLienType.TypeName;
                                        rblUWTaxLiensVerifiedResult.SelectedValue = "1";
                                    }
                                }
                            }
                            else
                            {
                                txtUWTaxLiensVerifiedNotes.Text = "No Tax Liens";
                                rblUWTaxLiensVerifiedResult.SelectedValue = "1";
                            }

                            if (ctx.LexisNexisRiskCodeResults.Any(lnrcr => lnrcr.LexisNexisUnderwritingResult.RecordId == underwritingResult.LexisNexisResults.RecordId))
                            {
                                String riskCodeList = "";
                                var riskCodes = ctx.LexisNexisRiskCodeResults.Where(lnrcr => lnrcr.LexisNexisUnderwritingResult.RecordId == underwritingResult.LexisNexisResults.RecordId);

                                foreach (var code in riskCodes)
                                {
                                    if (underwritingSchema.LexisNexisApprovedRiskCodes.Any(x => x.Decline && x.RiskCode.RecordId == code.RiskCode.RecordId))
                                    {
                                        riskCodeList += "Decline: " + code.RiskCode.RiskCodeDescription + " || ";
                                    }
                                    else if (underwritingSchema.LexisNexisApprovedRiskCodes.Any(x => x.ReqeustVerification && x.RiskCode.RecordId == code.RiskCode.RecordId))
                                    {
                                        riskCodeList += "Manual Verification: " + code.RiskCode.RiskCodeDescription + " || ";
                                    }
                                    else
                                    {
                                        riskCodeList += "Found, but Allowed: " + code.RiskCode.RiskCodeDescription + " || ";
                                    }
                                }

                                txtUWRiskIndicatorVerifiedNotes.Text = riskCodeList.Substring(0, riskCodeList.Length - 4);
                                if (riskCodeList.Contains("Decline:"))
                                {
                                    rblUWRiskIndicatorVerifiedResult.SelectedValue = "2";
                                    rblUWRiskIndicatorVerifiedResult.Enabled = false;
                                }
                                else if (riskCodeList.Contains("Manual Verification:"))
                                {
                                    rblUWRiskIndicatorVerifiedResult.SelectedValue = "0";
                                }
                                else
                                {
                                    rblUWRiskIndicatorVerifiedResult.SelectedValue = "1";
                                }

                            }
                        }
                    }
                }

                txtUWCorpInfoVerifiedNotes.Text = "";
                txtUWBUsLicStatusVerifiedNotes.Text = "";
                txtUWEINVerifiedNotes.Text = "";
                txtUWPrincipalVerifiedNotes.Text = "";
                txtUWCardSalesIndicatorsVerifiedNotes.Text = "";
                txtUWBankingInfoVerifiedNotes.Text = "";
                rblUWCorpInfoVerifiedResult.SelectedValue = "0";
                rblUWBusLicStatusResult.SelectedValue = "0";
                rblUWEINVerifiedResult.SelectedValue = "0";
                rblUWPrincipalVerifiedResult.SelectedValue = "0";
                rblUWCardSalesIndicatorsVerifiedResult.SelectedValue = "0";
                rblUWBankingInfoVerifiedResult.SelectedValue = "0";

            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "btnUnderwritingContinue_Click");
            }
        }
コード例 #49
0
        private void SavePrincipalChanges(MerchantModel editMerchant, ApplicationDbContext ctx)
        {
            try
            {
                foreach (RepeaterItem rItem in rptrPrincipalChanges.Items)
                {
                    Label lblFieldName = (Label)rItem.FindControl("lblFieldName1");
                    Label lblNewValue = (Label)rItem.FindControl("lblNewValue1");
                    CheckBox cbConfirmed = (CheckBox)rItem.FindControl("cbConfirmed1");

                    if (lblFieldName != null && lblNewValue != null && cbConfirmed != null)
                    {
                        if (lblFieldName.Text == "First Name")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.FirstName, lblNewValue.Text);

                                editMerchant.MerchantPrincipal.Contact.FirstName = lblNewValue.Text;
                            }
                            else
                            {
                                txtPrincipalFirstName.Text = editMerchant.MerchantPrincipal.Contact.FirstName;
                            }
                        }

                        if (lblFieldName.Text == "Last Name")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.LastName, lblNewValue.Text);

                                editMerchant.MerchantPrincipal.Contact.LastName = lblNewValue.Text;
                            }
                            else
                            {
                                txtPrincipalLastName.Text = editMerchant.MerchantPrincipal.Contact.LastName;
                            }
                        }

                        if (lblFieldName.Text == "M.I.")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.MiddleInitial, lblNewValue.Text);

                                editMerchant.MerchantPrincipal.Contact.MiddleInitial = lblNewValue.Text;
                            }
                            else
                            {
                                txtPrincipalMI.Text = editMerchant.MerchantPrincipal.Contact.MiddleInitial;
                            }
                        }

                        if (lblFieldName.Text == "D.O.B.")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.PrincipalDoB.ToString(), lblNewValue.Text);

                                editMerchant.MerchantPrincipal.PrincipalDoB = Convert.ToDateTime(lblNewValue.Text);
                            }
                            else
                            {
                                if (editMerchant.MerchantPrincipal.PrincipalDoB.HasValue)
                                {
                                    ddlBirthYear.SelectedValue = editMerchant.MerchantPrincipal.PrincipalDoB.Value.Year.ToString();
                                    ddlBirthMonth.SelectedValue = editMerchant.MerchantPrincipal.PrincipalDoB.Value.Month.ToString();
                                    ddlBirthDay.SelectedValue = editMerchant.MerchantPrincipal.PrincipalDoB.Value.Day.ToString();
                                }
                                else
                                {
                                    ddlBirthYear.SelectedIndex = -1;
                                    ddlBirthMonth.SelectedIndex = -1;
                                    ddlBirthDay.SelectedIndex = -1;
                                }
                            }
                        }

                        if (lblFieldName.Text == "S.S.N.")
                        {
                            if (cbConfirmed.Checked)
                            {
                                String maskedOldSsn = MaskSsn(editMerchant.MerchantPrincipal.PrincipalSsn, editMerchant.MerchantPrincipal.RecordId);

                                Logic.Crypt crypto1 = new Logic.Crypt();
                                crypto1.CryptType = "SSN";
                                crypto1.CryptData = Convert.ToBase64String(PWDTK.StringToUtf8Bytes(lblNewValue.Text));
                                crypto1.Purpose = "86d4b5b2-b34a-4968-9fde-f8ed677bca8b";
                                crypto1.AdditionalData = editMerchant.MerchantPrincipal.RecordId.ToString();

                                byte[] newSsn = crypto1.Protect();

                                editMerchant.MerchantPrincipal.PrincipalSsn = newSsn;

                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, maskedOldSsn, MaskSsn(newSsn, editMerchant.MerchantPrincipal.RecordId));

                            }
                            else
                            {
                                if (editMerchant.MerchantPrincipal.PrincipalSsn != null)
                                {
                                    txtPrincipalSSN.Text = MaskSsn(editMerchant.MerchantPrincipal.PrincipalSsn, editMerchant.MerchantPrincipal.RecordId);
                                }
                                else
                                {
                                    txtPrincipalSSN.Text = "";
                                }
                            }

                            txtPrincipalSSN.Enabled = false;
                        }

                        if (lblFieldName.Text == "% Ownership")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.PrincipalPctOwn.ToString(), lblNewValue.Text);

                                editMerchant.MerchantPrincipal.PrincipalPctOwn = Convert.ToDecimal(lblNewValue.Text.Substring(0, lblNewValue.Text.Length - 2));
                            }
                            else
                            {
                                if (editMerchant.MerchantPrincipal.PrincipalPctOwn.HasValue)
                                {
                                    txtPrincipalPctOwn.Text = editMerchant.MerchantPrincipal.PrincipalPctOwn.ToString();
                                }
                                else
                                {
                                    txtPrincipalPctOwn.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "Title")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.Title, lblNewValue.Text);

                                editMerchant.MerchantPrincipal.Contact.Title = lblNewValue.Text;
                            }
                            else
                            {
                                txtPrincipalTitle.Text = editMerchant.MerchantPrincipal.Contact.Title;
                            }
                        }

                        if (lblFieldName.Text == "DL Number")
                        {
                            if (cbConfirmed.Checked)
                            {
                                String maskedOldDL = MaskDLNumber(editMerchant.MerchantPrincipal.PrincipalDLNumber, editMerchant.MerchantPrincipal.RecordId);

                                Logic.Crypt crypto2 = new Logic.Crypt();
                                crypto2.CryptType = "DL";
                                crypto2.CryptData = Convert.ToBase64String(PWDTK.StringToUtf8Bytes(lblNewValue.Text));
                                crypto2.Purpose = "29dc7202-ae1f-4d38-9694-9d700a94897b";
                                crypto2.AdditionalData = editMerchant.MerchantPrincipal.RecordId.ToString();

                                byte[] newDl = crypto2.Protect();

                                editMerchant.MerchantPrincipal.PrincipalDLNumber = newDl;

                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, maskedOldDL, MaskDLNumber(newDl, editMerchant.MerchantPrincipal.RecordId));

                            }
                            else
                            {
                                txtPrincipalDLNumber.Text = MaskDLNumber(editMerchant.MerchantPrincipal.PrincipalDLNumber, editMerchant.MerchantPrincipal.RecordId);
                            }

                            txtPrincipalDLNumber.Enabled = false;
                        }

                        if (lblFieldName.Text == "DL State")
                        {
                            if (cbConfirmed.Checked)
                            {
                                string stateName = editMerchant.MerchantPrincipal.PrincipalDLState == null ? "" : editMerchant.MerchantPrincipal.PrincipalDLState.Name;

                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, stateName, lblNewValue.Text);

                                editMerchant.MerchantPrincipal.PrincipalDLState = ctx.GeoStates.First(gs => gs.Name == lblNewValue.Text);
                            }
                            else
                            {
                                if (editMerchant.MerchantPrincipal.PrincipalDLState != null)
                                {
                                    ddlPrincipalDLState.SelectedValue = editMerchant.MerchantPrincipal.PrincipalDLState.RecordId.ToString();
                                }
                                else
                                {
                                    ddlPrincipalDLState.SelectedIndex = -1;
                                }
                            }
                        }

                        if (lblFieldName.Text == "Address")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.MerchantPrincipal.Contact.Address != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.Address.Address, lblNewValue.Text);

                                    editMerchant.MerchantPrincipal.Contact.Address.Address = lblNewValue.Text;
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    AddressModel newContactAddress = new AddressModel();
                                    newContactAddress.Address = lblNewValue.Text;
                                    ctx.Addresses.Add(newContactAddress);
                                    editMerchant.MerchantPrincipal.Contact.Address = newContactAddress;
                                }
                            }
                            else
                            {
                                if (editMerchant.MerchantPrincipal.Contact.Address != null)
                                {
                                    txtPrincipalAddress.Text = editMerchant.MerchantPrincipal.Contact.Address.Address;
                                }
                                else
                                {
                                    txtPrincipalAddress.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "City")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.MerchantPrincipal.Contact.Address != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.Address.City, lblNewValue.Text);

                                    editMerchant.MerchantPrincipal.Contact.Address.City = lblNewValue.Text;
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    AddressModel newContactAddress = new AddressModel();
                                    newContactAddress.City = lblNewValue.Text;
                                    ctx.Addresses.Add(newContactAddress);
                                    editMerchant.MerchantPrincipal.Contact.Address = newContactAddress;
                                }
                            }
                            else
                            {
                                if (editMerchant.MerchantPrincipal.Contact.Address != null)
                                {
                                    txtPrincipalCity.Text = editMerchant.MerchantPrincipal.Contact.Address.City;
                                }
                                else
                                {
                                    txtPrincipalCity.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "Zip")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.MerchantPrincipal.Contact.Address != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.Address.Zip, lblNewValue.Text);

                                    editMerchant.MerchantPrincipal.Contact.Address.Zip = lblNewValue.Text;
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    AddressModel newContactAddress = new AddressModel();
                                    newContactAddress.Zip = lblNewValue.Text;
                                    ctx.Addresses.Add(newContactAddress);
                                    editMerchant.MerchantPrincipal.Contact.Address = newContactAddress;
                                }
                            }
                            else
                            {
                                if (editMerchant.MerchantPrincipal.Contact.Address != null)
                                {
                                    txtPrincipalZip.Text = editMerchant.MerchantPrincipal.Contact.Address.Zip;
                                }
                                else
                                {
                                    txtPrincipalZip.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "State")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.MerchantPrincipal.Contact.Address != null && editMerchant.MerchantPrincipal.Contact.Address.State != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.Address.State.Name, lblNewValue.Text);

                                    editMerchant.MerchantPrincipal.Contact.Address.State = ctx.GeoStates.First(gs => gs.Name == lblNewValue.Text);
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    AddressModel newContactAddress = new AddressModel();
                                    newContactAddress.State = ctx.GeoStates.First(x => x.Name == lblNewValue.Text);
                                    ctx.Addresses.Add(newContactAddress);
                                    editMerchant.MerchantPrincipal.Contact.Address = newContactAddress;
                                }
                            }
                            else
                            {
                                if (editMerchant.MerchantPrincipal.Contact.Address.State != null)
                                {
                                    ddlPrincipalState.SelectedValue = editMerchant.MerchantPrincipal.Contact.Address.State.RecordId.ToString();
                                }
                                else
                                {
                                    ddlPrincipalState.SelectedIndex = -1;
                                }
                            }
                        }

                        if (lblFieldName.Text == "Home Phone")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.HomePhone, lblNewValue.Text);

                                editMerchant.MerchantPrincipal.Contact.HomePhone = lblNewValue.Text;
                            }
                            else
                            {
                                txtPrincipalHomePhone.Text = editMerchant.MerchantPrincipal.Contact.HomePhone;
                            }
                        }

                        if (lblFieldName.Text == "Cell Phone")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantPrincipal.Contact.CellPhone, lblNewValue.Text);

                                editMerchant.MerchantPrincipal.Contact.CellPhone = lblNewValue.Text;
                            }
                            else
                            {
                                txtPrincipalCellPhone.Text = editMerchant.MerchantPrincipal.Contact.CellPhone;
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                string userId = "";

                if (Request.IsAuthenticated)
                {
                    userId = Page.User.Identity.GetUserId();
                }
                _newLogic.WriteExceptionToDB(ex, "SavePrincipalChanges", 0, editMerchant.RecordId, userId);
            }
        }
コード例 #50
0
        private void SaveMerchantAccountChanges(MerchantModel editMerchant, ApplicationDbContext ctx)
        {
            try
            {

                foreach (RepeaterItem rItem in rptrMerchantAccountChanges.Items)
                {
                    Label lblFieldName = (Label)rItem.FindControl("lblFieldName4");
                    Label lblNewValue = (Label)rItem.FindControl("lblNewValue4");
                    CheckBox cbConfirmed = (CheckBox)rItem.FindControl("cbConfirmed4");

                    if (lblFieldName != null && lblNewValue != null && cbConfirmed != null)
                    {
                        if (lblFieldName.Text == "Swiped %")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.SwipedPct.Value.ToString() + "%", lblNewValue.Text);

                                editMerchant.SwipedPct = Convert.ToInt32(lblNewValue.Text.Substring(0, lblNewValue.Text.Length - 2));
                            }
                            else
                            {
                                txtSwipedPct.Text = editMerchant.SwipedPct.ToString() ?? "";
                            }
                        }

                        if (lblFieldName.Text == "Avg Monthly Sales")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "$" + editMerchant.AvgMonthlySales.Value.ToString(), lblNewValue.Text);

                                editMerchant.AvgMonthlySales = Convert.ToDecimal(lblNewValue.Text.Trim().Replace("$", ""));
                            }
                            else
                            {
                                txtAvgMonthlySales.Text = editMerchant.AvgMonthlySales.ToString() ?? "";
                            }
                        }

                        if (lblFieldName.Text == "Highest Monthly Sales")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "$" + editMerchant.HighestMonthlySales.Value.ToString(), lblNewValue.Text);

                                editMerchant.HighestMonthlySales = Convert.ToDecimal(lblNewValue.Text.Trim().Replace("$", ""));
                            }
                            else
                            {
                                txtHighestMonthlySales.Text = editMerchant.HighestMonthlySales.ToString() ?? "";
                            }
                        }

                        if (lblFieldName.Text == "Avg Weekly Sales")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "$" + editMerchant.AvgWeeklySales.Value.ToString(), lblNewValue.Text);

                                editMerchant.AvgWeeklySales = Convert.ToDecimal(lblNewValue.Text.Trim().Replace("$", ""));
                            }
                            else
                            {
                                txtAvgWeeklySales.Text = editMerchant.AvgWeeklySales.ToString() ?? "";
                            }
                        }

                        if (lblFieldName.Text == "Processor")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Processor.ProcessorName, lblNewValue.Text);

                                //Check if merchant processor already exists, if so link to merchant.  If not, create it and add to merchant.
                                if (ctx.Processor.Any(p => p.ProcessorName == txtCardProcessor.Text.Trim()))
                                {
                                    editMerchant.Processor = ctx.Processor.First(p => p.ProcessorName == txtCardProcessor.Text.Trim());
                                }
                                else
                                {
                                    ProcessorModel newProcessor = new ProcessorModel();
                                    newProcessor.ProcessorName = txtCardProcessor.Text;
                                    ctx.Processor.Add(newProcessor);
                                    editMerchant.Processor = newProcessor;
                                }
                            }
                            else
                            {
                                if (editMerchant.Processor != null)
                                {
                                    txtCardProcessor.Text = editMerchant.Processor.ProcessorName;
                                }
                                else
                                {
                                    txtCardProcessor.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "Merchant Id")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.MerchantId, lblNewValue.Text);

                                editMerchant.MerchantId = lblNewValue.Text.Trim();
                            }
                            else
                            {
                                txtMerchantId.Text = editMerchant.MerchantId ?? "";
                            }
                        }

                        if (lblFieldName.Text == "High Risk")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.HighRisk.Value.ToString(), lblNewValue.Text.Trim());

                                editMerchant.HighRisk = Convert.ToBoolean(lblNewValue.Text.Trim());

                                if (lblNewValue.Text.Trim() == "False")
                                {
                                    editMerchant.HighRiskWho = "";
                                    editMerchant.HighRiskDate = null;
                                    txtHighRiskWho.Text = "";
                                    ddlHighRiskDay.SelectedIndex = -1;
                                    ddlHighRiskMonth.SelectedIndex = -1;
                                    ddlHighRiskYear.SelectedIndex = -1;
                                }
                            }
                            else
                            {
                                if (editMerchant.HighRisk != null)
                                {
                                    rblHighRisk.SelectedValue = editMerchant.HighRisk.ToString();
                                }
                                else
                                {
                                    rblHighRisk.SelectedIndex = -1;
                                }
                            }
                        }

                        if (lblFieldName.Text == "High Risk Who")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.HighRiskWho, lblNewValue.Text.Trim());

                                editMerchant.HighRiskWho = lblNewValue.Text.Trim();
                            }
                            else
                            {
                                txtHighRiskWho.Text = editMerchant.HighRiskWho ?? "";
                            }
                        }

                        if (lblFieldName.Text == "High Risk Date")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.HighRiskDate.Value.ToString(), lblNewValue.Text.Trim());

                                editMerchant.HighRiskDate = Convert.ToDateTime(lblNewValue.Text.Trim());
                            }
                            else
                            {
                                if (editMerchant.HighRiskDate.HasValue)
                                {
                                    ddlHighRiskYear.SelectedValue = editMerchant.HighRiskDate.Value.Year.ToString();
                                    ddlHighRiskMonth.SelectedValue = editMerchant.HighRiskDate.Value.Year.ToString();
                                    ddlHighRiskDay.SelectedValue = editMerchant.HighRiskDate.Value.Year.ToString();
                                }
                                else
                                {
                                    ddlHighRiskYear.SelectedIndex = -1;
                                    ddlHighRiskMonth.SelectedIndex = -1;
                                    ddlHighRiskDay.SelectedIndex = -1;
                                }
                            }
                        }

                        if (lblFieldName.Text == "Bankruptcy")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Bankruptcy.Value.ToString(), lblNewValue.Text.Trim());

                                editMerchant.Bankruptcy = Convert.ToBoolean(lblNewValue.Text.Trim());

                                if (lblNewValue.Text.Trim() == "False")
                                {
                                    editMerchant.BankruptcyDate = null;
                                    ddlBankruptcyDay.SelectedIndex = -1;
                                    ddlBankruptcyMonth.SelectedIndex = -1;
                                    ddlBankruptcyYear.SelectedIndex = -1;
                                }
                            }
                            else
                            {
                                if (editMerchant.Bankruptcy.HasValue)
                                {
                                    rblBankruptcy.SelectedValue = editMerchant.Bankruptcy.ToString();
                                }
                                else
                                {
                                    rblBankruptcy.SelectedIndex = -1;
                                }
                            }
                        }

                        if (lblFieldName.Text == "Bankruptcy Date")
                        {
                            if (cbConfirmed.Checked)
                            {
                                AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.BankruptcyDate.Value.ToString(), lblNewValue.Text.Trim());

                                editMerchant.BankruptcyDate = Convert.ToDateTime(lblNewValue.Text.Trim());
                            }
                            else
                            {
                                if (editMerchant.BankruptcyDate.HasValue)
                                {
                                    ddlBankruptcyYear.SelectedValue = editMerchant.BankruptcyDate.Value.Year.ToString();
                                    ddlBankruptcyMonth.SelectedValue = editMerchant.BankruptcyDate.Value.Year.ToString();
                                    ddlBankruptcyDay.SelectedValue = editMerchant.BankruptcyDate.Value.Year.ToString();
                                }
                                else
                                {
                                    ddlBankruptcyYear.SelectedIndex = -1;
                                    ddlBankruptcyMonth.SelectedIndex = -1;
                                    ddlBankruptcyDay.SelectedIndex = -1;
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                string userId = "";

                if (Request.IsAuthenticated)
                {
                    userId = Page.User.Identity.GetUserId();
                }
                _newLogic.WriteExceptionToDB(ex, "SaveMerchantAccountChanges", 0, editMerchant.RecordId, userId);
            }
        }
コード例 #51
0
        private void DetermineContactChanges(MerchantModel editMerchant, ArrayList arrContactChanges)
        {
            if (editMerchant.Contact == null)
            {
                if (txtContactFirstName.Text != "")
                {
                    string oldValue = "";

                    arrContactChanges.Add(new MerchantChanges("FirstName", oldValue, txtContactFirstName.Text));
                }

                if (txtContactLastName.Text != "")
                {
                    string oldValue = "";

                    arrContactChanges.Add(new MerchantChanges("LastName", oldValue, txtContactLastName.Text));
                }

                if (txtContactEmail.Text != "")
                {
                    string oldValue = "";

                    arrContactChanges.Add(new MerchantChanges("Email", oldValue, txtContactEmail.Text));
                }

                if (txtContactPhone.Text != "")
                {
                    string oldValue = "";

                    arrContactChanges.Add(new MerchantChanges("Phone", oldValue, txtContactPhone.Text));
                }

                if (txtContactFax.Text != "")
                {
                    string oldValue = "";

                    arrContactChanges.Add(new MerchantChanges("Fax", oldValue, txtContactFax.Text));
                }
            }
            else
            {
                if (txtContactFirstName.Text != _newLogic.Coalesce(editMerchant.Contact.FirstName))
                {
                    string oldValue = "";

                    oldValue = editMerchant.Contact.FirstName;

                    arrContactChanges.Add(new MerchantChanges("FirstName", oldValue, txtContactFirstName.Text));
                }

                if (txtContactLastName.Text != _newLogic.Coalesce(editMerchant.Contact.LastName))
                {
                    string oldValue = "";

                    oldValue = editMerchant.Contact.LastName;

                    arrContactChanges.Add(new MerchantChanges("LastName", oldValue, txtContactLastName.Text));
                }

                if (txtContactEmail.Text != _newLogic.Coalesce(editMerchant.Contact.Email))
                {
                    string oldValue = "";

                    oldValue = editMerchant.Contact.Email;

                    arrContactChanges.Add(new MerchantChanges("Email", oldValue, txtContactEmail.Text));
                }

                if (txtContactPhone.Text != _newLogic.Coalesce(editMerchant.Contact.HomePhone))
                {
                    string oldValue = "";

                    oldValue = editMerchant.Contact.HomePhone;

                    arrContactChanges.Add(new MerchantChanges("Phone", oldValue, txtContactPhone.Text));
                }

                if (txtContactFax.Text != _newLogic.Coalesce(editMerchant.Contact.Fax))
                {
                    string oldValue = "";

                    oldValue = editMerchant.Contact.Fax;

                    arrContactChanges.Add(new MerchantChanges("Fax", oldValue, txtContactFax.Text));
                }
            }
        }
コード例 #52
0
        public void CancelUnderwriting()
        {
            MerchantModel editMerchant = new MerchantModel();
            UnderwritingResultModel underwritingResult = new UnderwritingResultModel();
            UnderwritingResultModel oldUnderwritingResult = new UnderwritingResultModel();
            LexisNexisExceptionModel lnException = new LexisNexisExceptionModel();

            Int32 merchantRecordId;

            try
            {
                merchantRecordId = Convert.ToInt32(hMerchantRecordId.Value);

                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    editMerchant = ctx.Merchants.First(m => m.RecordId == merchantRecordId);

                    underwritingResult = ctx.UnderwritingResults.FirstOrDefault(ur => ur.Merchant.RecordId == merchantRecordId && ur.Active == true);

                    lnException = ctx.LexisNexisExceptions.FirstOrDefault(lne => lne.UnderwritingResult.RecordId == underwritingResult.RecordId);

                    if (lnException != null)
                    {
                        ctx.LexisNexisExceptions.Remove(lnException);
                    }
                    if (underwritingResult != null)
                    {
                        ctx.UnderwritingResults.Remove(underwritingResult);
                    }

                    ctx.SaveChanges();

                    if (ctx.UnderwritingResults.Any(ur => ur.Merchant.RecordId == merchantRecordId))
                    {
                        oldUnderwritingResult = ctx.UnderwritingResults.Where(ur => ur.Merchant.RecordId == merchantRecordId).OrderByDescending(ur => ur.Timestamp).First();

                        oldUnderwritingResult.Active = true;

                        ctx.SaveChanges();
                    }

                    gridUnderwritingHistory.Rebind();

                }

                //Reset Radio Button Fields
                rblUWCorpInfoVerifiedResult.SelectedValue = "0";
                rblUWBusLicStatusResult.SelectedValue = "0";
                rblUWEINVerifiedResult.SelectedValue = "0";
                rblUWPrincipalVerifiedResult.SelectedValue = "0";
                rblUWCardSalesIndicatorsVerifiedResult.SelectedValue = "0";
                rblUWBankingInfoVerifiedResult.SelectedValue = "0";
                rblUWMCCVerifiedResult.SelectedValue = "0";
                rblUWBVIVerifiedResult.SelectedValue = "0";
                rblUWTaxLiensVerifiedResult.SelectedValue = "0";
                rblUWRiskIndicatorVerifiedResult.SelectedValue = "0";

                //Reset Text Area Fields
                txtUWCorpInfoVerifiedNotes.Text = "";
                txtUWBUsLicStatusVerifiedNotes.Text = "";
                txtUWEINVerifiedNotes.Text = "";
                txtUWPrincipalVerifiedNotes.Text = "";
                txtUWCardSalesIndicatorsVerifiedNotes.Text = "";
                txtUWBankingInfoVerifiedNotes.Text = "";
                txtUWMCCVerifiedNotes.Text = "";
                txtUWBVIVerifiedNotes.Text = "";
                txtUWTaxLiensVerifiedNotes.Text = "";
                txtUWRiskIndicatorVerifiedNotes.Text = "";
                txtUnderwriterInitials.Text = "";

            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "CancelUnderwriting");
            }
        }