public int MailTrigger(string txtmailid)
        {
            try
            {
                string uid = canvBiz.GetCustId(txtmailid);
                AppCustomer oAppCustomer = new AppCustomer();
                oAppCustomer = canvBiz.GetCustomerInfo(txtmailid, uid, false);
                MailMessage mail = new MailMessage();
                //string adminid = txtmailid;
                string adminid = "*****@*****.**";//ConfigurationManager.AppSettings["usermailid"];
                string admpass = "******";// ConfigurationManager.AppSettings["userpassword"];
                System.Net.NetworkCredential auth = new System.Net.NetworkCredential(adminid, admpass);
                mail.From = new MailAddress(adminid);//TODO: Put actual sender email address
                mail.To.Add(new MailAddress(txtmailid));
                mail.Subject = "Reset your sonetreach password";    // Mail Subject
                mail.IsBodyHtml = true;
                mail.Priority = MailPriority.High; //Mail Priority

                StringBuilder strBody = new StringBuilder();

                strBody.Append("<div><center><table border=\"2px black\" width=\"800px\" style=\"height:200px;\">");
                strBody.Append("<tr><td style=\"background-color: #8BCD98; height: 40px; width: 400px;\">");
                strBody.Append("<center><span style=\"color: #0D6DA0; font-family: Verdana; font-size: large;\">");
                strBody.Append("SONETREACH");
                strBody.Append("</span></center></td></tr><tr><td>");
                strBody.Append("<span style=\"font-family: Verdana;\">");
                strBody.Append("<br/>");
                strBody.Append("Hello");
                strBody.Append("<br>");
                strBody.Append("<br>");
                strBody.Append("You recently asked for your SONETREACH Password.To complete your request, Please follow this link to reset your password.<br /><br/>");

                strBody.Append("https://www.sonetreach.com/Reset_Password.aspx?fp=1&id=" + HttpUtility.UrlEncode(CommonUtility.Encrypt(uid)) + "");
                strBody.Append("<br><br>");
                strBody.Append("User Name: &nbsp;");
                strBody.Append(txtmailid);
                strBody.Append("<br><br>");
                strBody.Append("<br><br><br>");
                strBody.Append("Thanks,");
                strBody.Append("<br><br>");
                strBody.Append("DigiMa Team");
                strBody.Append("</span></td></tr></tr></table></center></div>");

                mail.Body = strBody.ToString();
                SmtpClient mSMTPClient = new SmtpClient("smtpauth.net4india.com", 25);
                mSMTPClient.EnableSsl = false;
                mSMTPClient.UseDefaultCredentials = true;
                mSMTPClient.Credentials = auth;
                mSMTPClient.Port = 25; // PORT NUMBER
                mSMTPClient.Host = "smtpauth.net4india.com";
                mSMTPClient.Send(mail);
                return 1;
            }
            catch (Exception ex)
            {
                DigiMa.Common.CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
            }
            return 0;
        }
