public ActionResult AddShopImage(HttpPostedFileBase ShopImageFile, string txtImageTitle, string chkSlider, string UserId)
        {
            try
            {
                string USER_id = new SecurityManager().DecodeString(UserId);
                User UserObj = new User().GetUser(Convert.ToInt64(USER_id));
                string savedFileName = "";
                if (ShopImageFile != null)
                {
                    savedFileName = uploadProfileImage(ShopImageFile, UserObj.UserId);
                    if (!string.IsNullOrWhiteSpace(savedFileName))
                    {

                        Shop_Image shopImage = new Shop_Image();
                        shopImage.User_Id = UserObj.UserId;
                        shopImage.Image_Title = txtImageTitle;
                        shopImage.Image_Path = savedFileName;
                        shopImage.Is_For_Home_Page_Slider = false;
                        shopImage.Created_On = DateTime.Now;
                        if (!string.IsNullOrWhiteSpace(chkSlider) && chkSlider.Equals("1"))
                        {
                            shopImage.Is_For_Home_Page_Slider = true;
                        }
                        shopImage.AddShopImage(shopImage);
                        shopImage = null;
                    }
                }
                UserObj = null;
            }
            catch (Exception)
            {
            }
            return RedirectToRoute(new RouteValueDictionary(new { controller = "ShopImages", action = "Index", Id = UserId }));
        }
        public ActionResult ChangeProfileAvatar(HttpPostedFileBase fileUserProfile, string UserId)
        {
            try
            {
                //Int64 userid = new UserSession().getUserSession().UserId;
                string USER_id = new SecurityManager().DecodeString(UserId);
                User Old_userObj = new User().GetUser(Convert.ToInt64(USER_id));
                string savedFileName = "";
                if (fileUserProfile != null)
                {
                    savedFileName = uploadProfileImage(fileUserProfile);
                    if (!string.IsNullOrWhiteSpace(savedFileName))
                    {
                        string filename = new User().ChangeProfilePhoto(Old_userObj.UserId, savedFileName);
                        //New_userObj.ProfilePhoto = savedFileName;
                        deleteUploadedImage(filename);
                        User retObj = new User().AuthnticateUser(Old_userObj);
                        if (retObj != null)
                        {
                            new UserSession().SetUserSession(retObj);
                        }

                    }
                }
                Old_userObj = null;
            }
            catch (Exception)
            {
            }
            return RedirectToRoute(new RouteValueDictionary(new { controller = "ShopImages", action = "Index", Id = UserId }));
        }
        public ActionResult ChangePassword(string pwdCurrentPassword, string pwdNewPassword, string pwdConfirmPassword)
        {
            try
            {
                if (string.IsNullOrEmpty(pwdCurrentPassword) || string.IsNullOrEmpty(pwdNewPassword) || string.IsNullOrEmpty(pwdConfirmPassword))
                {
                    OperationMessageEntity objMsg = new OperationMessageEntity();
                    objMsg.MessageType = Convert.ToInt32(OperationMessageType.Error);
                    objMsg.MessageTitle = "Error";
                    objMsg.MessageText = "Please enter Password";

                    ViewData[Constants.OPERATIONALMESSAGE] = objMsg;
                }
                else if (!pwdNewPassword.Equals(pwdConfirmPassword))
                {
                    OperationMessageEntity objMsg = new OperationMessageEntity();
                    objMsg.MessageType = Convert.ToInt32(OperationMessageType.Error);
                    objMsg.MessageTitle = "Error";
                    objMsg.MessageText = "Password and Confirm Password does not match";

                    ViewData[Constants.OPERATIONALMESSAGE] = objMsg;
                }
                else if (!pwdCurrentPassword.Equals(new UserSession().getUserSession().UserPassword))
                {
                    OperationMessageEntity objMsg = new OperationMessageEntity();
                    objMsg.MessageType = Convert.ToInt32(OperationMessageType.Error);
                    objMsg.MessageTitle = "Error";
                    objMsg.MessageText = "Current password does not matched";

                    ViewData[Constants.OPERATIONALMESSAGE] = objMsg;
                }
                else
                {
                    new User().ChangeUserPassword(new UserSession().getUserSession().UserId, pwdNewPassword);
                    User user = new User().GetUser(new UserSession().getUserSession().UserId);
                    new UserSession().SetUserSession(user);
                    OperationMessageEntity objMsg = new OperationMessageEntity();
                    objMsg.MessageType = Convert.ToInt32(OperationMessageType.Success);
                    objMsg.MessageTitle = "Success";
                    objMsg.MessageText = "Password changed successfully";

                    ViewData[Constants.OPERATIONALMESSAGE] = objMsg;
                }
                return View("ChangePassword");
            }
            catch (Exception)
            {
                return View("ChangePassword");
            }
        }
