protected void Fillgrid()
    {
        DataTable dt = new DataTable();

        if (ddlfilterstore.SelectedIndex > 0)
        {
            lblBusiness.Text = ddlfilterstore.SelectedItem.Text;
            dt = select("SELECT  MessageFolderMaster.Foldername,InOutCompanyEmail.EmailId,Party_Master.Compname,MessageProcessRulesDetail.MoveToSpam,MessageProcessRulesDetail.PermanentlyDelete,MessageProcessRulesDetail.Id FROM MessageProcessRules inner join InOutCompanyEmail on InOutCompanyEmail.Id=MessageProcessRules.InoutgoingEmailID inner join MessageFolderMaster on MessageFolderMaster.InoutcommingId=InOutCompanyEmail.Id left join  MessageProcessRulesDetail on  MessageProcessRulesDetail.MovetoFolderID=MessageFolderMaster.Id Left join Party_master on Party_master.PartyID=MessageProcessRulesDetail.FromParty where Party_master.id='" + Session["comid"] + "' and InOutCompanyEmail.Whid='" + ddlfilterstore.SelectedValue + "' order by EmailId,Foldername,Compname asc");
            //Party_master.id='" + Session["comid"] + "' and
        }
        else
        {
            dt = select("SELECT  MessageFolderMaster.Foldername,InOutCompanyEmail.EmailId,Party_Master.Compname,MessageProcessRulesDetail.MoveToSpam,MessageProcessRulesDetail.PermanentlyDelete,MessageProcessRulesDetail.Id FROM MessageProcessRules inner join InOutCompanyEmail on InOutCompanyEmail.Id=MessageProcessRules.InoutgoingEmailID inner join MessageFolderMaster on MessageFolderMaster.InoutcommingId=InOutCompanyEmail.Id left join  MessageProcessRulesDetail on  MessageProcessRulesDetail.MovetoFolderID=MessageFolderMaster.Id Left join Party_master on Party_master.PartyID=MessageProcessRulesDetail.FromParty where  Party_master.id='" + Session["comid"] + "' order by EmailId,Foldername,Compname asc");
        }
        if (dt.Rows.Count > 0)
        {
            DataView myDataView = new DataView();
            myDataView = dt.DefaultView;

            if (hdnsortExp.Value != string.Empty)
            {
                myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value);
            }
            GridEmail.DataSource = dt;
            GridEmail.DataBind();
        }
        else
        {
            GridEmail.DataSource = null;
            GridEmail.DataBind();
        }
    }
    public void FillGrid()
    {
        //string str = "";

        //string str2 = "";

        //str = "  [EmployeeMaster].EmployeeName,warehousemaster.name as Wname,ID,OutgoingEmailServer, OutEmailID, OutPassword,IncomingEmailServer,InEmailID,InPassword,LastDownloadedTime,LastDownloadIndex,SetforOutgoingemail,InOutCompanyEmail.EmailId FROM InOutCompanyEmail Left Join EmployeeMaster on EmployeeMaster.EmployeeMasterID=InOutCompanyEmail.EmployeeId inner join warehousemaster on warehousemaster.WareHouseId=InOutCompanyEmail.Whid where comid='" + Session["Comid"].ToString() + "' and InOutCompanyEmail.Employeeid='" + ddlempfil.SelectedValue + "' and warehousemaster.status='1'";
        //str2 = "select count(InOutCompanyEmail.ID) as ci FROM InOutCompanyEmail Left Join EmployeeMaster on EmployeeMaster.EmployeeMasterID=InOutCompanyEmail.EmployeeId inner join warehousemaster on warehousemaster.WareHouseId=InOutCompanyEmail.Whid where comid='" + Session["Comid"].ToString() + "' and InOutCompanyEmail.Employeeid='" + ddlempfil.SelectedValue + "' and warehousemaster.status='1'";

        //GridEmail.VirtualItemCount = GetRowCount(str2);

        //string sortExpression = " warehousemaster.name,EmployeeName,EmailId";

        //if (Convert.ToInt32(ViewState["count"]) > 0)
        //{
        //    DataTable dt = GetDataPage(GridEmail.PageIndex, GridEmail.PageSize, sortExpression, str);

        //    DataView myDataView = new DataView();
        //    myDataView = dt.DefaultView;

        //    if (hdnsortExp.Value != string.Empty)
        //    {
        //        myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value);
        //    }
        //    GridEmail.DataSource = dt;
        //    GridEmail.DataBind();
        //}

        //else
        //{
        //    GridEmail.DataSource = null;
        //    GridEmail.DataBind();

        //}
        string condi = "";

        if (ddlbusinessfil.SelectedIndex > 0)
        {
            condi = " and dbo.InOutCompanyEmail_Panding.whid='" + ddlbusinessfil.SelectedValue + "' ";
        }
        if (ddlempfil.SelectedIndex > 0)
        {
            condi += "  and InOutCompanyEmail_Panding.employeeid='" + ddlempfil.SelectedValue + "' ";
        }
        string         strgrd = " SELECT dbo.EmployeeMaster.EmployeeName, dbo.WareHouseMaster.Name AS Wname, dbo.InOutCompanyEmail.ID, dbo.InOutCompanyEmail.OutgoingEmailServer, dbo.InOutCompanyEmail.OutEmailID, dbo.InOutCompanyEmail.OutPassword, dbo.InOutCompanyEmail.IncomingEmailServer, dbo.InOutCompanyEmail.InEmailID,  dbo.InOutCompanyEmail.InPassword, dbo.InOutCompanyEmail.LastDownloadedTime, dbo.InOutCompanyEmail.LastDownloadIndex,  dbo.InOutCompanyEmail.SetforOutgoingemail, dbo.InOutCompanyEmail.EmailId FROM dbo.InOutCompanyEmail INNER JOIN dbo.InOutCompanyEmail_Panding ON dbo.InOutCompanyEmail.ID = dbo.InOutCompanyEmail_Panding.inoutid INNER JOIN dbo.EmployeeMaster ON dbo.InOutCompanyEmail_Panding.employeeid = dbo.EmployeeMaster.EmployeeMasterID INNER JOIN dbo.WareHouseMaster ON dbo.InOutCompanyEmail_Panding.whid = dbo.WareHouseMaster.WareHouseId where comid='" + Session["Comid"].ToString() + "'   and dbo.InOutCompanyEmail.Whid='0' AND dbo.InOutCompanyEmail.EmployeeID='0' " + condi + " ";
        SqlDataAdapter daff   = new SqlDataAdapter(strgrd, con);
        DataTable      dtg    = new DataTable();

        daff.Fill(dtg);
        GridEmail.DataSource = dtg;

        //  DataView myDataView = new DataView();
        // myDataView = dtg.DefaultView;
        //if (hdnsortExp.Value != string.Empty)
        //{
        //    myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value);
        //}
        GridEmail.DataBind();
    }
    public void FillGrid()
    {
        string str = "";

        string str2 = "";

        if (Convert.ToInt32(ddlempfil.SelectedValue) > 0)
        {
            str = "  [EmployeeMaster].EmployeeName,warehousemaster.name as Wname,ID,OutgoingEmailServer, OutEmailID, OutPassword,IncomingEmailServer,InEmailID,InPassword,LastDownloadedTime,LastDownloadIndex,SetforOutgoingemail,InOutCompanyEmail.EmailId FROM InOutCompanyEmail Left Join EmployeeMaster on EmployeeMaster.EmployeeMasterID=InOutCompanyEmail.EmployeeId inner join warehousemaster on warehousemaster.WareHouseId=InOutCompanyEmail.Whid where comid='" + Session["Comid"].ToString() + "' and InOutCompanyEmail.Employeeid='" + ddlempfil.SelectedValue + "' and warehousemaster.status='1'";


            str2 = "select count(InOutCompanyEmail.ID) as ci FROM InOutCompanyEmail Left Join EmployeeMaster on EmployeeMaster.EmployeeMasterID=InOutCompanyEmail.EmployeeId inner join warehousemaster on warehousemaster.WareHouseId=InOutCompanyEmail.Whid where comid='" + Session["Comid"].ToString() + "' and InOutCompanyEmail.Employeeid='" + ddlempfil.SelectedValue + "' and warehousemaster.status='1'";
        }
        else if (Convert.ToInt32(ddlbusinessfil.SelectedValue) > 0)
        {
            str = "  [EmployeeMaster].EmployeeName,warehousemaster.name as Wname, ID,OutgoingEmailServer, OutEmailID, OutPassword,IncomingEmailServer,InEmailID,InPassword,LastDownloadedTime,LastDownloadIndex,SetforOutgoingemail,InOutCompanyEmail.EmailId FROM InOutCompanyEmail Left Join EmployeeMaster on EmployeeMaster.EmployeeMasterID=InOutCompanyEmail.EmployeeId inner join warehousemaster on warehousemaster.WareHouseId=InOutCompanyEmail.Whid where comid='" + Session["Comid"].ToString() + "' and InOutCompanyEmail.Whid='" + ddlbusinessfil.SelectedValue + "' and warehousemaster.status='1'";


            str2 = "select count(InOutCompanyEmail.ID) as ci FROM InOutCompanyEmail Left Join EmployeeMaster on EmployeeMaster.EmployeeMasterID=InOutCompanyEmail.EmployeeId inner join warehousemaster on warehousemaster.WareHouseId=InOutCompanyEmail.Whid where comid='" + Session["Comid"].ToString() + "' and InOutCompanyEmail.Whid='" + ddlbusinessfil.SelectedValue + "' and warehousemaster.status='1'";
        }
        else
        {
            str = "  [EmployeeMaster].EmployeeName,warehousemaster.name as Wname, ID,OutgoingEmailServer, OutEmailID, OutPassword,IncomingEmailServer,InEmailID,InPassword,LastDownloadedTime,LastDownloadIndex,SetforOutgoingemail,InOutCompanyEmail.EmailId FROM InOutCompanyEmail Left Join EmployeeMaster on EmployeeMaster.EmployeeMasterID=InOutCompanyEmail.EmployeeId inner join warehousemaster on warehousemaster.WareHouseId=InOutCompanyEmail.Whid where comid='" + Session["Comid"].ToString() + "' and warehousemaster.status='1'";


            str2 = "select count(InOutCompanyEmail.ID) as ci FROM InOutCompanyEmail Left Join EmployeeMaster on EmployeeMaster.EmployeeMasterID=InOutCompanyEmail.EmployeeId inner join warehousemaster on warehousemaster.WareHouseId=InOutCompanyEmail.Whid where comid='" + Session["Comid"].ToString() + "' and warehousemaster.status='1'";
        }

        GridEmail.VirtualItemCount = GetRowCount(str2);

        string sortExpression = " warehousemaster.name,EmployeeName,EmailId";

        if (Convert.ToInt32(ViewState["count"]) > 0)
        {
            DataTable dt = GetDataPage(GridEmail.PageIndex, GridEmail.PageSize, sortExpression, str);

            DataView myDataView = new DataView();
            myDataView = dt.DefaultView;

            if (hdnsortExp.Value != string.Empty)
            {
                myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value);
            }
            GridEmail.DataSource = dt;
            GridEmail.DataBind();
        }

        else
        {
            GridEmail.DataSource = null;
            GridEmail.DataBind();
        }
    }
