internal bool NewUserRegistration(NewUserRegistration user) { //uncomment if login from home page //var loginlink = WaitAndGetBySelector("loginlink", ApplicationSettings.TimeOut.SuperFast); //if (loginlink!=null&& loginlink.Displayed) // loginlink.Click(); //Thread.Sleep(1000); ExecuteJavascript("$('input[value=\"register\"]').click()"); Thread.Sleep(1500); ExecuteJavascript("$('input#Text1').val('" + user.FName + "');$('input#Text2').val('" + user.LName + "');$('input#Text3').val('" + user.EmailId + "');$('input#Text4').val('" + user.Password + "');"); ExecuteJavascript("$('input[placeholder=\"Date of Birth\"]').val('" + user.DOB + "')"); ExecuteJavascript("$('#chkTNC').prop('checked',true)"); ExecuteJavascript("$('button[val-submit=\"register\"]').click()"); var divPrefCust = WaitAndGetBySelector("divPrefCust", ApplicationSettings.TimeOut.Slow); if (divPrefCust != null && divPrefCust.Displayed) { return(true); } else { return(false); } }
public ActionResult DeleteConfirmed(int id) { NewUserRegistration newUserRegistration = db.newUserRegistrations.Find(id); db.newUserRegistrations.Remove(newUserRegistration); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "UserId,Username,Password,ConfirmPassword,Email,CreatedDate,LastLoginDate")] NewUserRegistration newUserRegistration) { if (ModelState.IsValid) { db.Entry(newUserRegistration).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(newUserRegistration)); }
public IHttpActionResult GetUserDirectCommissionList(int userId) { //var userId = Convert.ToInt32(Session["LogedUserID"].ToString()); SleepingPartnermanagementTestingEntities db = new SleepingPartnermanagementTestingEntities(); List <EWalletTransactionModel> ListEwalletModel = new List <EWalletTransactionModel>(); List <EWalletTransaction> ListEwallet = new List <EWalletTransaction>(); //List<UserGenealogyTable> ListGeoTbl = new List<UserGenealogyTable>(); NewUserRegistration newuser = new NewUserRegistration(); ListEwallet = db.EWalletTransactions.Where(a => a.UserId.Value.Equals(userId) && a.IsParentBonus.Value.Equals(true) && a.IsMatchingBonus.Value.Equals(false) && a.IsPackageBonus.Value.Equals(false) && a.Debit.Value.Equals(true)).ToList(); foreach (var item in ListEwallet) { var userIdChild = Convert.ToInt32(item.AsscociatedMember); bool checkWithDrawalOpen = false; newuser = db.NewUserRegistrations.Where(a => a.UserId.Equals(userIdChild)).FirstOrDefault(); if (newuser.IsWithdrawalOpen == true) { checkWithDrawalOpen = true; } if (newuser.IsWithdrawalOpen == false) { checkWithDrawalOpen = false; } if (newuser != null) { ListEwalletModel.Add(new EWalletTransactionModel() { TransactionId = item.TransactionId, TransactionSource = item.TransactionSource, TransactionName = item.TransactionName, AsscociatedMember = item.AsscociatedMember.Value, Amount = item.Amount.Value, TransactionDate = item.TransactionDate.Value, IsWithdrawlRequestByUser = item.IsWithdrawlRequestByUser.Value, IsWithdrawlPaidByAdmin = item.IsWithdrawlPaidByAdmin.Value, IsWithdrawlRequestApproved = item.IsWithdrawlRequestApproved.Value, isWithdrawalOpen = checkWithDrawalOpen, }); } } return(Ok(ListEwalletModel)); }
public IHttpActionResult ApproveSleepingPartnerContinue(int userId) { SleepingPartnermanagementTestingEntities dc = new SleepingPartnermanagementTestingEntities(); NewUserRegistration newuserdata = dc.NewUserRegistrations.Where(a => a.UserId.Equals(userId)).FirstOrDefault(); if (newuserdata != null) { newuserdata.IsSleepingPartner = true; newuserdata.UserDesignation = Common.Enum.UserAsSPorSM.SleepingPartner; dc.SaveChanges(); } return(Ok(new { success = true })); }
public static void RunCrossField(NewUserRegistration user) { Engine engine = new Engine(); engine.For<NewUserRegistration>() .Setup(u => user.UserName) .MustNotBeNullOrEmpty() .Setup(u => user.Password) .MustNotBeNullOrEmpty() .Setup(u => user.ConfirmPassword) .MustEqual(u => user.Password); user.IsValid = engine.Validate(user).ToString(); }
public IHttpActionResult FcmUpdate(FcmModel model) { SleepingPartnermanagementTestingEntities dce = new SleepingPartnermanagementTestingEntities(); NewUserRegistration newuser = dce.NewUserRegistrations.SingleOrDefault(x => x.UserId == model.UserId); if (newuser != null) { newuser.fcm = model.Fcm; dce.SaveChanges(); return(Ok(new { success = true, message = "Update Successfully" })); } return(Ok(new { success = false, message = "user not found" })); }
public IHttpActionResult updatePassword(string passord, int uid) { SleepingPartnermanagementTestingEntities dce = new SleepingPartnermanagementTestingEntities(); NewUserRegistration newuser = dce.NewUserRegistrations.SingleOrDefault(x => x.UserId == uid); if (newuser != null) { newuser.Password = passord; dce.SaveChanges(); return(Ok(new { success = true, message = "Update Successfully" })); } return(Ok(new { success = false, message = "user not found" })); }
public IHttpActionResult getNewRegistration(string Username) { try { using (SleepingPartnermanagementTestingEntities dce = new SleepingPartnermanagementTestingEntities()) { NewUserRegistration v = dce.NewUserRegistrations.Where(a => a.Username == Username).FirstOrDefault(); return(Ok(v)); } }catch (Exception e) { return(Ok(e)); } }
public void NewUserRegistration() { //please change email id before run this test case NewUserRegistration newUser = new NewUserRegistration() { FName = "Vikul", LName = "Rathod", EmailId = "*****@*****.**", DOB = "09/16/1989", Password = "******" }; Assert.IsTrue(_app.LoginDetailsPage.NewUserRegistration(newUser), "Registration Failed"); }
public IHttpActionResult addUserSetup(NewUserRegistration model) { SleepingPartnermanagementTestingEntities dce = new SleepingPartnermanagementTestingEntities(); NewUserRegistration newuser = dce.NewUserRegistrations.Where(a => a.Username.Equals(model.Username)).FirstOrDefault(); //NewUserRegistration newuser = dce.NewUserRegistrations.SingleOrDefault(x => x.Username == model.UserId); if (newuser == null) { dce.NewUserRegistrations.Add(model); dce.SaveChanges(); return(Ok(new { success = true, message = "user added" })); } return(Ok(new { success = false, message = "user not found" })); }
// GET: NewUserRegistration/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NewUserRegistration newUserRegistration = db.newUserRegistrations.Find(id); if (newUserRegistration == null) { return(HttpNotFound()); } return(View(newUserRegistration)); }
public IHttpActionResult ProfileSetup(ProfileSetup model, int userId) { SleepingPartnermanagementTestingEntities dc = new SleepingPartnermanagementTestingEntities(); SleepingPartnermanagementTreeTestingEntities dbTree = new SleepingPartnermanagementTreeTestingEntities(); NewUserRegistration newuser = dc.NewUserRegistrations.Where(a => a.UserId.Equals(userId)).FirstOrDefault(); if (newuser != null) { newuser.Name = model.Name; //newuser.Username = model.UserName; newuser.Password = model.Password; newuser.Country = model.Country; newuser.Address = model.Address; newuser.Phone = model.Phone; newuser.Email = model.Email; newuser.IsBlock = true; newuser.AccountTitle = model.AccountTitle; newuser.AccountNumber = model.AccountNumber; newuser.BankName = model.BankName; newuser.CNIC = model.CNICNumber; //if (userId == Common.Enum.UserType.User.ToString()) //{ // newuser.IsBlock = model.IsBlock = true; //} //else //{ // newuser.IsBlock = model.IsBlock = false; //} var fileImage1 = model.NICImage; var fileImage2 = model.ProfileImage; var fileImage3 = model.NICImage1; var fileImage4 = model.DocumentImage; if (fileImage1 != null && fileImage2 != null && fileImage3 != null && fileImage4 != null) { newuser.NICImage = fileImage1; newuser.ProfileImage = fileImage2; newuser.NICImage1 = fileImage3; newuser.DocumentImage = fileImage4; } dc.SaveChanges(); //dbTree.update_tree_name(userId, model.UserName); ModelState.Clear(); return(Ok(new { success = true, message = "Update Successfully" })); } return(Ok(new { success = true, message = "Update Successfully" })); //this.AddNotification("Your profile has bees saved", NotificationType.SUCCESS); }
private void button6_Click(object sender, EventArgs e) { MainWindow.Controls.Clear(); SidePanel.Height = button6.Height; SidePanel.Top = button6.Top; label1.Text = "User Registration"; NewUserRegistration nr = new NewUserRegistration(); nr.Dock = DockStyle.Fill; MainWindow.Controls.Add(nr); nr.Show(); nr.DataGridSource(); entriesButtonHide(); }
public User GetUserList(String email, String password) { SleepingPartnermanagementTestingEntities db = new SleepingPartnermanagementTestingEntities(); string usercodes = "Usr"; NewUserRegistration user = new NewUserRegistration(); //user = db.NewUserRegistrations.Where(a => a.UserCode == usercodes && a.Username == email && a.Password == password) // .Select(x => new NewUserRegistration // { // UserId = x.UserId, // Name = x.Username, // Password = x.Password, // Email = x.Email, // }).FirstOrDefault(); var u = (from ur in db.NewUserRegistrations where ur.UserCode == usercodes && ur.Username == email && ur.Password == password select ur).SingleOrDefault(); return(new User(u.UserId, u.Username, u.Email, u.Password, u.Name)); //SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["remote"].ConnectionString); //if (connect.State != ConnectionState.Open) // connect.Open(); //SqlCommand cmd = new SqlCommand("select * from NewUserRegistration where UserCode = 'Usr' and Username= '******' and Password = '******'", connect); //try //{ // SqlDataReader sdr = cmd.ExecuteReader(); // sdr.Read(); // int id = Convert.ToInt32(sdr["UserId"].ToString()); // string uname = sdr["Username"].ToString(); // string pass = sdr["Password"].ToString(); // string Email = sdr["Email"].ToString(); // string name = sdr["Name"].ToString(); // sdr.Close(); // connect.Close(); // return new User(id, name, email, pass, uname); //} //catch (Exception n) //{ // return null; //} }
public async Task <IActionResult> Post([FromBody] NewUserRegistration newReg) { if (!ModelState.IsValid) { string message = ModelState.First(pair => pair.Value.ValidationState == ModelValidationState.Invalid ) .Value.Errors[0].ErrorMessage; if (string.IsNullOrWhiteSpace(message)) { message = null; } return(StatusCode(400, new Error { Code = Enums.ErrorCodes.Validation, Message = message })); } var operationError = await _registrationService.RegisterUserAsync( User.Identity.Name, newReg.Username, newReg.ChatUserId, HttpContext.RequestAborted ).ConfigureAwait(false); if (operationError != null) { return(StatusCode(400, (Error)operationError)); } string chatPlatform = User.Claims.Single(claim => claim.Type == "platform").Value; var result = new UserRegistration { Platform = chatPlatform, BotId = User.Identity.Name, ChatUserId = newReg.ChatUserId, }; return(StatusCode(201, result)); }
public IHttpActionResult ProfileSetup(NewUserRegistration model) { SleepingPartnermanagementTestingEntities dce = new SleepingPartnermanagementTestingEntities(); //NewUserRegistration newuser = dce.NewUserRegistrations.Where(a => a.UserId.Equals(model.UserId)).FirstOrDefault(); NewUserRegistration newuser = dce.NewUserRegistrations.SingleOrDefault(x => x.UserId == model.UserId); if (newuser != null) { newuser.Name = model.Name; newuser.Username = model.Username; newuser.Password = model.Password; newuser.Country = model.Country; newuser.Address = model.Address; newuser.Phone = model.Phone; newuser.Email = model.Email; newuser.AccountNumber = model.AccountNumber; newuser.BankName = model.BankName; newuser.IsSalesExecutive = model.IsSalesExecutive; newuser.IsSleepingPartner = model.IsSleepingPartner; dce.SaveChanges(); return(Ok(new { success = true, message = "Update Successfully" })); } return(Ok(new { success = false, message = "user not found" })); }
public IHttpActionResult SendDirectSaleCommissionRequest(int transactionId) { using (SleepingPartnermanagementTestingEntities dc = new SleepingPartnermanagementTestingEntities()) { EWalletTransaction ewallet = dc.EWalletTransactions .Where(a => a.TransactionId.Equals(transactionId)).FirstOrDefault(); if (ewallet != null) { if (ewallet.IsWithdrawlRequestByUser == false) { var userId = Convert.ToInt32(ewallet.UserId.Value); NewUserRegistration user = dc.NewUserRegistrations.Where(a => a.UserId.Equals(userId)).FirstOrDefault(); EWalletWithdrawalFund newpckgadd = new EWalletWithdrawalFund(); if (user.IsVerify.Value == false) { return(Ok(new { info = true, message = "you are not eligible to withdrawal direct commission please complete and verify your profile" })); } else { // TwilioClient.Init(SendSMSAccountSid, SendSMSAuthToken); // var message = MessageResource.Create( // body: "Sleeping partner portal alert. " // + " You Sent Withdrawal Request To Admin" // + " Your Withdrawal Amount is : " + ewallet.Amount // + " and request Date is : " + DateTime.Now + "." // + " Click on http://sleepingpartnermanagementportalrct.com ", // from: new Twilio.Types.PhoneNumber(SendSMSFromNumber), // to: new Twilio.Types.PhoneNumber(user.Phone) // ); // System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(); // mail.From = new MailAddress("*****@*****.**"); // mail.To.Add(user.Email); // mail.Subject = "Sleeping partner management portal"; // mail.Body += "Sleeping partner portal alert." + // " You Sent Withdrawal Request To Admin" + // " Your Withdrawal Amount is : " + ewallet.Amount + // " and request Date is : " + DateTime.Now + "." // + " Click on http://sleepingpartnermanagementportalrct.com "; // mail.IsBodyHtml = true; // SmtpClient smtp = new SmtpClient(); // smtp.Host = "sleepingpartnermanagementportalrct.com"; // smtp.EnableSsl = true; // smtp.UseDefaultCredentials = false; // smtp.Credentials = new NetworkCredential("*****@*****.**", "Yly21#p8"); // smtp.DeliveryMethod = SmtpDeliveryMethod.Network; // smtp.Port = 25; // ServicePointManager.ServerCertificateValidationCallback = // delegate (object s, X509Certificate certificate, // X509Chain chain, SslPolicyErrors sslPolicyErrors) // { return true; }; // smtp.Send(mail); ewallet.IsWithdrawlRequestByUser = true; ewallet.IsWithdrawlPaidByAdmin = false; ewallet.IsWithdrawlRequestApproved = false; dc.SaveChanges(); newpckgadd.UserName = user.Username; newpckgadd.AccountNumber = user.AccountNumber; newpckgadd.BankName = user.BankName; newpckgadd.WithdrawalFundMethod = Common.Enum.PaymentSource.BankAccount.ToString(); newpckgadd.AmountPayble = ewallet.Amount.Value; newpckgadd.WithdrawalFundDescription = ewallet.TransactionSource; newpckgadd.WithdrawalFundCharge = 0; newpckgadd.Country = user.Country; newpckgadd.RequestedDate = DateTime.Now; newpckgadd.ApprovedDate = null; newpckgadd.PaidDate = null; newpckgadd.RejectedDate = null; newpckgadd.IsActive = true; newpckgadd.IsPending = true; newpckgadd.IsApproved = false; newpckgadd.IsPaid = false; newpckgadd.IsRejected = false; newpckgadd.UserId = user.UserId; newpckgadd.EwalletTransId = ewallet.TransactionId; dc.EWalletWithdrawalFunds.Add(newpckgadd); dc.SaveChanges(); ModelState.Clear(); return(Ok(new { success = true, message = "Successfully Done" })); } } else { return(Ok(new { info = true, message = "You already sended request" })); } } else { return(Ok(new { error = true, message = "unsuccessfully" })); } } //return View(); }
public void GuestUser_BookingFlow_CreditCard_Success() { #region search for flight AirSearchScenario airScenario = new AirSearchScenario() { Adults = 1, Childs = 0, Infants = 0, SearchType = SearchType.OneWay, AirportPairs = new List <AirportPair> { new AirportPair() { FromLocation = "LAS", ToLocation = "MIA", DepartureDateTime = DateTime.Today.AddDays(7) } } }; _app.HomePage.DoAirSearch(airScenario); #endregion while (_app.AirResultsPage.IsWaitingVisible()) { Thread.Sleep(2000); if (_app.AirResultsPage.IsResultsVisible()) { //if results available add first flight to cart Assert.IsTrue(_app.AirResultsPage.AddToCart(), "Itinerary not available."); Assert.IsTrue(_app.TripFolderPage.Checkout(), "Error on loading TripFolder."); #region Guest User Registration //for guest user asks for login on checkout page and he will register here //please change email id before run this test case NewUserRegistration newUser = new NewUserRegistration() { FName = "Vikul", LName = "Rathod", EmailId = "*****@*****.**", DOB = "09/16/1989", Password = "******" }; Assert.IsTrue(_app.LoginDetailsPage.NewUserRegistration(newUser), "Registration Failed"); Assert.IsTrue(_app.LoginDetailsPage.PreferedCustomerRegistration(), "Error during pref cust registration"); #endregion #region submit passenger details PassengerDetails pes = new PassengerDetails() { InsuranceData = new Insurance() { Country = "United States", IsInsuared = false }, FirstName = "Vikul", LastName = "Rathod", DOB = "09/16/1989", Gender = "Male", Emailid = "*****@*****.**" }; _app.PassengerInfoPage.SubmitPassengerDetails(pes); #endregion Thread.Sleep(1000); //check if itinerary available or price not changed before actual payment Assert.IsTrue(_app.CheckoutPage.IsPayNowSuccess_CreditCard(), "Itinerary not available or Price has changed."); #region pay by credit card PaymentFields paymentFields = new PaymentFields() { EmailAddress = "*****@*****.**", CreditCard = new CreditCard() { NameOnCard = "Vikul Rathod", CardNumber = "4111111111111111", SecurityCode = 999, ExpirationMonth = 10, ExpirationYear = 2015 }, Address = new Address() { Address1 = "888 main", City = "Plano", Country = "US", PostalCode = "77777", Provinces = "TX" }, PhoneNumber = new PhoneNumber() { PhoneNumberArea = "222", PhoneNumberExchange = "223", PhoneNumberDigits = "7777", } }; Assert.IsTrue(_app.CheckoutPage.MakePayment_CreditCard(paymentFields), "Payment Failed"); #endregion break; } } }
public IHttpActionResult EWalletWithdrawalFund(EWalletWithdrawalFundModel model, int userId) { try { // var userId = Convert.ToInt32(Session["LogedUserID"].ToString()); using (SleepingPartnermanagementTestingEntities dc = new SleepingPartnermanagementTestingEntities()) { decimal amountcheck = model.AmountPayble; decimal withdrawalFundCharges = 0; int payoutChargesPercent = 0; decimal payoutChargesPercentValue = 0; decimal minimumPayout = 0; decimal amountAfterChargesDeduct = 0; var Debit = (from eWallTr in dc.EWalletTransactions where eWallTr.UserId == userId && eWallTr.Credit == false && eWallTr.Debit == true && eWallTr.IsPackageBonus == true select eWallTr).ToList(); decimal DebitValue = Debit.Sum(x => x.Amount.Value); var Credit = (from eWallTr in dc.EWalletTransactions where eWallTr.UserId == userId && eWallTr.Credit == true && eWallTr.Debit == false && eWallTr.IsPackageBonus == true select eWallTr).ToList(); decimal CreditValue = Credit.Sum(x => x.Amount.Value); decimal minVal = Math.Min(DebitValue, CreditValue); decimal maxVal = Math.Max(DebitValue, CreditValue); decimal Sum = maxVal - minVal; EWalletWithdrawalFund newpckg = dc.EWalletWithdrawalFunds.Where(a => a.WithdrawalFundId.Equals(model.WithdrawalFundId)).FirstOrDefault(); NewUserRegistration user = dc.NewUserRegistrations.Where(a => a.UserId.Equals(userId)).FirstOrDefault(); if (user.IsPaidMember.Value == true) { EWalletPayoutConfig payoutconfig = dc.EWalletPayoutConfigs.FirstOrDefault(); minimumPayout = payoutconfig.MinimumPayout.Value; if (model.AmountPayble >= minimumPayout) { if (model.AmountPayble <= Sum) { if (newpckg == null) { payoutChargesPercent = payoutconfig.PayoutChargesPercent.Value; payoutChargesPercentValue = (decimal)payoutChargesPercent / 100; //0.1 withdrawalFundCharges = model.AmountPayble * payoutChargesPercentValue; amountAfterChargesDeduct = model.AmountPayble - withdrawalFundCharges; EWalletWithdrawalFund newpckgadd = new EWalletWithdrawalFund(); newpckgadd.UserName = user.Username; newpckgadd.AccountNumber = user.AccountNumber; //auto newpckgadd.BankName = user.BankName; //auto newpckgadd.WithdrawalFundMethod = Common.Enum.PaymentSource.BankAccount.ToString(); newpckgadd.AmountPayble = amountAfterChargesDeduct; newpckgadd.WithdrawalFundDescription = model.WithdrawalFundDescription; newpckgadd.WithdrawalFundCharge = withdrawalFundCharges; //auto newpckgadd.Country = user.Country; newpckgadd.RequestedDate = DateTime.Now; newpckgadd.ApprovedDate = null; newpckgadd.PaidDate = null; newpckgadd.RejectedDate = null; newpckgadd.IsActive = true; newpckgadd.IsPending = true; newpckgadd.IsApproved = false; newpckgadd.IsPaid = false; newpckgadd.IsRejected = false; newpckgadd.UserId = user.UserId; dc.EWalletWithdrawalFunds.Add(newpckgadd); dc.SaveChanges(); ModelState.Clear(); // ViewBag.Message = "Successfully Done"; return(Ok(new { success = true, message = "Successfully Done" })); } //else //{ // newpckg.TimePeriod = model.TimePeriod; // newpckg.MinimumPayout = model.MinimumPayout; // newpckg.PayoutChargesPercent = model.PayoutChargesPercent; // dc.SaveChanges(); // model = null; // ViewBag.Message = "Successfully Edit"; //} } else { return(Ok(new { success = false, message = "Amount must be smaller than the eligible amount" })); } } else { //this.AddNotification("Amount payable is less then minimum range", NotificationType.WARNING); return(Ok(new { success = false, message = "Amount must be greater than the processing charges" })); //return RedirectToAction("EWalletWithdrawalFund"); } } else { return(Ok(new { success = false, message = "You are not eligible for withdrawal. Kindly purchase your package." })); } } //this.AddNotification("Value has bees saved", NotificationType.SUCCESS); return(Ok(new { success = true, message = "Successfully Done" })); } catch (Exception ex) { return(Ok(new { success = false, message = "exception" })); } //return View(); }
public ActionResult CrossField(NewUserRegistration user) { RunCrossField(user); return View(user); }
public IHttpActionResult MakeNewUserName(string username, int userId) { // var userId = Convert.ToInt32(Session["LogedUserID"].ToString()); SleepingPartnermanagementTestingEntities dc = new SleepingPartnermanagementTestingEntities(); SleepingPartnermanagementTreeTestingEntities dbTree = new SleepingPartnermanagementTreeTestingEntities(); NewUserRegistration newuser = dc.NewUserRegistrations.Where(a => a.UserId.Equals(userId)).FirstOrDefault(); List <EWalletWithdrawalFund> userEWF = dc.EWalletWithdrawalFunds.Where(a => a.UserId.Value.Equals(userId)).ToList(); List <ReceiveAdminMessage> userRAM = dc.ReceiveAdminMessages.Where(a => a.UserId.Value.Equals(userId)).ToList(); List <ReceiveUserMessage> userRUM = dc.ReceiveUserMessages.Where(a => a.UserId.Value.Equals(userId)).ToList(); List <SentAdminMessage> userSAM = dc.SentAdminMessages.Where(a => a.UserId.Value.Equals(userId)).ToList(); List <SentUserMessage> userSUM = dc.SentUserMessages.Where(a => a.UserId.Value.Equals(userId)).ToList(); List <UserGenealogyTable> userUGT = dc.UserGenealogyTables.Where(a => a.UserId.Value.Equals(userId)).ToList(); List <UserGenealogyTableLeft> userUGTL = dc.UserGenealogyTableLefts.Where(a => a.UserId.Value.Equals(userId)).ToList(); List <UserGenealogyTableRight> userUGTR = dc.UserGenealogyTableRights.Where(a => a.UserId.Value.Equals(userId)).ToList(); List <UserGenealogyTable> userUGTS = dc.UserGenealogyTables.Where(a => a.SponsorId.Value.Equals(userId)).ToList(); List <UserGenealogyTableLeft> userUGTLS = dc.UserGenealogyTableLefts.Where(a => a.SponsorId.Value.Equals(userId)).ToList(); List <UserGenealogyTableRight> userUGTRS = dc.UserGenealogyTableRights.Where(a => a.SponsorId.Value.Equals(userId)).ToList(); List <UserGenealogyTable> userUGTD = dc.UserGenealogyTables.Where(a => a.DownlineMemberId.Value.Equals(userId)).ToList(); List <UserGenealogyTableLeft> userUGTLD = dc.UserGenealogyTableLefts.Where(a => a.DownlineMemberId.Value.Equals(userId)).ToList(); List <UserGenealogyTableRight> userUGTRD = dc.UserGenealogyTableRights.Where(a => a.DownlineMemberId.Value.Equals(userId)).ToList(); UserTableLevel userUTL = dc.UserTableLevels.Where(a => a.UserId.Value.Equals(userId)).FirstOrDefault(); if (newuser != null) { NewUserRegistration usernamecheck = dc.NewUserRegistrations.Where(a => a.Username.Equals(username)).FirstOrDefault(); if (usernamecheck == null) { newuser.Username = username; dbTree.update_tree_name(userId, username); if (userEWF != null) { foreach (var item in userEWF) { item.UserName = username; } } if (userRAM != null) { foreach (var item in userRAM) { item.Sender_Name = username; } } if (userRUM != null) { foreach (var item in userRUM) { item.Sender_Name = username; } } if (userSAM != null) { foreach (var item in userSAM) { item.Sender_Name = username; } } if (userSUM != null) { foreach (var item in userSUM) { item.Sender_Name = username; } } // if (userUGT != null) { foreach (var item in userUGT) { item.UserName = username; } } if (userUGTL != null) { foreach (var item in userUGTL) { item.UserName = username; } } if (userUGTR != null) { foreach (var item in userUGTR) { item.UserName = username; } } // if (userUGTS != null) { foreach (var item in userUGTS) { item.SponsorName = username; } } if (userUGTLS != null) { foreach (var item in userUGTLS) { item.SponsorName = username; } } if (userUGTRS != null) { foreach (var item in userUGTRS) { item.SponsorName = username; } } // if (userUGTD != null) { foreach (var item in userUGTD) { item.DownlineMemberName = username; } } if (userUGTLD != null) { foreach (var item in userUGTLD) { item.DownlineMemberName = username; } } if (userUGTRD != null) { foreach (var item in userUGTRD) { item.DownlineMemberName = username; } } if (userUTL != null) { userUTL.UserName = username; } dc.SaveChanges(); ModelState.Clear(); return(Ok(new { success = true, message = "Update Successfully" })); } else { return(Ok(new { success = false, message = "This user name is exist. Kindly change your username" })); } } return(Ok(new { success = true, message = "Update Successfully" })); //this.AddNotification("Your profile has bees saved", NotificationType.SUCCESS); //return RedirectToAction("ProfileSetup"); //return RedirectToAction("Index", "Dashboard", model); }
public ActionResult CrossField() { var user = new NewUserRegistration() { UserName = "******", Password = "******", ConfirmPassword = "******" }; RunCrossField(user); return View(user); }
public IHttpActionResult EWalletUpgradeInvestment(UserPackageModel model, int userId) { // var userId = Convert.ToInt32(Session["LogedUserID"].ToString()); using (SleepingPartnermanagementTestingEntities dc = new SleepingPartnermanagementTestingEntities()) { NewUserRegistration user = dc.NewUserRegistrations.Where(a => a.UserId.Equals(userId)).FirstOrDefault(); if (user.IsVerify.Value.Equals(true)) { Package newpckg = dc.Packages.Where(a => a.PackageId.Equals(model.PackageId)).FirstOrDefault(); if (model.PackagePurchaseMethod == Common.Enum.UpgradeInvestmentPaymentSource.EWalletBalance) { var Debit = (from eWallTr in dc.EWalletTransactions where eWallTr.UserId == userId && eWallTr.Credit == false && eWallTr.Debit == true select eWallTr).ToList(); var DebitValue = Debit.Sum(x => x.Amount); var Credit = (from eWallTr in dc.EWalletTransactions where eWallTr.UserId == userId && eWallTr.Credit == true && eWallTr.Debit == false select eWallTr).ToList(); var CreditValue = Credit.Sum(x => x.Amount); decimal MinVal = Math.Min(DebitValue.Value, CreditValue.Value); decimal MaxVal = Math.Max(DebitValue.Value, CreditValue.Value); var Sum = MaxVal - MinVal; if (Sum >= newpckg.PackagePrice) { if (newpckg != null) { UserPackage userpackage = new UserPackage(); userpackage.PackageId = newpckg.PackageId; userpackage.PackageName = newpckg.PackageName; userpackage.PackagePercent = newpckg.PackagePercent; userpackage.PackagePrice = newpckg.PackagePrice; userpackage.PackageValidity = newpckg.PackageValidity; userpackage.PackageMinWithdrawalAmount = newpckg.PackageMinWithdrawalAmount; userpackage.PackageMaxWithdrawalAmount = newpckg.PackageMaxWithdrawalAmount; userpackage.PackagePurchaseMethod = model.PackagePurchaseMethod; userpackage.UserId = userId; userpackage.IsInCurrentUse = false; userpackage.PurchaseDate = DateTime.Now; userpackage.IsBuyFromEWallet = true; userpackage.IsBuyFromBankAcnt = false; userpackage.IsRequestedForBuy = true; userpackage.IsApprovedForBuy = false; userpackage.IsRejectedForBuy = false; dc.UserPackages.Add(userpackage); dc.SaveChanges(); ModelState.Clear(); model = null; return(Ok(new { success = true, message = "Package save successfully" })); } else { return(Ok(new { error = true, message = "Unsuccessfull" })); } } else { return(Ok(new { info = true, message = "Your E-wallet balance is not enough to buy package" })); } } if (model.PackagePurchaseMethod == Common.Enum.UpgradeInvestmentPaymentSource.BankAccount) { if (newpckg != null) { UserPackage userpackage = new UserPackage(); userpackage.PackageId = newpckg.PackageId; userpackage.PackageName = newpckg.PackageName; userpackage.PackagePercent = newpckg.PackagePercent; userpackage.PackagePrice = newpckg.PackagePrice; userpackage.PackageValidity = newpckg.PackageValidity; userpackage.PackageMinWithdrawalAmount = newpckg.PackageMinWithdrawalAmount; userpackage.PackageMaxWithdrawalAmount = newpckg.PackageMaxWithdrawalAmount; userpackage.PackagePurchaseMethod = model.PackagePurchaseMethod; userpackage.UserId = userId; userpackage.IsInCurrentUse = false; userpackage.PurchaseDate = DateTime.Now; userpackage.IsBuyFromEWallet = false; userpackage.IsBuyFromBankAcnt = true; userpackage.IsRequestedForBuy = true; userpackage.IsApprovedForBuy = false; userpackage.IsRejectedForBuy = false; var bankSlipImage = model.BankSlipImage; if (bankSlipImage != null) { byte[] bankSlipImageSave = bankSlipImage; userpackage.BankSlipImage = bankSlipImageSave; } //file = Request.Files["AddBankSlipImage"]; //userpackage.BankSlipImage = ConvertToBytes(file); dc.UserPackages.Add(userpackage); dc.SaveChanges(); ModelState.Clear(); model = null; return(Ok(new { success = true, message = "Package save successfully" })); } else { return(Ok(new { error = true, message = "Unsuccessfull" })); } } } else { return(Ok(new { error = true, message = "You are not allowed to purchase package. Please verify your profile" })); } } return(Ok(new { success = true, message = "Package save successfully" })); //return RedirectToAction("EWalletUpgradeInvestment"); }