Esempio n. 1
0
        public async Task <string> CreateLogin(LoginCore login)
        {
            var loginDB = _mapper.Map <Login>(login);
            var res     = await _loginDBManager.CreateDBLogin(loginDB);

            if (res == "Success")
            {
                SmsProvider.SendSms(login.user.Telephone, "Welcome to Tender + Thanks for joining our services");
            }
            return(res);
        }
Esempio n. 2
0
        public ActionResult EditTransactionPassword(string OldTransactionPassword, string NewTransactionPassword, string ConfirmTransactionNewPassword)
        {
            ViewBag.Title        = "Admin: Change Password";
            ViewBag.ErrorMessage = false;

            try
            {
                if (NewTransactionPassword == ConfirmTransactionNewPassword)
                {
                    BankDetail bankDetail = _valleyDreamsIndiaDBEntities.BankDetails.First(x => x.UsersDetailsId == CurrentUser.CurrentUserId && x.Deleted == 0);
                    if (bankDetail.TransactionPassword == OldTransactionPassword)
                    {
                        bankDetail.TransactionPassword = NewTransactionPassword;
                        bankDetail.UpdatedOn           = DateTime.Now;
                        _valleyDreamsIndiaDBEntities.Entry(bankDetail).State = EntityState.Modified;
                        _valleyDreamsIndiaDBEntities.SaveChanges();
                        ViewBag.TransactionErrorMessage = true;

                        string phoneNumber = (_valleyDreamsIndiaDBEntities.PersonalDetails.Where(x => x.UsersDetailsId == CurrentUser.CurrentUserId).FirstOrDefault()).PhoneNumber1;

                        string textMessage = String.Format("Your new transaction password is {0}", NewTransactionPassword);

                        string smsStatus = SmsProvider.SendSms(phoneNumber, textMessage);
                        if (smsStatus == "Success")
                        {
                            ViewBag.SmsStatus = "New Transaction Password Sent To Your Registered Mobile Number Successfully";
                        }
                        else
                        {
                            ViewBag.SmsStatus = "Sended Sms Failed";
                        }

                        ViewBag.TransactionError = "Transaction Password Updated";
                        return(View("~/Views/Members/User/Edit.cshtml"));
                    }
                    else
                    {
                        ViewBag.TransactionErrorMessage = true;
                        ViewBag.TransactionError        = "Transaction Old Password Mismatched";
                        return(View("~/Views/Members/User/Edit.cshtml"));
                    }
                }
                else
                {
                    ViewBag.TransactionErrorMessage = true;
                    ViewBag.TransactionError        = "New And Confirm Transaction New Password Mismatched";
                    return(View("~/Views/Members/User/Edit.cshtml"));
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 3
0
        public async Task <bool> CreateUser(LoginCore userc)
        {
            try
            {
                Login login = new Login()
                {
                    UserName = userc.UserName,
                    Password = userc.Password,
                    Role     = userc.Role
                };
                var res1 = await _loginDBManager.CreateDBLogin(login);

                var res = await _loginDBManager.GetDBLoginByUsername(userc.UserName);

                User user = new User()
                {
                    Id          = res.Id,
                    Aadhar      = userc.user.Aadhar,
                    Email       = userc.user.Email,
                    Telephone   = userc.user.Telephone,
                    License     = userc.user.License,
                    CompanyName = userc.user.CompanyName,
                    Name        = userc.UserName,
                    PanId       = userc.user.PanId
                };
                bool res2;
                var  response = await _userDBManager.CreateDBUser(user);

                if (response)
                {
                    res2 = SmsProvider.SendSms(string.Concat("+91", userc.user.Telephone), "Welcome to Tender + Thanks for joining our services");
                }
                return(response);
            }
            catch (System.Exception e)
            {
                throw;
            }
        }
Esempio n. 4
0
        public ActionResult Create(UsersPersonalModelView usersPersonalModelView)
        {
            ViewBag.Title = "Admin: Add New Member";

            UsersDetail userDetail = _valleyDreamsIndiaDBEntities.UsersDetails
                                     .Where(x => x.SponsoredId == CurrentUser.CurrentUserId &&
                                            x.PinType == "NEW" && x.IsPinUsed == 0).OrderBy(x => x.UserName).FirstOrDefault();

            userDetail.IsPinUsed = 1;
            userDetail.Password  = Guid.NewGuid().ToString().Substring(0, 6);

            userDetail.Deleted   = 0;
            userDetail.CreatedOn = DateTime.Now;
            _valleyDreamsIndiaDBEntities.Entry(userDetail).State = EntityState.Modified;
            _valleyDreamsIndiaDBEntities.SaveChanges();


            int legId = _valleyDreamsIndiaDBEntities.UsersDetails
                        .Where(x => x.UserName == usersPersonalModelView.UserDetails.UserName).FirstOrDefault().Id;

            usersPersonalModelView.PersonalDetails.UsersDetailsId = userDetail.Id;
            usersPersonalModelView.PersonalDetails.JoinedOn       = DateTime.Now.ToString();
            usersPersonalModelView.PersonalDetails.CreatedOn      = DateTime.Now;
            usersPersonalModelView.PersonalDetails.SponsoredId    = CurrentUser.CurrentUserId;
            usersPersonalModelView.PersonalDetails.LegId          = legId;
            usersPersonalModelView.PersonalDetails.Deleted        = 0;
            usersPersonalModelView.PersonalDetails.ProfilePic     = "/UploadedTeamImages/default1_avatar_small.png";
            _valleyDreamsIndiaDBEntities.PersonalDetails.Add(usersPersonalModelView.PersonalDetails);
            _valleyDreamsIndiaDBEntities.SaveChanges();

            usersPersonalModelView.BankDetails.UsersDetailsId      = userDetail.Id;
            usersPersonalModelView.BankDetails.CreatedOn           = DateTime.Now;
            usersPersonalModelView.BankDetails.TransactionPassword = Guid.NewGuid().ToString().Substring(0, 6);
            usersPersonalModelView.BankDetails.Deleted             = 0;
            _valleyDreamsIndiaDBEntities.BankDetails.Add(usersPersonalModelView.BankDetails);
            _valleyDreamsIndiaDBEntities.SaveChanges();

            ContributionDetail contributionDetails = new ContributionDetail();

            contributionDetails.ContribNumber     = 1;
            contributionDetails.ContribDate       = DateTime.Now;
            contributionDetails.ContribAmount     = 1000;
            contributionDetails.NextContribNumber = 2;
            contributionDetails.NextContribDate   = new DateTime(DateTime.Now.AddMonths(1).Year, DateTime.Now.AddMonths(1).Month, 20);
            contributionDetails.RemainingContrib  = 15 - 1;
            contributionDetails.UserDetailsId     = userDetail.Id;
            contributionDetails.SponsoredId       = CurrentUser.CurrentUserId;
            contributionDetails.PayedBy           = "SPONSOR";
            contributionDetails.IsCompleted       = 0;
            _valleyDreamsIndiaDBEntities.ContributionDetails.Add(contributionDetails);
            _valleyDreamsIndiaDBEntities.SaveChanges();


            password            = userDetail.Password;
            transactionpassword = usersPersonalModelView.BankDetails.TransactionPassword;
            username            = userDetail.UserName;


            string textMessage = String.Format("Your username is {0}, password is {1} and transactionpassword is {2}", username, password, transactionpassword);
            string smsStatus   = SmsProvider.SendSms(usersPersonalModelView.PersonalDetails.PhoneNumber1, textMessage);

            if (smsStatus == "Success")
            {
                smsstatus = "Credentials Sent To Your Registered Mobile Number Successfully";
            }
            else
            {
                smsstatus = "Sended Sms Failed";
            }

            return(RedirectToAction("Create"));
        }