Exemplo n.º 1
0
        public ActionResult Login(LoanViewModel lvm)
        {
            try
            {
                users.Email   = lvm.AccountsModel.Email;
                users.pasword = lvm.AccountsModel.pasword;
                var EncrypPassword = new CryptographyManager().ComputeHash(users.pasword, HashName.SHA256);
                users.pasword = EncrypPassword;

                var valid = DataReaders.loggedIn(users.Email, EncrypPassword);

                if (valid == true)
                {
                    if (users.Email != null)
                    {
                        Session["id"]   = users.Email;
                        Session["User"] = "******" + Session["id"];
                        var    LoggedInuser = new LogginHelper();
                        string user         = LoggedInuser.LoggedInUser();
                        return(View("index"));
                    }
                    else
                    {
                        ViewBag.Message = "Invalid Details ! Try Again";
                        return(View("Signin"));
                    }
                }
                return(View("Signin"));
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 2
0
 public ActionResult CreateService(LoanViewModel lvm, FormCollection form)
 {
     try
     {
         var    LoggedInuser = new LogginHelper();
         string user         = LoggedInuser.LoggedInUser();
         if (user != "")
         {
             var          userid = DataReaders.GetUserIdByEmail(user);
             GLobalClient gc     = new GLobalClient();
             ViewBag.listMerchant             = gc.findAllMerchant();
             lvm.CustomerServices.Customer_FK = userid;
             lvm.CustomerServices.DateCreated = DateTime.Now;
             lvm.CustomerServices.ValueDate   = DateTime.Now.ToString();
             lvm.CustomerServices.Merchant_Fk = Convert.ToInt16(form["ID"]);
             lvm.CustomerServices.ValueTime   = "1";
             lvm.CustomerServices.isVissible  = 1;
             lvm.CustomerServices.OtherLabel  = "other";
             gc.CreateCustomerService(lvm.CustomerServices);
             TempData["Message"] = "New Service Added";
             return(View("CreateService"));
         }
         else
         {
             return(View("CreateService"));
         }
     }
     catch (Exception ex)
     {
         WebLog.Log(ex.Message.ToString());
         return(null);
     }
 }
Exemplo n.º 3
0
        public ActionResult CreateUser(LoanViewModel lvm, FormCollection form)
        {
            GLobalClient cc = new GLobalClient();

            try
            {
                if (lvm != null)
                {
                    string value          = lvm.AccountsModel.Email;
                    string password       = lvm.AccountsModel.pasword;
                    string confirmpass    = lvm.AccountsModel.confirmPassword;
                    bool   validatePass   = ValidatePassword(password, confirmpass);
                    var    EncrypPassword = new CryptographyManager().ComputeHash(password, HashName.SHA256);
                    password = EncrypPassword;
                    lvm.AccountsModel.confirmPassword = password;
                    lvm.AccountsModel.pasword         = password;
                    lvm.AccountsModel.Email           = value;
                    lvm.AccountsModel.Referal         = Convert.ToString(form["Referal"]);

                    if (validatePass == false)
                    {
                        TempData["Message"] = "Password And Confirm Password Must Match";
                    }
                    else if (validatePass == true)
                    {
                        bool val = DataReaders.Validate(value);
                        if (val == true)
                        {
                            TempData["Message"] = "User Already Exist";
                            // return RedirectToAction("Signup", "Home", new { area = "" });
                            ViewBag.channel = db.MarketingChannels;
                            return(View("Signup"));
                        }
                        else if (val == false)
                        {
                            lvm.AccountsModel.Date        = DateTime.Now;
                            lvm.AccountsModel.DateTim     = DateTime.Today;
                            lvm.AccountsModel.isVissibles = 1;
                            // This is For the Api
                            // cc.CreateUser(lvm.AccountsModel);
                            User users = new DataAccess.User();
                            users.confirmPassword = lvm.AccountsModel.confirmPassword;
                            users.pasword         = lvm.AccountsModel.pasword;
                            users.Email           = lvm.AccountsModel.Email;
                            users.Date            = lvm.AccountsModel.Date;
                            users.DateTim         = lvm.AccountsModel.DateTim;
                            users.isVissibles     = lvm.AccountsModel.isVissibles;
                            users.firstname       = lvm.AccountsModel.firstname;
                            users.lastname        = lvm.AccountsModel.lastname;
                            users.Phone           = lvm.AccountsModel.Phone;
                            users.Referal         = lvm.AccountsModel.Referal;
                            //string lastid = "0";
                            //users.MyReferalCode = MyUtility.getReferralCode(lastid);
                            users.ReferralLevel = MyUtility.getRefferalLevel(users.Referal);
                            // users.MyReferalCode =
                            int id = DataCreators.CreateUser(users);

                            var channellist = Request["checkboxName"];
                            if (channellist != null)
                            {
                                string[] arr      = channellist.Split(',');
                                var      chanList = removestring(arr);
                                if (arr.Length > 0)
                                {
                                    for (var i = 0; i < arr.Length; i++)
                                    {
                                        string arrc = Convert.ToString(arr[i]);
                                        insertMarketChannel(arrc, id);
                                    }
                                }
                            }


                            if (id != 0)
                            {
                                string lastid = id.ToString();
                                users.MyReferalCode = MyUtility.getReferralCode(lastid);
                                DataCreators.updatelastID(users);

                                DataAccess.UserRole userroles = new DataAccess.UserRole();
                                userroles.UserId     = id;
                                userroles.RoleId     = Convert.ToInt16(ConfigurationManager.AppSettings["DefaultUser"]);
                                userroles.IsVissible = 1;
                                userroles.dates      = DateTime.Now;
                                DataCreators.InsertUserRoles(userroles);
                                TempData["Message"] = "User Created Succesfully";



                                //For LoggedIn User
                                Session["id"]   = lvm.AccountsModel.Email;
                                Session["User"] = Session["id"];
                                var LoggedInuser = new LogginHelper();
                                user = LoggedInuser.LoggedInUser();
                                SendEmail(lvm);

                                string Regpage = ConfigurationManager.AppSettings["DefaultRegister"];

                                return(Redirect(Regpage));

                                //return RedirectToAction("Index", "Dashboard");
                                //  return RedirectToAction("Dashboard", "Dashboard");
                            }
                            else
                            {
                                TempData["Message"] = "Registration Not Succesful Please Try Again!";
                                ViewBag.channel     = db.MarketingChannels;
                            }
                        }
                    }
                }
                else
                {
                    TempData["Message"] = "Error Creating User";
                    ViewBag.channel     = db.MarketingChannels;
                }
                return(RedirectToAction("Signup", "Home", new { area = "" }));
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 4
0
        public ActionResult Logins(LoanViewModel lvm)
        {
            try
            {
                users.Email   = lvm.AccountsModel.Email;
                users.pasword = lvm.AccountsModel.pasword;
                var EncrypPassword = new CryptographyManager().ComputeHash(users.pasword, HashName.SHA256);
                users.pasword = EncrypPassword;

                var valid = DataReaders.loggedIn(users.Email, EncrypPassword);

                WebLog.Log("Email" + users.Email + EncrypPassword);
                WebLog.Log("Valid1" + valid);
                if (valid == true)
                {
                    WebLog.Log("Valid2" + valid);
                    if (users.Email != null)
                    {
                        WebLog.Log("users.Email 2" + users.Email);
                        Session["id"]   = users.Email;
                        Session["User"] = Session["id"];
                        var LoggedInuser = new LogginHelper();
                        user = LoggedInuser.LoggedInUser();
                        // return View("index");

                        // string LoginPage = ConfigurationManager.AppSettings["DefaultLogin"];
                        // return RedirectToAction("Index", "Dashboard");
                        // This is For Banks
                        var bankFk = DataReaders.getBankByUser(users.Email);

                        /* if(bankFk.BankFk != null || bankFk.BankFk != 0)
                         * {
                         *   return RedirectToAction("DashboardSummary", "Dashboard");
                         * }
                         * else if(bankFk .BankFk== null || bankFk.BankFk == 0)
                         * return RedirectToAction("Dashboard", "Dashboard");
                         */
                        if (bankFk.BankFk == null || bankFk.BankFk == 0)
                        {
                            TempData["Flg"] = "0";
                            return(RedirectToAction("Dashboard", "Dashboard"));
                        }
                        else if (bankFk.BankFk != null || bankFk.BankFk != 0)
                        {
                            return(RedirectToAction("DashboardSummary", "Dashboard"));
                        }
                        // return Redirect(LoginPage);
                    }
                    else
                    {
                        TempData["message"] = "Invalid User Try Again";
                    }
                    // ViewBag.Message ="Try Again!";
                    return(View("Signin"));
                }
                else
                {
                    WebLog.Log("Valid3" + valid);
                    TempData["message"] = "User Does Not Exist";
                    ViewBag.Message     = "User Does Not Exist";
                    return(View("Signin"));
                }
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }