示例#1
0
        public ActionResult Login(Login model)
        {
            if (ModelState.IsValid)
            {
                if (!model.rememberme)
                {
                    using (stuffWorks_BAL sw_bal = new stuffWorks_BAL())
                    {
                        //if(sw_bal.isloginsuccess(model.EmailID, model.Password))
                        //{
                        //    return RedirectToAction("Index","AboutUs");
                        //}
                        if (Membership.ValidateUser(model.EmailID, model.Password))
                        {
                            FormsAuthentication.SetAuthCookie(model.EmailID, false);
                            Session["UserData"] = UserDetails.LoadUserData(model.EmailID);

                            return(RedirectToAction("Index", "ManageUser"));
                        }
                        else
                        {
                            ModelState.AddModelError("password", "The username or password is incorrect");
                            return(RedirectToAction("Index", "Home"));
                        }
                    }
                }
                else if (model.rememberme)
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
示例#2
0
 public JsonResult IsEmailIDExists(string EmailID)
 {
     if (ModelState.IsValid)
     {
         if (EmailID != null)
         {
             using (stuffWorks_BAL sw_bal = new stuffWorks_BAL())
             {
                 if (sw_bal.IsEmailIDExists(EmailID, 1))
                 {
                     return(Json(true));
                 }
                 else
                 {
                     return(Json(false));
                 }
             }
         }
         else
         {
             return(Json(false));
         }
     }
     else
     {
         return(Json(false));
     }
 }
        // GET: ManageUser
        public ActionResult Index()
        {
            if (((UserDetails)Session["UserData"]).usertype == 1)
            {
                return(View("UserDashboard"));
            }
            //User
            else if (((UserDetails)Session["UserData"]).usertype == 2)
            {
                //UserDetails usd = (UserDetails)Session["UserData"];

                return(View("UserDashboard"));
            }
            //Admin
            else if (((UserDetails)Session["UserData"]).usertype == 99)
            {
                DataSet ds    = null;
                Admin   admin = new Admin();
                using (stuffWorks_BAL sw_bal = new stuffWorks_BAL())
                {
                    ds               = sw_bal.GetAdminData();
                    admin.dtusers    = ds.Tables[0];
                    admin.dtstuffers = ds.Tables[1];
                    admin.dtservices = ds.Tables[2];
                }

                return(View("AdminView", admin));
            }
            return(View("UserDashboard"));
        }
示例#4
0
 public void Register(Register model)
 {
     if (ModelState.IsValid)
     {
         using (stuffWorks_BAL sw_bal = new stuffWorks_BAL())
         {
             sw_bal.register(model.FullName, model.EmailID, model.Password, Convert.ToInt32(UserType.client_User), model.Phone);
         }
     }
 }
示例#5
0
        public void RegisterStuffer(RegisterStuffer model)
        {
            var errors = ModelState.Values.SelectMany(v => v.Errors);
            List <SelectListItem> items = new List <SelectListItem>();

            items = GetServices();
            if (ModelState.IsValid)
            {
                using (stuffWorks_BAL sw_bal = new stuffWorks_BAL())
                {
                    sw_bal.registerStuffer(model.FullName, model.EmailID, model.Password, Convert.ToInt32(UserType.service_User), model.Phone, model.Address1, model.Address2, model.City, model.State, model.ZipCode, Convert.ToInt32(items.Find(x => x.Value == model.Service.ToString()).Value));
                }
            }
        }
示例#6
0
        private static List <SelectListItem> GetServices()
        {
            List <SelectListItem> items = new List <SelectListItem>();
            DataTable             dt    = null;

            using (stuffWorks_BAL sw_bal = new stuffWorks_BAL())
            {
                dt = sw_bal.GetAvailableServices();
            }
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    items.Add(new SelectListItem
                    {
                        Text  = row["Service_Name"].ToString(),
                        Value = row["Service_ID"].ToString()
                    });
                }
            }
            return(items);
        }
示例#7
0
        //load particular user data using user email ID
        public static UserDetails LoadUserData(string Email)
        {
            UserDetails us = new UserDetails();
            DataTable   dt = null;

            using (stuffWorks_BAL swbal = new stuffWorks_BAL())
            {
                dt = swbal.GetUserDetails(Email);
            }
            if (dt != null)
            {
                us.useremail    = dt.Rows[0]["User_Email"].ToString();
                us.userfullname = dt.Rows[0]["User_Name"].ToString();
                us.Address1     = dt.Rows[0]["Address1"].ToString();
                us.Address2     = dt.Rows[0]["Address2"].ToString();
                us.City         = dt.Rows[0]["City"].ToString();
                us.State        = dt.Rows[0]["State"].ToString();
                us.pincode      = dt.Rows[0]["Zip"].ToString();
                us.userId       = Convert.ToInt32(dt.Rows[0]["User_ID"]);
                us.usertype     = Convert.ToInt32(dt.Rows[0]["Is_User_Type"]);
            }
            return(us);
        }
        public ActionResult ManageUserAccount(ManageUserDetails model)
        {
            UserDetails usd = (UserDetails)Session["UserData"];

            if (model.useremail != usd.useremail || model.Address1 != usd.Address1 || model.Address2 != usd.Address2 || model.City != usd.City || model.State != usd.State || model.Pincode != usd.pincode)
            {
                using (stuffWorks_BAL swBAL = new stuffWorks_BAL())
                {
                    Dictionary <string, string> userdict = new Dictionary <string, string>();
                    userdict.Add("userid", usd.userId.ToString());
                    userdict.Add("useremail", model.useremail);
                    userdict.Add("address1", model.Address1);
                    userdict.Add("address2", model.Address2);
                    userdict.Add("City", model.City);
                    userdict.Add("State", model.State);
                    userdict.Add("Pincode", model.Pincode.ToString());

                    swBAL.UpdateUserDetail(userdict);
                }
                Session["UserData"] = UserDetails.LoadUserData(model.useremail);
            }
            return(View("ManageAccount"));
        }