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());
                    }
                }
            }
        }
Beispiel #2
0
        public ActionResult Payment()
        {
            var objENPayment = new enPayment();
            var objBLPayment = new blPayment(objENPayment);
            List <enPayment> listOfPayments = new List <enPayment>();

            try
            {
                listOfPayments = objBLPayment.ReadAll();
            }
            catch (Exception ex)
            {
                return(RedirectToAction("error", "misc"));
            }
            return(View(listOfPayments));
        }
Beispiel #3
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"));
        }