private void AddSponsorship()
        {
            if (ChildID != Guid.Empty)
            {
                // grab off session once
                DataTable dt = this.cartData;
                //string id = Convert.ToString(Request.QueryString["id"]);

                // if the id is already in the cart, don't re-add it.
                DataRow[] check = dt.Select("id = '" + ChildID.ToString() + "'");
                if (check.Length == 0)
                {
                    DataFormLoadRequest opportunityRequest = OCM.BBISWebParts.WebsiteChildInfoViewForm.CreateRequest(this.API.AppFxWebServiceProvider);
                    opportunityRequest.FormID          = new Guid("9860f33f-efeb-478b-a312-f7e1c3bd4244");
                    opportunityRequest.RecordID        = ChildID.ToString();
                    opportunityRequest.ContextRecordID = ChildID.ToString();
                    OCM.BBISWebParts.WebsiteChildInfoViewFormData opportunity = OCM.BBISWebParts.WebsiteChildInfoViewForm.LoadData(this.API.AppFxWebServiceProvider, opportunityRequest);

                    DataRow dr = dt.NewRow();
                    dr["ID"]          = ChildID;
                    dr["Number"]      = opportunity.CHILDLOOKUPID;
                    dr["Name"]        = opportunity.CHILDNAME;
                    dr["Months"]      = 1;
                    dr["Amount"]      = Classes.Utility.GetSponsorshipAmount();
                    dr["Gender"]      = opportunity.GENDER;
                    dr["CountryName"] = opportunity.COUNTRYNAME;
                    dr["Birthdate"]   = opportunity.BIRTHDATE;
                    dt.Rows.Add(dr);

                    // add data back to session
                    this.cartData = dt;
                }
            }
        }
        private Boolean LockChild(Guid childID)
        {
            Boolean childLocked = false;

            try
            {
                string addDataForm = "b46fe5b4-0fbf-4dfc-8f9b-e6b19f281720";

                DataFormLoadRequest request = OCM.BBISWebParts.WebsiteChildLockAddDataForm.CreateLoadRequest(this.API.AppFxWebServiceProvider);
                request.FormID = new Guid(addDataForm);
                OCM.BBISWebParts.WebsiteChildLockAddDataFormData data = OCM.BBISWebParts.WebsiteChildLockAddDataForm.LoadData(this.API.AppFxWebServiceProvider, request);

                data.ContextRecordID = ChildID.ToString();
                data.SESSIONID       = Session.SessionID.ToString();

                // if this is successful, then the child was locked.
                data.Save(this.API.AppFxWebServiceProvider);

                // *****  this.LoadChildInfo(id);  *****


                if (ChildID != Guid.Empty)
                {
                    childLocked = true;
                }
            }

            catch (Exception ex)
            {
                // Determine if Child could not be locked
                if (ex.Message.ToString().Contains(LockError))
                {
                    if (ex.Message.ToString().Contains(LockUnsuccessful))
                    {
                        string childLockedPageURL = Utility.GetBBISPageUrl(MyContent.ChildLockedPageID) + "{0}id=" + ChildID;
                        childLockedPageURL = childLockedPageURL.IndexOf("?") > -1 ? String.Format(childLockedPageURL, "&") : String.Format(childLockedPageURL, "?");
                        Response.Redirect(childLockedPageURL, false);
                    }
                    else if (ex.Message.ToString().Contains(ChildNotEligible))
                    {
                        string childIneligiblePageURL = Utility.GetBBISPageUrl(MyContent.ChildIneligiblePageID) + "{0}id=" + ChildID;
                        childIneligiblePageURL = childIneligiblePageURL.IndexOf("?") > -1 ? String.Format(childIneligiblePageURL, "&") : String.Format(childIneligiblePageURL, "?");
                        Response.Redirect(childIneligiblePageURL, false);
                    }
                    else if (ex.Message.ToString().Contains(ChildNotReserved))
                    {
                        string childUnavailablePageURL = Utility.GetBBISPageUrl(MyContent.ChildUnavailablePageID) + "{0}id=" + ChildID;
                        childUnavailablePageURL = childUnavailablePageURL.IndexOf("?") > -1 ? String.Format(childUnavailablePageURL, "&") : String.Format(childUnavailablePageURL, "?");
                        Response.Redirect(childUnavailablePageURL, false);
                    }
                }
                else
                {
                    this.lblError.Text    = ex.Message + "<br /><br />" + ex.StackTrace;
                    this.lblError.Visible = true;
                }
            }

            return(childLocked);
        }
Beispiel #3
0
 public Form1()
 {
     InitializeComponent();
     panel1.BringToFront();
     stepIndex = 1;
     if (ChildID == -1)
     {
         ChildID = 1;
     }
     str = ChildID.ToString().PadLeft(8, '0');
     checkRemain();
 }
