Ejemplo n.º 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                //check if user has already entered
                FacebookBizProcess fbBiz = new FacebookBizProcess();
                if (!fbBiz.CheckIfSweepstakeAlreadyEntered(ADID, sonetID))
                {
                    //Save these details to SubmitForm table
                    SweepStakesEntryInfo sweepEntry = new SweepStakesEntryInfo();
                    sweepEntry.AppConfigDID1 = ADID;
                    sweepEntry.SoNetID1 = sonetID;
                    sweepEntry.FirstName1 = txtFirstName.Text.Trim().Replace("'", "''");
                    sweepEntry.LastName1 = txtLastName.Text.Trim().Replace("'", "''");
                    sweepEntry.Address1 = txtAddress.Text.Trim().Replace("'", "''");
                    sweepEntry.Country1 = ddlCountry.SelectedValue;
                    sweepEntry.City1 = txtCity.Text.Trim().Replace("'", "''");
                    sweepEntry.ZipCode1 = txtZip.Text.Trim().Replace("'", "''");
                    sweepEntry.Email1 = txtEmail.Text.Trim().Replace("'", "''");
                    sweepEntry.Gender1 = ddlGender.SelectedValue;
                    if (datepickerEntryForm.Value == "")
                    {
                        sweepEntry.DOB1 = System.DBNull.Value.ToString();
                    }
                    else
                    {
                        sweepEntry.DOB1 = SQLSafeDates(datepickerEntryForm.Value);
                    }
                    sweepEntry.Telephone1 = txtTelePhone.Text.Trim().Replace("'", "''");
                    sweepEntry.Mobile1 = txtMobile.Text.Trim().Replace("'", "''");
                    sweepEntry.UserType = System.DBNull.Value.ToString();
                    sweepEntry.Remarks = txtRemarks.Text.Trim().Replace("'", "''");

                    //CallBiz Method
                    using (CanvasBizProcess canvBiz = new CanvasBizProcess())
                    {
                        spanError.InnerHtml = "";
                        canvBiz.SaveSweepStakesEntryInfo(sweepEntry);
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close()", true);
                    }
                }
                else
                {
                    spanError.InnerHtml = "You have already entered this Sweepstakes contest!";
                }
            }
            catch (Exception ex)
            {
                commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
            }
        }