Ejemplo n.º 1
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            string value;
            decimal number;
            int workshopID = 0;
            int ProductID = 0;

            value = txtCost.Text;

            if (!Decimal.TryParse(value, out number))
            {

                lblCostErrorMessage.Text = "invalid  tuition value entered";
                lblCostErrorMessage.Visible = true;
                return;
            }

            if (!string.IsNullOrEmpty(txtDeposit.Text))
            {
                value = txtDeposit.Text;

                if (!Decimal.TryParse(value, out number))
                {

                    lblCostErrorMessage.Text = "invalid  deposit value entered";
                    lblCostErrorMessage.Visible = true;
                    return;
                }
            }

            var m = Request.QueryString["new"];
            if (!string.IsNullOrEmpty(m))
            {
                if (m == "yes")
                {
                    workshopID = 0;
                }
                else
                {
                    if (!string.IsNullOrEmpty(lstWorkShops.SelectedValue.ToString()))
                    {
                        workshopID = Int32.Parse(lstWorkShops.SelectedValue.ToString());
                    }
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(lstWorkShops.SelectedValue.ToString()))
                {
                    workshopID = Int32.Parse(lstWorkShops.SelectedValue.ToString());
                }
            }

            if (!string.IsNullOrEmpty(txtProductID.Text))
            {
                ProductID = 0;
            }

            CMEDWorkshop workshop = new CMEDWorkshop
            {
                Active = chkActive.Checked,
                Archive = ChkArchive.Checked,
                CanPurchase = chkCanPurchase.Checked,
                DepositOn = chkTurnOffDeposit.Checked,
                MealCostOn = chkTurnMealCost.Checked,
                DateLine = txtDateLine.Text,
                FullImageUrl = txtMainPhoto.SelectedValue,
                ID = workshopID,
                Location = txtLocation.Text,
                LongDescription = FreeTextBox1.Text,
                PurchaseDescription = FreeTextBox2.Text,
                Cost = Decimal.Parse(txtCost.Text),
                MealsCost = Decimal.Parse(txtMealDeposit.Text),
                MealsCount = Int32.Parse(txtMealsCount.Text),
                RegisterURL = txtPurchaseUrl.Text,
                ShortDescription = FreeTextBox3.Text,
                ThumbNailImageUrl = txtThumbNail.SelectedValue,
                Title = txtTitle.Text,
                Deposit = Decimal.Parse(txtDeposit.Text),
                SubTitle = txtSubTitle.Text,
                Prerequisite = txtPrerequisite.Text,
                ProductID = ProductID,
                Sort = Int32.Parse(txtSort.Text),

            };

            try
            {
                controller.SaveCMEDWorkshop(workshop);

                BindDropDown();
                ClearForm();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public List<CMEDWorkshop> GetCMEDWorkshopsAll()
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetCMEDWorkshopsAll";

            DataTable dt = db.Execute(cmd);

            List<CMEDWorkshop> Items = new List<CMEDWorkshop>();

            foreach (DataRow dr in dt.Rows)
            {
                CMEDWorkshop Item = new CMEDWorkshop
                {
                    ID = Int32.Parse(dr["ID"].ToString()),
                    Title = dr["Title"].ToString(),
                    SubTitle = dr["SubTitle"].ToString(),
                    Location = dr["Location"].ToString(),
                    DateLine = dr["DateLine"].ToString(),
                    Prerequisite = dr["Prerequisite"].ToString(),
                    ShortDescription = dr["ShortDescription"].ToString(),
                    LongDescription = dr["LongDescription"].ToString(),
                    PurchaseDescription = dr["PurchaseDescription"].ToString(),
                    Cost = Decimal.Parse(dr["Cost"].ToString()),
                    MealsCost = Decimal.Parse(dr["MealsCost"].ToString()),
                    MealsCount = Int32.Parse(dr["MealsCount"].ToString()),
                    Deposit = Decimal.Parse(dr["Deposit"].ToString()),
                    RegisterURL = dr["RegisterURL"].ToString(),
                    ThumbNailImageUrl = dr["ThumbNailImageUrl"].ToString(),
                    FullImageUrl = dr["FullImageUrl"].ToString(),
                    Active = Boolean.Parse(dr["Active"].ToString()),
                    Archive = Boolean.Parse(dr["Archive"].ToString()),
                    DepositOn = Boolean.Parse(dr["DepositOn"].ToString()),
                    MealCostOn = Boolean.Parse(dr["MealCostOn"].ToString()),
                    Sort = Int32.Parse(dr["Sort"].ToString()),
                    ProductID = Int32.Parse(dr["ProductID"].ToString()),
                };

                Items.Add(Item);

            }

            return Items;
        }
