コード例 #1
0
        public ActionResult Login(enUser enUser_)
        {
            var objBLUser = new blUser(enUser_);

            try
            {
                objBLUser.Read();
            }
            catch (Exception ex)
            {
                Log.Error("Hangout.UI.Account.Login() Error while Read() User  Exception:-" + ex.ToString());
            }

            if (enUser_.ID == 0)
            {
                ViewBag.Exception = true;
                Log.Info("Couldn't find user with EmailID - " + enUser_.E_Mail + "and Password - " + enUser_.Password, false);
                TempData["forgetPassword"] = "******";
                return(RedirectToAction("login", "account"));
            }
            else if (enUser_.Verified == false)
            {
                TempData["forgetPassword"] = "******";
                return(RedirectToAction("login", "account"));
            }

            #region ContestStatus
            var objENContestStatus = new enContestStatus()
            {
                ContestID = enUser_.ContestID, UserID = enUser_.ID
            };
            var objBLContestStatus = new blContestStatus(objENContestStatus);
            objBLContestStatus.Read();
            if (objENContestStatus.ID > 0)
            {
                objENContestStatus.Status = enUser_.Status;
                objBLContestStatus.Update();
            }
            else
            {
                if (enUser_.Status == true)
                {
                    objENContestStatus.Status = enUser_.Status;
                    objBLContestStatus.Create();
                }
            }
            #endregion

            Session["User_ID"] = enUser_.ID;
            HttpCookie loginCookie  = new HttpCookie("UILoginCookie");
            string     Key          = ConfigurationManager.AppSettings["EncryptKey"];
            var        Password     = Helper.EncryptString(enUser_.Password, Key);
            var        cookieDetail = new enCookieDetail {
                E_mail = enUser_.E_Mail, Password = Password, UserID = enUser_.ID
            };
            loginCookie.Value   = JsonConvert.SerializeObject(cookieDetail);
            loginCookie.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(loginCookie);
            return(RedirectToAction("About", "Content"));
        }
コード例 #2
0
        public JsonResult CheckAvailableMail(string mail_)
        {
            var objENUser = new enUser()
            {
                E_Mail = mail_
            };
            var objBLUser = new blUser(objENUser);

            try
            {
                objBLUser.Read();
            }
            catch (Exception ex)
            {
                Log.Error("Project1.UI.AccountController.ChechkAvailableUser()  Error while Read() User  Exception:" + ex.ToString());
            }

            if (objENUser.ID <= 0)
            {
                return(Json("f"));
            }
            else
            {
                return(Json("s"));
            }
        }
コード例 #3
0
        public void dbHandler(string name, string transtnID, string sponsorID, string amount, string email)
        {
            var objENPayment = new enPayment();

            objENPayment.Name           = name;
            objENPayment.Transection_ID = transtnID;
            objENPayment.Reference_Code = sponsorID;
            if (sponsorID == "empty")
            {
                objENPayment.Reference_Code = null;
            }
            objENPayment.Amount = Convert.ToSingle(amount);
            objENPayment.E_Mail = email;
            var objBLPayment = new blPayment(objENPayment);

            try
            {
                objBLPayment.Create();
            }
            catch (Exception ex)
            {
                Log.Error("HangOut.UI.PaymentController.dbHandler  Error while Create() Payment Exception:-" + ex.ToString());
            }

            if (sponsorID != "empty")
            {
                var objENUser = new enUser()
                {
                    Reference_Code = sponsorID
                };
                var objBLUser = new blUser(objENUser);
                try
                {
                    objBLUser.Read();
                }
                catch (Exception ex)
                {
                    Log.Error("Hangout.UI.PaymentController.dbHandler Error while Read() User  Exception:-" + ex.ToString());
                }

                if (objENUser.ID > 0)
                {
                    var objENReward = new enReward();
                    objENReward.Type    = (int)RewardType.ADVERTISEMENT;
                    objENReward.User_ID = objENUser.ID;
                    objENReward.Point   = (int)RewardPoints.ADVERTISEMENT;
                    var objBLReward = new blReward(objENReward);
                    try
                    {
                        objBLReward.Create();
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Hangout.UI.PaymentController.dbHandler Error while Create() Reward Exception:- " + ex.ToString());
                    }
                }
            }
        }