Exemple #2
0
        protected override void OnPreLoad(EventArgs e)
        {
            try
            {
                base.OnPreLoad(e);
                FacebookBizProcess fbBiz = new FacebookBizProcess();
                FaceBook oFBUtility = new FaceBook();
                SonetPieBizProcess sonetpiebiz = new SonetPieBizProcess();
                SonetPie sonetpie = new SonetPie();
                NotifyURL = ConfigurationSettings.AppSettings["NotifyURL"];
                pageRefreshed = false;

                if (QSVars.Contains("user_id"))
                {
                    Session["facebook_user_id"] = QSVars["user_id"].ToString();
                }
                if (QSVars.Contains("UDID"))
                {
                    Session["sr_user_did"] = QSVars["UDID"].ToString();
                }
                if (QSVars.Contains("PDID"))
                {
                    Session["sr_product_did"] = QSVars["PDID"].ToString();
                }

                if (Request.Url.Query.Contains("request") && !(Request.Url.Query.Contains("fb_source"))) //AppRequest callback, now save to notifiers
                {

                    for (int i = 0; i < Request.QueryString.Count - 2; i++)
                    {
                        //every Request["to[i]"] has a userID for AppNotifier
                        string fbUID = Request["to[" + i + "]"].ToString();
                        string _sNotifierDID = new AppNotifier().GetNewDIDWithPrefix();
                        string facebook_user_id = Convert.ToString(Session["facebook_user_id"]);
                        string UDID = Convert.ToString(Session["sr_user_did"]);
                        if (QSVars.Contains("NDID"))
                            QSVars["NDID"] = _sNotifierDID;
                        else
                            QSVars.Add("NDID", _sNotifierDID);

                        //Build DCAppWallPost for each user

                        AppUser oDCAppUser = new AppUser();
                        string ConfigDID = fbBiz.GetConfigDEED(Convert.ToString(QSVars["app_id"]));
                        if (!QSVars.Contains("ADID"))
                        {
                            QSVars.Add("ADID", ConfigDID);
                        }
                        if (!QSVars.Contains("PDID"))
                        {
                            QSVars.Add("PDID", Convert.ToString(Session["sr_product_did"]));
                        }
                        oDCAppUser = ofbBiz.GetAppUser(osonetpie, QSVars["ADID"].ToString(), facebook_user_id);

                        _oDCAppWallPost.FromUserID = Convert.ToString(QSVars["user_id"]);
                        _oDCAppWallPost.ToUserID = fbUID;
                        _oDCAppWallPost.Name = ofbBiz.GetCustomTabName(QSVars["app_id"].ToString());
                        _oDCAppWallPost.Source = Convert.ToString(QSVars["user_id"]);
                        AppLeadData oAppLead = new AppLeadData();

                        if (Request.Browser.IsMobileDevice == true || Request.UserAgent.ToLower().Contains("iphone") || Request.UserAgent.ToLower().Contains("android"))
                        {
                            if (fbBiz.RaiseAppNotifier(oDCAppUser, "MPOST", UDID, Convert.ToString(QSVars["PDID"]), "", fbUID))
                            {

                            }
                        }
                        else
                        {
                            if (fbBiz.RaiseAppNotifier(oDCAppUser, "POST", UDID, Convert.ToString(QSVars["PDID"]), "", fbUID))
                            {

                            }
                        }
                    }
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close();", true);
                }

                if (Request["code"] == null)
                {
                    if ((Request.QueryString.Count > 0) && !(Request["LIKED"] != null))
                    {
                        //ParseRequest & set values to qsvars
                        if (!(Request.QueryString).AllKeys[0].ToString().Contains("tabs_added"))
                        {
                            //REVISIT

                            sonetpie.QSvarsString = GetQsVarsCollection();
                            sonetpie.FormvarsString = GetFormVarsCollection();
                            sonetpie.AbsolutePath = AbsolutePagePath;

                            if (Request.Form.ToString() != string.Empty)
                            {
                                FormVars.Add("signed_request", Request.Form.Get(0).ToString());
                            }

                            //Init Biz
                            //SonetPieBizProcess sonetpiebiz = new SonetPieBizProcess();

                            if (QSVars.Contains("app_id"))
                            {

                                if (EnableAppServices) _oDCAppConfiguration = sonetpiebiz.GetAppConfiguration("", QSVars["app_id"].ToString());
                                SessionData.Config.DID = _oDCAppConfiguration.DID;
                                //DigiMa.Common.FaceBook oFBUtility1 = new DigiMa.Common.FaceBook();

                                //check AppConfig got loaded
                                if (AppConfig != null)
                                {
                                    //Add CDID to Load customer
                                    if (QSVars.Contains("CDID"))
                                        QSVars["CDID"] = AppConfig.AppCustomerDID;
                                    else
                                        QSVars.Add("CDID", AppConfig.AppCustomerDID);

                                    //Add ADID to Load customer
                                    if (QSVars.Contains("ADID"))
                                        QSVars["ADID"] = AppConfig.DID;
                                    else
                                        QSVars.Add("ADID", AppConfig.DID);

                                    //Reset KOKO QSVars
                                    sonetpie.QSvarsString = GetQsVarsCollection();
                                    _oDCAppCustomer = fbBiz.GetAppCustomer(Convert.ToString(QSVars["CDID"]));

                                    //ParseSigned Request
                                    if ((!QSVars.Contains("oauth_token")))
                                    {
                                        oFBUtility.ParseSignedRequest(ref _qsVars, ref _frmVars, AppConfig);
                                    }

                                    if (QSVars.Contains("oauth_token"))
                                    {
                                        Session["oauth_token"] = Convert.ToString(QSVars["oauth_token"]);
                                    }

                                    if (QSVars.Contains("user_id"))
                                    {
                                        Session["user_id"] = Convert.ToString(QSVars["user_id"]);
                                    }

                                    //call graph to get page_Acc_tok
                                    if (QSVars.Contains("oauth_token") && (_oDCAppConfiguration.SAppCustomNameAdded == null || _oDCAppConfiguration.SAppCustomNameAdded == ""))
                                    {
                                        page_access_token = facebook.GetPageAccessToken(QSVars["oauth_token"].ToString());
                                        System.Web.Script.Serialization.JavaScriptSerializer _oJavaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                                        JObject obj = JObject.Parse(page_access_token);
                                        IEnumerable<string> query = from res in (Newtonsoft.Json.Linq.JArray)obj["data"]
                                                                    let reso = res as JObject
                                                                    where ((string)reso["id"]).ToLower() == _oDCAppConfiguration.SPageID
                                                                    select (string)reso["access_token"];

                                        //fetch the logo of this Campaign from AppProduct and pass to CallPages

                                        if (facebook.CallPages(_oDCAppConfiguration.SPageID, query.ToList()[0].ToString(), "app_" + QSVars["app_id"].ToString(), _oDCAppConfiguration.SCustomtTabName, fbBiz.FetchAppLogo(QSVars["app_id"].ToString())))
                                        {
                                            //update custom_updated to Y
                                            fbBiz.UpdateCustomTabNAme(_oDCAppConfiguration.DID);
                                            ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + _oDCAppConfiguration.SAppPagePath + "'", true);
                                        }

                                    }

                                    //parse the JSON
                                    if (HasAuthorization)
                                    {
                                        if (!QSVars.Contains("oauth_token"))
                                        {
                                            //Set Authorization stamp on redirect url
                                            AppConfig.AppPath += "?soNETSrc=";
                                            if (QSVars.Contains("NDID"))
                                                AppConfig.AppPath += Convert.ToString(QSVars["NDID"]);
                                            else
                                                AppConfig.AppPath += "NULL";

                                            //oFBUtility.GetAccessToken(QSVars["code"].ToString(), "user_location,email,friends_location,publish_stream",AppConfig.AppPath,AppConfig);

                                            // CHeck if Request is coming from Mobile device, then open Standalone
                                            if (Request.Browser.IsMobileDevice == true || Request.UserAgent.ToLower().Contains("iphone") || Request.UserAgent.ToLower().Contains("android"))
                                            {
                                                //oFBUtility.AuthorizeMob(this, "user_location,email,friends_location,user_birthday", AppConfig);
                                            }
                                            else
                                            {
                                                oFBUtility.Authorize(this, "user_location,email,friends_location,user_birthday", AppConfig);
                                            }

                                        }
                                        else
                                        {
                                            //Insert user into DB
                                            if (true)
                                            {
                                                //Call service to store into DB
                                                AppUser oDCAppUser = new AppUser();
                                                oDCAppUser.AppConfigDID = AppConfig.DID;
                                                oDCAppUser.EmailID = "NULL";
                                                oDCAppUser.SonetID = Convert.ToString(QSVars["user_id"]);
                                                oDCAppUser.SonetSRC = Convert.ToString(QSVars["soNETSrc"]);
                                                oDCAppUser.UserStatus = "Active";
                                                oDCAppUser.SMType = "FB";
                                                oDCAppUser = oFBUtility.GetUserDetail(Convert.ToString(QSVars["user_id"]), Convert.ToString(QSVars["oauth_token"]), oDCAppUser);

                                                //Save to DB
                                                if (!fbBiz.IsUserCreatedForFacebook(oDCAppUser.SonetID, oDCAppUser.AppConfigDID))
                                                {
                                                    if (fbBiz.SetAppUserAuthorize(oDCAppUser, Convert.ToString(QSVars["ADID"]))) _oDCAppUser = oDCAppUser;
                                                }
                                            }
                                        }
                                    }
                                }

                                //refrsh to get tab name
                                //fbBiz.UpdateCustomTabNAme(_oDCAppConfiguration.DID);
                                //ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + _oDCAppConfiguration.SAppPagePath + "'", true);

                                //Load AppUser based on property
                                if (_bEnableAppUser && _qsVars.Contains("user_id"))
                                {
                                    sonetpie.QSvarsString = GetQsVarsCollection();
                                    _oDCAppUser = fbBiz.GetAppUser(sonetpie, Convert.ToString(QSVars["ADID"]), Convert.ToString(QSVars["user_id"]));
                                    if (_oDCAppUser != null)
                                    {
                                        if (!_qsVars.Contains("UDID")) _qsVars.Add("UDID", _oDCAppUser.DID); else _qsVars["UDID"] = _oDCAppUser.DID;
                                        if (QSVars.Count < 8)
                                        {
                                            ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + _oDCAppConfiguration.SAppPagePath + "'", true);//To ensure all QSVARS are loaded from facebook
                                        }
                                    }
                                }

                                //Update Notifier count based on NDID or soNETSrc
                                if (QSVars.Contains("soNETSrc") || QSVars.Contains("NDID"))
                                {
                                    AppNotifier oAppNotifier = new AppNotifier();
                                    if (QSVars.Contains("soNETSrc")) oAppNotifier.DID = Convert.ToString(QSVars["soNETSrc"]);
                                    if (QSVars.Contains("NDID")) oAppNotifier.DID = Convert.ToString(QSVars["NDID"]);
                                    if (!string.IsNullOrEmpty(oAppNotifier.DID)) fbBiz.EditAppNotifierDetails(oAppNotifier);
                                }
                            }
                        }

                    }
                    else
                    {
                        //
                    }
                }

                else
                {

                    //Here redirect user to Page path
                    if (QSVars.Contains("app_id") && QSVars.Contains("soNETSrc"))
                    {
                        //string pageToRedirect = fbBiz.GetAppPagePath(Convert.ToString(QSVars["app_id"]));
                        //Response.Redirect(pageToRedirect,true);

                    }

                }

            }
            catch (Exception ex)
            {
                CommonUtility commUtil = new CommonUtility();
                commUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);
            }
        }
 public bool InsertNewCustomer(AppCustomer oAppCustomer)
 {
     CanvasDALC cabc = new CanvasDALC();
     return cabc.InsertNewCustomer(oAppCustomer);
 }
