Exemplo n.º 1
0
 public void UpdateOfferLink(string linkid, string linkname, string linkref, string cookieuri, string shortenurl, string oldvalue, string bitlyrel)
 {
     try
     {
         string strconn = ConfigurationManager.AppSettings["Iframaddsense"];
         using (OfferLinkMgmt objlink = new OfferLinkMgmt(strconn))
         {
             objlink.EditOfferLink(linkid, linkname.Trim(), linkref.Trim(), cookieuri, shortenurl, bitlyrel);
             objlink.NewValues = linkref;
             objlink.OldValues = oldvalue;
             objlink.Action    = "Update";
             objlink.Linkid    = linkid;
             objlink.SaveOfferLinkHistory();
         }
     }
     catch (Exception ex)
     {
         CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Admin, "NewGamingnetAdmin/AjaxOfferLink.aspx.cs UpdateOfferLink", ex);
     }
 }
Exemplo n.º 2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                BaseUrl         = ConfigurationManager.AppSettings["BaseURL"];
                ltbaseurl.Text  = BaseUrl.ToString();
                ltbaseurl1.Text = BaseUrl.ToString();
                ltbaseurl2.Text = BaseUrl.ToString();
                strconn         = ConfigurationManager.AppSettings["Iframaddsense"];
                try
                {
                    if (string.IsNullOrEmpty(BLL.LoginInfo.Userid))
                    {
                        Response.Redirect(BLL.Constants.OldAdminUrl + "login.aspx", false);
                    }
                }
                catch
                {
                    Response.Redirect(BLL.Constants.OldAdminUrl + "login.aspx", false);
                }

                if (IsPostBack)
                {
                    Session["txtsearch"] = txtsearch.Text;
                    Session["datesort"]  = ddlsort.SelectedValue;
                    if (null != Request.QueryString["p"])
                    {
                        pagenumber = Convert.ToInt32(Request.QueryString["p"].ToString());
                    }
                    else
                    {
                        pagenumber = 1;
                    }
                    Session["region"] = ddlregion.SelectedValue;
                    OfferLinkList(pagesize, pagenumber, Session["txtsearch"].ToString(), Session["region"].ToString(), Session["datesort"].ToString());
                }
                else
                {
                    if (Session["datesort"] == null)
                    {
                        ddlsort.SelectedValue = "adddesc";
                        Session["datesort"]   = "adddesc";
                    }

                    if (Session["txtsearch"] != null)
                    {
                        txtsearch.Text = Session["txtsearch"].ToString();
                    }
                    else
                    {
                        Session["txtsearch"] = "";
                    }
                    if (Session["region"] != null)
                    {
                        ddlregion.SelectedValue = Session["region"].ToString();
                    }
                    else
                    {
                        Session["region"] = "0";
                    }
                    if (Request.QueryString["clear"] != null)
                    {
                        txtsearch.Text          = "";
                        Session["txtsearch"]    = "";
                        Session["region"]       = "0";
                        ddlregion.SelectedValue = "0";
                    }
                    if (null != Request.QueryString["aprids"] && null != Request.QueryString["re"])
                    {
                        using (OfferLinkMgmt obj = new OfferLinkMgmt(strconn))
                        {
                            obj.ChangeOfferLinkStatus(Request.QueryString["aprids"].ToString(), Request.QueryString["re"].ToString());
                            if (Request.QueryString["re"] == "D")
                            {
                                obj.AddDeletedBy(Request.QueryString["aprids"]);
                            }

                            switch (Request.QueryString["re"])
                            {
                            case "Y":
                                obj.Action = "Activate";
                                break;

                            case "N":
                                obj.Action = "Deactivate";
                                break;

                            case "D":
                                obj.Action = "Delete";
                                break;
                            }
                            string   strids   = Request.QueryString["aprids"].ToString();
                            string[] strarray = strids.Split(',');
                            if (strarray.Length > 0)
                            {
                                for (int i = 0; i < strarray.Length; i++)
                                {
                                    obj.Linkid = strarray[i];
                                    obj.SaveOfferLinkHistory();
                                }
                            }
                            Response.Redirect("ListOfferLinks.aspx");
                        }
                    }
                    disp_labels();
                    Session["txtsearch"] = txtsearch.Text;
                    if (null != Request.QueryString["p"])
                    {
                        pagenumber = Convert.ToInt32(Request.QueryString["p"].ToString());
                    }
                    else
                    {
                        pagenumber = 1;
                    }
                    OfferLinkList(pagesize, pagenumber, Session["txtsearch"].ToString(), Session["region"].ToString(), Session["datesort"].ToString());
                }
            }
            catch (Exception ex)
            {
                CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Admin, "OfferLink/ListOfferLinks.aspx.cs Page_Load", ex);
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                BaseUrl     = ConfigurationManager.AppSettings["BaseURL"];
                adsenseconn = ConfigurationManager.AppSettings["Iframaddsense"];

                try
                {
                    if (BLL.LoginInfo.Userid == null)
                    {
                        Response.Redirect(BLL.Constants.OldAdminUrl + "login.aspx", false);
                    }
                }
                catch
                {
                    Response.Redirect(BLL.Constants.OldAdminUrl + "login.aspx", false);
                }

                if (Request.QueryString["linkid"] != null)
                {
                    ltheader.Text = "Edit William Hill - Your Odds";
                    lttop.Text    = "&nbsp;&nbsp;&nbsp; Edit William Hill - Your Odds";
                }
                else
                {
                    ltheader.Text = "Add William Hill - Your Odds";
                    lttop.Text    = "&nbsp;&nbsp;&nbsp; Add William Hill - Your Odds";
                }

                validPage.Visible = false;
                dupli.Visible     = false;
                Tr2.Visible       = false;
            }
            catch (Exception ex)
            {
                CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Admin, "OfferLink/AddEditWHLink.aspx.cs Page_Load", ex);
            }
            if (IsPostBack)
            {
                try
                {
                    Page.Validate();
                    if (IsValid)
                    {
                        using (OfferLinkMgmt objlink = new OfferLinkMgmt(adsenseconn))
                        {
                            string whurl = string.Format("{0}&sel={1}&stake={2}&url={3}", txtWhUrl.Text.Trim(), txtSel.Text.Trim(), txtStake.Text.Trim(), txtUrl.Text.Trim());
                            objlink.LinkName       = txtLinkName.Text.Trim();
                            objlink.LinkReference  = whurl;
                            objlink.Region         = rdoregion.SelectedValue;
                            objlink.IsBetSlip      = "Y";
                            objlink.IsExpire       = ddlexpire.SelectedValue;
                            objlink.ExpireDate     = GetDate(txtexpiredate.Text);
                            objlink.FastBetName    = txtfastbetname.Text.Trim();
                            objlink.Shortenurl     = BLL.Constants.Fastbeturl + CommonLib.StringHandler.ToTitle(txtfastbetname.Text.Trim());
                            objlink.FastBetTotitle = CommonLib.StringHandler.ToTitle(txtfastbetname.Text.Trim());
                            objlink.Sel            = txtSel.Text.Trim();
                            objlink.Stake          = txtStake.Text.Trim();
                            objlink.Whurl          = txtUrl.Text.Trim();
                            if (Request.QueryString["linkid"] != null)
                            {
                                objlink.Linkid = Request.QueryString["linkid"].ToString();
                                objlink.Action = "Update";
                            }
                            else
                            {
                                objlink.Linkid = "0";
                            }
                            int _linkid = 0;
                            objlink.RandomId = GenerateUniqueID();
                            int fastbetcount   = objlink.CheckDuplicateFastbetForWHUrl(objlink.Shortenurl, objlink.Linkid, objlink.Region);
                            int promolinkcount = objlink.CheckDuplicateWHLinkName(objlink.LinkName, objlink.Linkid, objlink.Region);
                            if (fastbetcount == 0 && promolinkcount == 0)
                            {
                                _linkid           = objlink.WHLink_Save();
                                Session["region"] = rdoregion.SelectedValue;

                                if (ViewState["oldvalue"] != null)
                                {
                                    objlink.OldValues = ViewState["oldvalue"].ToString();
                                    objlink.NewValues = whurl;
                                    objlink.SaveOfferLinkHistory();
                                }
                                Response.Redirect("ListOfferLinks.aspx", false);
                            }
                            else
                            {
                                dupli.Visible = true;
                                if (fastbetcount > 0)
                                {
                                    ltdupsub.Text = "This FastBet Name already exists. Please choose another.";
                                }
                                if (promolinkcount > 0)
                                {
                                    ltdupsub.Text = "This link name already exists. Please choose another.";
                                }
                                objlink.SaveDuplicatePromoLink();
                            }
                        }
                    }
                    else
                    {
                        validPage.Visible = true;
                    }
                }
                catch (Exception ex)
                {
                    CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Admin, "OfferLink/AddEditWHLink.aspx.cs IsPostBack", ex);
                }
            }
            else
            {
                try
                {
                    if (Request.QueryString["linkid"] != null)
                    {
                        using (OfferLinkMgmt obj = new OfferLinkMgmt(adsenseconn))
                        {
                            DataTable dt = new DataTable();
                            dt = obj.GetWHLinkDetails(Request.QueryString["linkid"].ToString());
                            if (dt.Rows.Count > 0)
                            {
                                txtLinkName.Text = dt.Rows[0]["LinkName"].ToString();
                                txtSel.Text      = dt.Rows[0]["sel"].ToString();
                                txtStake.Text    = dt.Rows[0]["stake"].ToString();
                                txtUrl.Text      = dt.Rows[0]["whurl"].ToString();
                                string whurl = string.Format("{0}&sel={1}&stake={2}&url={3}", txtWhUrl.Text.Trim(), txtSel.Text.Trim(), txtStake.Text.Trim(), txtUrl.Text.Trim());
                                ViewState["oldvalue"]   = whurl;
                                rdoregion.SelectedValue = dt.Rows[0]["region"].ToString();
                                ddlexpire.SelectedValue = dt.Rows[0]["IsExpire"].ToString();
                                txtexpiredate.Text      = Convert.ToDateTime(dt.Rows[0]["ExpireDate"]).ToString("dd/MM/yyyy HH:mm");
                                txtfastbetname.Text     = dt.Rows[0]["FastBetName"].ToString();
                                if (dt.Rows[0]["IsBetSlip"].ToString() == "Y")
                                {
                                    txtfastbetname.ReadOnly = true;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Admin, "OfferLink/AddEditWHLink.aspx.cs IsNotPostBack", ex);
                }
            }
        }