コード例 #1
0
ファイル: iaSession.cs プロジェクト: Delcarta/PropManage
    public iaSession(UserBL PersonIn)
    {
        _Person = PersonIn;
        if (PersonIn.HasCompany)
        {
            _CompanyInfo = new CompanyBL(PersonIn.CompanyInfo);
        }

        if (PersonIn.HasProperty)
        {
            _PropertyInfo     = new PropertyBL(PersonIn.PropertyInfo);
            _ActivePropertyID = _PropertyInfo.GetLastPropertyID();
        }
    }
コード例 #2
0
        public ActionResult Login(LoginModel loginModel)
        {
            User   user   = new User();
            UserBL userBL = new UserBL();

            if (ModelState.IsValid)
            {
                user.Email    = loginModel.Email;
                user.Password = loginModel.Password;
                user          = userBL.Login(user);
                if (user != null)
                {
                    FormsAuthentication.SetAuthCookie(user.Email, false);
                    var    authTicket      = new FormsAuthenticationTicket(1, user.Email, DateTime.Now, DateTime.Now.AddMinutes(20), false, user.Role);
                    string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                    var    authCookie      = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                    HttpContext.Response.Cookies.Add(authCookie);
                    if (user.Role == "Admin")
                    {
                        return(RedirectToAction("DisplayPropertyDetails", "Property"));
                    }
                    else if (user.Role == "Buyer")
                    {
                        PropertyBL      propertyBL       = new PropertyBL();
                        List <Property> property         = userBL.GetPropertyDetailsByUserId(user.UserId);
                        List <int>      propertyValues   = new List <int>();
                        List <string>   propertyFeatures = new List <string>();
                        for (int index = 0; index < property.Count; index++)
                        {
                            propertyValues[index]   = Convert.ToInt32(propertyBL.GetPropertyValueDetails(Convert.ToInt32(property[index].PropertyId)));
                            propertyFeatures[index] = Convert.ToString(propertyBL.GetPropertyFeatureDetails(Convert.ToInt32(property[index].PropertyTypeID)));
                        }
                        TempData["Property"]        = property;
                        TempData["PropertyFeature"] = propertyFeatures;
                        TempData["PropertyValue"]   = propertyValues;
                        TempData["UserId"]          = user.UserId;
                        return(RedirectToAction("DisplayBuyerPropertyDetails", "Buyer"));
                    }
                    else
                    {
                        ViewBag.Message = "Login failed";
                    }
                }
                else
                {
                    ViewBag.Message = "Login failed";
                }
            }
            return(View());
        }
コード例 #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            PropertyModel model = new PropertyModel();

            model.PropertyName  = txtPropertyName.Value;
            model.ContactPerson = txtContact.Value;
            model.Address1      = txtAddress1.Value;
            model.Address2      = txtAddress2.Value;
            model.Zip           = txtZip.Value;
            model.Phone         = txtPhone.Value;
            model.Email         = txtEmail.Value;

            model.CompanyID = Sess.Person.CompanyID;

            PropertyBL propBL = new PropertyBL();

            propBL.AddProperty(model);
            Sess.Person.Reload();
            Response.Redirect("~/default.aspx");
        }