Example #4
0
        public ActionResult doLogin(string txtusername, string txtpassword)
        {
            try
            {

                ViewData["txtLoginName"] = txtusername;
                ViewData["txtPassword"] = txtpassword;
                if (!string.IsNullOrEmpty(txtusername) && !string.IsNullOrEmpty(txtpassword))
                {

                    User userObj = new User();
                    userObj.UserLoginName = txtusername;
                    userObj.UserPassword = txtpassword.Trim();
                    userObj.UserStatus = Convert.ToInt32(UserStatusType.Active);
                    User retObj = new User().AuthnticateUser(userObj);
                    if (retObj != null)
                    {
                        new UserSession().SetUserSession(retObj);
                        if (retObj.Is_ShopCreated == true)
                        {
                            return RedirectToRoute(new RouteValueDictionary(new { controller = "Home", action = "DashBoard" }));
                        }
                        else
                        {
                            return RedirectToRoute(new RouteValueDictionary(new { controller = "Register", action = "ShopRegister" }));
                        }
                    }
                    else
                    {
                        ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Login Failed", "Please enter correct username and password");
                    }
                }
                else
                {
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter username and password");
                }
            }
            catch (Exception)
            {
            }
            return View("Login");
        }
Example #5
0
        public User AuthnticateUser(User objUser)
        {
            try
            {
                using (var context = DbUtils.Create())
                {
                    User dbUser = context.Users
                    .Where(u => u.UserLoginName.Equals(objUser.UserLoginName)
                     && u.UserPassword.Equals(objUser.UserPassword)
                     && u.UserStatus.Equals(objUser.UserStatus)
                        ).SingleOrDefault();

                    return dbUser;
                }
            }
            catch (Exception)
            {
            }
            return null;
        }
        public ActionResult ActivateMe(string mySite)
        {
            try
            {
                if (!string.IsNullOrEmpty(mySite))
                {
                    string UserId = new SecurityManager().DecodeString(mySite);
                    Boolean retResult = new User().ChangeUserStatus(Convert.ToInt64(UserId), Convert.ToInt16(UserStatusType.Active));
                    if (retResult == true)
                    {
                        ViewData.Model = new User().GetUser(Convert.ToInt64(UserId));

                    }

                }
            }
            catch (Exception)
            {

            }
            return View("UserActivation");
        }
        public ActionResult CheckUserAvailability(string txtLoginName)
        {
            try
            {

                if (!string.IsNullOrEmpty(txtLoginName))
                {
                    Boolean retResult = new User().CheckUserAvailablity(txtLoginName.Trim());
                    if (retResult == true)
                    {
                        Response.Write("1");
                    }
                    else
                    {
                        Response.Write("0");
                    }
                }
            }
            catch (Exception)
            {
            }
            return null;
        }
        public ActionResult UpdateShop(string id)
        {
            ViewBag.TitleDes = "Free shop advertisement";

            ViewData[Constants.MENU_PARENT] = Constants.MENU_MANAGE_PROFILE;
            ViewData[Constants.MENU] = Constants.EDIT_SHOP_PROFILE;

            Int64 userid = new UserSession().getUserSession().UserId;
            User user = new User().GetUser(userid);
            ViewData.Model = user;
            return View();
        }