コード例 #4
0
        public ActionResult Index()
        {
            var objENUser = new enUser {
                ID = (int)Session["User_ID"]
            };
            var objBLUser = new blUser(objENUser);

            try
            {
                objBLUser.Read();
            }
            catch (Exception ex)
            {
                return(RedirectToAction("misc", "error"));
            }

            return(View(objENUser));
        }
コード例 #5
0
        public JsonResult GetProfile(int userID)
        {
            var objENUser = new enUser()
            {
                ID = userID
            };
            var objBLUser = new blUser(objENUser);

            try
            {
                objBLUser.Read();
            }
            catch (Exception ex)
            {
                Log.Error("Hangout.UI.QueryController.GetMember() Error while Read() User Excpetion:-" + ex.ToString());
                return(Json("null", JsonRequestBehavior.AllowGet));
            }
            return(Json(objENUser));
        }
コード例 #6
0
        public ActionResult VerifyUser(string str)
        {
            var objENUser = new enUser()
            {
                VerificationCode = str
            };
            var objBLUser = new blUser(objENUser);

            try
            {
                objBLUser.Read();
            }
            catch (Exception ex)
            {
                Log.Error("UI.AccountController.VerifyCode.Error while Read() User Exception: " + ex.ToString());
            }

            if (objENUser.ID > 0)
            {
                try
                {
                    if (objENUser.Verified == false)
                    {
                        objENUser.Verified = true;
                        objBLUser.Update();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("UI.AccountController.VerifyCode(). Error while Update User  Exception:" + ex.ToString());
                    RedirectToAction("error", "misc");
                }
            }
            else
            {
                TempData["forgetPassword"] = "******";
                return(RedirectToAction("login", "account"));
            }

            TempData["forgetPassword"] = "******";
            return(RedirectToAction("login", "account"));
        }
コード例 #7
0
        public ActionResult Registration(enUser enUser_)
        {
            var objENUser = new enUser();

            enUser_.Reference_Code   = Helper.GetRandomAlphaNumericPassword();
            enUser_.VerificationCode = Helper.GetRandomAlphaNumericPassword();

            var objBLUser = new blUser(enUser_);

            try
            {
                objBLUser.Create();
            }
            catch (Exception ex)
            {
                Log.Error("Hangout.UI.Account.Login() Error while Create() User  Exception:-" + ex.ToString());
                RedirectToAction("error", "misc");
            }

            if (enUser_.Sponsor_ID != null)
            {
                objENUser = new enUser()
                {
                    Reference_Code = enUser_.Sponsor_ID
                };
                objBLUser = new blUser(objENUser);
                try
                {
                    objBLUser.Read();
                }
                catch (Exception ex)
                {
                    Log.Error("Hangout.UI.Account.Login() Error while Read() User  Exception:-" + ex.ToString());
                    RedirectToAction("error", "misc");
                }

                if (objENUser.ID > 0)
                {
                    var Point = (int)RewardPoints.OTHER_MEMBER;
                    if (objENUser.Country == (int)CountryCode.India)
                    {
                        Point = (int)RewardPoints.IN_MEMBER;
                    }
                    var objENReward = new enReward()
                    {
                        Point = Point, Type = (int)RewardType.MEMBER, User_ID = objENUser.ID
                    };
                    var objBLReward = new blReward(objENReward);
                    try
                    {
                        objBLReward.Create();
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Hangout.UI.Account.Login() Error while Read() User  Exception:-" + ex.ToString());
                        RedirectToAction("error", "misc");
                    }

                    #region ContestStatus
                    var objENContestStatus = new enContestStatus()
                    {
                        ContestID = enUser_.ContestID, UserID = enUser_.ID, Status = enUser_.Status
                    };
                    var objBLContestStatus = new blContestStatus(objENContestStatus);
                    objBLContestStatus.Create();
                    #endregion
                }
            }

            //Shoot Mail to verify User
            bool status = Helper.SendVerificationCodeToMail(enUser_.E_Mail, enUser_.VerificationCode);
            if (!status)
            {
                Log.Error("Hangout.UI.Account.Login() Error while Read() User");
                TempData["forgetPassword"] = "******";
                return(RedirectToAction("login", "user"));
            }

            objENUser = new enUser()
            {
                Reference_Code = enUser_.Reference_Code
            };
            objBLUser = new blUser(objENUser);
            try
            {
                objBLUser.Read();
            }
            catch (Exception ex)
            {
                Log.Error("Hangout.UI.Account.Login() Error while Read() User  Exception:-" + ex.ToString());
                return(RedirectToAction("error", "misc"));
            }
            TempData["forgetPassword"] = "******";
            return(RedirectToAction("login", "account"));
        }
コード例 #8
0
        public ActionResult Index(enAdvertisement enAdvertisement_)
        {
            //Reward Section
            if (enAdvertisement_.AdvertisementImage != null)
            {
                if (enAdvertisement_.Reference_Code != null)
                {
                    var objENUser = new enUser()
                    {
                        Reference_Code = enAdvertisement_.Reference_Code
                    };
                    var objBLUser = new blUser(objENUser);
                    try
                    {
                        objBLUser.Read();
                    }
                    catch (Exception ex)
                    {
                        return(RedirectToAction("error", "misc"));
                    }

                    if (objENUser.ID > 0)
                    {
                        var objENReward = new enReward();
                        objENReward.User_ID = objENUser.ID;
                        objENReward.Point   = (int)RewardPoints.ADVERTISEMENT;
                        objENReward.Type    = (int)RewardType.ADVERTISEMENT;
                        var objBLReward = new blReward(objENReward);
                        try
                        {
                            objBLReward.Create();
                        }
                        catch (Exception ex)
                        {
                            return(RedirectToAction("error", "misc"));
                        }

                        var objENPayment = new enPayment();
                        objENPayment.Name           = objENUser.Name;
                        objENPayment.E_Mail         = objENUser.E_Mail;
                        objENPayment.Reference_Code = objENUser.Reference_Code;
                        objENPayment.Amount         = enAdvertisement_.Amount;
                        var objBLPayment = new blPayment(objENPayment);
                        try
                        {
                            objBLPayment.Create();
                        }
                        catch (Exception ex)
                        {
                            return(RedirectToAction("error", "misc"));
                        }
                    }
                }

                enAdvertisement_.Image_Name = Path.GetFileName(enAdvertisement_.AdvertisementImage.FileName);
                enAdvertisement_.Image_Name = Helper.GetRandomAlphaNumericSMSToken() + "-" + enAdvertisement_.Image_Name;
                var objBLAdvertisement = new blAdvertisement(enAdvertisement_);
                try
                {
                    string extension = Path.GetExtension(enAdvertisement_.AdvertisementImage.FileName);
                    var    path      = Path.Combine(Server.MapPath(Helper.AdvertisementImagePath()) + enAdvertisement_.Image_Name);
                    bool   exist     = Directory.Exists(Server.MapPath(Helper.AdvertisementImagePath()));
                    if (!exist)
                    {
                        Directory.CreateDirectory(Server.MapPath(Helper.AdvertisementImagePath()));
                    }
                    enAdvertisement_.AdvertisementImage.SaveAs(path);
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("error", "misc"));
                }
                try
                {
                    objBLAdvertisement.Create();
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("error", "misc"));
                }
            }
            else
            {
                return(RedirectToAction("error", "misc"));
            }

            return(RedirectToAction("list"));
        }