private void SetBannerinXML()
    {
        BannerOrder objBannerOrder    = new BannerOrder();
        string      virtualpath2      = string.Empty;
        string      virtualpathmobile = string.Empty;
        string      ImageName2        = string.Empty;
        string      BannerId          = string.Empty;
        string      PgName            = string.Empty;
        string      IsCoupon          = string.Empty;

        DataTable OrderDt   = (DataTable)ViewState["myDt"];
        DataSet   dsDefault = new DataSet();
        DataSet   dsPages   = new DataSet();

        dsPages = objBannerOrder.GetPagesNames();
        for (int j = 0; j < dsPages.Tables[0].Rows.Count; j++)
        {
            DataRow PageRow = dsPages.Tables[0].Rows[j];
            PageId    = Convert.ToInt32(PageRow["PageId"]);
            UserId    = Convert.ToInt32(PageRow["UserId"]);
            dsDefault = objBannerOrder.GetBannerList(PageId, UserId);
            string strPgName = GetPageNameForSequence(Convert.ToString(PageId), Convert.ToString(UserId));
            DeleteFromXml(strPgName, PageId, UserId);

            for (int k = 0; k < dsDefault.Tables[0].Rows.Count; k++)
            {
                DataRow BannerRow = dsDefault.Tables[0].Rows[k];
                BannerId = Convert.ToString(BannerRow["BannerID"]);
                for (int i = 0; i < OrderDt.Rows.Count; i++)
                {
                    DataRow defaultRow = OrderDt.Rows[i];
                    if (BannerId == Convert.ToString(defaultRow["BId"]))
                    {
                        virtualpath2      = Convert.ToString(defaultRow["BannerPath"]);
                        virtualpathmobile = Convert.ToString(defaultRow["virtualmobilepath"]);
                        ImageName2        = Convert.ToString(defaultRow["BannerName"]);
                        AddBannerToXml(virtualpath2, ImageName2, IsCoupon, strPgName, Convert.ToString(PageId), Convert.ToString(UserId), virtualpathmobile, BannerId);
                    }
                }
            }
        }
    }
Beispiel #2
0
    private void BindSequenceData()
    {
        BannerOrder objOrder = new BannerOrder();
        DataSet     dsOrder  = new DataSet();

        PageId  = Convert.ToInt32(ddlPage.SelectedValue);
        UserID  = Convert.ToInt32(ddlUserType.SelectedValue);
        cnt     = 0;
        dsOrder = objOrder.GetBannerList(PageId, UserID);
        if (dsOrder.Tables.Count > 0)
        {
            pgds.AllowPaging = true;
            pgds.PageSize    = 100000;
            pgds.DataSource  = dsOrder.Tables[0].DefaultView;
            //lblMsg.Text = "";
            dtlOrder.Visible    = true;
            dtlOrder.DataSource = pgds;
            dtlOrder.DataBind();
        }
    }
