コード例 #1
0
 private void ConstructObject(IDataReader dr_, enReward enReward_)
 {
     enReward_.ID         = Convert.ToInt32(dr_["ID"]);
     enReward_.Point      = Convert.ToInt32(dr_["Point"]);
     enReward_.Type       = Convert.ToInt32(dr_["Type"]);
     enReward_.User_ID    = Convert.ToInt32(dr_["User_ID"]);
     enReward_.InsertedOn = Convert.ToDateTime(dr_["InsertedOn"]);
 }
コード例 #2
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());
                    }
                }
            }
        }
コード例 #3
0
        public List <enReward> ReadAll(int?startRowIndex_ = null, int?endRowIndex_ = null)
        {
            var listOfRewards = new List <enReward>();

            using (IDataReader idr = base.Read(_enReward.ID, _enReward.User_ID, null, null))
            {
                while (idr.Read())
                {
                    var objENReward = new enReward();
                    ConstructObject(idr, objENReward);
                    listOfRewards.Add(objENReward);
                    _enReward.IsGetSuccess = true;
                }
            }
            return(listOfRewards);
        }
コード例 #4
0
        public JsonResult QueryConfirmation(int qID, int t_type, int confType)
        {
            var Point_ = (int)RewardPoints.TOPIC;
            var Type_  = (int)RewardType.TOPIC;

            if (t_type == 1)
            {
                Point_ = (int)RewardPoints.IDEA;
                Type_  = (int)RewardType.IDEA;
            }

            if (confType == 1)
            {
                var objENReward = new enReward()
                {
                    User_ID = qID, Point = Point_, Type = Type_
                };
                var objBLReward = new blReward(objENReward);
                try
                {
                    objBLReward.Create();
                }
                catch (Exception ex)
                {
                    return(Json("failure", JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var objENQuery = new enQuery()
                {
                    ID = qID
                };
                var objBLQuery = new blQuery(objENQuery);
                try
                {
                    objBLQuery.Delete();
                }
                catch (Exception ex)
                {
                    return(Json("failure", JsonRequestBehavior.AllowGet));
                }
            }

            return(Json("success", JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public JsonResult GetPoints(int userID)
        {
            var objENReward = new enReward()
            {
                User_ID = userID
            };
            var             objBLReward   = new blReward(objENReward);
            List <enReward> listOfRewards = new List <enReward>();

            try
            {
                listOfRewards = objBLReward.ReadAll();
            }
            catch (Exception ex)
            {
                Log.Error("Hangout.UI.QueryController.GetMember() Error while ReadAll() Reward Excpetion:-" + ex.ToString());
                return(Json("null", JsonRequestBehavior.AllowGet));
            }

            var objENRewardPoints = new RewardPoint();

            foreach (var item in listOfRewards)
            {
                if (item.Type == (int)RewardType.ADVERTISEMENT)
                {
                    objENRewardPoints.AdvertisePoint += item.Point;
                }
                else if (item.Type == (int)RewardType.IDEA)
                {
                    objENRewardPoints.IdeaPoint += item.Point;
                }
                else if (item.Type == (int)RewardType.MEMBER)
                {
                    objENRewardPoints.MemberPoint += item.Point;
                }
                else if (item.Type == (int)RewardType.TOPIC)
                {
                    objENRewardPoints.TopicPoint += item.Point;
                }
                else if (item.Type == (int)RewardType.WINNER)
                {
                    objENRewardPoints.WinnerPoint += item.Point;
                }
            }
            return(Json(objENRewardPoints, JsonRequestBehavior.AllowGet));
        }
コード例 #6
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"));
        }
コード例 #7
0
 public dlReward(enReward enReward_)
     : base("Reward")
 {
     this._enReward = enReward_;
 }
コード例 #8
0
 public blReward(enReward enReward_)
 {
     this._enReward = enReward_;
 }
コード例 #9
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"));
        }
コード例 #10
0
        public ActionResult Index(int id)
        {
            #region Category
            var objENCategory = new enCategory()
            {
                ID = id
            };
            var objBLCategory = new blCategory(objENCategory);
            try
            {
                objBLCategory.Read();
            }
            catch (Exception ex)
            {
                throw;
            }
            ViewBag.Title = objENCategory.Name;
            #endregion

            var objENDebate = new enDebate()
            {
                Category_ID = id
            };
            var             objBLDebate   = new blDebate(objENDebate);
            List <enDebate> listOfDebates = new List <enDebate>();
            try
            {
                listOfDebates = objBLDebate.ReadAllAndAggregate(null, null, typeof(enUser));
            }
            catch (Exception ex)
            {
                Log.Error("Hang-Out.UI.DebateController.Index() Error while Read() Debate  Exception:- " + ex.ToString());
            }

            foreach (var item in listOfDebates)
            {
                if (item.Date.Date < DateTime.Now.Date)
                {
                    if (item.IsActive != false)
                    {
                        var objENLikeCounter = new enLikeCounter()
                        {
                            Debate_ID = item.ID
                        };
                        var objBLLikeCounter = new blLikeCounter(objENLikeCounter);
                        List <enLikeCounter> listOfLikesCounter = new List <enLikeCounter>();
                        try
                        {
                            listOfLikesCounter = objBLLikeCounter.ReadAll();
                            if (listOfLikesCounter.Count > 0)
                            {
                                var maxRepeated = listOfLikesCounter.GroupBy(s => s.User_ID).OrderByDescending(s => s.Count()).First().Key;
                                int count       = listOfLikesCounter.FindAll(x => x.User_ID == Convert.ToInt32(maxRepeated)).Count;
                                if (Convert.ToInt32(count) > 0)
                                {
                                    var objENReward = new enReward();
                                    objENReward.Point   = 50;
                                    objENReward.Type    = (int)RewardType.WINNER;
                                    objENReward.User_ID = Convert.ToInt32(maxRepeated);
                                    var objBLReward = new blReward(objENReward);
                                    try
                                    {
                                        objBLReward.Create();
                                    }
                                    catch (Exception ex)
                                    {
                                        Log.Error("Hang-Out.UI.DebateController.Index() Error while Create() Reward  Exception:-" + ex.ToString());
                                        return(RedirectToAction("error", "misc"));
                                    }

                                    item.IsActive   = false;
                                    item.LikesCount = count;
                                    item.User_ID    = maxRepeated;
                                    objBLDebate     = new blDebate(item);
                                    try
                                    {
                                        objBLDebate.Update();
                                    }
                                    catch (Exception ex)
                                    {
                                        Log.Error("Hang-Out.UI.DebateController.Index() Error while Update() Debate  Exception:-" + ex.ToString());
                                        return(RedirectToAction("error", "misc"));
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Hang-Out.UI.DebateController.Index() Error while Read() LikeCounter  Exception:-" + ex.ToString());
                            return(RedirectToAction("error", "misc"));
                        }
                    }
                }
                else if (item.Date.Date == DateTime.Now.Date)
                {
                    if (item.Start <= DateTime.Now.TimeOfDay && item.End >= DateTime.Now.TimeOfDay)
                    {
                        item.IsActive = true;
                    }
                    else if (item.Start <= DateTime.Now.TimeOfDay && item.End <= DateTime.Now.TimeOfDay)
                    {
                        if (item.IsActive != false)
                        {
                            item.IsActive = false;
                            var objENLikeCounter = new enLikeCounter()
                            {
                                Debate_ID = item.ID
                            };
                            var objBLLikeCounter = new blLikeCounter(objENLikeCounter);
                            List <enLikeCounter> listOfLikesCounter = new List <enLikeCounter>();
                            try
                            {
                                listOfLikesCounter = objBLLikeCounter.ReadAll();
                                if (listOfLikesCounter.Count > 0)
                                {
                                    var maxRepeated = listOfLikesCounter.GroupBy(s => s.User_ID).OrderByDescending(s => s.Count()).First().Key;
                                    int count       = listOfLikesCounter.FindAll(x => x.User_ID == Convert.ToInt32(maxRepeated)).Count;
                                    if (Convert.ToInt32(count) > 0)
                                    {
                                        var objENReward = new enReward();
                                        objENReward.Point   = 50;
                                        objENReward.Type    = (int)RewardType.WINNER;
                                        objENReward.User_ID = Convert.ToInt32(maxRepeated);
                                        var objBLReward = new blReward(objENReward);
                                        try
                                        {
                                            objBLReward.Create();
                                        }
                                        catch (Exception ex)
                                        {
                                            Log.Error("Hang-Out.UI.DebateController.Index() Error while Create() Reward  Exception:-" + ex.ToString());
                                            return(RedirectToAction("error", "misc"));
                                        }
                                        item.LikesCount = count;
                                        item.User_ID    = maxRepeated;
                                        objBLDebate     = new blDebate(item);
                                        try
                                        {
                                            objBLDebate.Update();
                                        }
                                        catch (Exception ex)
                                        {
                                            Log.Error("Hang-Out.UI.DebateController.Index() Error while Update() Debate  Exception:-" + ex.ToString());
                                            return(RedirectToAction("error", "misc"));
                                        }
                                    }
                                }
                                else
                                {
                                    objBLDebate = new blDebate(item);
                                    try
                                    {
                                        objBLDebate.Update();
                                    }
                                    catch (Exception ex)
                                    {
                                        Log.Error("Hangout.UI.DebateControl.Index() error while Update() Debate Exception:-" + ex.ToString());
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Log.Error("Hang-Out.UI.DebateController.Index() Error while Read() LikeCounter  Exception:-" + ex.ToString());
                                return(RedirectToAction("error", "misc"));
                            }
                        }
                    }
                    else
                    {
                        item.IsActive = false;
                    }
                }
                else
                {
                    item.IsActive = false;
                }
            }
            return(View(listOfDebates));
        }