Exemple #4
0
 public AppCustomer GetAppCustomer(string CDID)
 {
     try
     {
         DatabaseHandler oDBH = new DatabaseHandler();
         DataTable oAppCustDataTable = oDBH.FillData_SP("GetAppCustomer", CDID).Tables[0];
         if (oAppCustDataTable != null)
         {
             AppCustomer _oAppCustomer = new AppCustomer();
             _oAppCustomer.CustomerID = oAppCustDataTable.Rows[0]["cid"].ToString();
             _oAppCustomer.SCustomerUserName = oAppCustDataTable.Rows[0]["username"].ToString();
             _oAppCustomer.SCustomerEmail = oAppCustDataTable.Rows[0]["cemail"].ToString();
             _oAppCustomer.SCustomerStatus = oAppCustDataTable.Rows[0]["cstatus"].ToString();
             _oAppCustomer.SCustomerPWD = oAppCustDataTable.Rows[0]["password"].ToString();
             _oAppCustomer.IsCoupon = oAppCustDataTable.Rows[0]["IsCoupon"].ToString();
             _oAppCustomer.IsSweepStakes = oAppCustDataTable.Rows[0]["IsSweepStakes"].ToString();
             _oAppCustomer.IsMultiPage = oAppCustDataTable.Rows[0]["IsMultiPage"].ToString();
             return _oAppCustomer;
         }
         else { return null; }
     }
     catch (Exception ex)
     {
         //Log4NetUtility.ErrorDebug(this.GetType().FullName, "Error in GetConfigData(string _AppId)", ex);
         throw ex;
     }
 }
