protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                changeLinks();
                getCompanyName();
                if (!Page.IsPostBack)
                {
                    int intcheck = 0;
                    intcheck = Convert.ToInt32(Request.QueryString["check"]);
                    if (intcheck == 1)
                    {
                        BindSubject();
                    }

                    BindGrid();

                    Page.ClientScript.RegisterOnSubmitStatement(
                        FCKeditor1.GetType(),
                        "editor1",
                        "FCKeditorAPI.GetInstance('" + FCKeditor1.ClientID + "').UpdateLinkedField();");

                    Page.ClientScript.RegisterOnSubmitStatement(
                        FCKeditor2.GetType(),
                        "editor2",
                        "FCKeditorAPI.GetInstance('" + FCKeditor2.ClientID + "').UpdateLinkedField();");
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                changeLinks();
                getCompanyName();
                if (!Page.IsPostBack)
                {
                    dropSales.bindSalesItemDropdown(drpSaleItem1);
                    dropSales.bindSalesItemDropdown(drpSaleItem2);
                    dropSales.bindSalesItemDropdown(drpSaleItem3);
                    dropSales.bindSalesItemDropdown(drpSaleItem4);
                    dropSales.bindSalesItemDropdown(drpSaleItem5);
                    dropSales.bindSalesItemDropdown(drpSaleItem6);
                    dropSales.bindSalesItemDropdown(drpSaleItem7);
                    dropSales.bindSalesItemDropdown(drpSaleItem8);
                    int intcheck = 0;
                    intcheck = Convert.ToInt32(Request.QueryString["check"]);
                    if (intcheck == 1)
                    {
                        BindSubject();
                        if (Request.Cookies["SaleProdInfo"] != null)
                        {
                            string tempSaleProduct = Convert.ToString(Request.Cookies["SaleProdInfo"].Value);
                            if (tempSaleProduct != "" || tempSaleProduct != null)
                            {
                                string[] splitter = { "|" };
                                string[] prodInfo = tempSaleProduct.Split(splitter, StringSplitOptions.None);

                                drpSaleItem1.SelectedValue = prodInfo[0].ToString();
                                drpSaleItem2.SelectedValue = prodInfo[1].ToString();
                                drpSaleItem3.SelectedValue = prodInfo[2].ToString();
                                drpSaleItem4.SelectedValue = prodInfo[3].ToString();
                                drpSaleItem5.SelectedValue = prodInfo[4].ToString();
                                drpSaleItem6.SelectedValue = prodInfo[5].ToString();
                                drpSaleItem7.SelectedValue = prodInfo[6].ToString();
                                drpSaleItem8.SelectedValue = prodInfo[7].ToString();
                            }
                        }
                    }
                    else
                    {
                        if (Request.Cookies["SaleProdInfo"] != null)
                        {
                            string tempSaleProduct = Convert.ToString(Request.Cookies["SaleProdInfo"].Value);
                            if (tempSaleProduct != "" || tempSaleProduct != null)
                            {
                                string[] splitter = { "|" };
                                string[] prodInfo = tempSaleProduct.Split(splitter, StringSplitOptions.None);

                                drpSaleItem1.SelectedValue = prodInfo[0].ToString();
                                drpSaleItem2.SelectedValue = prodInfo[1].ToString();
                                drpSaleItem3.SelectedValue = prodInfo[2].ToString();
                                drpSaleItem4.SelectedValue = prodInfo[3].ToString();
                                drpSaleItem5.SelectedValue = prodInfo[4].ToString();
                                drpSaleItem6.SelectedValue = prodInfo[5].ToString();
                                drpSaleItem7.SelectedValue = prodInfo[6].ToString();
                                drpSaleItem8.SelectedValue = prodInfo[7].ToString();
                            }
                        }
                    }

                    // BindGrid();

                    Page.ClientScript.RegisterOnSubmitStatement(
                        FCKeditor1.GetType(),
                        "editor1",
                        "FCKeditorAPI.GetInstance('" + FCKeditor1.ClientID + "').UpdateLinkedField();");

                    Page.ClientScript.RegisterOnSubmitStatement(
                        FCKeditor2.GetType(),
                        "editor2",
                        "FCKeditorAPI.GetInstance('" + FCKeditor2.ClientID + "').UpdateLinkedField();");
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                changeLinks();
                getCompanyName();
                if (!Page.IsPostBack)
                {
                    int intEmailId = 0;
                    int intCheck   = 0;
                    intCheck = Convert.ToInt32(Request.QueryString["Check"]);
                    if (intCheck == 1)
                    {
                        BindSubject();
                    }
                    else
                    {
                        intEmailId = Convert.ToInt32(Request.QueryString["EmailSendId"]);
                        string strHead    = string.Empty;
                        string strFoot    = string.Empty;
                        string strProdId  = string.Empty;
                        string strProdtit = string.Empty;



                        DataSet dsInfo = new DataSet();
                        dsInfo           = dbListInfo.SelectSendEmailInformation(intEmailId);
                        txtSubject.Text  = Convert.ToString(dsInfo.Tables[0].Rows[0]["Subject"]);
                        txtFromDate.Text = Convert.ToString(dsInfo.Tables[0].Rows[0]["StarDate"]);
                        txtToDate.Text   = Convert.ToString(dsInfo.Tables[0].Rows[0]["EndDate"]);
                        strHead          = Convert.ToString(dsInfo.Tables[0].Rows[0]["HeaderMsg"]);
                        FCKeditor1.Value = strHead;
                        strFoot          = Convert.ToString(dsInfo.Tables[0].Rows[0]["FooterMsg"]);
                        FCKeditor2.Value = strFoot;
                        DataSet dsSalesItemList = new DataSet();
                        int     incnt           = 0;
                        dsSalesItemList = dbListInfo.GetSalesDetailsInformation(Convert.ToInt32(AppConstants.locationId));
                        if (dsSalesItemList.Tables.Count > 0)
                        {
                            if (dsSalesItemList != null && dsSalesItemList.Tables.Count > 0 && dsSalesItemList.Tables[0].Rows.Count > 0)
                            {
                                dropSales.bindSalesItemDropdown(drpSaleItem1);
                                dropSales.bindSalesItemDropdown(drpSaleItem2);
                                dropSales.bindSalesItemDropdown(drpSaleItem3);
                                dropSales.bindSalesItemDropdown(drpSaleItem4);
                                dropSales.bindSalesItemDropdown(drpSaleItem5);
                                dropSales.bindSalesItemDropdown(drpSaleItem6);
                                dropSales.bindSalesItemDropdown(drpSaleItem7);
                                dropSales.bindSalesItemDropdown(drpSaleItem8);

                                if (Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale1"]) != "")
                                {
                                    incnt      = 0;
                                    strProdId  = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale1"]);
                                    strProdtit = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle1"]);

                                    foreach (DataRow dtrow in dsSalesItemList.Tables[0].Rows)
                                    {
                                        if (Convert.ToString(dtrow["product_id"]) == strProdId && Convert.ToString(dtrow["product_title"]) == strProdtit)
                                        {
                                            incnt = 1;
                                        }
                                    }
                                    if (incnt == 1)
                                    {
                                        lblSaleItem1.Text          = "";
                                        txtSaleItem1.Text          = "";
                                        pnlSaleItem1.Visible       = false;
                                        pnlSaleItemDrp1.Visible    = true;
                                        drpSaleItem1.SelectedValue = strProdId;
                                    }
                                    else
                                    {
                                        pnlSaleItem1.Visible    = true;
                                        pnlSaleItemDrp1.Visible = false;
                                        txtSaleItem1.Text       = strProdtit;
                                        lblSaleItem1.Text       = "";
                                        lblSaleItem1.Text       = AppConstants.unavailableSale;
                                    }
                                }
                                else
                                {
                                    pnlSaleItem1.Visible    = false;
                                    pnlSaleItemDrp1.Visible = true;
                                    lblSaleItem1.Text       = "";
                                    txtSaleItem1.Text       = "";
                                    btnSaleItem1.Visible    = false;
                                }


                                if (Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale2"]) != "")
                                {
                                    incnt      = 0;
                                    strProdId  = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale2"]);
                                    strProdtit = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle2"]);

                                    foreach (DataRow dtrow in dsSalesItemList.Tables[0].Rows)
                                    {
                                        if (Convert.ToString(dtrow["product_id"]) == strProdId && Convert.ToString(dtrow["product_title"]) == strProdtit)
                                        {
                                            incnt = 1;
                                        }
                                    }
                                    if (incnt == 1)
                                    {
                                        pnlSaleItem2.Visible       = false;
                                        pnlSaleItemDrp2.Visible    = true;
                                        drpSaleItem2.SelectedValue = strProdId;
                                        lblSaleItem2.Text          = "";
                                        txtSaleItem2.Text          = "";
                                    }
                                    else
                                    {
                                        pnlSaleItem2.Visible    = true;
                                        pnlSaleItemDrp2.Visible = false;
                                        txtSaleItem2.Text       = strProdtit;
                                        lblSaleItem1.Text       = "";
                                        lblSaleItem2.Text       = AppConstants.unavailableSale;
                                    }
                                }
                                else
                                {
                                    pnlSaleItem2.Visible    = false;
                                    pnlSaleItemDrp2.Visible = true;
                                    lblSaleItem2.Text       = "";
                                    txtSaleItem2.Text       = "";
                                    btnSaleItem2.Visible    = false;
                                }



                                if (Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale3"]) != "")
                                {
                                    incnt      = 0;
                                    strProdId  = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale3"]);
                                    strProdtit = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle3"]);

                                    foreach (DataRow dtrow in dsSalesItemList.Tables[0].Rows)
                                    {
                                        if (Convert.ToString(dtrow["product_id"]) == strProdId && Convert.ToString(dtrow["product_title"]) == strProdtit)
                                        {
                                            incnt = 1;
                                        }
                                    }
                                    if (incnt == 1)
                                    {
                                        pnlSaleItem3.Visible       = false;
                                        pnlSaleItemDrp3.Visible    = true;
                                        drpSaleItem3.SelectedValue = strProdId;
                                        lblSaleItem3.Text          = "";
                                        txtSaleItem2.Text          = "";
                                    }
                                    else
                                    {
                                        pnlSaleItem3.Visible    = true;
                                        pnlSaleItemDrp3.Visible = false;
                                        txtSaleItem3.Text       = strProdtit;
                                        lblSaleItem1.Text       = "";
                                        lblSaleItem3.Text       = AppConstants.unavailableSale;
                                    }
                                }
                                else
                                {
                                    pnlSaleItem3.Visible    = false;
                                    pnlSaleItemDrp3.Visible = true;
                                    txtSaleItem3.Text       = "";
                                    lblSaleItem3.Text       = "";
                                    btnSaleItem3.Visible    = false;
                                }


                                if (Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale4"]) != "")
                                {
                                    incnt      = 0;
                                    strProdId  = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale4"]);
                                    strProdtit = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle4"]);

                                    foreach (DataRow dtrow in dsSalesItemList.Tables[0].Rows)
                                    {
                                        if (Convert.ToString(dtrow["product_id"]) == strProdId && Convert.ToString(dtrow["product_title"]) == strProdtit)
                                        {
                                            incnt = 1;
                                        }
                                    }
                                    if (incnt == 1)
                                    {
                                        pnlSaleItem4.Visible       = false;
                                        pnlSaleItemDrp4.Visible    = true;
                                        drpSaleItem4.SelectedValue = strProdId;
                                        txtSaleItem4.Text          = "";
                                        lblSaleItem4.Text          = "";
                                    }
                                    else
                                    {
                                        pnlSaleItem4.Visible    = true;
                                        pnlSaleItemDrp4.Visible = false;
                                        txtSaleItem4.Text       = strProdtit;
                                        lblSaleItem4.Text       = "";
                                        lblSaleItem4.Text       = AppConstants.unavailableSale;
                                    }
                                }
                                else
                                {
                                    pnlSaleItem4.Visible    = false;
                                    pnlSaleItemDrp4.Visible = true;
                                    txtSaleItem4.Text       = "";
                                    lblSaleItem4.Text       = "";
                                    btnSaleItem4.Visible    = false;
                                }

                                if (Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale5"]) != "")
                                {
                                    incnt      = 0;
                                    strProdId  = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale5"]);
                                    strProdtit = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle5"]);

                                    foreach (DataRow dtrow in dsSalesItemList.Tables[0].Rows)
                                    {
                                        if (Convert.ToString(dtrow["product_id"]) == strProdId && Convert.ToString(dtrow["product_title"]) == strProdtit)
                                        {
                                            incnt = 1;
                                        }
                                    }
                                    if (incnt == 1)
                                    {
                                        pnlSaleItem5.Visible       = false;
                                        pnlSaleItemDrp5.Visible    = true;
                                        drpSaleItem5.SelectedValue = strProdId;
                                        txtSaleItem5.Text          = "";
                                        lblSaleItem5.Text          = "";
                                    }
                                    else
                                    {
                                        pnlSaleItem5.Visible    = true;
                                        pnlSaleItemDrp5.Visible = false;
                                        txtSaleItem5.Text       = strProdtit;
                                        lblSaleItem5.Text       = "";
                                        lblSaleItem5.Text       = AppConstants.unavailableSale;
                                    }
                                }
                                else
                                {
                                    pnlSaleItem5.Visible    = false;
                                    pnlSaleItemDrp5.Visible = true;
                                    txtSaleItem5.Text       = "";
                                    lblSaleItem5.Text       = "";
                                    btnSaleItem5.Visible    = false;
                                }
                                if (Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale6"]) != "")
                                {
                                    incnt      = 0;
                                    strProdId  = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale6"]);
                                    strProdtit = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle6"]);

                                    foreach (DataRow dtrow in dsSalesItemList.Tables[0].Rows)
                                    {
                                        if (Convert.ToString(dtrow["product_id"]) == strProdId && Convert.ToString(dtrow["product_title"]) == strProdtit)
                                        {
                                            incnt = 1;
                                        }
                                    }
                                    if (incnt == 1)
                                    {
                                        pnlSaleItem6.Visible       = false;
                                        pnlSaleItemDrp6.Visible    = true;
                                        drpSaleItem6.SelectedValue = strProdId;
                                        txtSaleItem6.Text          = "";
                                        lblSaleItem6.Text          = "";
                                    }
                                    else
                                    {
                                        pnlSaleItem6.Visible    = true;
                                        pnlSaleItemDrp6.Visible = false;
                                        txtSaleItem6.Text       = strProdtit;
                                        lblSaleItem6.Text       = "";
                                        lblSaleItem6.Text       = AppConstants.unavailableSale;
                                    }
                                }
                                else
                                {
                                    pnlSaleItem6.Visible    = false;
                                    pnlSaleItemDrp6.Visible = true;
                                    txtSaleItem6.Text       = "";
                                    lblSaleItem6.Text       = "";
                                    btnSaleItem6.Visible    = false;
                                }
                                if (Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale7"]) != "")
                                {
                                    incnt      = 0;
                                    strProdId  = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale7"]);
                                    strProdtit = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle7"]);

                                    foreach (DataRow dtrow in dsSalesItemList.Tables[0].Rows)
                                    {
                                        if (Convert.ToString(dtrow["product_id"]) == strProdId && Convert.ToString(dtrow["product_title"]) == strProdtit)
                                        {
                                            incnt = 1;
                                        }
                                    }
                                    if (incnt == 1)
                                    {
                                        pnlSaleItem7.Visible       = false;
                                        pnlSaleItemDrp7.Visible    = true;
                                        txtSaleItem7.Text          = "";
                                        lblSaleItem7.Text          = "";
                                        drpSaleItem7.SelectedValue = strProdId;
                                    }
                                    else
                                    {
                                        pnlSaleItem7.Visible    = true;
                                        pnlSaleItemDrp7.Visible = false;
                                        txtSaleItem7.Text       = strProdtit;
                                        lblSaleItem7.Text       = "";
                                        lblSaleItem7.Text       = AppConstants.unavailableSale;
                                    }
                                }
                                else
                                {
                                    pnlSaleItem7.Visible    = false;
                                    pnlSaleItemDrp7.Visible = true;
                                    txtSaleItem7.Text       = "";
                                    lblSaleItem7.Text       = "";
                                    btnSaleItem7.Visible    = false;
                                }
                                if (Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale8"]) != "")
                                {
                                    incnt      = 0;
                                    strProdId  = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSale8"]);
                                    strProdtit = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle8"]);

                                    foreach (DataRow dtrow in dsSalesItemList.Tables[0].Rows)
                                    {
                                        if (Convert.ToString(dtrow["product_id"]) == strProdId && Convert.ToString(dtrow["product_title"]) == strProdtit)
                                        {
                                            incnt = 1;
                                        }
                                    }
                                    if (incnt == 1)
                                    {
                                        pnlSaleItem8.Visible       = false;
                                        pnlSaleItemDrp8.Visible    = true;
                                        drpSaleItem8.SelectedValue = strProdId;
                                        txtSaleItem8.Text          = "";
                                        lblSaleItem8.Text          = "";
                                    }
                                    else
                                    {
                                        pnlSaleItem8.Visible    = true;
                                        pnlSaleItemDrp8.Visible = false;
                                        txtSaleItem8.Text       = strProdtit;
                                        lblSaleItem8.Text       = "";
                                        lblSaleItem8.Text       = AppConstants.unavailableSale;
                                    }
                                }
                                else
                                {
                                    pnlSaleItem8.Visible    = false;
                                    pnlSaleItemDrp8.Visible = true;
                                    txtSaleItem8.Text       = "";
                                    lblSaleItem8.Text       = "";
                                    btnSaleItem8.Visible    = false;
                                }
                            }
                            else
                            {
                                lblNoSalesItem.Text          = "";
                                lblNoSalesItem.Text          = AppConstants.NoProductavailableSale;
                                btnPreviewNewsletter.Visible = false;
                                pnlSaleItemDrp1.Visible      = false;
                                pnlSaleItemDrp2.Visible      = false;
                                pnlSaleItemDrp3.Visible      = false;
                                pnlSaleItemDrp4.Visible      = false;
                                pnlSaleItemDrp5.Visible      = false;
                                pnlSaleItemDrp6.Visible      = false;
                                pnlSaleItemDrp7.Visible      = false;
                                pnlSaleItemDrp8.Visible      = false;
                                btnSaleItem1.Visible         = false;
                                btnSaleItem2.Visible         = false;
                                btnSaleItem3.Visible         = false;
                                btnSaleItem4.Visible         = false;
                                btnSaleItem5.Visible         = false;
                                btnSaleItem6.Visible         = false;
                                btnSaleItem7.Visible         = false;
                                btnSaleItem8.Visible         = false;
                                txtSaleItem1.Text            = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle1"]);
                                txtSaleItem2.Text            = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle2"]);
                                txtSaleItem3.Text            = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle3"]);
                                txtSaleItem4.Text            = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle4"]);
                                txtSaleItem5.Text            = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle5"]);
                                txtSaleItem6.Text            = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle6"]);
                                txtSaleItem7.Text            = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle7"]);
                                txtSaleItem8.Text            = Convert.ToString(dsInfo.Tables[0].Rows[0]["ProductSaleTitle8"]);
                                lblSaleItem1.Text            = "";
                                lblSaleItem1.Text            = AppConstants.unavailableSale;
                                lblSaleItem2.Text            = "";
                                lblSaleItem2.Text            = AppConstants.unavailableSale;
                                lblSaleItem3.Text            = "";
                                lblSaleItem3.Text            = AppConstants.unavailableSale;
                                lblSaleItem4.Text            = "";
                                lblSaleItem4.Text            = AppConstants.unavailableSale;
                                lblSaleItem5.Text            = "";
                                lblSaleItem5.Text            = AppConstants.unavailableSale;
                                lblSaleItem6.Text            = "";
                                lblSaleItem6.Text            = AppConstants.unavailableSale;
                                lblSaleItem7.Text            = "";
                                lblSaleItem7.Text            = AppConstants.unavailableSale;
                                lblSaleItem8.Text            = "";
                                lblSaleItem8.Text            = AppConstants.unavailableSale;
                            }
                        }
                    }



                    Page.ClientScript.RegisterOnSubmitStatement(
                        FCKeditor1.GetType(),
                        "editor1",
                        "FCKeditorAPI.GetInstance('" + FCKeditor1.ClientID + "').UpdateLinkedField();");

                    Page.ClientScript.RegisterOnSubmitStatement(
                        FCKeditor2.GetType(),
                        "editor2",
                        "FCKeditorAPI.GetInstance('" + FCKeditor2.ClientID + "').UpdateLinkedField();");
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }