コード例 #1
0
ファイル: Report.aspx.cs プロジェクト: zggcd/MobileSystemApi
    private void setDDL()
    {
        using (wsAffiliateMS1.affiliateWSSoapClient svcAffiliateMS1 = new wsAffiliateMS1.affiliateWSSoapClient())
        {
            //ws_affiliate.affiliateWSSoapClient wsaffiliate = new ws_affiliate.affiliateWSSoapClient();
            DataSet ds = svcAffiliateMS1.GetCreativeDropdown(long.Parse(System.Web.HttpContext.Current.Session["affaffiliateID"].ToString()), long.Parse(commonVariables.OperatorId));

            if (ds.Tables.Count > 0)
            {
                ddlTrackingCode.DataTextField  = "trackCodeName";
                ddlTrackingCode.DataValueField = "trackCodeID";
                ddlTrackingCode.DataSource     = ds.Tables[2];
                ddlTrackingCode.DataBind();
                ddlTrackingCode.Items.Add(new ListItem("ALL", "-1"));
                ddlTrackingCode.SelectedValue = "-1";
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strOperatorId  = commonVariables.OperatorId;
        string strAffiliateId = string.Empty;

        xeErrors = commonVariables.ErrorsXML;

        commonCulture.appData.getRootResource("/AccountInfo.aspx", out xeResources);

        customConfig.OperatorSettings opSettings = new customConfig.OperatorSettings("W88");

        //testing
        //System.Web.HttpContext.Current.Session["AffiliateId"] = "20264";

        if (!Page.IsPostBack)
        {
            try
            {
                using (wsAffiliateMS1.affiliateWSSoapClient wsInstanceAff = new wsAffiliateMS1.affiliateWSSoapClient("affiliateWSSoap"))
                {
                    DataSet ds = wsInstanceAff.GetSubAffiliateList(long.Parse(commonCookie.CookieAffiliateId));

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ds.Tables[0].Rows[0]["ParentID"] = "0";

                        lblEmailAddress.Text = commonCulture.ElementValues.getResourceString("lblEmailAddress", xeResources);
                        lblMessage.Text      = commonCulture.ElementValues.getResourceString("lblMessage", xeResources);

                        btnSubmit.Text      = commonCulture.ElementValues.getResourceString("btnInvite", xeResources);
                        btnCancel.InnerText = commonCulture.ElementValues.getResourceString("btnCancel", xeResources);

                        string emailContent = "";
                        string emailSubject = "";
                        getEmail(ref emailSubject, ref emailContent);

                        mainContent.Text = Server.HtmlDecode(emailContent);
                    }
                }
            }
            catch (Exception) { }
        }
    }
コード例 #3
0
ファイル: Report.aspx.cs プロジェクト: zggcd/MobileSystemApi
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(commonVariables.CurrentMemberSessionId))
        {
            Response.Redirect("/Index.aspx", true);
        }

        else
        {
            xeErrors = commonVariables.ErrorsXML;
            commonCulture.appData.getRootResource("/Report.aspx", out xeResources);


            if (!IsPostBack)
            {
                setDDL();
                ddlSortBy.Items.Add(new ListItem(commonCulture.ElementValues.getResourceString("lbl_dropdown_earliest_first", xeResources), "1"));
                ddlSortBy.Items.Add(new ListItem(commonCulture.ElementValues.getResourceString("lbl_dropdown_latest_first", xeResources), "2"));
                //rb1 = "checked";
            }
            else
            {
                //if (Request.Form["Period"] != "")
                //{
                //    if (Request.Form["Period"] == "1")
                //        rb1 = "checked";
                //    else if (Request.Form["Period"] == "2")
                //        rb2 = "checked";
                //    else if (Request.Form["Period"] == "3")
                //        rb3 = "checked";
                //    else if (Request.Form["Period"] == "4")
                //        rb4 = "checked";
                //}

                string value = Request.Form["Period"];

                using (wsAffiliateMS1.affiliateWSSoapClient svcAffiliateMS1 = new wsAffiliateMS1.affiliateWSSoapClient())
                {
                    //ws_affiliate.affiliateWSSoapClient wsaffiliate = new ws_affiliate.affiliateWSSoapClient();
                    DateTime startdate = DateTime.Now.Date;
                    DateTime enddate   = DateTime.Now.Date;

                    int validateResult = 1;

                    if (value == "4")
                    {
                        try
                        {
                            startdate = commonFunctions.DateParse(txtFrom.Text);
                            enddate   = commonFunctions.DateParse(txtTo.Text);
                        }
                        catch (Exception)
                        {
                            validateResult = -4;
                        }
                    }

                    //Current day
                    if (value == "1")
                    {
                        startdate = DateTime.Now.Date;
                        enddate   = DateTime.Now.Date;
                    }//Current Week
                    else if (value == "2")
                    {
                        startdate = DateTime.Today.AddDays(-1 * (int)(DateTime.Today.DayOfWeek)).Date;
                        enddate   = DateTime.Now.Date;
                    }//Current Month
                    else if (value == "3")
                    {
                        startdate = DateTime.Today.AddDays(-1 * ((int)(DateTime.Today.Day) + 1)).Date;
                        enddate   = DateTime.Now.Date;
                    }
                    else if (value == "4")
                    {
                        try
                        {
                            startdate = commonFunctions.DateParse(txtFrom.Text);
                            enddate   = commonFunctions.DateParse(txtTo.Text);
                        }
                        catch (Exception)
                        {
                        }
                    }

                    string message    = "";
                    string javascript = "";
                    if (validateResult == -4)
                    {
                        message = commonCulture.ElementValues.getResourceString("msg_option_from_to_date_blank", xeResources);
                        if (!string.IsNullOrEmpty(message))
                        {
                            javascript = string.Format("window.parent.showMessage({0});", commonFunctions.EncodeJsString(message)) + javascript;
                        }
                        ClientScript.RegisterStartupScript(this.GetType(), "aworkinglongscriptkey", javascript, true);
                    }
                    else
                    {
                        DataSet ds = svcAffiliateMS1.GetTrackingStatistic(long.Parse(commonCookie.CookieAffiliateId), long.Parse(ddlTrackingCode.SelectedValue), startdate, enddate);

                        if (ds.Tables.Count > 0)
                        {
                            lblTable.Text = "<table id=myTable>";
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                string direction = "DESC";
                                if (ddlSortBy.SelectedValue == "1")
                                {
                                    direction = "ASC";
                                }
                                else if (ddlSortBy.SelectedValue == "2")
                                {
                                    direction = "DESC";
                                }

                                DataTable dt;

                                ds.Tables[0].DefaultView.Sort = "dates" + " " + direction;
                                dt = ds.Tables[0].DefaultView.ToTable();


                                //------start First Header--------
                                DataTable dtTrackGroup = dt.DefaultView.ToTable(true, "trackCodeName");
                                lblTable.Text += "<tr>";
                                lblTable.Text += "<td>";
                                lblTable.Text += "</td>";
                                for (int i = 0; i < dtTrackGroup.Rows.Count; i++)
                                {
                                    lblTable.Text += "<td colspan='2'>";
                                    lblTable.Text += dtTrackGroup.Rows[i]["trackCodeName"].ToString();
                                    lblTable.Text += "</td>";
                                }
                                lblTable.Text += "</tr>";
                                //------end First Header--------


                                //------start Second Header--------
                                lblTable.Text += "<tr>";
                                lblTable.Text += "<td>";
                                lblTable.Text += commonCulture.ElementValues.getResourceString("lbl_table_header_date", xeResources).ToString();
                                lblTable.Text += "</td>";
                                for (int i = 0; i < dtTrackGroup.Rows.Count; i++)
                                {
                                    lblTable.Text += "<td>";
                                    lblTable.Text += commonCulture.ElementValues.getResourceString("lbl_table_header_clicks", xeResources).ToString();
                                    lblTable.Text += "</td>";
                                    lblTable.Text += "<td>";
                                    lblTable.Text += commonCulture.ElementValues.getResourceString("lbl_table_header_unique_clicks", xeResources).ToString();
                                    lblTable.Text += "</td>";
                                }
                                lblTable.Text += "</tr>";
                                //------end Second Header--------


                                //------start Rows for Column Date--------
                                DataTable dtDateDistinct = dt.DefaultView.ToTable(true, "dates");
                                for (int i = 0; i < dtDateDistinct.Rows.Count; i++)
                                {
                                    //------start Second Header--------
                                    lblTable.Text += "<tr>";
                                    lblTable.Text += "<td>";
                                    lblTable.Text += DateTime.Parse(dtDateDistinct.Rows[i]["dates"].ToString()).ToString(commonFunctions.wcDateFormat);
                                    lblTable.Text += "</td>";
                                    for (int x = 0; x < dtTrackGroup.Rows.Count; x++)
                                    {
                                        bool hasValue = false;

                                        DataRow[] result = dt.Select("dates = '" + dtDateDistinct.Rows[i]["dates"].ToString() + "' AND trackCodeName = '" + dtTrackGroup.Rows[x]["trackCodeName"] + "'");
                                        foreach (DataRow row in result)
                                        {
                                            lblTable.Text += "<td>";
                                            lblTable.Text += row["CountClick"];
                                            lblTable.Text += "</td>";
                                            lblTable.Text += "<td>";
                                            lblTable.Text += row["CountUniqueClick"];
                                            lblTable.Text += "</td>";
                                            hasValue       = true;
                                        }
                                        if (!hasValue)
                                        {
                                            lblTable.Text += "<td>";
                                            lblTable.Text += "0";
                                            lblTable.Text += "</td>";
                                            lblTable.Text += "<td>";
                                            lblTable.Text += "0";
                                            lblTable.Text += "</td>";
                                        }
                                    }
                                    lblTable.Text += "</tr>";
                                    //------end Second Header--------
                                }
                                //------end Rows for Column Date--------


                                //------start Footer for Column Date--------
                                //------start Second Header--------
                                lblTable.Text += "<tr>";
                                lblTable.Text += "<td>";
                                lblTable.Text += commonCulture.ElementValues.getResourceString("lbl_table_footer_total_click", xeResources).ToString();
                                lblTable.Text += "</td>";
                                for (int x = 0; x < dtTrackGroup.Rows.Count; x++)
                                {
                                    lblTable.Text += "<td>";
                                    lblTable.Text += dt.Compute("Sum(CountClick)", "trackCodeName = '" + dtTrackGroup.Rows[x]["trackCodeName"] + "'");
                                    lblTable.Text += "</td>";
                                    lblTable.Text += "<td>";
                                    lblTable.Text += dt.Compute("Sum(CountUniqueClick)", "trackCodeName = '" + dtTrackGroup.Rows[x]["trackCodeName"] + "'");
                                    lblTable.Text += "</td>";
                                }
                                lblTable.Text += "</tr>";
                                //------end Second Header--------
                                //------end Rows for Column Date--------
                            }
                            else
                            {
                                lblTable.Text += "<tr>";
                                lblTable.Text += "<td>";
                                lblTable.Text += commonCulture.ElementValues.getResourceString("lbl_table_no_result", xeResources).ToString();
                                lblTable.Text += "</td>";
                                lblTable.Text += "</tr>";
                            }
                            lblTable.Text += "</table>";
                        }
                        else
                        {
                            lblTable.Text  = "<table>";
                            lblTable.Text += "<tr>";
                            lblTable.Text += "<td>";
                            lblTable.Text += commonCulture.ElementValues.getResourceString("lbl_table_no_result", xeResources).ToString();
                            lblTable.Text += "</td>";
                            lblTable.Text += "</tr>";
                            lblTable.Text += "</table>";
                        }
                    }
                }//ws
            }
        }
    }
