Ejemplo n.º 1
0
 public void AddEmailSubscriber(OiiONewsLetter EmailSubscribe)
 {
     try
     {
         DatabaseHelper.Insert <OiiONewsLetter>(EmailSubscribe);
     }
     catch (Exception ex) { throw new Exception(ex.Message, ex); }
 }
Ejemplo n.º 2
0
        public void UpdateEmailSubscribe(OiiONewsLetter EmailSubscribe)
        {
            try
            {
                OiiOHaatDCDataContext msDC           = DatabaseHelper.GetDataModelDataContext();
                OiiONewsLetter        Emailsubscribe = msDC.OiiONewsLetters.Single(d => d.UserEmail == EmailSubscribe.UserEmail);
                DatabaseHelper.Update <OiiONewsLetter>(msDC, EmailSubscribe, Emailsubscribe);

                msDC.Dispose();
            }
            catch (Exception ex) { throw new Exception(ex.Message, ex); }
        }
Ejemplo n.º 3
0
        //public OiiONewsLetter GetEmailSubscribrByEmail(string p)
        //{
        //    throw new NotImplementedException();
        //}

        public OiiONewsLetter GetEmailSubscribrIDByEmail(string EmailSubscribr)
        {
            try
            {
                OiiOHaatDCDataContext dbContext      = DatabaseHelper.GetDataModelDataContext();
                OiiONewsLetter        Emailsubscribr = new OiiONewsLetter();
                Emailsubscribr = dbContext.OiiONewsLetters.Single(d => d.UserEmail == EmailSubscribr && d.IsSubscribe == true);

                dbContext.Dispose();
                return(Emailsubscribr);
            }
            catch (Exception ex) { throw new Exception(ex.Message, ex); }
        }
Ejemplo n.º 4
0
        private OiiONewsLetter CreateEmailSubscriber()
        {
            Session["EmailID"] = "1";
            OiiONewsLetter EmailSubscriber = new OiiONewsLetter();

            try
            {
                if (hdIsEdit.Value == "true")
                {
                    EmailSubscriptionRT receiverTransfer  = new EmailSubscriptionRT();
                    OiiONewsLetter      emailSubscription = receiverTransfer.GetEmailSubscribrIDByEmail(txtEmailSubscription.Text);
                    Session[sessEmailSubscribe] = emailSubscription;
                    // OiiONewsLetter EmailSubscribe = (OiiONewsLetter)Session[sessEmailSubscribe];
                    EmailSubscriber.IID = emailSubscription.IID;
                }
                EmailSubscriber.UserEmail     = txtEmailSubscription.Text.Trim();
                EmailSubscriber.SubscribeDate = DateTime.Now;
                if (EmailSubscriber.IID <= 0)
                {
                    EmailSubscriber.CreatedBy   = Convert.ToInt64(Session["EmailID"]);
                    EmailSubscriber.CreatedDate = GlobalRT.GetServerDateTime();
                }
                else
                {
                    OiiONewsLetter EmailSubscribe = (OiiONewsLetter)Session[sessEmailSubscribe];
                    EmailSubscriber.CreatedBy    = EmailSubscribe.CreatedBy;;
                    EmailSubscriber.CreatedDate  = EmailSubscribe.CreatedDate;
                    EmailSubscriber.ModifiedBy   = Convert.ToInt64(Session["EmailID"]);
                    EmailSubscriber.ModifiedDate = GlobalRT.GetServerDateTime();
                }
                if (hdIsDelete.Value != "true")
                {
                    EmailSubscriber.IsSubscribe = true;
                }
                else
                {
                    EmailSubscriber.IsSubscribe = false;
                }
            }
            catch (Exception ex)
            {
                lblEmailSubscribe.Text      = "Error : " + ex.Message;
                lblEmailSubscribe.ForeColor = System.Drawing.Color.White;
            }
            return(EmailSubscriber);
        }