Beispiel #3
0
    private void SetBannersInXML()
    {
        try
        {
            Banner      objB           = new Banner();
            BannerOrder objBannerOrder = new BannerOrder();
            PageId = Convert.ToInt32(ddlPage.SelectedValue);
            UserID = Convert.ToInt32(ddlUserType.SelectedValue);
            string PageName          = string.Empty;
            string virtualpath2      = string.Empty;
            string virtualmobilepath = string.Empty;
            string ImageName2        = string.Empty;
            string BannerId          = string.Empty;
            string PgName            = string.Empty;
            string IsCoupon          = string.Empty;
            int    boolIscoupon      = 0;
            string strPgName         = GetPageNameForSequence(Convert.ToString(PageId), Convert.ToString(UserID));
            DeleteFromXml(strPgName, PageId, UserID);
            DataTable OrderDt = (DataTable)ViewState["myDt"];
            foreach (DataListItem item in dtlOrder.Items)
            {
                TextBox  myTextBox   = (TextBox)item.FindControl("txtId");
                Label    lblPageName = (Label)item.FindControl("lblPageName");
                Label    lblIsCoupon = (Label)item.FindControl("lblIsCoupon");
                Label    lblId       = (Label)item.FindControl("lblId");
                CheckBox chkIsCOupon = (CheckBox)item.FindControl("chkIsCOupon");
                if (chkIsCOupon.Checked)
                {
                    boolIscoupon = 1;
                }
                else
                {
                    boolIscoupon = 0;
                }

                BannerId = myTextBox.Text;
                PgName   = strPgName;
                IsCoupon = lblIsCoupon.Text;
                int Id = Convert.ToInt32(lblId.Text);
                if (BannerId != "")
                {
                    for (int i = 0; i < OrderDt.Rows.Count; i++)
                    {
                        DataRow row = OrderDt.Rows[i];
                        if (BannerId == Convert.ToString(row["BId"]))
                        {
                            virtualpath2      = Convert.ToString(row["BannerPath"]);
                            ImageName2        = Convert.ToString(row["BannerName"]);
                            virtualmobilepath = Convert.ToString(row["virtualmobilepath"]);
                            objBannerOrder.UpdateBannerSequence(Id, Convert.ToInt32(BannerId), boolIscoupon);
                            if (PageId != 12)
                            {
                                AddBannerToXml(virtualpath2, ImageName2, IsCoupon, strPgName, Convert.ToString(PageId), Convert.ToString(UserID), virtualmobilepath, BannerId);
                            }
                            break;
                        }
                        else
                        {
                            objBannerOrder.UpdateBannerSequence(Id, 0, 0);
                        }
                    }
                }
                else
                {
                    objBannerOrder.UpdateBannerSequence(Id, 0, 0);
                }
            }
            DataSet dsDefault = new DataSet();
            int     emtCnt    = 0;
            int     EID       = 0;
            DataSet dsPages   = new DataSet();
            dsPages = objBannerOrder.GetPagesNames();
            for (int j = 0; j < dsPages.Tables[0].Rows.Count; j++)
            {
                DataRow PageRow = dsPages.Tables[0].Rows[j];
                PageId    = Convert.ToInt32(PageRow["PageId"]);
                UserID    = Convert.ToInt32(PageRow["UserId"]);
                strPgName = GetPageNameForSequence(Convert.ToString(PageId), Convert.ToString(UserID));
                dsDefault = objBannerOrder.GetBannerList(PageId, UserID);
                if (dsDefault.Tables[1].Rows.Count > 0)
                {
                    DataRow countRow = dsDefault.Tables[1].Rows[0];

                    if (dsDefault.Tables[4].Rows.Count > 0)
                    {
                        DataRow checkDefRow = dsDefault.Tables[4].Rows[0];
                        if (Convert.ToInt32(checkDefRow["defbannercount"]) == 0)
                        {
                            if (Convert.ToInt32(countRow["bannercount"]) == 0)
                            {
                                DeleteFromXml(strPgName, PageId, UserID);
                                objBannerOrder.UpdateBannerSequenceByPage(strPgName);
                            }
                        }
                    }


                    if (Convert.ToString(countRow["bannercount"]) == "0")
                    {
                        DeleteFromXml(strPgName, PageId, UserID);
                        emtCnt = dsDefault.Tables[0].Rows.Count;
                        int Kcount = dsDefault.Tables[2].Rows.Count;
                        for (int k = 0; k < dsDefault.Tables[2].Rows.Count; k++)
                        {
                            DataRow BannerRow = dsDefault.Tables[2].Rows[k];

                            if (emtCnt <= Kcount)
                            {
                                DataRow emptyRow = dsDefault.Tables[0].Rows[k];
                                EID = Convert.ToInt32(emptyRow["ID"]);
                            }

                            BannerId     = Convert.ToString(BannerRow["BannerId"]);
                            boolIscoupon = Convert.ToInt32(BannerRow["IsCoupon"]);
                            for (int i = 0; i < OrderDt.Rows.Count; i++)
                            {
                                DataRow defaultRow = OrderDt.Rows[i];

                                if (BannerId == Convert.ToString(defaultRow["BId"]))
                                {
                                    virtualpath2 = Convert.ToString(defaultRow["BannerPath"]);
                                    ImageName2   = Convert.ToString(defaultRow["BannerName"]);
                                    objBannerOrder.UpdateBannerSequence(EID, Convert.ToInt32(BannerId), boolIscoupon);
                                    AddBannerToXml(virtualpath2, ImageName2, IsCoupon, strPgName, Convert.ToString(PageId), Convert.ToString(UserID), virtualmobilepath, BannerId);
                                }
                            }
                        }
                    }
                }
            }

            BindData();
            BindSequenceData();
        }
        catch { }
    }