public void RetrieveCampaign()
        {
            try
            {
                objCampaign = new Campaign();
                objBL_CreateCampaign = new BL_CreateCampaign();
                lstCampaign = objBL_CreateCampaign.SelectCampaignListbasedonid(Convert.ToInt32(HttpUtility.UrlDecode(Request.QueryString["CampId"]).ToString()));

                if (lstCampaign.Count > 0)
                {
                    txtCampaignName.Value = lstCampaign[0].CampaignName;
                    txtTitle.Value = lstCampaign[0].Title;

                    if(lstCampaign[0].FromName != null)
                        FromName.Value = lstCampaign[0].FromName;
                    if (lstCampaign[0].Emailid != null)
                        EmailID.Value = lstCampaign[0].Emailid;
                }
            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("CampaignEdit.aspx:RetrieveCampaign() - " + ex.Message);
            }
        }
        private void RetrieveCampaigndetails()
        {
            try
            {
                objCampaign = new Campaign();
                objBL_CreateCampaign = new BL_CreateCampaign();
                lstCampaign = objBL_CreateCampaign.SelectCampaignListbasedonid(Convert.ToInt32(Session["CampgnID"].ToString()));

                if (lstCampaign.Count > 0)
                {
                    txtCampaignName.Value = lstCampaign[0].CampaignName;
                    txtTitle.Value = lstCampaign[0].Title;

                    if (lstCampaign[0].FromName != null)
                        FromName.Value = lstCampaign[0].FromName;
                    if (lstCampaign[0].FromName != null)
                        EmailID.Value = lstCampaign[0].Emailid;
                }
            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("CreateCampign.aspx:RetrieveCampaigndetails() - " + ex.Message);
            }
        }
        private void BindGrid()
        {
            try
            {
                objBL_CreateCampaign = new BL_CreateCampaign();
                string uertype = string.Empty;
                int Userid = 0;

                if (Convert.ToInt16(Session["Usertype"].ToString()) == 1)
                {
                    uertype = "r";
                    Userid = Convert.ToInt32(Session["CompanyID"].ToString());
                }
                else
                {
                    uertype = "t";
                    Userid = Convert.ToInt32(Session["UserID"].ToString());
                }

                DataSet dt = new DataSet();
                dt = objBL_CreateCampaign.SelectCampaignreportListforgrid(uertype, Userid, ViewState["CurrentAlphabet"].ToString());
                SetViewState(dt);

                if (dt.Tables[0].Rows.Count <= 0)
                {
                    gvcampaign.DataSource = GetViewState();
                    gvcampaign.DataBind();
                }
                else
                {
                    gvcampaign.DataSource = GetViewState();
                    gvcampaign.DataBind();
                    sortImage.ImageUrl = "~/images/view_sort_descending.png";
                    gvcampaign.HeaderRow.Cells[5].Controls.Add(sortImage);
                    ViewState["SortDirection"] = "DESC";
                }

            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("CampaignReportList.aspx:BindGrid() - " + ex.Message);
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                objBL_CreateCampaign = new BL_CreateCampaign();
                string uertype = string.Empty;
                int compid = 0;
                Nullable<DateTime> CreatedOn = null;
                string alphabet = ViewState["CurrentAlphabet"].ToString();

                if (Convert.ToInt16(Session["Usertype"].ToString()) == 1)
                {
                    uertype = "v";
                    compid = Convert.ToInt32(Session["CompanyID"].ToString());

                    if (dtScheduledatetime.Value != "")
                        CreatedOn = DateTime.ParseExact(dtScheduledatetime.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                else
                {
                    uertype = "w";
                    compid = Convert.ToInt32(Session["UserID"].ToString());

                    if (dtScheduledatetime.Value != "")
                        CreatedOn = DateTime.ParseExact(dtScheduledatetime.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }

                DataSet dt = new DataSet();
                dt = objBL_CreateCampaign.SelectCampaignreportListforgridBasedonfilter(uertype, compid, txtCampName.Value.Trim(), txtTitle.Value.Trim(), CreatedOn, alphabet);
                SetViewState(dt);

                if (dt.Tables[0].Rows.Count <= 0)
                {
                    gvcampaign.DataSource = GetViewState();
                    gvcampaign.DataBind();
                }
                else
                {
                    gvcampaign.DataSource = GetViewState();
                    gvcampaign.DataBind();
                    sortImage.ImageUrl = "~/images/view_sort_descending.png";
                    gvcampaign.HeaderRow.Cells[5].Controls.Add(sortImage);
                    ViewState["SortDirection"] = "DESC";
                }
                collapseExample.Attributes["class"] = "collapse in";
            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("CampaignReportList.aspx:Button1_Click() - " + ex.Message);
            }
        }