コード例 #4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        int    intProcessSerialId = 0;
        string strProcessId       = Guid.NewGuid().ToString().ToUpper();
        string strPageName        = "UpdatePassword";

        string strProcessCode = string.Empty;

        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isProcessAbort   = false;
        bool   isSystemError    = false;

        long lngOperatorId = 1;

        string strAffiliateId          = string.Empty;
        string strPassword             = string.Empty;
        string strPasswordEncrypted    = string.Empty;
        string strPasswordNew          = string.Empty;
        string strPasswordNewEncrypted = string.Empty;
        string strPasswordConfirm      = string.Empty;

        int intResult = int.MinValue;

        #region populateVariables
        strAlertCode = "-1";

        strAffiliateId     = commonCookie.CookieAffiliateId;
        strPassword        = txtCurrentPassword.Text;
        strPasswordNew     = txtNewPassword.Text;
        strPasswordConfirm = txtConfirmPassword.Text;

        #endregion

        #region parametersValidation

        if (string.IsNullOrEmpty(commonVariables.CurrentMemberSessionId))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceString("SessionExpired", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strPassword))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdatePassword/MissingPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strPasswordNew))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdatePassword/MissingPasswordNew", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strPasswordConfirm))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdatePassword/MissingPasswordConfirm", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPassword))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdatePassword/InvalidPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPasswordNew))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdatePassword/InvalidPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPasswordConfirm))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdatePassword/InvalidPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.Compare(strPasswordNew, strPasswordConfirm, true) != 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdatePassword/UnmatchedPassword", xeErrors);
            isProcessAbort  = true;
        }

        else
        {
            strPasswordEncrypted    = commonEncryption.Encrypt(strPassword);
            strPasswordNewEncrypted = commonEncryption.Encrypt(strPasswordNew);
        }

        #endregion

        if (!isProcessAbort)
        {
            try
            {
                using (wsAffiliateMS1.affiliateWSSoapClient wsInstanceAff = new wsAffiliateMS1.affiliateWSSoapClient("affiliateWSSoap"))
                {
                    intResult = wsInstanceAff.ChangePassword(long.Parse(commonCookie.CookieAffiliateId), strPasswordEncrypted, strPasswordNewEncrypted);

                    strProcessRemark = string.Format("OperatorId: {0} | AffiliateId: {1} | Password: {2} | PasswordNew: {3} | REMOTEIP: {4} | FORWARDEDIP: {5} | REQUESTERIP: {6}", lngOperatorId, strAffiliateId, strPasswordEncrypted, strPasswordNewEncrypted, commonIp.remoteIP, commonIp.forwardedIP, commonIp.requesterIP);

                    intProcessSerialId += 1;
                    commonAuditTrail.appendLog("system", strPageName, "UpdatePassword", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
                }
            }
            catch (Exception) { }

            switch (intResult)
            {
            case 1:     // success
                //case 10:
                strAlertCode    = "1";
                strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdatePassword/Success", xeErrors);
                break;

            case 11:     // wrong password
                strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdatePassword/IncorrectPassword", xeErrors);
                break;

            default:     // general error
                strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                break;
            }
        }
    }
