public static List <SellerData> GetSellers(int currentSellerId) { List <SellerData> l = new List <SellerData>(); foreach (var r in DB.GetSellers(currentSellerId)) { SellerData item = new SellerData(); item.SellerId = int.Parse(r["seller_id"].ToString()); item.Code = r["code"].ToString(); item.UserId = int.Parse(r["user_id"].ToString()); item.Username = r["username"].ToString(); item.FullName = r["fullname"].ToString(); item.Email = r["email"].ToString(); if (r["parent_seller_id"].ToString() != "") { item.ParentSellerId = int.Parse(r["parent_seller_id"].ToString()); } l.Add(item); } return(l); }
public JsonResult AmazonAccount(String sellerName) { String msg = ""; SellerData sellerData = new SellerData(); msg = sellerData.UpdateSellerAccount(SessionData.UserID, sellerName.Trim()); if (msg == "-1") { msg = "Seller Name already exists, please contact administrator!"; } else if (msg == "-2") { msg = "Seller Name already exists with trail ended.Please contact administrator!"; } else if (msg == "1") { msg = ""; } else { msg = "Error! Please try again."; } return(new JsonResult() { Data = msg, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public void Register([FromBody] SellerData sellerData) { var seller = _sellerProvider.Insert(sellerData.FirstName, sellerData.LastName, sellerData.PhoneNumber, sellerData.Address, sellerData.Longitude, sellerData.Latitude); var userId = Request.HttpContext.User.Claims.Single(c => c.Type == ClaimTypes.NameIdentifier).Value; _userProvider.LinkToSeller(Guid.Parse(userId), seller.Id); }
private List <string> GetSeller(int mealid) { using var connection = db.Connect(); int userid = connection.QuerySingle <int>("SELECT UserID FROM maaltijden WHERE MealID=@id", new { id = mealid }); SellerData sellerData = connection.QuerySingle <SellerData>("SELECT UserID, Name FROM verkoper_profiel WHERE UserID=@id", new { id = userid }); string urlToRedirect = $"/profile?id={sellerData.UserID}"; return(new List <string> { sellerData.Name, urlToRedirect }); }
public SettingsController() { this.pdata = new ProfileData(); this.ealert = new EmailAlert(); this.sellerData = new SellerData(); this.dashboardData = new DashboardData(); _version = ConfigurationManager.AppSettings["ApiVersion"]; _api = ConfigurationManager.AppSettings["Url"]; _redirecturi = ConfigurationManager.AppSettings["LwaRedirectUrl"]; _clientkey = ConfigurationManager.AppSettings["ClientKey"]; _clientSecretkey = ConfigurationManager.AppSettings["ClientSecretKey"]; }
public JsonResult Agreement(Int16 isAgreed) { String msg = ""; SellerData sellerData = new SellerData(); msg = userregistrationData.UpdateUserAgreement(SessionData.UserID, isAgreed); if (msg == "") { SessionData.IsAgreementAccept = 1; } return(new JsonResult() { Data = msg, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public async Task AddLedgerData(SellerData sell, BuyerData buy, decimal Quantities) { Ledger ledger = new Ledger(); ledger.BuyerId = buy.BuyId.ToString(); ledger.DisplayId = Guid.NewGuid().ToString(); ledger.BuyerPrice = (double)buy.BuyPrice; ledger.SellerId = sell.SellerId.ToString(); ledger.SellerPrice = (double)sell.SellPrice; ledger.SellerQuantity = (long)Quantities; ledger.ProcessTime = DateTime.Now; ledger.TransactionStatus = TransactionStatus.Success; _transactionDbContext.Ledgers.Add(ledger); await _transactionDbContext.SaveChangesAsync(); }
public static SellerData GetSeller(int id) { SellerData seller = null; var row = DB.GetSeller(id); if (row != null) { seller = new SellerData(); //seller.SellerId = (row["id"] != DBNull.Value) ? (int?)row["id"] : null; seller.SellerId = id; seller.UserId = Convert.ToInt32(row["user_id"]); seller.UserType = (UserTypes)row["usertype_id"]; seller.ParentSellerId = (row["parent_seller_id"] != DBNull.Value) ? (int?)row["parent_seller_id"] : (int?)null; seller.Phone = row["phone"].ToString(); seller.Email = row["email"].ToString(); seller.Code = row["code"].ToString(); seller.CountryId = (row["country_id"] != DBNull.Value) ? (int?)row["country_id"] : null; seller.CountryName = row["country_name"].ToString(); seller.FullName = row["fullname"].ToString(); seller.FullNameEN = row["fullname"].ToString().Unidecode(); } return(seller); }
public async Task UpdateSellerData(SellerData sell) { _transactionDbContext.SellerDatas.Update(sell); //await _transactionDbContext.SaveChangesAsync(); await _transactionDbContext.SaveEntitiesAsync(); }
public async Task AddSellerData(SellerData sellerData) { _transactionDbContext.SellerDatas.Add(sellerData); await _transactionDbContext.SaveChangesAsync(); }
//All Services public void Process_AllServices() { DataTable dtbl = null, dtbl1 = null, dtbl2 = null; DataSet ds = null; var sdata = new SellerData(); dtbl = sdata.GetUserStatus(); if (dtbl.Rows.Count > 0) { foreach (DataRow rw in dtbl.Rows) { bool subscription = false; int UserId = Convert.ToInt32(rw["MppUserID"]); String CustmID = Convert.ToString(rw["stp_custId"]); if (!String.IsNullOrWhiteSpace(CustmID)) { subscription = StripeHelper.UnSubscribe(CustmID); //unsubscribe the users either whose status is 2 or active with no card } if (subscription) { ServicesData.UpdatePlanData(UserId, 0); } } } ds = sdata.GetUserEmails(); dtbl1 = ds.Tables[0]; dtbl2 = ds.Tables[1]; if (dtbl1.Rows.Count > 0) { DataTable tbl = new DataTable(); tbl.Columns.AddRange(new DataColumn[2] { new DataColumn("MppUserId", typeof(Int32)), new DataColumn("Limit", typeof(Int32)) }); //Using Parallel Multi-Threading to send multiple bulk email. Parallel.ForEach(dtbl1.AsEnumerable(), row => { String msg = ""; Int32 Limit = Convert.ToInt32(row["accesslimit"]); Int32 UserID = Convert.ToInt32(row["MppUserID"]); msg = alert.SendNewUserAccessAlert(row["Email"].ToString(), row["FirstName"].ToString(), row["LastName"].ToString()); if (msg == "") { tbl.Rows.Add(); tbl.Rows[tbl.Rows.Count - 1][0] = UserID; switch (Limit) { case 1: Limit = 2; break; case 2: Limit = 3; break; default: Limit = 0; break; } tbl.Rows[tbl.Rows.Count - 1][1] = Limit; } }); if (tbl.Rows.Count > 0) { sdata.UpdateUserAccessLimit(tbl); } } if (dtbl2.Rows.Count > 0) { DataTable tbl1 = new DataTable(); DataTable tbl2 = new DataTable(); tbl1.Columns.AddRange(new DataColumn[2] { new DataColumn("UserID", typeof(Int32)), new DataColumn("Status", typeof(Int32)) }); tbl2.Columns.AddRange(new DataColumn[2] { new DataColumn("UserID", typeof(Int32)), new DataColumn("Status", typeof(Int32)) }); //Using Parallel Multi-Threading to send multiple bulk email. Parallel.ForEach(dtbl2.AsEnumerable(), row => { String msg = ""; Int32 UserID = Convert.ToInt32(row["MppUserID"]); String FirstName = Convert.ToString(row["FirstName"]); String LastName = Convert.ToString(row["LastName"]); String Email = Convert.ToString(row["Email"]); DateTime TrialEndDate = Convert.ToDateTime(row["TrailEndDate"]); msg = alert.SendTrialExpiresAlert(Email, TrialEndDate, FirstName, LastName); if (msg == "") { if (TrialEndDate < DateTime.Now) { tbl2.Rows.Add(); tbl2.Rows[tbl2.Rows.Count - 1][0] = UserID; tbl2.Rows[tbl2.Rows.Count - 1][1] = 1; } else { tbl1.Rows.Add(); tbl1.Rows[tbl1.Rows.Count - 1][0] = UserID; tbl1.Rows[tbl1.Rows.Count - 1][1] = 1; } } }); if (tbl1.Rows.Count > 0) { sdata.UpdateSevenTrialEmailStatus(tbl1); } if (tbl2.Rows.Count > 0) { sdata.UpdateTrialEndEmailStatus(tbl2); } } StripeServices.RenewPlan(); }
public WebHookController() { this.sellerData = new SellerData(); upData = new UserPlanData(); }
public async Task <TransactionResponse> Execute(TransactionModel transactionModel) { SellerData sell = new SellerData(transactionModel.Price, transactionModel.Quantity); try { await _sellerRepository.AddSellerData(sell); List <BuyerData> BuyerList = await _buyerRepository.GetGreaterBuyerPriceListFromSellerPrice(sell.SellPrice); foreach (var buy in BuyerList) { decimal Quantities = 0.0m; if (sell.RemainingQuantity >= buy.RemainingQuantity) { Quantities = buy.RemainingQuantity; } else { Quantities = sell.RemainingQuantity; } sell.RemainingQuantity -= Quantities; sell.SettledQuantity += Quantities; buy.RemainingQuantity -= Quantities; buy.SettledQuantity += Quantities; if (sell.RemainingQuantity == 0) { sell.StatusChangeToSettleStatus(); } else { sell.StatusChangeToOnHoldStatus(); } if (buy.RemainingQuantity == 0) { buy.StatusChangeToSettleStatus(); } else { buy.StatusChangeToOnHoldStatus(); } await _sellerRepository.UpdateSellerData(sell); await _buyerRepository.UpdateBuyerData(buy); await _ledgerRepository.AddLedgerData(sell, buy, Quantities); if (sell.RemainingQuantity == 0) { break; } } TransactionResponse transactionResponse = new TransactionResponse(); transactionResponse.UniqId = sell.SellerId.ToString(); transactionResponse.StatusCode = (int)sell.TransactionStatus; transactionResponse.StatusMessage = sell.TransactionStatus.ToString(); return(transactionResponse); } catch (Exception) { return(new TransactionResponse { ErrorCode = enErrorCode.InternalError, StatusCode = (int)TransactionStatus.Validationfail, StatusMessage = TransactionStatus.Validationfail.ToString() }); } }