Пример #1
0
        public ActionResult UpdateOTP(Int64 PhoneNumber)
        {
            int              otp;
            Utility          en       = new Utility();
            UserDetailsModel objModel = new UserDetailsModel();

            objModel.txtPhoneNumber = PhoneNumber;
            ManagementServiceWrapper  ObjService = new ManagementServiceWrapper();
            InformationServiceWrapper infoObj    = new InformationServiceWrapper();
            GDictionaryModel          GDOBJ      = new GDictionaryModel();

            GDOBJ = infoObj.MobileNumberVerification(PhoneNumber);

            if (GDOBJ.ID == 0)
            {
                otp = ObjService.UpdateOtp(objModel);
                HttpCookie OTPCookie = new HttpCookie("_ROTP_");
                OTPCookie.Values["_ROTP_"] = en.Encrypt(otp.ToString());
                OTPCookie.Expires          = DateTime.Now.AddMinutes(30);
                Response.Cookies.Add(OTPCookie);
                return(Json(1, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
Пример #2
0
        public ActionResult DeleteAccount(Int64 BigIntPhoneNumber)
        {
            int        succuss      = 0;
            HttpCookie UserIdCookie = Request.Cookies["_RRUID"];
            HttpCookie KeyCookie    = Request.Cookies["_RRPS"];
            HttpCookie OTPCookie    = Request.Cookies["_ROTP_"];

            if (UserIdCookie != null)
            {
                if ((UserIdCookie != null && KeyCookie != null) || (UserIdCookie != null && OTPCookie != null))
                {
                    ManagementServiceWrapper obj = new ManagementServiceWrapper();
                    succuss = obj.DeleteUserAccount(BigIntPhoneNumber);
                    return(Json(succuss, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(succuss, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(succuss, JsonRequestBehavior.AllowGet));
            }
        }
Пример #3
0
        protected override void OnException(ExceptionContext filterContext)
        {
            var controllerName = filterContext.RouteData.Values["controller"];
            var actionName     = filterContext.RouteData.Values["action"];
            var Exception      = filterContext.Exception.Message;
            ManagementServiceWrapper objwrap = new ManagementServiceWrapper();

            objwrap.ExceptionLoggin((string)controllerName, (string)actionName, (string)Exception);
            base.OnException(filterContext);
        }
Пример #4
0
        public ActionResult ContactUs(FormCollection ContUs)
        {
            ContactUsModel ModelObj = new ContactUsModel();
            int            success  = 0;

            ModelObj.PhoneNumber = Convert.ToInt64(ContUs["txtPhoneNumber"]);
            ModelObj.Subject     = ContUs["txtSubject"];
            ModelObj.Description = ContUs["txtContactUsDescription"];

            ManagementServiceWrapper manobj = new ManagementServiceWrapper();

            success = manobj.insertContactUs(ModelObj);
            return(Json(success, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public ActionResult Verification(FormCollection fnVer)
        {
            ManagementServiceWrapper obj   = new ManagementServiceWrapper();
            UserDetailsModel         Model = new UserDetailsModel();

            Model = obj.VerifyMobileNumber(Convert.ToInt32(fnVer["txtOTP"]), Convert.ToInt64(fnVer["BigIntMobileNumber"]));
            Utility en = new Utility();

            if (Model.txtUserName != null)
            {
                HttpCookie OTPCookie         = new HttpCookie("_ROTP_");
                HttpCookie KeyCookie         = new HttpCookie("_RRPS");
                HttpCookie UserIdCookie      = new HttpCookie("_RRUID");
                HttpCookie PhoneNumberCookie = new HttpCookie("_RRUPn");
                HttpCookie UserNameCookie    = new HttpCookie("_RRUN");

                UserIdCookie.Values["_RRUID"]      = en.Encrypt(Model.intUserId.ToString());
                PhoneNumberCookie.Values["_RRUPn"] = en.Encrypt(Model.txtPhoneNumber.ToString());
                KeyCookie.Values["_RRPS"]          = en.Encrypt(Model.txtPassword.ToString());

                if (Model.txtUserName.Length <= 10)
                {
                    UserNameCookie.Values["_RRUN"] = Model.txtUserName;
                }
                else
                {
                    UserNameCookie.Values["_RRUN"] = Model.txtUserName.Substring(0, 10) + "..";
                }

                UserIdCookie.Expires      = DateTime.Now.AddDays(365);
                PhoneNumberCookie.Expires = DateTime.Now.AddDays(365);
                UserNameCookie.Expires    = DateTime.Now.AddDays(365);
                KeyCookie.Expires         = DateTime.Now.AddDays(365);

                Response.Cookies.Add(UserIdCookie);
                Response.Cookies.Add(KeyCookie);
                Response.Cookies.Add(PhoneNumberCookie);
                Response.Cookies.Add(UserNameCookie);
                Utility Utilobj = new Utility();
                OTPCookie.Values["_ROTP_"] = en.Encrypt(fnVer["txtOTP"]);

                OTPCookie.Expires = DateTime.Now.AddMinutes(30);
                Response.Cookies.Add(OTPCookie);
                return(Json(Model.txtUserName, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("", JsonRequestBehavior.AllowGet));
            }
        }
Пример #6
0
        public ActionResult AdDelete(int adId)
        {
            HttpCookie UserIdCookie = Request.Cookies["_RRUID"];

            if (UserIdCookie != null)
            {
                ManagementServiceWrapper obj = new ManagementServiceWrapper();
                obj.DeleteUserAd(adId);
                return(Json(1, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
Пример #7
0
        public ActionResult UserDetails(FormCollection fnPost)
        {
            int AdId;
            ManagementServiceWrapper ObjService = new ManagementServiceWrapper();
            AdDetailsModel           obj        = new AdDetailsModel();

            obj.txtAddTitle      = fnPost["txtAddTitle"];
            obj.Category         = fnPost["ddlCategory"];
            obj.txtAdDescription = fnPost["txtAdDescription"];
            obj.txtPrice         = Convert.ToInt32(fnPost["txtPrice"]);
            obj.txtQuantity      = Convert.ToInt32(fnPost["txtQuantity"]);
            obj.SellingUnit      = fnPost["ddlUnit"];
            obj.UserID           = 1;
            AdId = ObjService.InsertAddPostDetails(obj);
            return(Json(AdId, JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        public ActionResult VerifyUsers(string SelectedPhoneNumbers)
        {
            HttpCookie nameCookie = Request.Cookies["_RRAUN"];

            if (nameCookie != null)
            {
                int success = 0;
                ManagementServiceWrapper obj = new ManagementServiceWrapper();
                success = obj.VerifyUsersByAdmin(SelectedPhoneNumbers);
                return(Json(success, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(RedirectToAction("Login", "Admin"));
            }
        }
Пример #9
0
        public ActionResult UserDetailsManagement(string UserIdList)
        {
            HttpCookie nameCookie = Request.Cookies["_RRAUN"];

            if (nameCookie != null)
            {
                int success = 0;
                ManagementServiceWrapper obj = new ManagementServiceWrapper();
                success = obj.DeleteSelectedUserAccounts(UserIdList);
                return(Json(success, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(RedirectToAction("AdminLogin", "Admin"));
            }
        }
Пример #10
0
        public ActionResult AdManagement(string AdIdList)
        {
            HttpCookie nameCookie = Request.Cookies["_RRAUN"];

            if (nameCookie != null)
            {
                int success = 0;
                ManagementServiceWrapper obj = new ManagementServiceWrapper();
                success = obj.DeleteAdsByAdmin(AdIdList);
                return(Json(success, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(RedirectToAction("Login", "Admin"));
            }
        }
Пример #11
0
        public ActionResult AdDisplayWithPhoneNumber(int AdId)
        {
            HttpCookie UserIdCookie      = Request.Cookies["_RRUID"];
            HttpCookie PhoneNumberCookie = Request.Cookies["_RRUPn"];

            if (UserIdCookie != null && PhoneNumberCookie != null)
            {
                AdDetailsModel            model      = new AdDetailsModel();
                InformationServiceWrapper objservice = new InformationServiceWrapper();
                model                = objservice.SPRRGetAdDisplayDetails(AdId);
                ViewBag.IntAdId      = model.AdID;
                ViewBag.AdId         = model.AdID + ".jpg";
                ViewBag.Title        = model.txtAddTitle;
                ViewBag.Description  = model.txtAdDescription;
                ViewBag.Category     = model.Category;
                ViewBag.Price        = model.txtPrice;
                ViewBag.Quantity     = model.txtQuantity;
                ViewBag.Unit         = model.SellingUnit;
                ViewBag.Name         = model.Name;
                ViewBag.MobileNumber = model.MobileNuber.ToString();
                ViewBag.Location     = model.Location;
                ViewBag.AdPostedDate = model.PostedDate;

                if (model.Category == "Fruit" || model.Category == "Handloom" || model.Category == "Equipment" || model.Category == "Vegetable" || model.Category == "Others")
                {
                    ViewBag.DefinedTitle = model.txtSubCategoryName + " " + model.txtQuantity + " " + model.SellingUnit + " at Price Rs." + model.txtPrice + " Per " + model.SellingUnit.Substring(0, model.SellingUnit.Length - 1);
                }
                else
                {
                    ViewBag.DefinedTitle = model.Category + " " + model.txtQuantity + " " + model.SellingUnit + " at Price Rs." + model.txtPrice + " Per " + model.SellingUnit.Substring(0, model.SellingUnit.Length - 1);
                }
                ViewBag.DefinedUnit = " /" + model.SellingUnit.Substring(0, model.SellingUnit.Length - 1);

                ManagementServiceWrapper ManObj = new ManagementServiceWrapper();
                Utility        en            = new Utility();
                AdDetailsModel StatisticsObj = new AdDetailsModel();
                StatisticsObj.UserID      = Convert.ToInt32(en.Decrypt(UserIdCookie["_RRUID"]));
                StatisticsObj.MobileNuber = Convert.ToInt64(en.Decrypt(PhoneNumberCookie["_RRUPn"]));
                StatisticsObj.AdID        = model.AdID;;
                ManObj.SPInsertAdViewsStatistics(StatisticsObj);
                return(View("AdDisplay"));
            }
            else
            {
                return(RedirectToAction("Login", "User"));
            }
        }
Пример #12
0
        public ActionResult UpdatePhoneNumber(FormCollection fnRegistration)
        {
            int        UserId;
            HttpCookie UserIdCookie      = Request.Cookies["_RRUID"];
            HttpCookie PhoneNumberCookie = Request.Cookies["_RRUPn"];

            if (UserIdCookie != null)
            {
                GDictionaryModel          GDModel     = new GDictionaryModel();
                UserDetailsModel          objModel    = new UserDetailsModel();
                ManagementServiceWrapper  ObjService  = new ManagementServiceWrapper();
                InformationServiceWrapper InfoService = new InformationServiceWrapper();
                Utility en = new Utility();
                objModel.intUserId          = Convert.ToInt32(en.Decrypt(UserIdCookie["_RRUID"]));
                objModel.txtPhoneNumber     = Convert.ToInt64(fnRegistration["txtPhoneNumber"]);
                objModel.KeyForUserSettings = Convert.ToString(UserSettings.PHONENUMBER);

                GDModel = InfoService.MobileNumberVerification(objModel.txtPhoneNumber);
                if (GDModel.ID == 0)
                {
                    ViewBag.MobileError = "Entered Mobiler Number is already registered";
                    return(Json(0, JsonRequestBehavior.AllowGet));
                }
                else if (GDModel.ID == 1 && Regex.Match(objModel.txtPhoneNumber.ToString(), @"^([5-9]{1}[0-9]{9})$").Success)
                {
                    UserId = ObjService.UpdateUserDetails(objModel);
                    if (UserId != 0)
                    {
                        PhoneNumberCookie.Values["_RRUPn"] = en.Encrypt(objModel.txtPhoneNumber.ToString());
                        PhoneNumberCookie.Expires          = DateTime.Now.AddDays(365);
                        Response.Cookies.Add(PhoneNumberCookie);
                    }
                    return(Json(UserId, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(-99, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(-99, JsonRequestBehavior.AllowGet));
            }
        }
Пример #13
0
        public ActionResult Reviews(FormCollection RVCollection)
        {
            int        success           = 0;
            HttpCookie UserIdCookie      = Request.Cookies["_RRUID"];
            HttpCookie PhoneNumberCookie = Request.Cookies["_RRUPn"];

            if (UserIdCookie != null)
            {
                Utility en = new Utility();
                string  ReviewDescription        = RVCollection["txtReviewDescription"];
                Int64   PhoneNumber              = Convert.ToInt64(en.Decrypt(PhoneNumberCookie["_RRUPn"]));
                ManagementServiceWrapper wrapobj = new ManagementServiceWrapper();
                success = wrapobj.InsertReview(PhoneNumber, ReviewDescription);
            }
            else
            {
                success = 0;
            }
            return(Json(success, JsonRequestBehavior.AllowGet));
        }
Пример #14
0
        public ActionResult UpdatePassword(FormCollection fnRegistration)
        {
            int UserId;

            UserDetailsModel objModel     = new UserDetailsModel();
            Utility          en           = new Utility();
            HttpCookie       UserIdCookie = Request.Cookies["_RRUID"];
            HttpCookie       KeyCookie    = Request.Cookies["_RRPS"];


            if (UserIdCookie != null)
            {
                objModel.intUserId          = Convert.ToInt32(en.Decrypt(UserIdCookie["_RRUID"]));
                objModel.txtPassword        = en.Encrypt(fnRegistration["txtPassword"]);
                objModel.KeyForUserSettings = Convert.ToString(UserSettings.PASSWORD);

                if (System.Text.RegularExpressions.Regex.IsMatch(objModel.txtPassword, "[^<>'\"/`%-]"))
                {
                    ManagementServiceWrapper ObjService = new ManagementServiceWrapper();
                    UserId = ObjService.UpdateUserDetails(objModel);
                    if (UserId != 0)
                    {
                        KeyCookie.Values["_RRPS"] = en.Encrypt(objModel.txtPassword);
                        KeyCookie.Expires         = DateTime.Now.AddDays(365);
                        Response.Cookies.Add(KeyCookie);
                    }
                    return(Json(UserId, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(-99, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(-99, JsonRequestBehavior.AllowGet));
            }
        }
Пример #15
0
        public ActionResult AdDetails(FormCollection fnAd)
        {
            int        success    = 0;
            HttpCookie nameCookie = Request.Cookies["_RRAUN"];

            if (nameCookie != null)
            {
                ManagementServiceWrapper ObjService = new ManagementServiceWrapper();
                AdDetailsModel           obj        = new AdDetailsModel();
                obj.AdID               = Convert.ToInt32(fnAd["AdId"]);
                obj.Category           = fnAd["ddlCategoryText"];
                obj.txtSubCategoryName = fnAd["txtSubCategoryName"];
                obj.txtAdDescription   = fnAd["txtAdDescription"];
                obj.txtPrice           = Convert.ToInt32(fnAd["txtPrice"]);
                obj.txtQuantity        = Convert.ToInt32(fnAd["txtQuantity"]);
                obj.SellingUnit        = fnAd["ddlUnitText"];
                HttpPostedFileBase file = Request.Files["myImage"];

                if (obj.Category == "Fruit" || obj.Category == "Handloom" || obj.Category == "Equipment" || obj.Category == "Vegetable" || obj.Category == "Others")
                {
                    obj.txtSubCategoryName = obj.txtSubCategoryName;
                }
                else
                {
                    obj.txtSubCategoryName = obj.Category;
                }

                string s     = "[^<>'\"/`%-]";
                int    count = 0;

                if (System.Text.RegularExpressions.Regex.IsMatch(obj.Category, "^[a-zA-Z0-9 .]"))
                {
                    count = count + 1;
                }
                if (System.Text.RegularExpressions.Regex.IsMatch(obj.txtSubCategoryName, s))
                {
                    count = count + 1;
                }
                if (System.Text.RegularExpressions.Regex.IsMatch(obj.txtAdDescription, s))
                {
                    count = count + 1;
                }

                if (System.Text.RegularExpressions.Regex.IsMatch(obj.SellingUnit, "^[a-zA-Z0-9 .]"))
                {
                    count = count + 1;
                }
                if (Regex.Match(obj.txtPrice.ToString(), "[1-9]").Success)
                {
                    count = count + 1;
                }
                if (Regex.Match(obj.txtQuantity.ToString(), "[1-9]").Success)
                {
                    count = count + 1;
                }

                if (count == 6)
                {
                    ObjService.UpdateAdDetails(obj);
                    success = obj.AdID;
                    return(Json(success, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    success = -99;
                    return(Json(success, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Admin"));
            }
        }
Пример #16
0
        public ActionResult FileUpload(HttpPostedFileBase image, Int32 AdId)
        {
            HttpCookie UserIdCookie = Request.Cookies["_RRUID"];
            Utility    en           = new Utility();

            if (UserIdCookie != null)
            {
                string             userid = en.Decrypt(UserIdCookie["_RRUID"].ToString());
                HttpPostedFileBase file   = Request.Files["ImageData"];

                if (file != null)
                {
                    var    LENGTH = (file.ContentLength / 1024);
                    var    ext    = Path.GetExtension(file.FileName);
                    Stream strm   = file.InputStream;

                    var ActualImagePath     = Path.Combine(Server.MapPath("~/PhotoManagement/Actual/"), Convert.ToString(AdId) + ".jpg");
                    var CompressedImagePath = Path.Combine(Server.MapPath("~/PhotoManagement/Compressed/"), Convert.ToString(AdId) + ".jpg");

                    var CompressedDelPath = Path.Combine(Server.MapPath("~/PhotoManagement/Deleted/"), Convert.ToString(AdId) + "_Compressed_Deleted.jpg");
                    var ActualDelPath     = Path.Combine(Server.MapPath("~/PhotoManagement/Deleted/"), Convert.ToString(AdId) + "_Actual_Deleted.jpg");

                    if (System.IO.File.Exists(CompressedImagePath))
                    {
                        System.IO.File.Delete(CompressedDelPath);
                        System.IO.File.Move(CompressedImagePath, CompressedDelPath);

                        if (System.IO.File.Exists(ActualImagePath))
                        {
                            System.IO.File.Delete(ActualDelPath);
                            System.IO.File.Move(ActualImagePath, ActualDelPath);
                        }

                        ReduceImageSize(strm, CompressedImagePath);
                        if (LENGTH >= 350)
                        {
                            ReduceImageSizeForActualImage(strm, ActualImagePath);
                        }
                        else
                        {
                            file.SaveAs(ActualImagePath);
                        }
                    }
                    else
                    {
                        ReduceImageSize(strm, CompressedImagePath);
                        if (LENGTH >= 350)
                        {
                            ReduceImageSizeForActualImage(strm, ActualImagePath);
                        }
                        else
                        {
                            file.SaveAs(ActualImagePath);
                        }
                    }


                    AdDetailsModel obj = new AdDetailsModel();
                    obj.UserID = Convert.ToInt32(userid);
                    obj.AdID   = AdId;
                    obj.Image  = ConvertToBytes(file);
                    ManagementServiceWrapper OBJ = new ManagementServiceWrapper();
                    OBJ.UploadImage(obj);
                    return(Json(AdId, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(AdId, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(AdId, JsonRequestBehavior.AllowGet));
            }
        }
Пример #17
0
        public ActionResult UpdateUserDetails(FormCollection fnRegistration)
        {
            int              UserId;
            Utility          en       = new Utility();
            UserDetailsModel objModel = new UserDetailsModel();


            HttpCookie UserIdCookie   = Request.Cookies["_RRUID"];
            HttpCookie UserNameCookie = Request.Cookies["_RRUN"];


            if (UserIdCookie != null)
            {
                objModel.txtUserName = fnRegistration["txtUserNameDetails"];
                objModel.intUserId   = Convert.ToInt32(en.Decrypt(UserIdCookie["_RRUID"]));
                objModel.ddlState    = fnRegistration["ddlStateText"];
                objModel.ddlDistrict = fnRegistration["ddlDistrict"];
                objModel.ddlMandal   = fnRegistration["ddlMandal"];
                objModel.txtVillage  = fnRegistration["txtVillage"];
                //objModel.txtMailId = fnRegistration["txtMailId"];
                objModel.KeyForUserSettings = Convert.ToString(UserSettings.DETAILS);
                string s = "[^<>'\"/`%-]";

                objModel.OTP = fnRegistration[""];
                int count = 0;
                if (System.Text.RegularExpressions.Regex.IsMatch(objModel.txtUserName, s))
                {
                    count = count + 1;
                }
                if (System.Text.RegularExpressions.Regex.IsMatch(objModel.ddlState, "^[a-zA-Z0-9 .]{1,50}"))
                {
                    count = count + 1;
                }
                if (System.Text.RegularExpressions.Regex.IsMatch(objModel.ddlDistrict, "^[a-zA-Z0-9 .]{1,50}"))
                {
                    count = count + 1;
                }
                if (System.Text.RegularExpressions.Regex.IsMatch(objModel.ddlMandal, "^[a-zA-Z0-9 .]{1,50}"))
                {
                    count = count + 1;
                }

                if (System.Text.RegularExpressions.Regex.IsMatch(objModel.txtVillage, s))
                {
                    count = count + 1;
                }
                GDictionaryModel GDOBJ = new GDictionaryModel();
                if (count == 5)
                {
                    ManagementServiceWrapper ObjService = new ManagementServiceWrapper();
                    UserId = ObjService.UpdateUserDetails(objModel);

                    if (UserId != 0)
                    {
                        if (objModel.txtUserName.Length <= 10)
                        {
                            UserNameCookie.Values["_RRUN"] = objModel.txtUserName;
                            UserNameCookie.Expires         = DateTime.Now.AddDays(365);
                            Response.Cookies.Add(UserNameCookie);
                        }
                        else
                        {
                            UserNameCookie.Values["_RRUN"] = objModel.txtUserName.Substring(0, 10) + "..";
                            UserNameCookie.Expires         = DateTime.Now.AddDays(365);
                            Response.Cookies.Add(UserNameCookie);
                        }
                    }
                    return(Json(UserId, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(-99, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(-99, JsonRequestBehavior.AllowGet));
            }
        }
Пример #18
0
        public ActionResult Registration(FormCollection fnRegistration)
        {
            int count = 0;
            int UserId;     //=(Int32)Session["_RRUID"];
            UserDetailsModel objModel = new UserDetailsModel();

            objModel.txtUserName    = fnRegistration["txtUserName"];
            objModel.txtPhoneNumber = Convert.ToInt64(fnRegistration["txtPhoneNumber"]);

            Utility en = new Utility();

            objModel.txtPassword = en.Encrypt(fnRegistration["txtPassword"]);
            objModel.ddlState    = fnRegistration["ddlStateText"];
            objModel.ddlDistrict = fnRegistration["ddlDistrict"];
            objModel.ddlMandal   = fnRegistration["ddlMandal"];
            objModel.txtVillage  = fnRegistration["txtVillage"];
            // objModel.txtMailId = fnRegistration["txtMailId"];
            objModel.OTP = fnRegistration[""];

            string s = "[^<>'\"/`%-]";

            if (System.Text.RegularExpressions.Regex.IsMatch(objModel.txtUserName, s))
            {
                count = count + 1;
            }
            if (System.Text.RegularExpressions.Regex.IsMatch(objModel.ddlState, "^[a-zA-Z0-9 .]{1,50}"))
            {
                count = count + 1;
            }
            if (System.Text.RegularExpressions.Regex.IsMatch(objModel.ddlDistrict, "^[a-zA-Z0-9 .]{1,50}"))
            {
                count = count + 1;
            }
            if (System.Text.RegularExpressions.Regex.IsMatch(objModel.ddlMandal, "^[a-zA-Z0-9 .]{1,50}"))
            {
                count = count + 1;
            }
            if (System.Text.RegularExpressions.Regex.IsMatch(en.Decrypt(objModel.txtPassword), s))
            {
                count = count + 1;
            }
            if (System.Text.RegularExpressions.Regex.Match(objModel.txtPhoneNumber.ToString(), "[5-9]{1}[0-9]{9}").Success)
            {
                count = count + 1;
            }
            if (System.Text.RegularExpressions.Regex.IsMatch(objModel.txtVillage, s))
            {
                count = count + 1;
            }


            GDictionaryModel GDOBJ = new GDictionaryModel();

            if (count == 7)
            {
                ManagementServiceWrapper  ObjService = new ManagementServiceWrapper();
                InformationServiceWrapper infoObj    = new InformationServiceWrapper();
                GDOBJ = infoObj.MobileNumberVerification(objModel.txtPhoneNumber);
                if (GDOBJ.ID == 1)
                {
                    UserId = ObjService.InsertAddUserDetails(objModel);
                    if (UserId != 0)
                    {
                        HttpCookie KeyCookie = new HttpCookie("_RRPS");
                        KeyCookie.Values["_RRPS"] = en.Encrypt(objModel.txtPassword);
                        KeyCookie.Expires         = DateTime.Now.AddDays(365);
                        Response.Cookies.Add(KeyCookie);
                    }
                    return(Json(UserId, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    ViewBag.MobileError = "Entered Mobiler Number is already registered";
                    return(Json(GDOBJ.ID, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                GDOBJ.ID = -1;
                return(Json(GDOBJ.ID, JsonRequestBehavior.AllowGet));
            }
        }
Пример #19
0
        public ActionResult AdPostByAdmin(FormCollection fnPost)
        {
            int        AdId       = 0;
            HttpCookie nameCookie = Request.Cookies["_RRAUN"];

            if (nameCookie != null)
            {
                ManagementServiceWrapper ObjService = new ManagementServiceWrapper();
                AdDetailsModel           obj        = new AdDetailsModel();
                obj.Category           = fnPost["ddlCategoryText"];
                obj.txtSubCategoryName = fnPost["txtSubCategoryName"];
                obj.txtAdDescription   = fnPost["txtAdDescription"];
                obj.txtPrice           = Convert.ToInt32(fnPost["txtPrice"]);
                obj.txtQuantity        = Convert.ToInt32(fnPost["txtQuantity"]);
                obj.SellingUnit        = fnPost["ddlUnitText"];
                obj.MobileNuber        = Convert.ToInt64(fnPost["txtPhoneNumber"]);
                if (obj.Category == "Fruit" || obj.Category == "Handloom" || obj.Category == "Equipment" || obj.Category == "Vegetable" || obj.Category == "Others")
                {
                    obj.txtSubCategoryName = obj.txtSubCategoryName;
                }
                else
                {
                    obj.txtSubCategoryName = obj.Category;
                }

                string s     = "[^<>'\"/`%-]";
                int    count = 0;

                if (System.Text.RegularExpressions.Regex.IsMatch(obj.Category, "^[a-zA-Z0-9 .]"))
                {
                    count = count + 1;
                }
                if (System.Text.RegularExpressions.Regex.IsMatch(obj.txtSubCategoryName, s))
                {
                    count = count + 1;
                }
                if (System.Text.RegularExpressions.Regex.IsMatch(obj.txtAdDescription, s))
                {
                    count = count + 1;
                }

                if (System.Text.RegularExpressions.Regex.IsMatch(obj.SellingUnit, "^[a-zA-Z0-9 .]"))
                {
                    count = count + 1;
                }
                if (Regex.Match(obj.txtPrice.ToString(), "[1-9]").Success)
                {
                    count = count + 1;
                }
                if (Regex.Match(obj.txtQuantity.ToString(), "[1-9]").Success)
                {
                    count = count + 1;
                }

                if (count == 6)
                {
                    AdId = ObjService.InsertAdPostByAdmin(obj);
                    return(Json(AdId, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    AdId = -1;
                    return(Json(AdId, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Admin"));
            }
        }