コード例 #5
0
    private void getEmail(ref string emailSubject, ref string emailContent)
    {
        WebRequest  req;
        WebResponse res;

        try
        {
            req = WebRequest.Create(Server.MapPath("~").ToLower() + "/emailTemplate/1/SubAffiliateInvitation_" + commonVariables.SelectedLanguage + ".html");
            res = req.GetResponse();
        }
        catch (Exception ex)
        {
            req = WebRequest.Create(Server.MapPath("~").ToLower() + "/emailTemplate/1/SubAffiliateInvitation_en-us.html");
            res = req.GetResponse();
        }



        StreamReader sr = new StreamReader(res.GetResponseStream());


        string html        = sr.ReadToEnd();
        bool   utf8Content = false;
        bool   utf8Subject = false;



        var     wsaffiliate     = new wsAffiliateMS1.affiliateWSSoapClient();
        DataSet emailTemplateDS = wsaffiliate.GetEmailTemplate(1, 7, commonCookie.CookieLanguage);

        if (emailTemplateDS.Tables.Count > 0 && emailTemplateDS.Tables[0].Rows.Count > 0)
        {
            emailSubject = emailTemplateDS.Tables[0].Rows[0]["emailSubject"].ToString();
            emailContent = emailTemplateDS.Tables[0].Rows[0]["emailContent"].ToString();

            emailContent = emailContent.Replace("[affiliateid]", (string)Session["affaffiliateID"]);
            emailContent = emailContent.Replace("[domain]", string.Format("affiliate{0}", ((string)Session["domain_1"])));
            emailContent = emailContent.Replace(".w88.com/register", (string)Session["domain_1"] + "/register");
        }
        else
        {
            if (html != "")
            {
                string subjectStartTag = "<!--emailsubject=";
                string subjectEndTag   = "=emailsubject-->";
                int    startPosition   = html.IndexOf(subjectStartTag);
                int    endposition     = html.IndexOf(subjectEndTag);

                if (startPosition >= 0 && endposition >= 0)
                {
                    string domain = commonIp.DomainName;
                    //string domain = "w88uat";

                    emailSubject = html.Substring(startPosition + subjectStartTag.Length, endposition - startPosition - subjectStartTag.Length);
                    emailContent = html.Replace(subjectStartTag + emailSubject + subjectEndTag, "");
                    emailContent = emailContent.Replace("[affiliateid]", commonCookie.CookieAffiliateId);
                    //emailContent = emailContent.Replace(".w88.com/register", (string)Session["domain_1"] + "/register");
                    //emailContent = emailContent.Replace(".w88.com/register", "." + domain + ".com/register");
                    emailContent = emailContent.Replace(".w88.com/register", "." + domain + "/register");


                    if (commonVariables.SelectedLanguage.ToString().ToLower() != "en-us")
                    {
                        utf8Subject = true;
                        utf8Content = true;
                    }
                }
            }
        }
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(commonVariables.CurrentMemberSessionId))
        {
            Response.Redirect("/Index.aspx", true);
        }

        else
        {
            xeErrors = commonVariables.ErrorsXML;
            commonCulture.appData.getRootResource("/Overview.aspx", out xeResources);
            commonCulture.appData.getRootResource("/Month.aspx", out xeResourcesMonth);
            commonCulture.appData.getRootResource("/ReportProduct.aspx", out xeResourcesProduct);

            //Link
            //testing
            //System.Web.HttpContext.Current.Session["AffiliateId"] = "20264";

            //affiliateLink = "/Track.aspx?affiliateid=" + Convert.ToString(string.IsNullOrEmpty((string)System.Web.HttpContext.Current.Session["AffiliateId"]) ? "" : (string)System.Web.HttpContext.Current.Session["AffiliateId"]);
            //affiliateUrl = System.Web.HttpContext.Current.Request.Url.Host.ToString() + "/Track.aspx?affiliateid=" + System.Web.HttpContext.Current.Session["AffiliateId"].ToString();

            affiliateLink = "http://affiliate.w88aff.com/Track.aspx?affiliateid=" + commonCookie.CookieAffiliateId;
            affiliateUrl  = "http://affiliate.w88aff.com/Track.aspx?affiliateid=" + commonCookie.CookieAffiliateId;

            #region overall summary
            DataSet dsSummary = new DataSet("Summary");

            DataTable summary1 = dsSummary.Tables.Add("OverallSummary");

            dsSummary.Tables[0].Columns.Add(new DataColumn("S1"));
            dsSummary.Tables[0].Columns.Add(new DataColumn("S2"));

            //add header to dataset
            DataTable dt       = (DataTable)dsSummary.Tables[0];
            DataRow   drHeader = dt.NewRow();

            drHeader["S1"] = commonCulture.ElementValues.getResourceString("lblSummary", xeResources);

            dt.Rows.Add(drHeader);
            #endregion

            #region overall Commission
            DataSet dsComm = new DataSet("Comm");

            DataTable comm = dsComm.Tables.Add("OverallCommission");

            dsComm.Tables[0].Columns.Add(new DataColumn("C1"));
            dsComm.Tables[0].Columns.Add(new DataColumn("C2"));

            //add header to dataset
            DataTable dtComm    = (DataTable)dsComm.Tables[0];
            DataRow   drHeader2 = dtComm.NewRow();

            drHeader2["C1"] = commonCulture.ElementValues.getResourceString("lblCommission", xeResources);

            dtComm.Rows.Add(drHeader2);
            #endregion

            #region overall NegativeBal
            DataSet dsNegBal = new DataSet("NegativeBal");

            DataTable negBal = dsNegBal.Tables.Add("OverallNegativeBal");

            dsNegBal.Tables[0].Columns.Add(new DataColumn("N1"));
            dsNegBal.Tables[0].Columns.Add(new DataColumn("N2"));

            //add header to dataset
            DataTable dtNegBal  = (DataTable)dsNegBal.Tables[0];
            DataRow   drHeader3 = dtNegBal.NewRow();

            drHeader3["N1"] = commonCulture.ElementValues.getResourceString("lblNegBal", xeResources);

            dtNegBal.Rows.Add(drHeader3);
            #endregion

            #region overall summary part2
            DataSet ds2 = new DataSet("Overall2");

            DataTable summary2 = ds2.Tables.Add("OverallSummary2");

            ds2.Tables[0].Columns.Add(new DataColumn("QS1"));
            ds2.Tables[0].Columns.Add(new DataColumn("QS2"));

            //add header to dataset
            DataTable dt2       = (DataTable)ds2.Tables[0];
            DataRow   drHeader4 = dt2.NewRow();

            drHeader4["QS1"] = commonCulture.ElementValues.getResourceString("lblQuickSummary", xeResources);

            dt2.Rows.Add(drHeader4);
            #endregion

            #region transaction data
            DataSet ds3 = new DataSet("TransData");

            DataTable transData = ds3.Tables.Add("TransData");

            ds3.Tables[0].Columns.Add(new DataColumn("P1A"));
            ds3.Tables[0].Columns.Add(new DataColumn("P1B"));

            #endregion

            #region sub affiliate
            DataSet dsSubAff = new DataSet("SubAffiliate");

            DataTable subAff = dsSubAff.Tables.Add("SubAffiliate");

            dsSubAff.Tables[0].Columns.Add(new DataColumn("S1"));
            dsSubAff.Tables[0].Columns.Add(new DataColumn("S2"));

            //add header to dataset
            DataTable dtSubAff  = (DataTable)dsSubAff.Tables[0];
            DataRow   drHeader6 = dtSubAff.NewRow();

            drHeader6["S1"] = commonCulture.ElementValues.getResourceString("lblSubAffTitle", xeResources);

            dtSubAff.Rows.Add(drHeader6);
            #endregion

            #region sub affiliate Product
            DataSet dsSubAffProduct = new DataSet("SubAffiliateProduct");

            DataTable subAffProduct = dsSubAffProduct.Tables.Add("SubAffiliateProduct");

            dsSubAffProduct.Tables[0].Columns.Add(new DataColumn("S1"));
            dsSubAffProduct.Tables[0].Columns.Add(new DataColumn("S2"));
            dsSubAffProduct.Tables[0].Columns.Add(new DataColumn("S3"));

            //add header to dataset
            DataTable dtSubAffProduct = (DataTable)dsSubAffProduct.Tables[0];
            DataRow   drHeader7       = dtSubAffProduct.NewRow();

            drHeader7["S1"] = commonCulture.ElementValues.getResourceString("lblProduct", xeResources);
            drHeader7["S2"] = commonCulture.ElementValues.getResourceString("lblTurnOver", xeResources);
            drHeader7["S3"] = commonCulture.ElementValues.getResourceString("lblWinLoss", xeResources);

            dtSubAffProduct.Rows.Add(drHeader7);
            #endregion

            string first  = commonCulture.ElementValues.getResourceString("lbl1sthalf", xeResourcesMonth);
            string second = commonCulture.ElementValues.getResourceString("lbl2ndhalf", xeResourcesMonth);

            //Overview
            using (wsAffiliateMS1.affiliateWSSoapClient svcAffiliateMS1 = new wsAffiliateMS1.affiliateWSSoapClient())
            {
                DataSet   dsAffOverview        = svcAffiliateMS1.AffiliateOverview(long.Parse(commonCookie.CookieAffiliateId));
                DataSet   dsProdOverview       = svcAffiliateMS1.ProductOverview(long.Parse(commonCookie.CookieAffiliateId));
                DataTable dtAffOverviewProduct = dsProdOverview.Tables[0].DefaultView.ToTable(true, "productName");

                #region aff Info & summary
                if (dsAffOverview.Tables.Count > 0)
                {
                    if (dsAffOverview.Tables[0].Rows.Count > 0)
                    {
                        #region Summary
                        DataTable dtData = (DataTable)dsSummary.Tables[0];
                        DataRow   drData = dtData.NewRow();

                        DataTable dtDataQuick = (DataTable)ds2.Tables[0];


                        //if (Session["language"] != null && (string)Session["language"].ToString() == "zh-cn")

                        if (commonVariables.SelectedLanguage != null && commonVariables.SelectedLanguage == "zh-cn")
                        {
                            lastLogin = dsAffOverview.Tables[0].Rows[0]["lastLogiin"].ToString();

                            if (dsAffOverview.Tables[0].Rows[0]["lastLogiin"] != null && dsAffOverview.Tables[0].Rows[0]["lastLogiin"].ToString() != "")
                            {
                                int    month_int = DateTime.ParseExact(lastLogin, "dd MMM yyyy HH:mm:ss", CultureInfo.CurrentCulture).Month;
                                string month_str = DateTime.ParseExact(lastLogin, "dd MMM yyyy HH:mm:ss", CultureInfo.CurrentCulture).ToString("MMM");
                                lastLogin = lastLogin.Replace(month_str, month_int.ToString() + "月");
                            }
                            else
                            {
                                lastLogin = dsAffOverview.Tables[0].Rows[0]["lastLogiin"].ToString();
                            }
                        }
                        else
                        {
                            lastLogin = dsAffOverview.Tables[0].Rows[0]["lastLogiin"].ToString();
                        }

                        totalMember = dsAffOverview.Tables[0].Rows[0]["TotalMember"].ToString();

                        drData["S1"] = commonCulture.ElementValues.getResourceString("lblTotalMember", xeResources);
                        drData["S2"] = totalMember;
                        dtData.Rows.Add(drData);

                        #endregion

                        NoOfClick = dsAffOverview.Tables[0].Rows[0]["NoOfClick"].ToString();

                        DataRow drDataQuick = dtDataQuick.NewRow();
                        drDataQuick["QS1"] = commonCulture.ElementValues.getResourceString("lblNoOfClicks", xeResources);
                        drDataQuick["QS2"] = NoOfClick;
                        dt2.Rows.Add(drDataQuick);

                        using (mwsAffiliateMain.affiliateWSSoapClient svcAffiliateMain = new mwsAffiliateMain.affiliateWSSoapClient())
                        {
                            DataSet dsNewSignupMemberCount = svcAffiliateMain.NewSignupMemberCount(long.Parse(commonCookie.CookieAffiliateId), DateTime.Now.Month, DateTime.Now.Year);

                            if (dsNewSignupMemberCount.Tables.Count > 0)
                            {
                                newSignup            = dsNewSignupMemberCount.Tables[0].Rows[0][0].ToString();
                                newSignupWithDeposit = dsNewSignupMemberCount.Tables[1].Rows[0][0].ToString();
                            }
                            else
                            {
                                newSignup            = "0";
                                newSignupWithDeposit = "0";
                            }

                            DataRow drDataQuick2 = dtDataQuick.NewRow();
                            drDataQuick2["QS1"] = commonCulture.ElementValues.getResourceString("lblNewSignUp", xeResources);
                            drDataQuick2["QS2"] = newSignup;
                            dt2.Rows.Add(drDataQuick2);

                            DataRow drDataQuick3 = dtDataQuick.NewRow();
                            drDataQuick3["QS1"] = commonCulture.ElementValues.getResourceString("lblNewSignUpWDeposit", xeResources);
                            drDataQuick3["QS2"] = newSignupWithDeposit;
                            dt2.Rows.Add(drDataQuick3);

                            #region commission
                            //Commission

                            DataTable dtDataComm = (DataTable)dsComm.Tables[0];
                            DataRow   drDataComm = dtDataComm.NewRow();

                            if (dsAffOverview.Tables[1].Rows.Count > 0)
                            {
                                commissionCount = dsAffOverview.Tables[1].Rows.Count.ToString();

                                for (int i = 0; i < 1; i++)
                                {
                                    string monthx         = dsAffOverview.Tables[1].Rows[i]["settlementdate"].ToString().Replace("1st half ", "").Replace("2nd half ", "");
                                    int    month_int      = DateTime.ParseExact(monthx, "MMM yyyy", CultureInfo.CurrentCulture).Month;
                                    string month_str      = DateTime.ParseExact(monthx, "MMM yyyy", CultureInfo.CurrentCulture).ToString("MMM");
                                    string monthTranslate = commonCulture.ElementValues.getResourceString("lbl" + month_int.ToString(), xeResourcesMonth);
                                    string dateFinal      = dsAffOverview.Tables[1].Rows[i]["settlementdate"].ToString().Replace("1st half", first).Replace("2nd half", second).Replace(month_str, monthTranslate);

                                    drDataComm["C1"] = dateFinal;
                                    drDataComm["C2"] = "USD " + commonFunctions.Tuncate2DecimalToString(double.Parse(dsAffOverview.Tables[1].Rows[i]["grandtotal"].ToString()));
                                }
                            }
                            else
                            {
                                drDataComm["C1"] = "No Data";
                                commissionCount  = "0";
                            }

                            dtDataComm.Rows.Add(drDataComm);

                            #endregion

                            #region Negative Balance
                            //------------- Negatie balance Rollover

                            DataTable dtDataNegBal = (DataTable)dsNegBal.Tables[0];
                            DataRow   drDataNegBal = dtDataNegBal.NewRow();

                            if (dsAffOverview.Tables[2].Rows.Count > 0)
                            {
                                negativeBalCount = dsAffOverview.Tables[2].Rows.Count.ToString();

                                for (int i = 0; i < 1; i++)
                                {
                                    string monthx         = dsAffOverview.Tables[2].Rows[i]["settlementdate"].ToString().Replace("1st half ", "").Replace("2nd half ", "");
                                    int    month_int      = DateTime.ParseExact(monthx, "MMM yyyy", CultureInfo.CurrentCulture).Month;
                                    string month_str      = DateTime.ParseExact(monthx, "MMM yyyy", CultureInfo.CurrentCulture).ToString("MMM");
                                    string monthTranslate = commonCulture.ElementValues.getResourceString("lbl" + month_int.ToString(), xeResourcesMonth);
                                    string dateFinal      = dsAffOverview.Tables[2].Rows[i]["settlementdate"].ToString().Replace("1st half", first).Replace("2nd half", second).Replace(month_str, monthTranslate);

                                    drDataNegBal["N1"] = dateFinal;
                                    drDataNegBal["N2"] = "USD " + commonFunctions.Tuncate2DecimalToString(double.Parse(dsAffOverview.Tables[2].Rows[i]["NegativeBalanceRollover"].ToString()));
                                }
                            }
                            else
                            {
                                drDataNegBal["N1"] = "No Data";
                                negativeBalCount   = "0";
                            }

                            dtDataNegBal.Rows.Add(drDataNegBal);

                            #endregion

                            //add remaining row of record
                            if (int.Parse(commissionCount) > 1 || int.Parse(negativeBalCount) > 1)
                            {
                                int comCount = commissionCount == "" ? 0 : int.Parse(commissionCount);
                                int negCount = negativeBalCount == "" ? 0 : int.Parse(negativeBalCount);
                                int count    = comCount >= negCount ? comCount : negCount;

                                for (int i = 1; i < count; i++)
                                {
                                    if (i < comCount)
                                    {
                                        drDataComm = dtDataComm.NewRow();

                                        string monthx         = dsAffOverview.Tables[1].Rows[i]["settlementdate"].ToString().Replace("1st half ", "").Replace("2nd half ", "");
                                        int    month_int      = DateTime.ParseExact(monthx, "MMM yyyy", CultureInfo.CurrentCulture).Month;
                                        string month_str      = DateTime.ParseExact(monthx, "MMM yyyy", CultureInfo.CurrentCulture).ToString("MMM");
                                        string monthTranslate = commonCulture.ElementValues.getResourceString("lbl" + month_int.ToString(), xeResourcesMonth);
                                        string dateFinal      = dsAffOverview.Tables[1].Rows[i]["settlementdate"].ToString().Replace("1st half", first).Replace("2nd half", second).Replace(month_str, monthTranslate);

                                        drDataComm["C1"] = dateFinal;
                                        drDataComm["C2"] = "USD " + commonFunctions.Tuncate2DecimalToString(double.Parse(dsAffOverview.Tables[1].Rows[i]["grandtotal"].ToString()));

                                        dtDataComm.Rows.Add(drDataComm);
                                    }

                                    if (i < negCount)
                                    {
                                        drDataNegBal = dtDataNegBal.NewRow();

                                        string monthx         = dsAffOverview.Tables[2].Rows[i]["settlementdate"].ToString().Replace("1st half ", "").Replace("2nd half ", "");
                                        int    month_int      = DateTime.ParseExact(monthx, "MMM yyyy", CultureInfo.CurrentCulture).Month;
                                        string month_str      = DateTime.ParseExact(monthx, "MMM yyyy", CultureInfo.CurrentCulture).ToString("MMM");
                                        string monthTranslate = commonCulture.ElementValues.getResourceString("lbl" + month_int.ToString(), xeResourcesMonth);
                                        string dateFinal      = dsAffOverview.Tables[2].Rows[i]["settlementdate"].ToString().Replace("1st half", first).Replace("2nd half", second).Replace(month_str, monthTranslate);

                                        drDataNegBal["N1"] = dateFinal;
                                        drDataNegBal["N2"] = "USD " + commonFunctions.Tuncate2DecimalToString(double.Parse(dsAffOverview.Tables[2].Rows[i]["NegativeBalanceRollover"].ToString()));

                                        dtDataNegBal.Rows.Add(drDataNegBal);
                                    }
                                }
                            }

                            if (dsProdOverview.Tables.Count > 0)
                            {
                                if (dsProdOverview.Tables[1].Rows.Count > 0)
                                {
                                    activeMembers = dsProdOverview.Tables[1].Rows[0]["ActiveMember"].ToString();
                                }
                                else
                                {
                                    activeMembers = "0";
                                }

                                DataRow drDataQuick4 = dtDataQuick.NewRow();
                                drDataQuick4["QS1"] = commonCulture.ElementValues.getResourceString("lblActiveMembers", xeResources);
                                drDataQuick4["QS2"] = activeMembers;
                                dt2.Rows.Add(drDataQuick4);
                            }
                        }
                    }
                }
                #endregion

                #region Transaction Data
                if (dsProdOverview.Tables.Count > 0)
                {
                    if (dsProdOverview.Tables[0].Rows.Count > 0)
                    {
                        DataTable dt3       = (DataTable)ds3.Tables[0];
                        DataRow   drHeader5 = dt3.NewRow();

                        DataTable dtWL = (DataTable)ds3.Tables[0];
                        DataRow   drWL = dtWL.NewRow();

                        DataTable dtAM = (DataTable)ds3.Tables[0];
                        DataRow   drAM = dtAM.NewRow();

                        DataTable dtNB = (DataTable)ds3.Tables[0];
                        DataRow   drNB = dtNB.NewRow();

                        DataTable dtTO = (DataTable)ds3.Tables[0];
                        DataRow   drTO = dtTO.NewRow();

                        DataTable dtEmptyLine = (DataTable)ds3.Tables[0];
                        DataRow   drEmptyLine = dtEmptyLine.NewRow();

                        //foreach (DataRow drProdOverview in dsProdOverview.Tables[0].Rows)
                        for (int i = 0; i < dtAffOverviewProduct.Rows.Count; i++)
                        {
                            DataRow[] result = dsProdOverview.Tables[0].Select("productName = '" + dtAffOverviewProduct.Rows[i]["productName"].ToString() + "'");
                            foreach (DataRow row in result)
                            {
                                drHeader5["P1A"] = commonCulture.ElementValues.getResourceString("lblTitle", xeResources) + commonCulture.ElementValues.getResourceString("lbl" + dtAffOverviewProduct.Rows[i]["productName"].ToString().Replace(" ", string.Empty).ToLower(), xeResourcesProduct);
                                dt3.Rows.Add(drHeader5);
                                drHeader5 = dt3.NewRow();

                                drWL["P1A"] = commonCulture.ElementValues.getResourceString("lblWinLoss", xeResources);
                                drWL["P1B"] = "USD " + decimal.Parse(dsProdOverview.Tables[0].Rows[i]["base_winlost_amount"].ToString()).ToString("n2");
                                dtWL.Rows.Add(drWL);
                                drWL = dtWL.NewRow();

                                drAM["P1A"] = commonCulture.ElementValues.getResourceString("lblActiveMember", xeResources);
                                drAM["P1B"] = dsProdOverview.Tables[0].Rows[i]["totalactivemember"].ToString();
                                dtAM.Rows.Add(drAM);
                                drAM = dtAM.NewRow();

                                drNB["P1A"] = commonCulture.ElementValues.getResourceString("lblBets", xeResources);
                                drNB["P1B"] = dsProdOverview.Tables[0].Rows[i]["total_hand"].ToString();
                                dtNB.Rows.Add(drNB);
                                drNB = dtNB.NewRow();

                                drTO["P1A"] = commonCulture.ElementValues.getResourceString("lblTurnOver", xeResources);
                                drTO["P1B"] = "USD " + decimal.Parse(dsProdOverview.Tables[0].Rows[i]["base_stake_amount"].ToString()).ToString("n2");
                                dtTO.Rows.Add(drTO);
                                drTO = dtTO.NewRow();
                            }
                        }
                    }
                }
                #endregion

                #region sub affiliate summary & product
                DataSet   dsProdSubAff = svcAffiliateMS1.ProductSubAffOverview(long.Parse(commonCookie.CookieAffiliateId));
                DataTable dtProdSubAff = dsProdSubAff.Tables[0].DefaultView.ToTable(true, "productName");

                DataTable dtSA         = (DataTable)dsSubAff.Tables[0];
                DataRow   drDataSubAff = dtSA.NewRow();

                if (dsProdSubAff.Tables.Count > 0)
                {
                    if (dsProdSubAff.Tables[1].Rows.Count > 0)
                    {
                        drDataSubAff["S1"] = commonCulture.ElementValues.getResourceString("lblWinLoss", xeResources);
                        drDataSubAff["S2"] = "USD " + decimal.Parse(dsProdSubAff.Tables[1].Rows[0]["base_winlost_amount"].ToString()).ToString("n2");
                        dtSA.Rows.Add(drDataSubAff);

                        drDataSubAff       = dtSA.NewRow();
                        drDataSubAff["S1"] = commonCulture.ElementValues.getResourceString("lblActiveMember", xeResources);
                        drDataSubAff["S2"] = dsProdSubAff.Tables[1].Rows[0]["ActiveMember"].ToString();
                        dtSA.Rows.Add(drDataSubAff);


                        //totalSubAffActiveMember = dsProdSubAff.Tables[1].Rows[0]["ActiveMember"].ToString();
                        //totalSubAffCompanyWinLose = commonFunction.Tuncate2DecimalToString(double.Parse(dsProdSubAff.Tables[1].Rows[0]["base_winlost_amount"].ToString()));
                    }
                    else
                    {
                        drDataSubAff["S1"] = commonCulture.ElementValues.getResourceString("lblWinLoss", xeResources);
                        drDataSubAff["S2"] = totalSubAffCompanyWinLose;
                        dtSA.Rows.Add(drDataSubAff);

                        drDataSubAff       = dtSA.NewRow();
                        drDataSubAff["S1"] = commonCulture.ElementValues.getResourceString("lblActiveMember", xeResources);
                        drDataSubAff["S2"] = totalSubAffActiveMember;
                        dtSA.Rows.Add(drDataSubAff);
                    }


                    //lblSubProduct.Text = "";
                    //for (int i = 0; i < dtProdSubAff.Rows.Count; i++)
                    //{
                    //    DataRow[] result = dsProdSubAff.Tables[0].Select("productName = '" + dtProdSubAff.Rows[i]["productName"].ToString() + "'");
                    //    foreach (DataRow row in result)
                    //    {
                    //        lblSubProduct.Text += "<tr>";
                    //        lblSubProduct.Text += setCurrentMonthSubAffProduct(HttpContext.GetLocalResourceObject(localResx_product, dtProdSubAff.Rows[i]["productName"].ToString()).ToString(), commonFunction.Tuncate2DecimalToString(double.Parse(row["base_winlost_amount"].ToString())), commonFunction.Tuncate2DecimalToString(double.Parse(row["base_stake_amount"].ToString())));
                    //        lblSubProduct.Text += "</tr>";
                    //    }
                    //}

                    DataTable dtSAProduct         = (DataTable)dsSubAffProduct.Tables[0];
                    DataRow   drDataSubAffProduct = dtSAProduct.NewRow();

                    for (int i = 0; i < dtProdSubAff.Rows.Count; i++)
                    {
                        DataRow[] result = dsProdSubAff.Tables[0].Select("productName = '" + dtProdSubAff.Rows[i]["productName"].ToString() + "'");
                        foreach (DataRow row in result)
                        {
                            //drDataSubAffProduct["S1"] = dtProdSubAff.Rows[i]["productName"].ToString();
                            drDataSubAffProduct["S1"] = commonCulture.ElementValues.getResourceString("lbl" + dtProdSubAff.Rows[i]["productName"].ToString().Replace(" ", string.Empty).ToLower(), xeResourcesProduct);
                            drDataSubAffProduct["S2"] = "USD " + decimal.Parse(row["base_winlost_amount"].ToString()).ToString("n2");
                            drDataSubAffProduct["S3"] = "USD " + decimal.Parse(row["base_stake_amount"].ToString()).ToString("n2");
                            dtSAProduct.Rows.Add(drDataSubAffProduct);
                            drDataSubAffProduct = dtSAProduct.NewRow();
                        }
                    }
                }
                #endregion
            }

            //Add in data table
            DataTable dtOverallSummary = (DataTable)dsSummary.Tables[0];
            overallSummary = ConvertDataTableToHTML(dtOverallSummary);

            DataTable dtOverallComm = (DataTable)dsComm.Tables[0];
            overallComm = ConvertDataTableToHTML(dtOverallComm);

            DataTable dtOverallNegBal = (DataTable)dsNegBal.Tables[0];
            overallNegBal = ConvertDataTableToHTML(dtOverallNegBal);

            DataTable dtOverallSummary2 = (DataTable)ds2.Tables[0];
            overallSummary2 = ConvertDataTableToHTML(dtOverallSummary2);

            DataTable dtTransData = (DataTable)ds3.Tables[0];
            transactionData = ConvertDataTableToHTML2(dtTransData);

            DataTable dtSubAff1 = (DataTable)dsSubAff.Tables[0];
            SubAffiliate = ConvertDataTableToHTML(dtSubAff1);

            DataTable dtSubAff2 = (DataTable)dsSubAffProduct.Tables[0];
            SubAffiliateProduct = ConvertDataTableToHTML3(dtSubAff2);
        }
    }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Xml.Linq.XElement xeErrors = commonVariables.ErrorsXML;

        #region initialiseVariables
        int    intProcessSerialId = 0;
        string strProcessId       = Guid.NewGuid().ToString().ToUpper();
        string strPageName        = "ProcessLoginBySessionId";

        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isProcessAbort   = false;
        bool   isSystemError    = false;

        //string strLanguage = string.Empty;
        string strLoginIp        = string.Empty;
        string strCountryCode    = string.Empty;
        string strSessionId      = string.Empty;
        string strProcessCode    = string.Empty;
        string strProcessMessage = string.Empty;

        #endregion

        #region populateVariables
        strSessionId   = commonVariables.CurrentMemberSessionId;
        strLoginIp     = HttpContext.Current.Request.Form.Get("ip");
        strCountryCode = HttpContext.Current.Request.Form.Get("country");

        if (string.IsNullOrEmpty(strSessionId))
        {
            isProcessAbort = true;
            commonVariables.ClearSessionVariables();
            commonCookie.ClearCookies();
        }

        #endregion

        #region initiateSessionCheck
        if (!isProcessAbort)
        {
            try
            {
                using (wsAffiliateMS1.affiliateWSSoapClient svcInstance = new wsAffiliateMS1.affiliateWSSoapClient())
                {
                    System.Data.DataSet dsSignin = null;
                    dsSignin = svcInstance.MemberSessionCheck(strSessionId, strLoginIp);

                    if (dsSignin.Tables[0].Rows.Count > 0)
                    {
                        strProcessCode = Convert.ToString(dsSignin.Tables[0].Rows[0]["RETURN_VALUE"]);
                        switch (strProcessCode)
                        {
                        case "0":
                            strProcessMessage = "Exception";
                            break;

                        case "1":
                            string strMemberSessionId = Convert.ToString(dsSignin.Tables[0].Rows[0]["memberSessionId"]);
                            HttpContext.Current.Session.Add("MemberSessionId", Convert.ToString(dsSignin.Tables[0].Rows[0]["memberSessionId"]));
                            HttpContext.Current.Session.Add("MemberId", Convert.ToString(dsSignin.Tables[0].Rows[0]["affiliateID"]));
                            HttpContext.Current.Session.Add("MemberCode", Convert.ToString(dsSignin.Tables[0].Rows[0]["memberCode"]));
                            HttpContext.Current.Session.Add("CountryCode", Convert.ToString(dsSignin.Tables[0].Rows[0]["countryCode"]));
                            HttpContext.Current.Session.Add("CurrencyCode", Convert.ToString(dsSignin.Tables[0].Rows[0]["currencyCode"]));
                            HttpContext.Current.Session.Add("LanguageCode", Convert.ToString(dsSignin.Tables[0].Rows[0]["languageCode"]));
                            //HttpContext.Current.Session.Add("RiskId", Convert.ToString(dsSignin.Tables[0].Rows[0]["riskId"]));
                            //HttpContext.Current.Session.Add("PartialSignup", Convert.ToString(dsSignin.Tables[0].Rows[0]["partialSignup"]));
                            HttpContext.Current.Session.Add("ResetPassword", Convert.ToString(dsSignin.Tables[0].Rows[0]["resetPassword"]));

                            commonCookie.CookieAffiliateId = Convert.ToString(dsSignin.Tables[0].Rows[0]["affiliateID"]);
                            commonCookie.CookieS           = strMemberSessionId;
                            commonCookie.CookieG           = strMemberSessionId;
                            HttpContext.Current.Session.Add("LoginStatus", "success");
                            break;

                        case "10":
                            strProcessMessage = "NotLogin";
                            commonVariables.ClearSessionVariables();
                            commonCookie.ClearCookies();
                            break;

                        case "21":
                            strProcessMessage = "InvalidUsername";
                            break;

                        case "22":
                            strProcessMessage = "InactiveAccount";
                            break;

                        case "23":
                            strProcessMessage = "InvalidPassword";
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                strProcessCode    = "0";
                strProcessMessage = ex.Message;
                commonVariables.ClearSessionVariables();
                commonCookie.ClearCookies();
            }
        }

        strProcessRemark = string.Format("SessionId: {0} | IPAddress: {1} | CountryCode: {2} | ProcessCode: {3} | ProcessMessage: {4}", strSessionId, strLoginIp, strCountryCode, strProcessCode, strProcessMessage);

        intProcessSerialId += 1;
        commonAuditTrail.appendLog("system", strPageName, "InitiateProcessLogin", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
        #endregion

        if (string.Compare(strProcessCode, "1", true) == 0)
        {
            Response.Write(commonVariables.SelectedLanguage);
        }
        else
        {
            Response.Write("0");
        }
        Response.End();
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strOperatorId  = commonVariables.OperatorId;
        string strAffiliateId = string.Empty;

        xeErrors = commonVariables.ErrorsXML;
        System.Xml.Linq.XElement xeResources = null;
        commonCulture.appData.getLocalResource(out xeResources);
        customConfig.OperatorSettings opSettings = new customConfig.OperatorSettings("W88");

        if (!Page.IsPostBack)
        {
            //if (string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId"))) { if (string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("AffiliateId"))) { commonVariables.SetSessionVariable("AffiliateId", HttpContext.Current.Request.QueryString.Get("AffiliateId")); } }
            //strAffiliateId = string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId")) ? string.Empty : Convert.ToString(commonVariables.GetSessionVariable("AffiliateId"));

            lblUsername.Text = commonCulture.ElementValues.getResourceString("lblUsername", xeResources);
            txtUsername.Attributes.Add("PLACEHOLDER", lblUsername.Text);

            lblPassword.Text = commonCulture.ElementValues.getResourceString("lblPassword", xeResources);
            txtPassword.Attributes.Add("PLACEHOLDER", lblPassword.Text);

            lblEmail.Text = commonCulture.ElementValues.getResourceString("lblEmailAddress", xeResources);
            txtEmail.Attributes.Add("PLACEHOLDER", lblEmail.Text);

            lblDOB.Text = commonCulture.ElementValues.getResourceString("lblDOB", xeResources);

            lblContact.Text = commonCulture.ElementValues.getResourceString("lblContact", xeResources);
            txtContact.Attributes.Add("PLACEHOLDER", lblContact.Text);

            //lblFirstName.Text = commonCulture.ElementValues.getResourceString("lblFirstName", xeResources);
            //txtFirstName.Attributes.Add("PLACEHOLDER", lblFirstName.Text);

            //lblLastName.Text = commonCulture.ElementValues.getResourceString("lblLastName", xeResources);
            //txtLastName.Attributes.Add("PLACEHOLDER", lblLastName.Text);

            lblFullName.Text = commonCulture.ElementValues.getResourceString("lblFullName", xeResources);
            txtFullName.Attributes.Add("PLACEHOLDER", lblFullName.Text);

            lblAccount.Text = commonCulture.ElementValues.getResourceString("lblAccount", xeResources);
            txtAccount.Attributes.Add("PLACEHOLDER", lblAccount.Text);

            lblReferralID.Text = commonCulture.ElementValues.getResourceString("lblReferralID", xeResources);
            txtReferralID.Attributes.Add("PLACEHOLDER", lblReferralID.Text);

            lblAddress.Text = commonCulture.ElementValues.getResourceString("lblAddress", xeResources);
            txtAddress.Attributes.Add("PLACEHOLDER", lblAddress.Text);

            lblCity.Text = commonCulture.ElementValues.getResourceString("lblCity", xeResources);
            txtCity.Attributes.Add("PLACEHOLDER", lblCity.Text);

            lblPostal.Text = commonCulture.ElementValues.getResourceString("lblPostal", xeResources);
            txtPostal.Attributes.Add("PLACEHOLDER", lblPostal.Text);

            lblWebsiteUrl.Text = commonCulture.ElementValues.getResourceString("lblWebsiteUrl", xeResources);

            lblURL1.Text = commonCulture.ElementValues.getResourceString("lblURL1", xeResources);
            txtURL1.Attributes.Add("PLACEHOLDER", lblURL1.Text);

            lblURL2.Text = commonCulture.ElementValues.getResourceString("lblURL2", xeResources);
            txtURL2.Attributes.Add("PLACEHOLDER", lblURL2.Text);

            lblURL3.Text = commonCulture.ElementValues.getResourceString("lblURL3", xeResources);
            txtURL3.Attributes.Add("PLACEHOLDER", lblURL3.Text);

            lblDesc.Text = commonCulture.ElementValues.getResourceString("lblDesc", xeResources);
            txtDesc.Attributes.Add("PLACEHOLDER", lblDesc.Text);

            lblCaptcha.Text = commonCulture.ElementValues.getResourceString("lblCaptcha", xeResources);
            txtCaptcha.Attributes.Add("PLACEHOLDER", lblCaptcha.Text);

            lblDisclaimer.InnerText = commonCulture.ElementValues.getResourceString("lblDisclaimer", xeResources);

            btnSubmit.Text      = commonCulture.ElementValues.getResourceString("btnSubmit", xeResources);
            btnCancel.InnerText = commonCulture.ElementValues.getResourceString("btnCancel", xeResources);

            #region PhoneCountryCode
            System.Data.DataSet dsCountryInfo = null;

            using (wsMemberMS1.memberWSSoapClient wsInstance = new wsMemberMS1.memberWSSoapClient())
            {
                dsCountryInfo = wsInstance.GetCountryInfo(Convert.ToInt64(strOperatorId));

                if (dsCountryInfo.Tables[0].Rows.Count > 0)
                {
                    foreach (System.Data.DataRow drPhoneCountryCode in dsCountryInfo.Tables[0].Select("", "countryPhoneCode ASC"))
                    {
                        string strProcessRemark   = "Register: GetCountryInfo" + strOperatorId;
                        int    intProcessSerialId = 0;
                        intProcessSerialId += 1;
                        commonAuditTrail.appendLog("system", "Register", "ParameterValidation", "DataBaseManager.DLL", "", "", "", "", strProcessRemark, Convert.ToString(intProcessSerialId), "", true);

                        drpContactCountry.Items.Add(new ListItem(string.Format("+ {0}", Convert.ToString(drPhoneCountryCode["countryPhoneCode"])), Convert.ToString(drPhoneCountryCode["countryPhoneCode"])));
                    }
                }
            }
            #endregion

            #region Currencies
            string        arrStrCurrencies = opSettings.Values.Get("Currencies");
            List <string> lstCurrencies    = arrStrCurrencies.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList();

            drpCurrency.Items.Insert(0, new ListItem(commonCulture.ElementValues.getResourceString("drpCurrencySelect", xeResources), "-1"));

            foreach (string currency in lstCurrencies)
            {
                string strProcessRemark   = "currency: " + currency;
                int    intProcessSerialId = 0;
                intProcessSerialId += 1;
                commonAuditTrail.appendLog("system", "Register", "ParameterValidation", "DataBaseManager.DLL", "", "", "", "", strProcessRemark, Convert.ToString(intProcessSerialId), "", true);

                drpCurrency.Items.Add(new ListItem(commonCulture.ElementValues.getResourceXPathString("Currency/" + currency, xeResources), currency));
            }
            #endregion

            #region Country
            using (wsAffiliateMS1.affiliateWSSoapClient wsInstanceAff = new wsAffiliateMS1.affiliateWSSoapClient("affiliateWSSoap"))
            {
                System.Data.DataSet ds_country = wsInstanceAff.GetCountryList();

                if (ds_country.Tables[0].Rows.Count > 0)
                {
                    drpCountry.DataTextField  = "countryName";
                    drpCountry.DataValueField = "countryCode";
                    drpCountry.DataSource     = ds_country.Tables[0];
                    drpCountry.DataBind();

                    drpCountry.Items.Insert(0, new ListItem(commonCulture.ElementValues.getResourceString("drpCountrySelect", xeResources), "-1"));
                }
            }
            #endregion

            #region Language
            string[] langcodes = System.Configuration.ConfigurationManager.AppSettings.Get("list_language_code").Split(',');
            string[] langNames = System.Configuration.ConfigurationManager.AppSettings.Get("list_language_translation").Split(',');

            drpLanguage.Items.Insert(0, new ListItem(commonCulture.ElementValues.getResourceString("drpLanguageSelect", xeResources), "-1"));

            for (int i = 0; i < langcodes.Length; i++)
            {
                drpLanguage.Items.Add(new ListItem(langNames[i], langcodes[i]));
            }
            #endregion

            #region Commission Type
            drpCommissionType.Items.Insert(0, new ListItem(commonCulture.ElementValues.getResourceString("lblCommissionType", xeResources), "-1"));
            drpCommissionType.Items.Add(new ListItem(commonCulture.ElementValues.getResourceString("lblRevenueShare", xeResources).ToString(), "Revenue Share"));
            #endregion

            //drpDOB.Items.Add(new ListItem(commonCulture.ElementValues.getResourceString("lblDOB", xeResources), string.Empty, true));

            int intDay = 0;
            foreach (int vintDay in new int[31])
            {
                intDay++; drpDay.Items.Add(new ListItem((intDay).ToString("0#"), Convert.ToString(intDay)));
            }
            foreach (System.Xml.Linq.XElement xeMonth in xeResources.Element("Calendar").Elements())
            {
                drpMonth.Items.Add(new ListItem(xeMonth.Value, Convert.ToString(xeMonth.Name).Replace("m", "")));
            }
            for (int intYear = System.DateTime.Now.Year - 18; intYear >= System.DateTime.Now.Year - 99; intYear--)
            {
                drpYear.Items.Add(new ListItem(Convert.ToString(intYear)));
            }

            //txtAffiliateID.Text = strAffiliateId;
        }
    }
コード例 #9
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string strAffiliateId = string.Empty;

        #region initialiseVariables
        int    intProcessSerialId = 0;
        string strProcessId       = Guid.NewGuid().ToString().ToUpper();
        string strPageName        = "Register";

        string strProcessCode = string.Empty;

        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isProcessAbort   = false;
        bool   isSystemError    = false;

        long   lngOperatorId        = 1;
        bool   isTestAccount        = false;
        string strMemberCode        = string.Empty;
        string strPassword          = string.Empty;
        string strPasswordEncrypted = string.Empty;
        string strEmail             = string.Empty;
        string strContact           = string.Empty;
        string strContactNumber     = string.Empty;
        string strDOB            = string.Empty;
        string strFName          = string.Empty;
        string strLName          = string.Empty;
        string strCurrencyCode   = string.Empty;
        string strCountryCode    = string.Empty;
        string strAccount        = string.Empty;
        string strReferralId     = string.Empty;
        string strLanguageCode   = string.Empty;
        string strCommissionType = string.Empty;
        string strAddress        = string.Empty;
        string strCity           = string.Empty;
        string strPostal         = string.Empty;
        string strUrl1           = string.Empty;
        string strUrl2           = string.Empty;
        string strUrl3           = string.Empty;
        string strDesc           = string.Empty;

        string strIPAddress    = string.Empty;
        string strSignUpUrl    = string.Empty;
        string strVCode        = string.Empty;
        string strSessionVCode = string.Empty;
        string strPermission   = string.Empty;


        int             intOddsType     = 1;
        System.DateTime dtDOB           = DateTime.MinValue;
        string          strHiddenValues = hidValues.Value;

        List <string> lstValues = null;
        #endregion

        #region populateVariables

        strMemberCode    = txtUsername.Text.Trim();
        strPassword      = txtPassword.Text;
        strEmail         = txtEmail.Text;
        strContact       = txtContact.Text;
        strContactNumber = string.Format("{0}-{1}", drpContactCountry.SelectedValue, strContact);
        strDOB           = string.Format("{0}-{1}-{2}", drpYear.SelectedValue, drpMonth.SelectedValue, drpDay.SelectedValue);
        //strFName = System.Text.RegularExpressions.Regex.Replace(txtFirstName.Text, @"\t|\n|\r|", "");
        //strLName = System.Text.RegularExpressions.Regex.Replace(txtLastName.Text, @"\t|\n|\r|", "");
        strFName          = System.Text.RegularExpressions.Regex.Replace(txtFullName.Text, @"\t|\n|\r|", "");
        strCurrencyCode   = drpCurrency.SelectedValue;
        strCountryCode    = drpCountry.SelectedValue;
        strAccount        = txtAccount.Text.Trim();;
        strReferralId     = txtReferralID.Text.Trim();
        strLanguageCode   = drpLanguage.SelectedValue;
        strCommissionType = drpCommissionType.SelectedValue;
        strAddress        = txtAddress.Text.Trim();
        strCity           = txtCity.Text.Trim();
        strPostal         = txtPostal.Text.Trim();
        strUrl1           = txtURL1.Text.Trim();
        strUrl2           = txtURL2.Text.Trim();
        strUrl3           = txtURL3.Text.Trim();
        strDesc           = txtDesc.Text.Trim();

        strVCode        = txtCaptcha.Text;
        strSessionVCode = commonVariables.GetSessionVariable("vCode");
        strAlertCode    = "-1";

        //strAffiliateId = txtAffiliateID.Text;

        System.Text.RegularExpressions.Regex rexContact = new System.Text.RegularExpressions.Regex("([0-9]{1,4})[-]([0-9]{6,12})$");
        #endregion

        #region parametersValidation

        strResultCode   = "11";
        strResultDetail = "Error:ParameterValidation";

        txtCaptcha.Text = string.Empty;

        if (string.IsNullOrEmpty(strMemberCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingUsername", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strPassword))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strEmail))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingEmail", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (!rexContact.IsMatch(strContactNumber))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strFName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingFName", xeErrors);
            isProcessAbort  = true;
        }
        //else if (string.IsNullOrEmpty(strLName))
        //{
        //    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingLName", xeErrors);
        //    isProcessAbort = true;
        //}
        else if (string.IsNullOrEmpty(strCurrencyCode) || string.Compare(strCurrencyCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCurrency", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strCountryCode) || string.Compare(strCountryCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCountryCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strLanguageCode) || string.Compare(strLanguageCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingLanguageCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strCommissionType) || string.Compare(strCommissionType, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCommissionType", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strVCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingVCode", xeErrors);
            isProcessAbort  = true;
        }

        else if (commonValidation.isInjection(strMemberCode) || strMemberCode.IndexOf(' ') >= 0 || !commonValidation.isAlphanumeric(strMemberCode) || strMemberCode.Length < 5 || strMemberCode.Length > 16)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUsername", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPassword) || strPassword.Length < 8 || strPassword.Length > 10)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strEmail))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidEmail", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCurrencyCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCurrency", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCountryCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCountryCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strFName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidFName", xeErrors);
            isProcessAbort  = true;
        }
        //else if (commonValidation.isInjection(strLName))
        //{
        //    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidLName", xeErrors);
        //    isProcessAbort = true;
        //}
        else if (commonValidation.isInjection(strAccount))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidAccount", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strReferralId))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidReferralId", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strLanguageCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidLanguageCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCommissionType))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCommissionType", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strAddress))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidAddress", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCity))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCity", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPostal))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidPostal", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl1))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl1", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl2))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl2", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl3))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl3", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strDesc))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidDesc", xeErrors);
            isProcessAbort  = true;
        }

        else if (commonValidation.isInjection(strVCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidVCode", xeErrors);
            isProcessAbort  = true;
        }

        else if (!DateTime.TryParse(strDOB, out dtDOB))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidDOB", xeErrors);
            isProcessAbort  = true;
        }
        //else if (!chkDisclaimer.Checked)
        //{
        //    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/chkDisclaimer", xeErrors);
        //    isProcessAbort = true;
        //}

        else if (string.Compare(commonEncryption.encrypting(strVCode), strSessionVCode, true) != 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/IncorrectVCode", xeErrors);
            isProcessAbort  = true;
        }
        else
        {
            strResultCode   = "00";
            strResultDetail = "OK:ParameterValidation";

            strContact           = strContact.TrimStart('+');
            strPasswordEncrypted = commonEncryption.Encrypt(strPassword);
        }

        strErrorDetail   = strAlertMessage;
        strProcessRemark = string.Format("strAlertMessage: {0} | HiddenValues: {1}", strAlertMessage, strHiddenValues);

        intProcessSerialId += 1;
        commonAuditTrail.appendLog("system", strPageName, "ParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

        #endregion

        if (!isProcessAbort)
        {
            lstValues = strHiddenValues.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList();

            if (lstValues.Count > 0)
            {
                //if (lstValues[0] != null) { strCountryCode = lstValues[0]; }
                //if (lstValues[1] != null) { strSignUpUrl = string.Format("m.{0}", lstValues[1]); }
                if (lstValues[2] != null)
                {
                    strIPAddress = lstValues[2];
                }
                if (lstValues[3] != null)
                {
                    strPermission = lstValues[3];
                }
            }

            strSignUpUrl    = string.Format("m.{0}", commonIp.DomainName);
            strLanguageCode = commonVariables.SelectedLanguage;

            if (string.IsNullOrEmpty(strIPAddress))
            {
                strIPAddress = commonIp.UserIP;
            }

            if (string.IsNullOrEmpty(strCountryCode) || string.Compare(strCountryCode, "-", true) == 0)
            {
                using (wsIP2Loc.ServiceSoapClient wsInstance = new wsIP2Loc.ServiceSoapClient())
                {
                    wsInstance.location(strIPAddress, ref strCountryCode, ref strPermission);
                }
            }

            switch (strCountryCode.ToUpper())
            {
            case "MY":
            case "TH":
            case "VN":
            case "KH":
                intOddsType = 1;
                break;

            case "CN":
                intOddsType = 2;
                break;

            case "IN":
            case "KR":
            case "JP":
            case "AU":
                intOddsType = 3;
                break;

            case "ID":
                intOddsType = 4;
                break;

            default:
                intOddsType = 3;
                break;
            }

            customConfig.OperatorSettings opSettings = new customConfig.OperatorSettings("W88");

            if (opSettings.Values.Get("DemoDomains").IndexOf(commonIp.DomainName) >= 0)
            {
                isTestAccount = true;
            }

            int    intAffiliateId = string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId")) ? (string.IsNullOrEmpty(strAffiliateId) ? 0 : Convert.ToInt32(strAffiliateId)) : Convert.ToInt32(commonVariables.GetSessionVariable("AffiliateId"));
            string strReferBy     = string.Empty;
            string strDeviceId    = "Mobile";

            long referralid = 0;
            try
            {
                referralid = long.Parse(strReferralId);
            }
            catch (Exception)
            {
                referralid = 0;
            }

            //System.Data.DataSet dsRegister = null;
            int result = 0;

            //using (wsMemberMS1.memberWSSoapClient svcInstance = new wsMemberMS1.memberWSSoapClient())
            using (wsAffiliateMS1.affiliateWSSoapClient svcInstance = new wsAffiliateMS1.affiliateWSSoapClient())
            {
                //dsRegister = svcInstance.MemberRegistrationNew(lngOperatorId, strMemberCode, strPasswordEncrypted, strEmail, strContactNumber,
                //            strAddress, strCity, strPostal, strCountryCode, strCurrencyCode, strGender, intOddsType, strLanguageCode,
                //            intAffiliateId, strReferBy, strIPAddress, strSignUpUrl, strDeviceId, isTestAccount, strFName, strLName, dtDOB, string.Empty);

                result = svcInstance.MemberRegistration(strMemberCode, strPasswordEncrypted, strFName, strEmail, strContactNumber, strCountryCode, strLanguageCode, strCurrencyCode, lngOperatorId,
                                                        strAddress, strCity, strPostal, strIPAddress, strDesc, referralid, strUrl1, strUrl2, strUrl3, dtDOB, strAccount, strCommissionType, strSignUpUrl,
                                                        (string)System.Configuration.ConfigurationManager.AppSettings.Get("internal_affiliate"));

                //strProcessRemark = string.Format("OperatorId: {0} | MemberCode: {1} | Password: {2} | Email: {3} | Contact: {4} | Address: {5} | City: {6} | Postal: {6} | Country: {8} | Currency: {9} | Gender: {10} | OddsType: {11} | Language: {12} | Affiliate: {13} | ReferBy: {14} | IP: {15} | SignUpUrl: {16} | DeviceID: {17} | TestAccount: {18} | FName: {19} | LName: {20} | DOB: {21} | REMOTEIP: {22} | FORWARDEDIP: {23} | REQUESTERIP: {24} | AffiliateID: {25}",
                //    lngOperatorId, strMemberCode, strPasswordEncrypted, strEmail, strContact, strAddress, strCity, strPostal, strCountryCode, strCurrencyCode, strGender, intOddsType, strLanguageCode, intAffiliateId, strReferBy, strIPAddress, strSignUpUrl, strDeviceId, isTestAccount, strFName, strLName, dtDOB, commonIp.remoteIP, commonIp.forwardedIP, commonIp.requesterIP, intAffiliateId);

                strProcessRemark = "exec spAffiliateMemberInsertWS " + "'" + strMemberCode + "'" + ",'" + strPasswordEncrypted + "'" + ",'" + strFName + "'" + ",'" + strEmail + "'" + ",'" + strContactNumber + "'" + ",'" + strCountryCode + "'" + ",'" + strLanguageCode + "'" + ",'" + strCurrencyCode + "'" + ",'" + lngOperatorId + "'" + ",'" + strAddress + "'" + ",'" + strCity + "'" + ",'" + strPostal + "'" + ",'" + strIPAddress + "'" + ",'" + strDesc + "'" + ",'" + referralid + "'" + ",'" + strUrl1 + "'" + ",'" + strUrl2 + "'" + ",'" + strUrl3 + "'" + ",'" + dtDOB + "'" + ",'" + strAccount + "'" + ",'" + strCommissionType + "'" + ",'" + strSignUpUrl + "'" + ",'" + (string)System.Configuration.ConfigurationManager.AppSettings.Get("internal_affiliate") + "'";

                intProcessSerialId += 1;
                commonAuditTrail.appendLog("system", strPageName, "RegistrationParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

                strResultCode   = "21";
                strResultDetail = "Error:MemberRegistrationNew";

                //if (dsRegister.Tables[0].Rows.Count > 0)
                //{
                //    strProcessCode = Convert.ToString(dsRegister.Tables[0].Rows[0]["RETURN_VALUE"]);

                //switch (strProcessCode)
                switch (result.ToString())
                {
                case "0":
                    strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                    break;

                case "1":
                    strAlertCode    = "1";
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/Success", xeErrors);
                    //string strMemberSessionId = Convert.ToString(dsRegister.Tables[0].Rows[0]["memberSessionId"]);
                    //HttpContext.Current.Session.Add("MemberSessionId", Convert.ToString(dsRegister.Tables[0].Rows[0]["memberSessionId"]));
                    //HttpContext.Current.Session.Add("MemberId", Convert.ToString(dsRegister.Tables[0].Rows[0]["memberId"]));
                    //HttpContext.Current.Session.Add("MemberCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["memberCode"]));
                    //HttpContext.Current.Session.Add("CountryCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["countryCode"]));
                    //HttpContext.Current.Session.Add("CurrencyCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["currency"]));
                    //HttpContext.Current.Session.Add("LanguageCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["languageCode"]));
                    //HttpContext.Current.Session.Add("RiskId", Convert.ToString(dsRegister.Tables[0].Rows[0]["riskId"]));
                    ////HttpContext.Current.Session.Add("PaymentGroup", "A"); //Convert.ToString(dsSignin.Tables[0].Rows[0]["paymentGroup"]));
                    //HttpContext.Current.Session.Add("PartialSignup", Convert.ToString(dsRegister.Tables[0].Rows[0]["partialSignup"]));
                    //HttpContext.Current.Session.Add("ResetPassword", Convert.ToString(dsRegister.Tables[0].Rows[0]["resetPassword"]));

                    //commonCookie.CookieS = strMemberSessionId;
                    //commonCookie.CookieG = strMemberSessionId;
                    //HttpContext.Current.Session.Add("LoginStatus", "success");

                    //strResultCode = "00";
                    //strResultDetail = "OK:MemberRegistrationNew";

                    //#region IOVATION
                    //this.IovationSubmit(ref intProcessSerialId, strProcessId, strPageName, strMemberCode, strIPAddress, strPermission);
                    //#endregion
                    break;

                case "10":
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateUsername", xeErrors);
                    break;

                case "11":
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateEmail", xeErrors);
                    break;

                default:
                    strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                    break;
                }

                strErrorCode   = strProcessCode;
                strErrorDetail = strAlertMessage;
            }

            intProcessSerialId += 1;
            commonAuditTrail.appendLog("system", strPageName, "MemberRegistrationNew", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
        }
    }
コード例 #10
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string strAffiliateId = string.Empty;

        #region initialiseVariables
        int    intProcessSerialId = 0;
        string strProcessId       = Guid.NewGuid().ToString().ToUpper();
        string strPageName        = "Register";

        string strProcessCode = string.Empty;

        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isProcessAbort   = false;
        bool   isSystemError    = false;

        long lngOperatorId = 1;
        bool isTestAccount = false;
        //string strMemberCode = string.Empty;
        //string strPassword = string.Empty;
        //string strPasswordEncrypted = string.Empty;
        //string strEmail = string.Empty;
        string strContact       = string.Empty;
        string strContactNumber = string.Empty;
        string strDOB           = string.Empty;
        string strFName         = string.Empty;
        //string strLName = string.Empty;
        //string strCurrencyCode = string.Empty;
        string strCountryCode = string.Empty;
        string strAccount     = string.Empty;
        //string strReferralId = string.Empty;
        string strLanguageCode   = string.Empty;
        string strCommissionType = string.Empty;
        string strAddress        = string.Empty;
        string strCity           = string.Empty;
        string strPostal         = string.Empty;
        string strUrl1           = string.Empty;
        string strUrl2           = string.Empty;
        string strUrl3           = string.Empty;
        //string strDesc = string.Empty;

        string strIPAddress    = string.Empty;
        string strSignUpUrl    = string.Empty;
        string strVCode        = string.Empty;
        string strSessionVCode = string.Empty;
        string strPermission   = string.Empty;

        string strSecurityQues = string.Empty;
        string strSecurityAns  = string.Empty;

        string strBankAccName = string.Empty;
        string strBankAccNo   = string.Empty;
        string strSwiftCode   = string.Empty;
        string strBankName    = string.Empty;
        string strBankAdd     = string.Empty;


        int             intOddsType     = 1;
        System.DateTime dtDOB           = DateTime.MinValue;
        string          strHiddenValues = hidValues.Value;

        List <string> lstValues = null;
        #endregion

        #region populateVariables

        strContact        = txtContact.Text;
        strContactNumber  = string.Format("{0}-{1}", drpContactCountry.SelectedValue, strContact);
        strDOB            = string.Format("{0}-{1}-{2}", drpYear.SelectedValue, drpMonth.SelectedValue, drpDay.SelectedValue);
        strCountryCode    = drpCountry.SelectedValue;
        strAccount        = txtAccount.Text.Trim();;
        strLanguageCode   = drpLanguage.SelectedValue;
        strCommissionType = drpCommissionType.SelectedValue;
        strAddress        = txtAddress.Text.Trim();
        strCity           = txtCity.Text.Trim();
        strPostal         = txtPostal.Text.Trim();
        strUrl1           = txtURL1.Text.Trim();
        strUrl2           = txtURL2.Text.Trim();
        strUrl3           = txtURL3.Text.Trim();

        strSecurityQues = drpSecQues.SelectedValue;
        strSecurityAns  = txtSecAns.Text.Trim();
        strBankAccName  = txtBankAccName.Text.Trim();
        strBankAccNo    = txtBankAccNo.Text.Trim();
        strSwiftCode    = txtSwiftCode.Text.Trim();
        strBankName     = txtBankName.Text.Trim();
        strBankAdd      = txtBankAdd.Text.Trim();

        strSessionVCode = commonVariables.GetSessionVariable("vCode");
        strAlertCode    = "-1";

        //strAffiliateId = txtAffiliateID.Text;

        System.Text.RegularExpressions.Regex rexContact = new System.Text.RegularExpressions.Regex("([0-9]{1,4})[-]([0-9]{6,12})$");
        #endregion

        #region parametersValidation

        strResultCode   = "11";
        strResultDetail = "Error:ParameterValidation";

        //txtCaptcha.Text = string.Empty;

        if (string.IsNullOrEmpty(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (!rexContact.IsMatch(strContactNumber))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strSecurityAns))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/MissingSecurityAnswer", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strBankAccName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAccName", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strBankAccNo))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAccNo", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strBankName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankName", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strBankAdd))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidBankAdd", xeErrors);
            isProcessAbort  = true;
        }

        else if (string.IsNullOrEmpty(strCountryCode) || string.Compare(strCountryCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCountryCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strLanguageCode) || string.Compare(strLanguageCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingLanguageCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strCommissionType) || string.Compare(strCommissionType, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCommissionType", xeErrors);
            isProcessAbort  = true;
        }

        else if (commonValidation.isInjection(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCountryCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCountryCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strAccount))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidAccount", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strLanguageCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidLanguageCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCommissionType))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCommissionType", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strAddress))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidAddress", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCity))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCity", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPostal))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidPostal", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl1))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl1", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl2))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl2", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl3))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl3", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strSecurityQues))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidSecurityQuestion", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strSecurityAns))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidSecurityAnswer", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strBankAccName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAccName", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strBankAccNo))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAccNo", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strBankName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankName", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strBankAdd))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAdd", xeErrors);
            isProcessAbort  = true;
        }


        else if (!DateTime.TryParse(strDOB, out dtDOB))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidDOB", xeErrors);
            isProcessAbort  = true;
        }
        else
        {
            strResultCode   = "00";
            strResultDetail = "OK:ParameterValidation";

            strContact = strContact.TrimStart('+');
        }

        strErrorDetail   = strAlertMessage;
        strProcessRemark = string.Format("strAlertMessage: {0} | HiddenValues: {1}", strAlertMessage, strHiddenValues);

        intProcessSerialId += 1;
        commonAuditTrail.appendLog("system", strPageName, "ParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

        #endregion

        if (!isProcessAbort)
        {
            lstValues = strHiddenValues.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList();

            if (lstValues.Count > 0)
            {
                //if (lstValues[0] != null) { strCountryCode = lstValues[0]; }
                //if (lstValues[1] != null) { strSignUpUrl = string.Format("m.{0}", lstValues[1]); }
                if (lstValues[2] != null)
                {
                    strIPAddress = lstValues[2];
                }
                if (lstValues[3] != null)
                {
                    strPermission = lstValues[3];
                }
            }

            strSignUpUrl    = string.Format("m.{0}", commonIp.DomainName);
            strLanguageCode = commonVariables.SelectedLanguage;

            if (string.IsNullOrEmpty(strIPAddress))
            {
                strIPAddress = commonIp.UserIP;
            }

            if (string.IsNullOrEmpty(strCountryCode) || string.Compare(strCountryCode, "-", true) == 0)
            {
                using (wsIP2Loc.ServiceSoapClient wsInstance = new wsIP2Loc.ServiceSoapClient())
                {
                    wsInstance.location(strIPAddress, ref strCountryCode, ref strPermission);
                }
            }

            switch (strCountryCode.ToUpper())
            {
            case "MY":
            case "TH":
            case "VN":
            case "KH":
                intOddsType = 1;
                break;

            case "CN":
                intOddsType = 2;
                break;

            case "IN":
            case "KR":
            case "JP":
            case "AU":
                intOddsType = 3;
                break;

            case "ID":
                intOddsType = 4;
                break;

            default:
                intOddsType = 3;
                break;
            }

            customConfig.OperatorSettings opSettings = new customConfig.OperatorSettings("W88");

            if (opSettings.Values.Get("DemoDomains").IndexOf(commonIp.DomainName) >= 0)
            {
                isTestAccount = true;
            }

            int    intAffiliateId = string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId")) ? (string.IsNullOrEmpty(strAffiliateId) ? 0 : Convert.ToInt32(strAffiliateId)) : Convert.ToInt32(commonVariables.GetSessionVariable("AffiliateId"));
            string strReferBy     = string.Empty;
            string strDeviceId    = "Mobile";


            //System.Data.DataSet dsRegister = null;
            int result = 0;

            //using (wsMemberMS1.memberWSSoapClient svcInstance = new wsMemberMS1.memberWSSoapClient())
            using (wsAffiliateMS1.affiliateWSSoapClient svcInstance = new wsAffiliateMS1.affiliateWSSoapClient())
            {
                //result = svcInstance.MemberRegistration(strMemberCode, strPasswordEncrypted, strFName, strEmail, strContactNumber, strCountryCode, strLanguageCode, strCurrencyCode, lngOperatorId,
                //            strAddress, strCity, strPostal, strIPAddress, strDesc, referralid, strUrl1, strUrl2, strUrl3, dtDOB, strAccount, strCommissionType, strSignUpUrl,
                //            (string)System.Configuration.ConfigurationManager.AppSettings.Get("internal_affiliate"));

                //strProcessRemark = "exec spAffiliateMemberInsertWS " + "'" + strMemberCode + "'" + ",'" + strPasswordEncrypted + "'" + ",'" + strFName + "'" + ",'" + strEmail + "'" + ",'" + strContactNumber + "'" + ",'" + strCountryCode + "'" + ",'" + strLanguageCode + "'" + ",'" + strCurrencyCode + "'" + ",'" + lngOperatorId + "'" + ",'" + strAddress + "'" + ",'" + strCity + "'" + ",'" + strPostal + "'" + ",'" + strIPAddress + "'" + ",'" + strDesc + "'" + ",'" + referralid + "'" + ",'" + strUrl1 + "'" + ",'" + strUrl2 + "'" + ",'" + strUrl3 + "'" + ",'" + dtDOB + "'" + ",'" + strAccount + "'" + ",'" + strCommissionType + "'" + ",'" + strSignUpUrl + "'" + ",'" + (string)System.Configuration.ConfigurationManager.AppSettings.Get("internal_affiliate") + "'";
                try
                {
                    //result = svcInstance.UpdateAffiliateMemberInfo(long.Parse(System.Web.HttpContext.Current.Session["AffiliateId"].ToString()), DateTime.Parse(strDOB),
                    //strCountryCode, strAccount, strContactNumber, strAddress, strCity, strPostal, strLanguageCode, strCommissionType, strSecurityQues,
                    //strSecurityAns, strBankAccName, strBankAccNo, strSwiftCode, strBankName, strBankAdd);

                    result = svcInstance.UpdateAffiliateMemberInfo(long.Parse(commonCookie.CookieAffiliateId), DateTime.Parse(strDOB),
                                                                   strCountryCode, strAccount, strContactNumber, strAddress, strCity, strPostal, strLanguageCode, strCommissionType, strSecurityQues,
                                                                   strSecurityAns, strBankAccName, strBankAccNo, strSwiftCode, strBankName, strBankAdd, "");

                    if (result == 1)
                    {
                        //delete removed url
                        if (String.IsNullOrEmpty(txtURL1.Text) && (string)System.Web.HttpContext.Current.Session["url1"] != "")
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID1"]));
                        }

                        if (String.IsNullOrEmpty(txtURL2.Text) && (string)System.Web.HttpContext.Current.Session["url2"] != "")
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID2"]));
                        }

                        if (String.IsNullOrEmpty(txtURL3.Text) && (string)System.Web.HttpContext.Current.Session["url3"] != "")
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID3"]));
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url1"] != txtURL1.Text && !String.IsNullOrEmpty((string)System.Web.HttpContext.Current.Session["url1"]))
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID1"]));
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url2"] != txtURL2.Text && !String.IsNullOrEmpty((string)System.Web.HttpContext.Current.Session["url2"]))
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID2"]));
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url3"] != txtURL3.Text && !String.IsNullOrEmpty((string)System.Web.HttpContext.Current.Session["url3"]))
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID3"]));
                        }

                        //add new url
                        if ((string)System.Web.HttpContext.Current.Session["url1"] != txtURL1.Text && txtURL1.Text != commonCulture.ElementValues.getResourceString("lblURL1", xeResources) && !String.IsNullOrEmpty(txtURL1.Text))
                        {
                            result = svcInstance.InsertWebsiteURL(long.Parse(commonCookie.CookieAffiliateId), txtURL1.Text);
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url2"] != txtURL2.Text && txtURL2.Text != commonCulture.ElementValues.getResourceString("lblURL2", xeResources) && !String.IsNullOrEmpty(txtURL2.Text))
                        {
                            result = svcInstance.InsertWebsiteURL(long.Parse(commonCookie.CookieAffiliateId), txtURL2.Text);
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url3"] != txtURL3.Text && txtURL3.Text != commonCulture.ElementValues.getResourceString("lblURL3", xeResources) && !String.IsNullOrEmpty(txtURL3.Text))
                        {
                            result = svcInstance.InsertWebsiteURL(long.Parse(commonCookie.CookieAffiliateId), txtURL3.Text);
                        }
                    }
                }
                catch (Exception)
                {
                    throw;
                }
                strProcessRemark = "exec spAffiliateMemberUpdatePublic " + "'" + long.Parse(commonCookie.CookieAffiliateId) + "'" + ",'" + DateTime.Parse(strDOB) + "'" + ",'" + strCountryCode + "'" + ",'" + strAccount + "'" + ",'" + strContactNumber + "'" + ",'" + strAddress + "'" + ",'" + strCity + "'" + ",'" + strPostal + "'" + ",'" + strLanguageCode + "'" + ",'" + strCommissionType + "'" + ",'" + strSecurityQues + "'" + ",'" + strSecurityAns + "'" + ",'" + strBankAccName + "'" + ",'" + strBankAccNo + "'" + ",'" + strSwiftCode + "'" + ",'" + strBankName + ",'" + strBankAdd + "'" + "'";

                intProcessSerialId += 1;
                commonAuditTrail.appendLog("system", strPageName, "RegistrationParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

                strResultCode   = "21";
                strResultDetail = "Error:MemberRegistrationNew";

                //if (dsRegister.Tables[0].Rows.Count > 0)
                //{
                //    strProcessCode = Convert.ToString(dsRegister.Tables[0].Rows[0]["RETURN_VALUE"]);

                //switch (strProcessCode)
                switch (result.ToString())
                {
                case "0":
                    strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                    break;

                case "1":
                    strAlertCode    = "1";
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/Success", xeErrors);
                    break;

                case "10":
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateUsername", xeErrors);
                    break;

                case "11":
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateEmail", xeErrors);
                    break;

                default:
                    strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                    break;
                }

                strErrorCode   = strProcessCode;
                strErrorDetail = strAlertMessage;
            }

            intProcessSerialId += 1;
            commonAuditTrail.appendLog("system", strPageName, "MemberRegistrationNew", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
        }
    }
コード例 #11
0
    //else { Response.Redirect(Request.RawUrl); }

    protected void Page_Load(object sender, EventArgs e)
    {
        string strOperatorId  = commonVariables.OperatorId;
        string strAffiliateId = string.Empty;

        xeErrors = commonVariables.ErrorsXML;
        //System.Xml.Linq.XElement xeResources = null;
        //commonCulture.appData.getLocalResource(out xeResources);

        //xeErrors = commonVariables.ErrorsXML;
        commonCulture.appData.getRootResource("/AccountInfo.aspx", out xeResources);
        commonCulture.appData.getRootResource("/security_question.aspx", out xeResourcesSecQues);

        customConfig.OperatorSettings opSettings = new customConfig.OperatorSettings("W88");

        //testing
        //System.Web.HttpContext.Current.Session["AffiliateId"] = "20264";

        if (!Page.IsPostBack)
        {
            using (wsAffiliateMS1.affiliateWSSoapClient wsInstanceAff = new wsAffiliateMS1.affiliateWSSoapClient("affiliateWSSoap"))
            {
                DataSet dsAffMember = wsInstanceAff.GetAffiliateMemberInfoByID(long.Parse(commonCookie.CookieAffiliateId));
                if (dsAffMember.Tables.Count > 0)
                {
                    if (dsAffMember.Tables[0].Rows.Count > 0)
                    {
                        //if (string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId"))) { if (string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("AffiliateId"))) { commonVariables.SetSessionVariable("AffiliateId", HttpContext.Current.Request.QueryString.Get("AffiliateId")); } }
                        //strAffiliateId = string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId")) ? string.Empty : Convert.ToString(commonVariables.GetSessionVariable("AffiliateId"));

                        lblFullName.Text       = commonCulture.ElementValues.getResourceString("lblFullName", xeResources);
                        lblMemberFullName.Text = dsAffMember.Tables[0].Rows[0]["firstname"].ToString();

                        lblUsername.Text       = commonCulture.ElementValues.getResourceString("lblUsername", xeResources);
                        lblMemberUsername.Text = dsAffMember.Tables[0].Rows[0]["affiliateUser"].ToString();

                        lblEmail.Text       = commonCulture.ElementValues.getResourceString("lblEmailAddress", xeResources);
                        lblMemberEmail.Text = dsAffMember.Tables[0].Rows[0]["email"].ToString();

                        lblCurrency.Text       = commonCulture.ElementValues.getResourceString("lblCurrency", xeResources);
                        lblMemberCurrency.Text = dsAffMember.Tables[0].Rows[0]["currency"].ToString();

                        lblDOB.Text = commonCulture.ElementValues.getResourceString("lblDOB", xeResources);

                        drpDay.SelectedValue   = ((DateTime)dsAffMember.Tables[0].Rows[0]["dob"]).Year.ToString();
                        drpMonth.SelectedValue = ((DateTime)dsAffMember.Tables[0].Rows[0]["dob"]).Month.ToString();
                        drpYear.SelectedValue  = ((DateTime)dsAffMember.Tables[0].Rows[0]["dob"]).Day.ToString();

                        lblContact.Text = commonCulture.ElementValues.getResourceString("lblContact", xeResources);
                        //txtContact.Attributes.Add("PLACEHOLDER", lblContact.Text);
                        //txtContact.Attributes.Add("PLACEHOLDER", lblContact.Text);

                        string mobilno = dsAffMember.Tables[0].Rows[0]["mobileNo"].ToString();
                        if (mobilno.Contains("-"))
                        {
                            string[] mobilenosplit = mobilno.Split('-');
                            drpContactCountry.SelectedValue = mobilenosplit[0];
                            txtContact.Text = mobilenosplit[1];
                        }
                        else
                        {
                            drpContactCountry.SelectedValue = "-1";
                            txtContact.Text = mobilno;
                        }

                        lblCountry.Text          = commonCulture.ElementValues.getResourceString("lblCountry", xeResources);
                        drpCountry.SelectedValue = dsAffMember.Tables[0].Rows[0]["countryCode"].ToString();

                        lblAccount.Text = commonCulture.ElementValues.getResourceString("lblAccount", xeResources);
                        txtAccount.Text = dsAffMember.Tables[0].Rows[0]["contactMessenger"].ToString();

                        lblAddress.Text = commonCulture.ElementValues.getResourceString("lblAddress", xeResources);
                        txtAddress.Text = dsAffMember.Tables[0].Rows[0]["address"].ToString();

                        lblCity.Text   = commonCulture.ElementValues.getResourceString("lblCity", xeResources);
                        txtCity.Text   = dsAffMember.Tables[0].Rows[0]["city"].ToString();
                        txtPostal.Text = dsAffMember.Tables[0].Rows[0]["postal"].ToString();

                        lblWebsiteUrl.Text = commonCulture.ElementValues.getResourceString("lblWebsiteUrl", xeResources);

                        System.Web.HttpContext.Current.Session["urlID1"] = "";
                        System.Web.HttpContext.Current.Session["url1"]   = "";

                        System.Web.HttpContext.Current.Session["urlID2"] = "";
                        System.Web.HttpContext.Current.Session["url2"]   = "";

                        System.Web.HttpContext.Current.Session["urlID3"] = "";
                        System.Web.HttpContext.Current.Session["url3"]   = "";


                        DataSet dsAffMemberWebSite = wsInstanceAff.GetAffiliateMemberWebsite(long.Parse(commonCookie.CookieAffiliateId));

                        //check by individual

                        if (dsAffMemberWebSite.Tables[0].Rows.Count > 0)
                        {
                            if (!string.IsNullOrEmpty(dsAffMemberWebSite.Tables[0].Rows[0]["AffiliateMemberURLID"].ToString()))
                            {
                                System.Web.HttpContext.Current.Session["urlID1"] = dsAffMemberWebSite.Tables[0].Rows[0]["AffiliateMemberURLID"].ToString();
                                System.Web.HttpContext.Current.Session["url1"]   = dsAffMemberWebSite.Tables[0].Rows[0]["affiliateURL"].ToString();
                                txtURL1.Text = dsAffMemberWebSite.Tables[0].Rows[0]["affiliateURL"].ToString();
                            }
                            else
                            {
                                lblURL1.Text = commonCulture.ElementValues.getResourceString("lblURL1", xeResources);
                                txtURL1.Attributes.Add("PLACEHOLDER", lblURL1.Text);
                            }

                            if (dsAffMemberWebSite.Tables[0].Rows.Count >= 2 && !string.IsNullOrEmpty(dsAffMemberWebSite.Tables[0].Rows[1]["AffiliateMemberURLID"].ToString()))
                            {
                                System.Web.HttpContext.Current.Session["urlID2"] = dsAffMemberWebSite.Tables[0].Rows[1]["AffiliateMemberURLID"].ToString();
                                System.Web.HttpContext.Current.Session["url2"]   = dsAffMemberWebSite.Tables[0].Rows[1]["affiliateURL"].ToString();
                                txtURL2.Text = dsAffMemberWebSite.Tables[0].Rows[1]["affiliateURL"].ToString();
                            }
                            else
                            {
                                lblURL2.Text = commonCulture.ElementValues.getResourceString("lblURL2", xeResources);
                                txtURL2.Attributes.Add("PLACEHOLDER", lblURL2.Text);
                            }

                            if (dsAffMemberWebSite.Tables[0].Rows.Count >= 3 && !string.IsNullOrEmpty(dsAffMemberWebSite.Tables[0].Rows[2]["AffiliateMemberURLID"].ToString()))
                            {
                                System.Web.HttpContext.Current.Session["urlID3"] = dsAffMemberWebSite.Tables[0].Rows[2]["AffiliateMemberURLID"].ToString();
                                System.Web.HttpContext.Current.Session["url3"]   = dsAffMemberWebSite.Tables[0].Rows[2]["affiliateURL"].ToString();
                                txtURL3.Text = dsAffMemberWebSite.Tables[0].Rows[2]["affiliateURL"].ToString();
                            }
                            else
                            {
                                lblURL3.Text = commonCulture.ElementValues.getResourceString("lblURL3", xeResources);
                                txtURL3.Attributes.Add("PLACEHOLDER", lblURL3.Text);
                            }
                        }

                        else
                        {
                            lblURL1.Text = commonCulture.ElementValues.getResourceString("lblURL1", xeResources);
                            txtURL1.Attributes.Add("PLACEHOLDER", lblURL1.Text);

                            lblURL2.Text = commonCulture.ElementValues.getResourceString("lblURL2", xeResources);
                            txtURL2.Attributes.Add("PLACEHOLDER", lblURL2.Text);

                            lblURL3.Text = commonCulture.ElementValues.getResourceString("lblURL3", xeResources);
                            txtURL3.Attributes.Add("PLACEHOLDER", lblURL3.Text);
                        }

                        lblLanguage.Text       = commonCulture.ElementValues.getResourceString("lblLanguage", xeResources);
                        lblCommissionType.Text = commonCulture.ElementValues.getResourceString("lblCommissionType", xeResources);

                        lblSecQues.Text = commonCulture.ElementValues.getResourceString("lblSecQues", xeResources);

                        lblSecAns.Text = commonCulture.ElementValues.getResourceString("lblSecAns", xeResources);
                        txtSecAns.Text = dsAffMember.Tables[0].Rows[0]["securityAnswer"].ToString();

                        lblBankAccName.Text = commonCulture.ElementValues.getResourceString("lblBankAccName", xeResources);
                        txtBankAccName.Text = dsAffMember.Tables[0].Rows[0]["BankAccName"].ToString();

                        lblBankAccNo.Text = commonCulture.ElementValues.getResourceString("lblBankAccNo", xeResources);
                        txtBankAccNo.Text = dsAffMember.Tables[0].Rows[0]["BankAccNumber"].ToString();

                        lblSwiftCode.Text = commonCulture.ElementValues.getResourceString("lblSwiftCode", xeResources);
                        txtSwiftCode.Text = dsAffMember.Tables[0].Rows[0]["BankSwiftCode"].ToString();

                        lblBankName.Text = commonCulture.ElementValues.getResourceString("lblBankName", xeResources);
                        txtBankName.Text = dsAffMember.Tables[0].Rows[0]["BankName"].ToString();

                        lblBankAdd.Text = commonCulture.ElementValues.getResourceString("lblBankAdd", xeResources);
                        txtBankAdd.Text = dsAffMember.Tables[0].Rows[0]["BankAddress"].ToString();

                        //lblCaptcha.Text = commonCulture.ElementValues.getResourceString("lblCaptcha", xeResources);
                        //txtCaptcha.Attributes.Add("PLACEHOLDER", lblCaptcha.Text);

                        //lblDisclaimer.InnerText = commonCulture.ElementValues.getResourceString("lblDisclaimer", xeResources);

                        btnUpdate.Text      = commonCulture.ElementValues.getResourceString("lblUpdate", xeResources);
                        btnCancel.InnerText = commonCulture.ElementValues.getResourceString("btnCancel", xeResources);

                        #region PhoneCountryCode
                        System.Data.DataSet dsCountryInfo = null;

                        using (wsMemberMS1.memberWSSoapClient wsInstance = new wsMemberMS1.memberWSSoapClient())
                        {
                            dsCountryInfo = wsInstance.GetCountryInfo(Convert.ToInt64(strOperatorId));

                            if (dsCountryInfo.Tables[0].Rows.Count > 0)
                            {
                                foreach (System.Data.DataRow drPhoneCountryCode in dsCountryInfo.Tables[0].Select("", "countryPhoneCode ASC"))
                                {
                                    string strProcessRemark   = "Register: GetCountryInfo" + strOperatorId;
                                    int    intProcessSerialId = 0;
                                    intProcessSerialId += 1;
                                    commonAuditTrail.appendLog("system", "Register", "ParameterValidation", "DataBaseManager.DLL", "", "", "", "", strProcessRemark, Convert.ToString(intProcessSerialId), "", true);

                                    drpContactCountry.Items.Add(new ListItem(string.Format("+ {0}", Convert.ToString(drPhoneCountryCode["countryPhoneCode"])), Convert.ToString(drPhoneCountryCode["countryPhoneCode"])));
                                }
                            }
                        }
                        #endregion

                        #region Currencies
                        //string arrStrCurrencies = opSettings.Values.Get("Currencies");
                        //List<string> lstCurrencies = arrStrCurrencies.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList();

                        //drpCurrency.Items.Insert(0, new ListItem(commonCulture.ElementValues.getResourceString("drpCurrencySelect", xeResources), "-1"));

                        //foreach (string currency in lstCurrencies)
                        //{
                        //    string strProcessRemark = "currency: " + currency;
                        //    int intProcessSerialId = 0;
                        //    intProcessSerialId += 1;
                        //    commonAuditTrail.appendLog("system", "Register", "ParameterValidation", "DataBaseManager.DLL", "", "", "", "", strProcessRemark, Convert.ToString(intProcessSerialId), "", true);

                        //    drpCurrency.Items.Add(new ListItem(commonCulture.ElementValues.getResourceXPathString("Currency/" + currency, xeResources), currency));
                        //}
                        #endregion

                        #region Country
                        //using (wsAffiliateMS1.affiliateWSSoapClient wsInstanceAff = new wsAffiliateMS1.affiliateWSSoapClient("affiliateWSSoap"))
                        //{

                        System.Data.DataSet ds_country = wsInstanceAff.GetCountryList();

                        if (ds_country.Tables[0].Rows.Count > 0)
                        {
                            drpCountry.DataTextField  = "countryName";
                            drpCountry.DataValueField = "countryCode";
                            drpCountry.DataSource     = ds_country.Tables[0];
                            drpCountry.DataBind();

                            drpCountry.Items.Insert(0, new ListItem(commonCulture.ElementValues.getResourceString("drpCountrySelect", xeResources), "-1"));
                        }
                        //}
                        #endregion

                        #region Language

                        string[] langcodes = System.Configuration.ConfigurationManager.AppSettings.Get("list_language_code").Split(',');
                        string[] langNames = System.Configuration.ConfigurationManager.AppSettings.Get("list_language_translation").Split(',');

                        drpLanguage.Items.Insert(0, new ListItem(commonCulture.ElementValues.getResourceString("drpLanguageSelect", xeResources), "-1"));

                        for (int i = 0; i < langcodes.Length; i++)
                        {
                            drpLanguage.Items.Add(new ListItem(langNames[i], langcodes[i]));
                        }

                        drpLanguage.SelectedValue = dsAffMember.Tables[0].Rows[0]["languageCode"].ToString();

                        #endregion

                        #region Commission Type

                        drpCommissionType.Items.Insert(0, new ListItem(commonCulture.ElementValues.getResourceString("lblCommissionType", xeResources), "-1"));
                        drpCommissionType.Items.Add(new ListItem(commonCulture.ElementValues.getResourceString("lblRevenueShare", xeResources).ToString(), "Revenue Share"));

                        drpCommissionType.SelectedValue = dsAffMember.Tables[0].Rows[0]["comType"].ToString();

                        #endregion

                        #region Security Question


                        //drpSecQues.Items.Insert(0, new ListItem(commonCulture.ElementValues.getResourceString("lblSecQues", xeResources), "-1"));

                        for (int i = 1; i <= 6; i++)
                        {
                            drpSecQues.Items.Add(new ListItem(commonCulture.ElementValues.getResourceString("lblsecurityquestion" + i, xeResourcesSecQues), "security_question_" + i));
                        }

                        drpSecQues.SelectedValue = dsAffMember.Tables[0].Rows[0]["securityQuestion"].ToString();

                        #endregion

                        int intDay = 0;
                        foreach (int vintDay in new int[31])
                        {
                            intDay++; drpDay.Items.Add(new ListItem((intDay).ToString("0#"), Convert.ToString(intDay)));
                        }
                        foreach (System.Xml.Linq.XElement xeMonth in xeResources.Element("Calendar").Elements())
                        {
                            drpMonth.Items.Add(new ListItem(xeMonth.Value, Convert.ToString(xeMonth.Name).Replace("m", "")));
                        }
                        for (int intYear = System.DateTime.Now.Year - 18; intYear >= System.DateTime.Now.Year - 99; intYear--)
                        {
                            drpYear.Items.Add(new ListItem(Convert.ToString(intYear)));
                        }

                        //txtAffiliateID.Text = strAffiliateId;
                    }
                }
            }
        }
    }