Ejemplo n.º 3
0
        public void SaveCMEDWorkshop(CMEDWorkshop worshop)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SaveCMEDWorkshop";

            cmd.Parameters.AddWithValue("@ID", worshop.ID);
            cmd.Parameters.AddWithValue("@ProductID", worshop.ProductID);
            cmd.Parameters.AddWithValue("@Title", worshop.Title);
            cmd.Parameters.AddWithValue("@SubTitle", worshop.SubTitle);
            cmd.Parameters.AddWithValue("@Location", worshop.Location);
            cmd.Parameters.AddWithValue("@DateLine", worshop.DateLine);
            cmd.Parameters.AddWithValue("@Prerequisite", worshop.Prerequisite);
            cmd.Parameters.AddWithValue("@ShortDescription", worshop.ShortDescription);
            cmd.Parameters.AddWithValue("@LongDescription", worshop.LongDescription);
            cmd.Parameters.AddWithValue("@PurchaseDescription", worshop.PurchaseDescription);
            cmd.Parameters.AddWithValue("@RegisterURL", worshop.RegisterURL);
            cmd.Parameters.AddWithValue("@ThumbNailImageUrl", worshop.ThumbNailImageUrl);
            cmd.Parameters.AddWithValue("@FullImageUrl", worshop.FullImageUrl);
            cmd.Parameters.AddWithValue("@Cost", worshop.Cost);
            cmd.Parameters.AddWithValue("@MealsCost", worshop.MealsCost);
            cmd.Parameters.AddWithValue("@MealsCount", worshop.MealsCount);
            cmd.Parameters.AddWithValue("@Deposit", worshop.Deposit);
            cmd.Parameters.AddWithValue("@Active", worshop.Active);
            cmd.Parameters.AddWithValue("@Archive", worshop.Archive);
            cmd.Parameters.AddWithValue("@Sort", worshop.Sort);
            cmd.Parameters.AddWithValue("@DepositOn", worshop.DepositOn);
            cmd.Parameters.AddWithValue("@MealCostOn", worshop.MealCostOn);
            cmd.Parameters.AddWithValue("@CanPurchase", worshop.CanPurchase);

            db.Execute(cmd);

            return;
        }
Ejemplo n.º 4
0
        public CMEDWorkshop GetCMEDWorkShop(int workshop_id)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetCMEDWorkShop";
            cmd.Parameters.AddWithValue("@ID", workshop_id);

            DataTable dt = db.Execute(cmd);

            DataRow dr = dt.Rows[0];

            CMEDWorkshop workShop = new CMEDWorkshop
            {
                ID = Int32.Parse(dr["ID"].ToString()),
                Title = dr["Title"].ToString(),
                SubTitle = dr["SubTitle"].ToString(),
                Location = dr["Location"].ToString(),
                DateLine = dr["DateLine"].ToString(),
                Prerequisite = dr["Prerequisite"].ToString(),
                ShortDescription = dr["ShortDescription"].ToString(),
                LongDescription = dr["LongDescription"].ToString(),
                PurchaseDescription = dr["PurchaseDescription"].ToString(),
                Cost = Decimal.Parse(dr["Cost"].ToString()),
                MealsCost = Decimal.Parse(dr["MealsCost"].ToString()),
                MealsCount = Int32.Parse(dr["MealsCount"].ToString()),
                Deposit = Decimal.Parse(dr["Deposit"].ToString()),
                RegisterURL = dr["RegisterURL"].ToString(),
                ThumbNailImageUrl = dr["ThumbNailImageUrl"].ToString(),
                FullImageUrl = dr["FullImageUrl"].ToString(),
                Active = Boolean.Parse(dr["Active"].ToString()),
                Archive = Boolean.Parse(dr["Archive"].ToString()),
                CanPurchase = Boolean.Parse(dr["CanPurchase"].ToString()),
                DepositOn = Boolean.Parse(dr["DepositOn"].ToString()),
                MealCostOn = Boolean.Parse(dr["MealCostOn"].ToString()),
                Sort = Int32.Parse(dr["Sort"].ToString()),
                ProductID = Int32.Parse(dr["ProductID"].ToString()),

            };

            return workShop;
        }