Beispiel #4
0
 public void CleanSelect()
 {
     textBox1.Text         = "";
     radioButton1.Checked  = false;
     radioButton2.Checked  = false;
     radioButton3.Checked  = false;
     radioButton4.Checked  = false;
     radioButton5.Checked  = false;
     radioButton6.Checked  = false;
     radioButton7.Checked  = false;
     radioButton8.Checked  = false;
     radioButton9.Checked  = false;
     radioButton10.Checked = false;
     radioButton11.Checked = false;
     radioButton12.Checked = false;
     ChildID++;
     str = ChildID.ToString().PadLeft(8, '0');
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.SetSponsorshipState();

                if (ChildID != Guid.Empty)
                {
                    try
                    {
                        // Check if there are any locks and if the child is available and eligible using the data list
                        // The GetRows method will throw an exception if the child is not available or not eligible

                        OCM.BBISWebParts.WebsiteChildLockDataListFilterData filter = new OCM.BBISWebParts.WebsiteChildLockDataListFilterData();
                        filter.SESSIONID = Session.SessionID.ToString();

                        OCM.BBISWebParts.WebsiteChildLockDataListRow[] childLocks = OCM.BBISWebParts.WebsiteChildLockDataList.GetRows(this.API.AppFxWebServiceProvider, ChildID.ToString(), filter);

                        // If are any rows, then there are locks that have not expired
                        if (childLocks.Length > 0)
                        {
                            string childLockedPageURL = Utility.GetBBISPageUrl(MyContent.ChildLockedPageID) + "{0}id=" + ChildID;
                            childLockedPageURL = childLockedPageURL.IndexOf("?") > -1 ? String.Format(childLockedPageURL, "&") : String.Format(childLockedPageURL, "?");
                            Response.Redirect(childLockedPageURL);
                        }
                        else
                        {
                            // If you make it to here, the child can be displayed
                            this.LoadChildInfo(ChildID);
                        }
                    }

                    catch (Exception ex)
                    {
                        // Determine if Child could not be locked
                        if (ex.Message.ToString().Contains(LockError))
                        {
                            if (ex.Message.ToString().Contains(ChildNotEligible))
                            {
                                string childIneligiblePageURL = Utility.GetBBISPageUrl(MyContent.ChildIneligiblePageID) + "{0}id=" + ChildID;
                                childIneligiblePageURL = childIneligiblePageURL.IndexOf("?") > -1 ? String.Format(childIneligiblePageURL, "&") : String.Format(childIneligiblePageURL, "?");
                                Response.Redirect(childIneligiblePageURL, false);
                            }
                            else if (ex.Message.ToString().Contains(ChildNotReserved))
                            {
                                string childUnavailablePageURL = Utility.GetBBISPageUrl(MyContent.ChildUnavailablePageID) + "{0}id=" + ChildID;
                                childUnavailablePageURL = childUnavailablePageURL.IndexOf("?") > -1 ? String.Format(childUnavailablePageURL, "&") : String.Format(childUnavailablePageURL, "?");
                                Response.Redirect(childUnavailablePageURL, false);
                            }
                        }
                        else
                        {
                            this.lblError.Text    = ex.Message + "<br /><br />" + ex.StackTrace;
                            this.lblError.Visible = true;
                        }
                    }

                    //try
                    //{

                    //    string addDataForm = "b46fe5b4-0fbf-4dfc-8f9b-e6b19f281720";

                    //    DataFormLoadRequest request = OCM.BBISWebParts.WebsiteChildLockAddDataForm.CreateLoadRequest(this.API.AppFxWebServiceProvider);
                    //    request.FormID = new Guid(addDataForm);
                    //    OCM.BBISWebParts.WebsiteChildLockAddDataFormData data = OCM.BBISWebParts.WebsiteChildLockAddDataForm.LoadData(this.API.AppFxWebServiceProvider, request);

                    //    data.ContextRecordID = id.ToString();
                    //    data.SESSIONID = Session.SessionID.ToString();

                    //    // if this is successful, then the child was locked.
                    //    data.Save(this.API.AppFxWebServiceProvider);

                    //    this.LoadChildInfo(id);
                    //}
                    //catch (Exception ex)
                    //{
                    //    // Determine if Child could not be locked
                    //    if (ex.Message.ToString().Contains(LockError))
                    //    {
                    //        if (ex.Message.ToString().Contains(LockUnsuccessful))
                    //        {
                    //            string childLockedPageURL = Utility.GetBBISPageUrl(MyContent.ChildLockedPageID) + "{0}id=" + id;
                    //            childLockedPageURL = childLockedPageURL.IndexOf("?") > -1 ? String.Format(childLockedPageURL, "&") : String.Format(childLockedPageURL, "?");
                    //            Response.Redirect(childLockedPageURL);
                    //        }
                    //        else if (ex.Message.ToString().Contains(ChildNotEligible))
                    //        {
                    //            string childIneligiblePageURL = Utility.GetBBISPageUrl(MyContent.ChildIneligiblePageID) + "{0}id=" + id;
                    //            childIneligiblePageURL = childIneligiblePageURL.IndexOf("?") > -1 ? String.Format(childIneligiblePageURL, "&") : String.Format(childIneligiblePageURL, "?");
                    //            Response.Redirect(childIneligiblePageURL);
                    //        }
                    //        else if (ex.Message.ToString().Contains(ChildNotReserved))
                    //        {
                    //            string childUnavailablePageURL = Utility.GetBBISPageUrl(MyContent.ChildUnavailablePageID) + "{0}id=" + id;
                    //            childUnavailablePageURL = childUnavailablePageURL.IndexOf("?") > -1 ? String.Format(childUnavailablePageURL, "&") : String.Format(childUnavailablePageURL, "?");
                    //            Response.Redirect(childUnavailablePageURL);
                    //        }

                    //    }
                    //    else
                    //    {
                    //        this.lblError.Text = ex.Message + "<br /><br />" + ex.StackTrace;
                    //        this.lblError.Visible = true;
                    //    }
                    //}
                }
            }
        }