Example #9
0
 public void SetUserSession(User user)
 {
     Session["user"] = user;
 }
        public ActionResult RegisterShop(string txtShopName, string txtShopCountry, string txtShopCity, string txtShopAddress, string txtMapUrl, string txtShopDescription)
        {
            try
            {
                Boolean validInput = true;

                ViewData["txtShopName"] = txtShopName;
                ViewData["txtShopCountry"] = txtShopCountry;
                ViewData["txtShopCity"] = txtShopCity;
                ViewData["txtShopAddress"] = txtShopAddress;
                ViewData["txtMapUrl"] = txtMapUrl;
                ViewData["txtShopDescription"] = txtShopDescription;

                //my own
                if (string.IsNullOrWhiteSpace(txtShopName))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter shop name");
                }
                if (string.IsNullOrWhiteSpace(txtShopCountry))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter shop country name");
                }
                if (string.IsNullOrWhiteSpace(txtShopCity))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter shop city name");
                }
                if (string.IsNullOrWhiteSpace(txtShopAddress))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter shop address");
                }
                if (string.IsNullOrWhiteSpace(txtShopDescription))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter shop description");
                }

                //limit

                if (validInput == true)
                {

                    Int64 userid = new UserSession().getUserSession().UserId;

                    User userObj = new User();
                    userObj.UserId = userid;
                    userObj.ShopName = txtShopName;
                    userObj.ShopCountry = txtShopCountry;
                    userObj.ShopCity = txtShopCity;
                    userObj.ShopAddress = txtShopAddress;
                    userObj.ShopMapUrl = txtMapUrl;
                    userObj.ShopDescription = txtShopDescription;
                    userObj.Shop_Last_Updated_On = DateTime.UtcNow;
                    userObj.Is_ShopCreated= true;
                    User retShop = new User().CreateShop(userObj);
                    if (retShop==null)
                    {
                        validInput = false;
                        ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Error", "Error occured during process Please try again");
                    }
                    else
                    {
                        string USER_ID = new ShopOnline.Common.SecurityManager().EncodeString(Convert.ToString(retShop.UserId));
                        new UserSession().SetUserSession(retShop);
                        return RedirectToRoute(new RouteValueDictionary(new { controller = "ShopImages", action = "Index", Id = USER_ID }));
                    }
                }
            }
            catch (Exception)
            {
            }

            return View("ShopRegister");
        }
 public ActionResult ShopRegister()
 {
     ViewBag.TitleDes = "Free shop advertisement";
     if (new UserSession().EverLogin_User() == false)
     {
         return View();
     }
     else
     {
         Int64 userid = new UserSession().getUserSession().UserId;
         User user=new User().GetUser(userid);
         ViewData.Model = user;
         return RedirectToRoute(new RouteValueDictionary(new { controller = "ShopImages", action = "Index", Id = user.UserId }));
     }
 }
        public ActionResult RegisterUser(string txtCaptchaCode, string txtLoginName, string txtEmail, string txtPassword, string txtConfirmPassword, string txtFirstName, string txtLastName, string txtContactNumber, string radGender, string txtDay, string txtMonth, string txtYear)
        {
            try
            {
                ViewBag.TitleDes = "Free shop advertisement";
                Boolean validInput = true;
                ViewData["txtLoginName"] = txtLoginName;
                ViewData["txtPassword"] = txtPassword;
                ViewData["txtConfirmPassword"] = txtConfirmPassword;
                ViewData["txtFirstName"] = txtFirstName;
                ViewData["txtLastName"] = txtLastName;
                ViewData["txtContactNumber"] = txtContactNumber;
                ViewData["txtEmail"] = txtEmail;

                ViewData["radGender"] = radGender;
                ViewData["txtDay"] = txtDay;
                ViewData["txtMonth"] = txtMonth;
                ViewData["txtYear"] = txtYear;

                if (string.IsNullOrWhiteSpace(txtCaptchaCode))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter security code");
                }

                if (string.IsNullOrWhiteSpace(txtLoginName))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter login name");
                }
                else
                {
                    if (new User().CheckUserAvailablity(txtLoginName.Trim()) == false)
                    {
                        validInput = false;
                        ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Sorry Login Name Not Available", "Sorry, Login name not available. Please try with different login name.");
                    }
                }

                if (string.IsNullOrWhiteSpace(txtEmail))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter email");
                }

                if (string.IsNullOrWhiteSpace(txtPassword))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter password");
                }
                if (string.IsNullOrWhiteSpace(txtConfirmPassword))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please confirm your password");
                }
                if (string.IsNullOrWhiteSpace(txtFirstName))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter first name");
                }
                if (string.IsNullOrWhiteSpace(txtLastName))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter last name");
                }
                //my own
                if (txtDay.Equals("0"))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please select day of birth");
                }
                if (txtMonth.Equals("0"))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please select month of birth");
                }
                if (txtYear.Equals("0"))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please select year of birth");
                }
                if (string.IsNullOrWhiteSpace(radGender))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please select gender");
                }
                //limit

                if (!string.IsNullOrWhiteSpace(txtPassword) && !string.IsNullOrWhiteSpace(txtConfirmPassword))
                {
                    if (!txtPassword.Trim().Equals(txtConfirmPassword.Trim()))
                    {
                        validInput = false;
                        ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Incorrect password", "Password and confirm password does not match.");
                    }
                }

                if (!string.IsNullOrWhiteSpace(txtCaptchaCode))
                {
                    if (!txtCaptchaCode.Trim().Equals(new SecurityManager().DecodeString(Session["CaptchaCode"].ToString())))
                    {
                        validInput = false;
                        ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Invalid security code", "Please enter valid security code");
                    }
                }

                if (validInput == false)
                {
                    Session["CaptchaCode"] = Utils.getCaptchaCode();
                    return View("Index");
                }
                else
                {
                    User userObj = new User();
                    userObj.UserRoleId = Convert.ToInt32(UserRolesType.RegisteredUser);
                    userObj.UserFirstName = txtFirstName;
                    userObj.UserLastName = txtLastName;
                    userObj.UserLoginName = txtLoginName;
                    userObj.Contact_Email = txtEmail;
                    userObj.UserPassword = txtPassword.Trim();
                    userObj.UserContactNumber = txtContactNumber;

                    userObj.Gender = radGender;
                    userObj.DOB = Convert.ToDateTime(txtDay + "/" + txtMonth + "/" + txtYear).Date;
                    userObj.Is_ShopCreated= false;
                    userObj.Created_On = DateTime.UtcNow;
                    userObj.Last_Updated_On = DateTime.UtcNow;
                    userObj.UserStatus = Convert.ToInt16(UserStatusType.InActive);

                    userObj.ProfilePhoto = "BlankImage.jpg";

                    long UserId = new User().CreateUser(userObj);
                    if (UserId <= 0)
                    {
                        validInput = false;
                        ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Error", "Error occured during process Please try again");
                    }
                    else
                    {

                        if (UserId > 0)
                        {
                            string UserIdEncrypted = new SecurityManager().EncodeString(UserId.ToString());
                            string linkUrl = Utils.getSiteUrl() + "/Register/ActivateMe?mySite=" + UserIdEncrypted;

                            string emailMessage = "<div><b>Your User account created successfully</b></div>";
                            emailMessage = emailMessage + "<div style='padding-top:10px'>Your account is not active for the time being. Click the link below to activate your account</div>";
                            emailMessage = emailMessage + "<div><a href='" + linkUrl + "'>" + linkUrl + "</a></div>";

                            string emailHtml = Utils.GetEmailTemplate(txtFirstName + " " + txtLastName, emailMessage);

                            new EmailManager().SendEmail(txtEmail, SmtpUserName, "Account Activation Link", emailHtml);

                            return RedirectToRoute(new RouteValueDictionary(new { controller = "Register", action = "UserRegistered", webId = UserIdEncrypted }));
                        }
                        else
                        {
                            validInput = false;
                            ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Error", "Error occured during process Please try again");
                        }

                    }
                }
            }
            catch (Exception)
            {
            }
            Session["CaptchaCode"] = Utils.getCaptchaCode();
            return View("Index");
        }
        public ActionResult UpdateUser(string txtLoginName, string txtFirstName, string txtLastName, string txtCellNumber, string txtEmail, string radGender, string txtDay, string txtMonth, string txtYear, string userId)
        {
            try
            {
                Boolean validInput = true;
                ViewData["txtLoginName"] = txtLoginName;
                ViewData["txtFirstName"] = txtFirstName;
                ViewData["txtLastName"] = txtLastName;
                ViewData["txtContactNumber"] = txtCellNumber;
                ViewData["txtEmail"] = txtEmail;

                ViewData["radGender"] = radGender;
                ViewData["txtDay"] = txtDay;
                ViewData["txtMonth"] = txtMonth;
                ViewData["txtYear"] = txtYear;

                if (string.IsNullOrWhiteSpace(txtLoginName))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter login name");
                }
                else
                {
                    //if (new User().CheckUserAvailablity(txtLoginName.Trim()) == false)
                    //{
                    //    validInput = false;
                    //    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Sorry Login Name Not Available", "Sorry, Login name not available. Please try with different login name.");
                    //}
                }

                if (string.IsNullOrWhiteSpace(txtEmail))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter email");
                }
                if (string.IsNullOrWhiteSpace(txtFirstName))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter first name");
                }
                if (string.IsNullOrWhiteSpace(txtLastName))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please enter last name");
                }
                //my own
                if (txtDay.Equals("0"))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please select day of birth");
                }
                if (txtMonth.Equals("0"))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please select month of birth");
                }
                if (txtYear.Equals("0"))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please select year of birth");
                }
                if (string.IsNullOrWhiteSpace(radGender))
                {
                    validInput = false;
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Input field required", "Please select gender");
                }
                //limit

                if (validInput == true)
                {
                    User userObj = new User();
                    //userObj.UserRoleId = Convert.ToInt32(UserRolesType.RegisteredUser);
                    userObj.UserId =Convert.ToInt64(userId);
                    userObj.UserFirstName = txtFirstName;
                    userObj.UserLastName = txtLastName;
                    userObj.UserLoginName = txtLoginName;
                    userObj.Contact_Email = txtEmail;
                    userObj.Gender = radGender;
                    userObj.DOB = Convert.ToDateTime(txtDay + "/" + txtMonth + "/" + txtYear).Date;
                    userObj.Last_Updated_On = DateTime.UtcNow;

                    User user = new User().UpdateUser(userObj);
                    if (user == null)
                    {
                        validInput = false;
                        ViewData[Constants.OPERATIONALMESSAGE] = Utils.getErrorMessage("Error", "Error occured during process Please try again");
                    }
                    else
                    {

                        return RedirectToRoute(new RouteValueDictionary(new { controller = "UpdateProfiles", action = "UpdateUser", Id = user.UserId }));

                    }
                }
            }
            catch (Exception)
            {
            }
            return View("UpdateUser");
        }
        public ActionResult UpdateUser(string id)
        {
            ViewData[Constants.MENU_PARENT] = Constants.MENU_MANAGE_PROFILE;
            ViewData[Constants.MENU] = Constants.EDIT_USER_PROFILE;

            ViewBag.TitleDes = "Free shop advertisement";
            Int64 userid = new UserSession().getUserSession().UserId;
            User user = new User().GetUser(userid);
            ViewData.Model = user;

            //ViewData["txtLoginName"] = user.UserLoginName;
            //ViewData["txtEmail"] = user.Contact_Email;
            //ViewData["txtFirstName"] = user.UserFirstName;
            //ViewData["txtLastName"] = user.UserLastName;
            //ViewData[" txtContactNumber"] = user.UserContactNumber;
            //ViewData["radGender"] = user.Gender;
            //string s = Convert.ToString(user.DOB);
            //string[] values = s.Split('/', ' ');
            //int ii = values.Length;
            //for (int i = 0; i < values.Length; i++)
            //{
            //    values[i] = values[i].Trim();
            //    if (i == 0)
            //    {
            //        string day = values[i].Trim();
            //        ViewData["txtDay"] = values[i].Trim();
            //    }
            //    else if (i == 1)
            //    {
            //        string month = values[i].Trim();
            //        ViewData["txtMonth"] = values[i].Trim();
            //    }
            //    else if (i == 2)
            //    {
            //        string year = values[i].Trim();
            //        ViewData["txtYear"] = values[i].Trim();
            //    }
            //}
            return View();
        }
        public ActionResult Index(string RecDelOperation, string RecSaveOperation, string Id)
        {
            ViewData[Constants.MENU_PARENT] = Constants.MENU_MANAGE_PICTURES;
            ViewData[Constants.MENU] = Constants.EDIT_PICTURES;

            ViewBag.TitleDes = "Free shop advertisement";
            try
            {

                if (!String.IsNullOrEmpty(RecDelOperation))
                {
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getSuccessMessage("Success", "Record deleted successfully.");
                }
                if (!String.IsNullOrEmpty(RecSaveOperation))
                {
                    ViewData[Constants.OPERATIONALMESSAGE] = Utils.getSuccessMessage("Success", "Record saved successfully.");
                }

                if (!string.IsNullOrWhiteSpace(Id))
                {
                    string User_id = new SecurityManager().DecodeString(Id);
                    User user = new User().GetUser(Convert.ToInt64(User_id));
                    if (user != null)
                    {
                        user.Shop_Image_List = new Shop_Image().GetShopImagesList(user.UserId);
                        user.UserEntity = new User().GetUser(user.UserId);
                    }
                    ViewData.Model = user;
                    user = null;
                }
                else
                {
                    Int64 user_id = new UserSession().getUserSession().UserId;
                    User user = new User().GetUser(user_id);
                    if (user != null)
                    {
                        user.Shop_Image_List = new Shop_Image().GetShopImagesList(user.UserId);
                        user.UserEntity = new User().GetUser(user.UserId);
                    }
                    ViewData.Model = user;
                    user = null;
                }
                return View();
            }
            catch (Exception)
            {
            }
            return null;
        }