Exemple #5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            CanvasBizProcess canvBiz = new CanvasBizProcess();
            try
            {
                if (txtEmailid.Text.Contains(">") || txtEmailid.Text.Contains("<") || txtEmailid.Text.Contains("'") || txtEmailid.Text.Contains("--") || txtEmailid.Text.Contains("%"))
                {
                    txtEmailid.Text = "";
                }
                else
                {
                    string temppass = "******";
                    AppCustomer oAppCustomer = new AppCustomer();
                    oAppCustomer.CustomerID = oAppCustomer.GetNewDIDWithPrefix();
                    oAppCustomer.SCompanyName = txtOrganization.Text.Trim();
                    oAppCustomer.SCustomerCountry = Convert.ToInt32(ddlCountry.SelectedValue);
                    oAppCustomer.SCustomerEmail = txtEmailid.Text.Trim();
                    oAppCustomer.SCustomerPWD = temppass;
                    oAppCustomer.SCustomerStatus = "1"; //Remove hardcoding
                    oAppCustomer.SCustomerUserName = txtFullName.Text.Trim();
                    oAppCustomer.SfpStatus = "0";
                    oAppCustomer.SAddress = txtAddress.Text.Trim();

                    //Check if Privacy policy check-box is checked
                    if (flag)
                    {
                        if (checkTC.Checked == true)
                        {
                            canvBiz.InsertNewCustomer(oAppCustomer);

                            int mailstatus = MailTrigger(txtEmailid.Text);
                            if (mailstatus == 1)
                            {
                                string script = "alert('A verification Email has been sent to you.');" + "location.href='Home.aspx?';";
                                this.ClientScript.RegisterStartupScript(typeof(Page), "Redirect", script, true);
                            }
                        }
                        else
                        {
                            string script = "alert('Kindly accept the T&C and Privacy Policy')";
                            this.ClientScript.RegisterStartupScript(typeof(Page), "Redirect", script, true);
                            CodeNumberTextBox.Text = "";
                            this.Session["CaptchaImageText"] = GenerateRandomCode();
                        }

                    }
                    else
                    {
                        CodeNumberTextBox.Text = "";
                        errorlblsecurity.Style.Add("display", "block");
                        StringBuilder sErrorMsg = new StringBuilder();
                        sErrorMsg.Append("The Characters Don't Match.</br>");
                        sErrorMsg.Append("Please Try Again.");
                        errorlblsecurity.Text = sErrorMsg.ToString();
                        CodeNumberTextBox.Focus();
                        this.Session["CaptchaImageText"] = GenerateRandomCode();
                    }
                }
            }
            catch (Exception ex)
            {
                objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);
            }
        }
        protected void submibmail_Click(object sender, EventArgs e)
        {
            canvBiz = new CanvasBizProcess();
            AppCustomer oAppCustomer = new AppCustomer();

            string uid = canvBiz.GetCustId(txtmailid.Text.TrimStart(' ').TrimEnd(' '));
            try
            {
                if (txtmailid.Text.Contains(">") || txtmailid.Text.Contains("<") || txtmailid.Text.Contains("'") || txtmailid.Text.Contains("--") || txtmailid.Text.Contains("%"))
                {
                    txtmailid.Text = "";
                }
                else
                {
                    if (flag)
                    {
                        string NewTempPass = GenerateNewPassword(8);
                        string temppass = _oEncryptionUtilities.getEncryptedCode(NewTempPass);
                        int chkavalible = canvBiz.VerifyEmailInsertNewPassword(txtmailid.Text.TrimStart(' ').TrimEnd(' '), temppass);

                        if (chkavalible == 1)
                        {
                            int mailstatus = MailTrigger(txtmailid.Text);
                            if (mailstatus == 1)
                            {
                                string script = "alert('Password Sent To Email.');" + "location.href='Home.aspx?';";
                                this.ClientScript.RegisterStartupScript(typeof(Page), "Redirect", script, true);
                                CanvasBizProcess canvasBiz = new CanvasBizProcess();
                                //UPdate fpStatus to 1 as user has requested reset password
                                canvasBiz.UpdatefpStatus(uid, 1);
                                //canvBiz.UpdateTempPwd(txtmailid.Text, temppass);

                            }
                        }
                        else
                        {
                            maillbl.Visible = true;
                            maillbl.Text = " Invalid Email Id /Please Check Email Id Again.";
                            CodeNumberTextBox.Text = "";
                            this.Session["CaptchaImageText"] = GenerateRandomCode();
                            errorlblsecurity.Text = string.Empty;
                        }
                    }
                    else
                    {
                        errorlblsecurity.Style.Add("display", "block");
                        errorlblsecurity.Text = "The Characters Doesn't Match. Please Try Again.";
                        CodeNumberTextBox.Text = "";
                        errorlblsecurity.Focus();
                    }

                }
            }

            catch (Exception ex)
            {
                DigiMa.Common.CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
            }
        }
        private int MailTriggerToSonetREachAdmin(string txtEmailid)
        {
            try
            {
                canvBiz = new CanvasBizProcess();
                string uid = canvBiz.GetCustId(txtEmailid);
                AppCustomer oAppCustomer = new AppCustomer();
                oAppCustomer = canvBiz.GetCustomerInfo(txtEmailid, uid, false);
                MailMessage mail = new MailMessage();
                //string adminid = txtmailid;
                string adminid = "*****@*****.**";//ConfigurationManager.AppSettings["usermailid"];
                string admpass = "******";// ConfigurationManager.AppSettings["userpassword"];
                System.Net.NetworkCredential auth = new System.Net.NetworkCredential(adminid, admpass);
                mail.From = new MailAddress(adminid);//TODO: Put actual sender email address
                mail.To.Add(new MailAddress("*****@*****.**"));
                mail.Subject = "New Registration"; // Mail Subject
                mail.IsBodyHtml = true;
                mail.Priority = MailPriority.High; //Mail Priority

                mail.Body = txtEmailid + " has just registered with SonetReach !";
                SmtpClient mSMTPClient = new SmtpClient("smtpauth.net4india.com", 25);
                mSMTPClient.EnableSsl = false;
                mSMTPClient.UseDefaultCredentials = true;
                mSMTPClient.Credentials = auth;
                mSMTPClient.Port = 25; // PORT NUMBER
                mSMTPClient.Host = "smtpauth.net4india.com";
                mSMTPClient.Send(mail);
                return 1;
            }
            catch (Exception ex)
            {
                objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);
            }
            return 0; //for failure if try is not executed
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (SessionData.Customer.CustomerID.Equals(string.Empty))
                {
                    //Response.Redirect("Home.aspx");

                    //*************SARANYA
                    //bind the dropdown to PReferenceMAster table.
                }
                else
                {
                    //Enable Promos on basis of DB value

                    AppCustomer oAppCustomer = new AppCustomer();
                    string CustId = SessionData.Customer.CustomerID;
                    oAppCustomer = fbBiz.GetAppCustomer(CustId);
                    string iscoupon = oAppCustomer.IsCoupon.ToString();
                    string issweep = oAppCustomer.IsSweepStakes.ToString();

                    // If Coupon = 1, enable for user

                }
            }
        }