예제 #4
0
        protected void CarregaGrid()
        {
            try
            {
                IList <ValueObjectLayer.Email_Tipo> tiposEmail = EmailFacade.RecuperaTipoEmail(ValueObjectLayer.TipoEmail.Empresa);

                GridEmail.DataSource = tiposEmail;
                GridEmail.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    public void FillGrid()
    {
        lblBusiness.Text = DropDownList1.SelectedItem.Text;

        DataTable dt = new DataTable();

        dt = clscompany.SelectDownloadFolder(DropDownList1.SelectedValue);


        DataView myDataView = new DataView();

        myDataView = dt.DefaultView;

        if (hdnsortExp.Value != string.Empty)
        {
            myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value);
        }
        GridEmail.DataSource = dt;
        GridEmail.DataBind();
    }
    public void FillGrid()
    {
        lblCompany.Text = DropDownList1.SelectedItem.Text;

        DataTable dt = new DataTable();

        dt = clsDocument.SelectDocumentEmailDownloadMaster(DropDownList1.SelectedValue);


        DataView myDataView = new DataView();

        myDataView = dt.DefaultView;

        if (hdnsortExp.Value != string.Empty)
        {
            myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value);
        }


        GridEmail.DataSource = dt;
        GridEmail.DataBind();
        //setGridisze();
    }
    protected void Fillgrid()
    {
        DataTable dt = new DataTable();

        if (ddlfilterstore.SelectedIndex > 0)
        {
            lblBusiness.Text = ddlfilterstore.SelectedItem.Text;
            dt = select("SELECT WareHouseMaster.Name, MessageFolderMaster.*,InOutCompanyEmail.EmailId FROM MessageFolderMaster inner join InOutCompanyEmail on InOutCompanyEmail.Id=MessageFolderMaster.InoutcommingId inner join  WareHouseMaster   on InOutCompanyEmail.Whid=WareHouseMaster.WareHouseId where comid = '" + Session["comid"] + "' and  WareHouseMaster.Status='" + 1 + "' and Whid='" + ddlfilterstore.SelectedValue + "' order by Name,EmailId,Foldername asc");
            //
        }
        else
        {
            dt = select("SELECT WareHouseMaster.Name, MessageFolderMaster.*,InOutCompanyEmail.EmailId FROM MessageFolderMaster inner join InOutCompanyEmail on InOutCompanyEmail.Id=MessageFolderMaster.InoutcommingId inner join  WareHouseMaster   on InOutCompanyEmail.Whid=WareHouseMaster.WareHouseId where comid = '" + Session["comid"] + "' and WareHouseMaster.Status='" + 1 + "' order by Name,EmailId,Foldername asc");
            //comid = '" + Session["comid"] + "'and
        }


        if (dt.Rows.Count > 0)
        {
            DataView myDataView = new DataView();
            myDataView = dt.DefaultView;

            if (hdnsortExp.Value != string.Empty)
            {
                myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value);
            }

            GridEmail.DataSource = dt;
            GridEmail.DataBind();
        }
        else
        {
            GridEmail.DataSource = null;
            GridEmail.DataBind();
        }
    }