Ejemplo n.º 5
0
        protected void RegisterButton_Click(object sender, ImageClickEventArgs e)
        {
            var id = txtID.Value;

            if (Request.Cookies["email"] == null)
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.RedirectToLoginPage();

            }

            var email = Request.Cookies["email"].Value;

            CMEDWorkShopBalance objbalance = controller.GetCMEDWorkShopBalancePayment(Convert.ToInt32(id), email.ToString());
            workshop = controller.GetCMEDWorkShop(Convert.ToInt32(id));

            if (!string.IsNullOrEmpty(id))
            {
                if (Helper.IsNumeric(id))
                {

                    Price = Convert.ToInt32(objbalance.balance);

                }
                else
                {
                    Response.Redirect("http://www.myss.com/");
                }

                var amt = 0m;

                try
                {

                    decimal charge = Price;

                    if (charge > 0)
                    {
                        long ShoppingCartID = controller.IssueNewGlobalID();

                        try
                        {
                            controller.SaveCartItem(workshop.ProductID, Price, ShoppingCartID, EmailTextBox.Text.Trim(), GetUserIP());
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }

                        string auth_status = string.Empty;
                        string auth_code = string.Empty;
                        string auth_message = string.Empty;
                        string auth_response_code = string.Empty;
                        string auth_transaction_id = string.Empty;

                        CMEDShopTransaction transaction = new CMEDShopTransaction
                        {
                            order_id = ShoppingCartID,
                            first_name = FirstNameTextBox.Text,
                            last_name = LastNameTextBox.Text,
                            address = AddressTextBox.Text,
                            city = CityTextBox.Text,
                            state = State.SelectedValue,
                            postal_code = ZipTextBox.Text,
                            email = EmailTextBox.Text,
                            phone_number = PhoneNumberTextBox.Text,
                            transaction_type = "Credit Card",
                            status = "Status"
                        };

                        try
                        {

                            long transaction_id = controller.CreateCMEDShopTransaction(transaction);

                            CreateCharge(out auth_status,
                                         out auth_code,
                                         out auth_message,
                                         out auth_response_code,
                                         out auth_transaction_id,
                                         out amt,
                                         charge,
                                         transaction_id);

                            controller.UpateCMEDShopTransaction(transaction_id,
                                                                auth_status,
                                                                auth_code,
                                                                auth_message,
                                                                auth_response_code,
                                                                auth_transaction_id);

                            long order_id = controller.CreateOrderFromCart(ShoppingCartID);

                            HttpCookie Checkout = new HttpCookie("Confirmation");
                            Checkout["Email"] = transaction.email;
                            Checkout["WorkShopName"] = workshop.Title;
                            Checkout.Expires = DateTime.Now.AddMinutes(30);
                            Response.Cookies.Add(Checkout);

                            Util.SendWelcomeMailWorkShopBalance(transaction, amt, workshop.Title);

                            String s = "CMEDWorkshopPurchaseThankYou.aspx";

                            Response.Redirect(s);
                        }
                        catch (Exception ex)
                        {
                            string error = ex.Message;
                            lblErrorMessage.Text = "Unable to create customer record, please contact myss.com support:  ";
                            return;
                        }
                    }

                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                    lblErrorMessage.Text = "Unable to process your credit card. Please verify the information or try another card. ";
                    return;
                }

            }
        }
