Exemple #1
0
        public ActionResult AddCompany(int?id, string message)
        {
            ViewBag.Message = message;
            Users rUser = new Repository.Users();

            ViewBag.CountryList = rUser.GetCountrySelectList();
            if (id == 0)
            {
                ViewBag.TitleText = "Add Company";
                ViewBag.CompanyID = id;
                return(View());
            }
            else
            {
                ViewBag.TitleText = "Edit Company";
                ServiceFirstCompanies Company;
                using (ISession session = NHibernateSession.OpenSession())
                {
                    Company = session.Query <ServiceFirstCompanies>().Where(b => b.ServiceFirstCompanyID
                                                                            == id).FirstOrDefault();
                }

                //ServiceFirstCompany Company = db.ServiceFirstCompanies.Find(id);
                if (Company == null)
                {
                    return(HttpNotFound());
                }
                ViewBag.CompanyID = Company.ServiceFirstCompanyID;
                return(View(Company));
            }
        }
Exemple #2
0
        public ActionResult Login(LoginViewModel _loginUser)
        {
            /*
             * string password = "******";
             * string _salt = string.Empty;
             * string _password = string.Empty;
             * CommonFunctions.GeneratePassword(password, "new", ref _salt, ref _password);
             */
            Users rUser = new Repository.Users();

            if (rUser.Login(_loginUser))
            {
                LoginInfo.CreateAdminLoginSession(rUser.UserObj.ServiceFirstID, "", rUser.UserObj.ServiceFirstUserName,
                                                  rUser.UserObj.ServiceFirstPassword, rUser.UserObj.ServiceFirstUserName, rUser.UserObj.ServiceFirstUserName, "SuperAdmin"
                                                  , _loginUser.RememberMe, _loginUser.Salt);
                return(RedirectToAction("CompanyList"));
            }
            else
            {
                TempData["message"] = rUser.Message;
                return(View());
            }
        }