Ejemplo n.º 5
0
        protected void btnSubscribeUnsubcbe_Click(object sender, EventArgs e)
        {
            //if (ChkEmailUnsubcribe.Checked == false)
            //{
            try
            {
                lblEmailSubscribe.Text = string.Empty;
                using (EmailSubscriptionRT receiverTransfer = new EmailSubscriptionRT())
                {
                    List <OiiONewsLetter> EmailSubscriberList = new List <OiiONewsLetter>();
                    EmailSubscriberList = receiverTransfer.GetEmailSubscriber(txtEmailSubscription.Text);

                    if (EmailSubscriberList != null && EmailSubscriberList.Count > 0)
                    {
                        string msg = "" + txtEmailSubscription.Text + " Already Subscribed!";
                        lblEmailSubscribe.Text      = msg;
                        lblEmailSubscribe.ForeColor = System.Drawing.Color.White;
                        lblEmailSubscribe.BackColor = System.Drawing.Color.Blue;
                        return;
                    }

                    OiiONewsLetter EmailSubscribe = CreateEmailSubscriber();
                    receiverTransfer.AddEmailSubscriber(EmailSubscribe);
                    if (EmailSubscribe.IID > 0)
                    {
                        lblEmailSubscribe.Text      = "Data successfully saved...";
                        lblEmailSubscribe.ForeColor = System.Drawing.Color.White;
                        lblEmailSubscribe.BackColor = System.Drawing.Color.Blue;
                    }
                    else
                    {
                        lblEmailSubscribe.Text      = "Data not saved...";
                        lblEmailSubscribe.ForeColor = System.Drawing.Color.White;
                        lblEmailSubscribe.BackColor = System.Drawing.Color.Blue;
                    }
                }

                ClearEmailField();
                //LoadUserGrp();
            }
            catch (Exception ex)
            {
                lbLogStatus.Text      = "Error : " + ex.Message;
                lbLogStatus.ForeColor = System.Drawing.Color.Red;
            }
            //}
            //else if(ChkEmailUnsubcribe.Checked==true && txtEmailSubscription.Text!=null)
            //{

            //    try
            //    {
            //        lblEmailSubscribe.Text = string.Empty;
            //        using (EmailSubscriptionRT receiverTransfer = new EmailSubscriptionRT())
            //        {
            //            List<OiiONewsLetter> EmailSubscriberList = new List<OiiONewsLetter>();
            //            EmailSubscriberList = receiverTransfer.GetEmailSubscriber(txtEmailSubscription.Text);

            //            if (EmailSubscriberList != null && EmailSubscriberList.Count > 0)
            //            {
            //                hdIsDelete.Value = "true";
            //                hdIsEdit.Value = "true";

            //                OiiONewsLetter EmailSubscribe = CreateEmailSubscriber();

            //                if (EmailSubscribe != null)
            //                {
            //                    receiverTransfer.UpdateEmailSubscribe(EmailSubscribe);
            //                    lblEmailSubscribe.Text = "Data successfully deleted...";
            //                    lblEmailSubscribe.ForeColor = System.Drawing.Color.White;
            //                    lblEmailSubscribe.BackColor = System.Drawing.Color.Blue;
            //                }
            //                else
            //                {
            //                    lblEmailSubscribe.Text = "Data not deleted...";
            //                    lblEmailSubscribe.ForeColor = System.Drawing.Color.White;
            //                }
            //            }
            //            else
            //            {
            //                lblEmailSubscribe.Text = "You Should Subscribe First";
            //                lblEmailSubscribe.ForeColor = System.Drawing.Color.YellowGreen;
            //            }

            //        }

            //        ClearEmailField();
            //    }
            //    catch (Exception ex)
            //    {
            //        lblEmailSubscribe.Text = "Error : " + ex.Message;
            //        lblEmailSubscribe.ForeColor = System.Drawing.Color.White;
            //    }

            //}
            //else
            //{
            //    lblEmailSubscribe.Text = "Can Not Subscribe Or Unsubscribe";
            //}
        }