Ejemplo n.º 6
0
        protected void btn_SubmitPaypal_Click(object sender, ImageClickEventArgs e)
        {
            var id = txtID.Value;

            if (Request.Cookies["email"] == null)
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.RedirectToLoginPage();

            }

            var email = Request.Cookies["email"].Value;

            CMEDWorkShopBalance objbalance = controller.GetCMEDWorkShopBalancePayment(Convert.ToInt32(id), email.ToString());
            workshop = controller.GetCMEDWorkShop(Convert.ToInt32(id));

            if (!string.IsNullOrEmpty(id))
            {
                if (Helper.IsNumeric(id))
                {

                    Price = Convert.ToInt32(objbalance.balance);

                }
                else
                {
                    Response.Redirect("http://www.myss.com/");
                }

                long ShoppingCartID = controller.IssueNewGlobalID();
                Response.Cookies["ShoppingCartID"].Value = ShoppingCartID.ToString();

                try
                {
                    controller.SaveCartItem(workshop.ProductID, Price, ShoppingCartID, EmailTextBox.Text.Trim(), GetUserIP());
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                string auth_status = string.Empty;
                string auth_code = string.Empty;
                string auth_message = string.Empty;
                string auth_response_code = string.Empty;
                string auth_transaction_id = string.Empty;

                CMEDShopTransaction transaction = new CMEDShopTransaction
                {
                    order_id = ShoppingCartID,
                    first_name = FirstNameTextBox.Text,
                    last_name = LastNameTextBox.Text,
                    address = AddressTextBox.Text,
                    city = CityTextBox.Text,
                    state = State.SelectedValue,
                    postal_code = ZipTextBox.Text,
                    email = EmailTextBox.Text,
                    phone_number = PhoneNumberTextBox.Text,
                    transaction_type = "Credit Card",
                    status = "in-progress"
                };

                try
                {
                    if (Request.Cookies["TransactionID"] == null)
                    {
                        long transaction_id = controller.CreateCMEDShopTransaction(transaction);

                        //write the cookie of transaction_id for use later
                        Response.Cookies["TransactionID"].Value = transaction_id.ToString();

                    }

                    Cart cart = controller.LoadCart(ShoppingCartID);
                    if (cart.order_amount == 0)
                    {
                        Response.Redirect(redirectPage);
                    }

                    NVPAPICaller payPalCaller = new NVPAPICaller();
                    string retTokenMsg = "";
                    string token = "";
                    NVPCodec decoder = new NVPCodec();
                    string amt01 = cart.order_amount.ToString();

                    bool retToken = payPalCaller.ShortcutExpressCheckout(amt01, ShoppingCartID, ref token, ref retTokenMsg, true);
                    if (retToken)
                    {
                        HttpContext.Current.Session["token"] = token;
                        Response.Redirect(retTokenMsg);
                    }
                    else
                    {
                        lblErrorMessage.Text = "PayPal is not responding, please try again in a few moments.";
                    }

                }
                catch (Exception ex)
                {

                    throw ex;

                }

            }
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var PayPalEnabled = Convert.ToBoolean(ConfigurationManager.AppSettings["PayPalEnabled"]);
            if (PayPalEnabled)
            {

                pnlCreditCard.Enabled = false;
                pnlCreditCard.Visible = false;
                RegisterButton.Visible = false;
                btn_SubmitPaypal.Visible = false;
            }
            else
            {
                pnlCreditCard.Visible = true;
                RegisterButton.Visible = true;
                PaymentMethod.Visible = false;
                lblPaymentMethod.Visible = false;
            }

            if (!IsPostBack)
            {
                var m = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(m))
                {
                    if (Helper.IsNumeric(m))
                    {
                        try
                        {
                            workshop = controller.GetCMEDWorkShop(Int32.Parse(m));
                            lblTitle.Text = workshop.Title;
                            lblDateline.Text = workshop.DateLine;
                            lblLocation.Text = workshop.Location;
                            txtID.Value = workshop.ID.ToString();

                            lnkOverView.NavigateUrl = "CMEDWorkshopDetail.aspx?id=" + workshop.ID.ToString();
                            lnkRegistration.NavigateUrl = "WorkshopPurchaseDetail.aspx?id=" + workshop.ID.ToString();

                            ID = workshop.ID;
                            Response.Cookies["WorkShopName"].Value = workshop.Title;

                            if (Request.Cookies["email"] == null)
                            {
                                FormsAuthentication.SignOut();
                                FormsAuthentication.RedirectToLoginPage();

                            }

                            var email = Request.Cookies["email"].Value;

                            CMEDWorkShopBalance objbalance = controller.GetCMEDWorkShopBalancePayment(ID, email.ToString());

                            if (objbalance.balance <= 0)
                            {
                                lblNoRegistration1.Text = "You have no balance to be paid off for this workshop.";
                                lblNoRegistration2.Text = "if you need more information , please contact David Smith at: ";
                                lblNoRegistration1.Visible = true;
                                lblNoRegistration2.Visible = true;
                                lblEmail.Visible = true;
                                lnkEmail.Visible = true;
                                pnlContent.Visible = false;
                                RegistrationTitle.Visible = false;

                                return;
                            }

                            if (objbalance.rowcount == 0)
                            {
                                lblNoRegistration1.Visible = true;
                                lblNoRegistration2.Visible = true;
                                lblEmail.Visible = true;
                                lnkEmail.Visible = true;
                                pnlContent.Visible = false;
                                RegistrationTitle.Visible = false;

                            }
                            else
                            {
                                FirstNameTextBox.Text = objbalance.first_name;
                                LastNameTextBox.Text = objbalance.last_name;
                                EmailTextBox.Text = objbalance.email;
                                AddressTextBox.Text = objbalance.address;
                                CityTextBox.Text = objbalance.city;
                                ZipTextBox.Text = objbalance.posta_code;
                                State.SelectedValue = objbalance.state;
                                PhoneNumberTextBox.Text = objbalance.phone_number;
                                pnlContent.Visible = true;
                            }

                            lblTotalCost.Text = objbalance.balance.ToString("C2");
                            lblBalance.Text = objbalance.balance.ToString("C2");
                            Response.Cookies["Balance"].Value = objbalance.balance.ToString();

                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }

                    }
                }
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var m = Request.QueryString["id"];
            if (!string.IsNullOrEmpty(m))
            {
                if (Helper.IsNumeric(m))
                {
                    try
                    {
                        workshop = controller.GetCMEDWorkShop(Int32.Parse(m));
                        lblTitle.Text = workshop.Title;
                        lblDateline.Text = workshop.DateLine;
                        lblLocation.Text = workshop.Location;
                        txtID.Value = workshop.ID.ToString();

                        lnkOverView.NavigateUrl = "CMEDWorkshopDetail.aspx?id=" + workshop.ID.ToString();
                        lnkRegistration.NavigateUrl = "WorkshopPurchaseDetail.aspx?id=" + workshop.ID.ToString();

                        ID = workshop.ID;

                        if (!IsPostBack)
                        {
                            PaymentDropDown.Items.Add(new ListItem { Text = "", Value = "" });
                            PaymentDropDown.Items.Add(new ListItem { Text = "Full Payment Option - " + String.Format("{0:C}", workshop.Cost), Value = workshop.Cost.ToString("#####.##") });

                            if (workshop.Deposit > 0 && workshop.DepositOn == false)
                            {
                                PaymentDropDown.Items.Add(new ListItem { Text = "Deposit Payment Option - " + String.Format("{0:C}", workshop.Deposit), Value = workshop.Deposit.ToString("#####.##") });

                            }

                            decimal balance = workshop.Cost - workshop.Deposit;
                            PaymentDropDown.Items.Add(new ListItem { Text = "Balance Payment - " + String.Format("{0:C}", balance), Value = balance.ToString("#####.##") });

                            if (workshop.MealsCost > 0 && workshop.MealCostOn == false)
                            {
                                PaymentDropDown.Items.Add(new ListItem { Text = "Meal Plan 7 Meals - " + String.Format("{0:C}", workshop.MealsCost), Value = workshop.MealsCost.ToString("#####.##") });
                            }
                        }

                        if (PaymentDropDown.SelectedValue.Length > 0)
                        {
                            string TotalCost = PaymentDropDown.SelectedItem.Text;

                            lblTotalCost.Text = TotalCost;
                        }
                        else
                        {
                            lblTotalCost.Text = string.Empty;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }

                }
            }
        }