Example #16
0
 public User CreateShop(User userObj)
 {
     try
     {
         using (shoponlineDataContext context = DbUtils.Create())
         {
             User dbUserObj = context.Users.Where(u => u.UserId.Equals(userObj.UserId)).SingleOrDefault();
             if (dbUserObj != null)
             {
                 dbUserObj.ShopName = userObj.ShopName;
                 dbUserObj.ShopCountry = userObj.ShopCountry;
                 dbUserObj.ShopCity = userObj.ShopCity;
                 dbUserObj.ShopAddress = userObj.ShopAddress;
                 dbUserObj.ShopMapUrl = userObj.ShopMapUrl;
                 dbUserObj.ShopDescription = userObj.ShopDescription;
                 dbUserObj.Shop_Last_Updated_On = userObj.Shop_Last_Updated_On;
                 dbUserObj.Is_ShopCreated= userObj.Is_ShopCreated;
                 context.SubmitChanges();
                 return dbUserObj;
             }
         }
     }
     catch (Exception)
     { }
     return null;
 }
Example #17
0
 public User UpdateUser(User userObj)
 {
     try
     {
         using (shoponlineDataContext context = DbUtils.Create())
         {
             User dbUserObj = context.Users.Where(u => u.UserId.Equals(userObj.UserId)).SingleOrDefault();
             if (dbUserObj != null)
             {
                 dbUserObj.UserLoginName = userObj.UserLoginName;
                 dbUserObj.UserFirstName = userObj.UserFirstName;
                 dbUserObj.UserLastName = userObj.UserLastName;
                 dbUserObj.Contact_Email = userObj.Contact_Email;
                 dbUserObj.Gender = userObj.Gender;
                 dbUserObj.DOB = userObj.DOB;
                 dbUserObj.Last_Updated_On = userObj.Last_Updated_On;
                 context.SubmitChanges();
                 return dbUserObj;
             }
         }
     }
     catch (Exception)
     { }
     return null;
 }
Example #18
0
        public long CreateUser(User userObj)
        {
            try
            {

                using (shoponlineDataContext context = DbUtils.Create())
                {
                    context.Users.InsertOnSubmit(userObj);
                    context.SubmitChanges();
                    return userObj.UserId;

                }
            }
            catch (Exception)
            {
                return 0;
            }
        }