Exemple #9
0
 public bool InsertNewCustomer(AppCustomer oAppCustomer)
 {
     try
     {
         DatabaseHandler oDBH = new DatabaseHandler();
         StringBuilder oSBQuery = new StringBuilder();
         oDBH = new DatabaseHandler();
         oDBH.ExecuteNonQuery_SP("InsertNewCustomer", oAppCustomer.GetNewDIDWithPrefix(), oAppCustomer.SCustomerUserName, oAppCustomer.SCustomerEmail, oAppCustomer.SCustomerPWD, oAppCustomer.SCompanyName, oAppCustomer.SCustomerCountry, 1, 1, oAppCustomer.SAddress,"");
         return true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #10
0
        public AppCustomer GetCustomerInfo(string email, string cid, bool login)
        {
            if (email != null && cid == null)
            {
                try
                {
                    DataSet dsFinalHTML = new DataSet();
                    DatabaseHandler oDBH = new DatabaseHandler();
                    AppCustomer oAppCustomer = new AppCustomer();
                    dsFinalHTML = oDBH.FillData_SP("GetCustomerInfo", email);

                    oAppCustomer.CustomerID = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["cid"].ToString());
                    oAppCustomer.SCompanyName = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["ccompany"].ToString());
                    oAppCustomer.SCustomerCountry = Convert.ToInt32(dsFinalHTML.Tables[0].Rows[0]["ctryid"].ToString());
                    oAppCustomer.SCustomerPWD = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["password"].ToString());
                    oAppCustomer.SCustomerStatus = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["cstatus"].ToString());
                    oAppCustomer.SCustomerUserName = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["username"].ToString());
                    oAppCustomer.SCustomerEmail = email;

                    return oAppCustomer;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else if (login)
            {
                try
                {
                    DataSet dsFinalHTML = new DataSet();
                    DatabaseHandler oDBH = new DatabaseHandler();
                    AppCustomer oAppCustomer = new AppCustomer();
                    dsFinalHTML = oDBH.FillData("select * from customer where cemail='" + email + "'");

                    oAppCustomer.CustomerID = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["cid"].ToString());
                    oAppCustomer.SCompanyName = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["ccompany"].ToString());
                    oAppCustomer.SCustomerCountry = Convert.ToInt32(dsFinalHTML.Tables[0].Rows[0]["ctryid"].ToString());
                    oAppCustomer.SCustomerPWD = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["password"].ToString());
                    oAppCustomer.SCustomerStatus = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["cstatus"].ToString());
                    oAppCustomer.SCustomerUserName = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["username"].ToString());
                    oAppCustomer.SCustomerEmail = email;

                    return oAppCustomer;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else if (email == null && cid != null)
            {
                DataSet dsFinalHTML = new DataSet();
                DatabaseHandler oDBH = new DatabaseHandler();
                AppCustomer oAppCustomer = new AppCustomer();
                dsFinalHTML = oDBH.FillData("select * from customer where cid='" + cid + "'");

                oAppCustomer.CustomerID = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["cid"].ToString());
                oAppCustomer.SCompanyName = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["ccompany"].ToString());
                oAppCustomer.SCustomerCountry = Convert.ToInt32(dsFinalHTML.Tables[0].Rows[0]["ctryid"].ToString());
                oAppCustomer.SCustomerPWD = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["password"].ToString());
                oAppCustomer.SCustomerStatus = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["cstatus"].ToString());
                oAppCustomer.SCustomerUserName = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["username"].ToString());

                return oAppCustomer;
            }
            else
            {
                try
                {
                    DataSet dsFinalHTML = new DataSet();
                    DatabaseHandler oDBH = new DatabaseHandler();
                    AppCustomer oAppCustomer = new AppCustomer();
                    dsFinalHTML = oDBH.FillData("select cemail from customer where cid='" + cid + "'");

                    oAppCustomer.SCustomerEmail = Convert.ToString(dsFinalHTML.Tables[0].Rows[0]["cemail"].ToString());

                    return oAppCustomer;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Exemple #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = "";
            string pwd = "";

            if (!Request.IsSecureConnection)
            {
                string redirectUrl = Request.Url.ToString().Replace("http:", "https:");
                Response.Redirect(redirectUrl);
            }

            if (!IsPostBack)
            {
                oAppCust = new AppCustomer();

                if (Request.QueryString["fp"] != null && Request.QueryString["fp"].Contains("1") ||
                     (Request.QueryString["nu"] != null && Request.QueryString["nu"].Contains("1")))
                {
                    if (Request.QueryString["fp"] != null && Request.QueryString["id"] != null)
                    {
                        if (Request.QueryString["fp"].Contains("1") && Request.QueryString["id"] != null)
                        {
                            lblLoginuser.Visible = true;
                            lblLoginuser.Text = "Reset Your Password by logging with the temprary password";
                        }
                    }
                }
                else
                {
                    if (Request["lo"] != null)
                    {
                        SessionData.Config = null;
                        SessionData.Product = null;
                        Session.Abandon();
                    }
                    if (SessionData.Customer != null)
                    {
                        if (Request["err"] != null)
                        {

                        }
                        if (Request["cp"] != null || Request["rp"] != null)//(SessionData.Customer.CustomerID.Equals(string.Empty) ||
                        {
                            //Need to login

                        }
                        else
                            if (Request["lp"] != null)
                            {
                                //Need to Logout User
                                Response.Redirect("Home.aspx", true);
                            }
                            else
                                if ((Request["sp"] != null) && (!SessionData.Customer.CustomerID.Equals(string.Empty)))
                                {
                                    //Need to Logout User

                                    RegisterNew.HRef = "LandingPage.aspx?CDID=" + SessionData.Customer.CustomerID;
                                }
                    }
                    else
                    {
                        //Need to login
                        tdLogin.Visible = true;
                        tdSignup.Visible = true;
                    }
                }
            }
        }