void BindMember()
    {
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        UserValidation         mem    = new UserValidation();
        DataTable dt = new MemberService().FindList(0, ItemId, null, null, null, "", paging);

        grvAdmin.DataSource = dt;
        grvAdmin.DataBind();

        if (dt != null && dt.Rows.Count > 0)
        {
            btnAddMember.Visible = false;
            paging.RowsCount     = Convert.ToInt32(dt.Rows[0]["Total"]);
            Paging.PageSize      = PageSize;
            Paging.CurrentPage   = CurrentPage;
            Paging.TotalRecord   = Convert.ToInt32(dt.Rows[0]["Total"]);
            Paging.DataLoad();
            if (Paging.TotalPages <= 1)
            {
                ltTotal.Text   = "Tổng số " + paging.RowsCount + " tài khoản";
                Paging.Visible = false;
            }
            else
            {
                ltTotal.Text   = "Tổng số " + paging.RowsCount + " tài khoản";
                Paging.Visible = true;
            }
        }
        else
        {
            btnAddMember.Visible = true;
            ltTotal.Text         = "Có tổng số " + paging.RowsCount + " tài khoản";
            Paging.Visible       = false;
        }
    }
Beispiel #2
0
 private void BindDataApproved()
 {
     ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPageApp);
     if (memVal.OrgId > 0)
     {
         //Danh sách báo cáo đã được phê duyệt
         //DataTable list = new ReportFuelService().FindList(false, 0, 0, 0, memVal.OrgId, 0, 0, -1, true, 0, null, null, "", paging);
         DataTable list = new ReportFuelService().FindListWithType(false, 0, 0, 0, memVal.OrgId, 0, 0, -1, true, 0, null, null, "", paging, ReportKey.ANNUAL);
         rptApproved.DataSource = list;
         rptApproved.DataBind();
         if (list != null && list.Rows.Count > 0)
         {
             PagingApproved.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
             PagingApproved.PageSize    = PageSize;
             PagingApproved.DataLoad();
             if (PagingApproved.TotalPages > 1)
             {
                 PagingApproved.Visible = true;
             }
             else
             {
                 PagingApproved.Visible = false;
             }
         }
         else
         {
             PagingApproved.Visible = false;
         }
     }
 }
Beispiel #3
0
 private void BindData()
 {
     ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
     if (memVal.OrgId > 0)
     {
         DataTable list = new ReportFuelService().FindList(false, 0, 0, 0, memVal.OrgId, 0, 0, 2, true, 0, null, null, "", paging);
         rptNoFuelCurrent.DataSource = list;
         rptNoFuelCurrent.DataBind();
         if (list.Rows.Count > 0)
         {
             Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
             Paging.PageSize    = PageSize;
             Paging.DataLoad();
             if (Paging.TotalPages > 1)
             {
                 Paging.Visible = true;
             }
             else
             {
                 Paging.Visible = false;
             }
         }
         else
         {
             Paging.Visible = false;
         }
     }
 }
Beispiel #4
0
    private void BindData(int ProvinceId)
    {
        string TrangThai = "245";//2,4,5(vì sql đang dùng charindex)

        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int SubAreaId            = 0;
        int Year = 0;

        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }
        int AreaId = 0;

        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        int DistrictId = 0;

        if (ddlDistrict.SelectedIndex > 0)
        {
            DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);

        //list = comBSO.FindProcessingList(false, AreaId, SubAreaId, m_UserValidation.OrgId, 0, 0, 0, false, Year, null, null, txtKeyword.Text.Trim(), paging);
        list = comBSO.ListBCTieuThuNangLuong(false, AreaId, SubAreaId, m_UserValidation.OrgId, 0, ProvinceId, 0, false, Year, null, null, txtKeyword.Text.Trim(), TrangThai, paging);
        if (list != null && list.Rows.Count > 0)
        {
            int Total = list.Rows.Count;
            //paging.RowsCount = Convert.ToInt32(list.Rows[0]["Total"]);
            paging.RowsCount   = Total;
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            //Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.TotalRecord = Total;
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltNotice.Text  = "Có tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = false;
            }
            else
            {
                ltNotice.Text  = "Có" + list.Rows.Count + " trong tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = true;
            }
        }
        else
        {
            ltNotice.Text  = "";
            Paging.Visible = false;
        }
        rptNoFuelCurrent.DataSource = list;

        rptNoFuelCurrent.DataBind();
    }
Beispiel #5
0
    private void BindData()
    {
        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int SubAreaId            = 0;
        int Year = 0;

        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }
        int AreaId = 0;

        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        int DistrictId = 0;

        if (ddlDistrict.SelectedIndex > 0)
        {
            DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);

        //list = comBSO.FindProcessingList(false, AreaId, SubAreaId, m_UserValidation.OrgId, 0, 0, 0, false, Year, null, null, txtKeyword.Text.Trim(), paging);
        list = comBSO.FindProcessingListWithType(false, AreaId, SubAreaId, m_UserValidation.OrgId, 0, 0, 0, false, Year, null, null, txtKeyword.Text.Trim(), ddlPhanLoaiBC.SelectedValue, paging);
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltNotice.Text  = "Có tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = false;
            }
            else
            {
                ltNotice.Text  = "Có" + list.Rows.Count + " trong tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = true;
            }
        }
        else
        {
            ltNotice.Text  = "";
            Paging.Visible = false;
        }
        rptNoFuelCurrent.DataSource = list;

        rptNoFuelCurrent.DataBind();
    }
Beispiel #6
0
    void BindData()
    {
        DistrictService comBSO      = new DistrictService();
        DataTable       list        = new DataTable();
        int             _provinceId = 0;
        string          strKey      = string.Empty;

        if (ddlProvince.SelectedValue != "")
        {
            _provinceId = Convert.ToInt32(ddlProvince.SelectedValue);
        }

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        if (txtKeyword.Text != "" && txtKeyword.Text.Trim() != "")
        {
            strKey = txtKeyword.Text.Trim();
        }
        if (_provinceId > 0)
        {
            list = new DistrictService().FindList(ProvinceId, strKey, paging);
        }
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltrTotal.Text  = "Tổng số " + paging.RowsCount + " quận huyện";
                Paging.Visible = false;
            }
            else
            {
                int  st  = (CurrentPage - 1) * PageSize + 1;
                long end = CurrentPage * PageSize;
                if (end > paging.RowsCount)
                {
                    end = paging.RowsCount;
                }
                ltrTotal.Text  = "Đang xem trang " + CurrentPage + ". Hiển thị từ " + st + " - " + end + " trên tổng số " + paging.RowsCount + " quận huyện";
                Paging.Visible = true;
            }
        }
        else
        {
            ltrTotal.Text  = "";
            Paging.Visible = false;
        }
        grvArea.DataSource = list;
        grvArea.DataBind();
    }
Beispiel #7
0
    void BindData()
    {
        FuelService objFuelService = new FuelService();
        DataTable   list           = new DataTable();

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        int    groupId = 0;
        string strKey  = string.Empty;

        if (txtKeyword.Text != "" && txtKeyword.Text.Trim() != "")
        {
            strKey = txtKeyword.Text.Trim();
        }
        if (ddlParent.SelectedIndex > 0)
        {
            groupId = Convert.ToInt32(ddlParent.SelectedValue);
        }

        list = objFuelService.FindFuelList(strKey, 0, groupId, paging, true);
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltrTotal.Text  = "Tổng số " + paging.RowsCount + " nhiên liệu";
                Paging.Visible = false;
            }
            else
            {
                int  st  = (CurrentPage - 1) * PageSize + 1;
                long end = CurrentPage * PageSize;
                if (end > paging.RowsCount)
                {
                    end = paging.RowsCount;
                }
                ltrTotal.Text  = "Đang xem trang " + CurrentPage + ". Hiển thị từ " + st + " - " + end + " trên tổng số " + paging.RowsCount + " nhiên liệu";
                Paging.Visible = true;
            }
        }
        else
        {
            ltrTotal.Text  = "";
            Paging.Visible = false;
        }
        grvFuel.DataSource = list;
        grvFuel.DataBind();
    }
    private void BindData()
    {
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        //if (m_UserValidation.OrgId > 0)
        //{
        int AuditYear = 0;

        if (ddlYear.SelectedIndex > 0)
        {
            AuditYear = Convert.ToInt32(ddlYear.SelectedValue);
        }
        int AreaId = 0;

        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        int DistrictId = 0;
        //if (ddlDistrict.SelectedIndex > 0)
        //    DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue);
        DataTable list = new AuditReportService().FindList(AreaId, 0, 0, 0, 0, DistrictId, Convert.ToInt32(AuditReportStatus.CONFIRMED), AuditYear, txtKeyword.Text.Trim(), paging);

        rptAuditReport.DataSource = list;
        rptAuditReport.DataBind();
        if (list != null && list.Rows.Count > 0)
        {
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.DataLoad();
            Paging2.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging2.PageSize    = PageSize;
            Paging2.DataLoad();
            if (Paging.TotalPages > 1)
            {
                ltTotal.Text    = "Có " + list.Rows.Count + " trong tổng số " + list.Rows[0]["Total"] + " báo cáo";
                Paging2.Visible = Paging.Visible = true;
            }
            else
            {
                ltTotal.Text    = "Có tổng số " + list.Rows[0]["Total"] + " báo cáo";
                Paging2.Visible = Paging.Visible = false;
            }
        }
        else
        {
            Paging2.Visible = Paging.Visible = false;
        }
        //}
    }
Beispiel #9
0
    private void BindData()
    {
        GiaiPhapService comBSO = new GiaiPhapService();
        DataTable       list   = new DataTable();

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        string strKey = string.Empty;

        if (txtKeyword.Text != "" && txtKeyword.Text.Trim() != "")
        {
            strKey = txtKeyword.Text.Trim();
        }
        if (m_UserValidation != null && m_UserValidation.OrgId > 0)
        {
            list = comBSO.FindList(m_UserValidation.OrgId, strKey, paging);
            if (list != null && list.Rows.Count > 0)
            {
                paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
                Paging.PageSize    = PageSize;
                Paging.CurrentPage = CurrentPage;
                Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
                Paging.DataLoad();
                if (paging.PagesCount <= 1)
                {
                    ltrTotal.Text  = "Tổng số " + paging.RowsCount + " giải pháp";
                    Paging.Visible = false;
                }
                else
                {
                    int  st  = (CurrentPage - 1) * PageSize + 1;
                    long end = CurrentPage * PageSize;
                    if (end > paging.RowsCount)
                    {
                        end = paging.RowsCount;
                    }
                    ltrTotal.Text  = "Đang xem trang " + CurrentPage + ". Hiển thị từ " + st + " - " + end + " trên tổng số " + paging.RowsCount + " giải pháp";
                    Paging.Visible = true;
                }
            }
            else
            {
                ltrTotal.Text  = "";
                Paging.Visible = false;
            }
            rptSolution.DataSource = list;
            rptSolution.DataBind();
        }
    }
Beispiel #10
0
    void BindData()
    {
        AreaService comBSO   = new AreaService();
        DataTable   list     = new DataTable();
        int         ParentId = 0;

        if (ddlParent.SelectedIndex > 0)
        {
            ParentId = Convert.ToInt32(ddlParent.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        list = new AreaService().FindList(ParentId, txtKeyword.Text.Trim(), paging);
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltrTotal.Text  = "Có tổng số " + paging.RowsCount + " lĩnh vực";
                Paging.Visible = false;
            }
            else
            {
                int  st  = (CurrentPage - 1) * PageSize + 1;
                long end = CurrentPage * PageSize;
                if (end > paging.RowsCount)
                {
                    end = paging.RowsCount;
                }
                ltrTotal.Text  = "Đang xem trang " + CurrentPage + ". Hiển thị từ " + st + " - " + end + " trên tổng số " + paging.RowsCount + " lĩnh vực";
                Paging.Visible = true;
            }
        }
        else
        {
            ltrTotal.Text  = "";
            Paging.Visible = false;
        }
        grvArea.DataSource = list;
        grvArea.DataBind();
    }
    private void BindData()
    {
        OrganizationService comBSO = new OrganizationService();
        DataTable           list   = new DataTable();
        int provinceId             = 0;

        if (ddlProvinceSearch.SelectedIndex > 0)
        {
            provinceId = Convert.ToInt32(ddlProvinceSearch.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        list = comBSO.FindOrganizationList(txtKeyword.Text.Trim(), provinceId, paging, true);
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltrTotal.Text  = "Có tổng số " + paging.RowsCount + " đơn vị";
                Paging.Visible = false;
            }
            else
            {
                int  st  = (CurrentPage - 1) * PageSize + 1;
                long end = CurrentPage * PageSize;
                if (end > paging.RowsCount)
                {
                    end = paging.RowsCount;
                }
                ltrTotal.Text  = "Đang xem trang " + CurrentPage + ". Hiển thị từ " + st + " - " + end + " trên tổng số " + paging.RowsCount + " đơn vị";
                Paging.Visible = true;
            }
        }
        else
        {
            ltrTotal.Text  = "";
            Paging.Visible = false;
        }
        grvOrg.DataSource = list;
        grvOrg.DataBind();
    }
    //void BindArea()
    //{
    //    IList<ProjectArea> list = new List<ProjectArea>();
    //    if (!AspNetCache.CheckCache(Constants.Cache_Project_Area_All))
    //    {
    //        list = new ProjectAreaService().FindAll();
    //        AspNetCache.SetCache(Constants.Cache_Project_Area_All, list);
    //    }
    //    else
    //        list = (IList<ProjectArea>)AspNetCache.GetCache(Constants.Cache_Project_Area_All);
    //    ddlArea.DataSource = list;
    //    ddlArea.DataTextField = "AreaName";
    //    ddlArea.DataValueField = "Id";
    //    ddlArea.DataBind();
    //    ddlArea.Items.Insert(0, new ListItem("---Chọn lĩnh vực---"));
    //}
    //void BindSubArea()
    //{
    //    IList<ProjectArea> list = new List<ProjectArea>();
    //    if (!AspNetCache.CheckCache(Constants.Cache_Project_Area_All))
    //    {
    //        list = new ProjectAreaService().FindAll();
    //        AspNetCache.SetCache(Constants.Cache_Project_Area_All, list);
    //    }
    //    else
    //        list = (IList<ProjectArea>)AspNetCache.GetCache(Constants.Cache_Project_Area_All);
    //    ddlSubArea.DataSource = list;
    //    ddlSubArea.DataTextField = "AreaName";
    //    ddlSubArea.DataValueField = "Id";
    //    ddlSubArea.DataBind();
    //    ddlSubArea.Items.Insert(0, new ListItem("---Chọn phân ngành---"));
    //}
    //void BindProvince()
    //{
    //    IList<Province> list = new List<Province>();
    //    if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Provice_All))
    //    {
    //        list = new ProvinceService().FindAll();
    //        AspNetCache.SetCache(Constants.Cache_ReportFuel_Provice_All, list);
    //    }
    //    else
    //        list = (IList<Province>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Provice_All);
    //    ddlProvince.DataSource = list;
    //    ddlProvince.DataTextField = "ProvinceName";
    //    ddlProvince.DataValueField = "Id";
    //    ddlProvince.DataBind();
    //    ddlProvince.Items.Insert(0, new ListItem("---Chọn Tỉnh/TP---"));

    //    ddlProvinceReporter.DataSource = list;
    //    ddlProvinceReporter.DataTextField = "ProvinceName";
    //    ddlProvinceReporter.DataValueField = "Id";
    //    ddlProvinceReporter.DataBind();
    //    ddlProvinceReporter.Items.Insert(0, new ListItem("---Chọn Tỉnh/TP---"));
    //}
    //void BindDistrict()
    //{
    //    IList<District> list = new List<District>();
    //    if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_District_All))
    //    {
    //        list = new DistrictService().FindAll();
    //        AspNetCache.SetCache(Constants.Cache_ReportFuel_District_All, list);
    //    }
    //    else
    //        list = (IList<District>)AspNetCache.GetCache(Constants.Cache_ReportFuel_District_All);
    //    ddlDistrict.DataSource = list;
    //    ddlDistrict.DataTextField = "DistrictName";
    //    ddlDistrict.DataValueField = "Id";
    //    ddlDistrict.DataBind();
    //    ddlDistrict.Items.Insert(0, new ListItem("---Chọn Quận/Huyện---"));

    //    ddlDistrictReporter.DataSource = list;
    //    ddlDistrictReporter.DataTextField = "DistrictName";
    //    ddlDistrictReporter.DataValueField = "Id";
    //    ddlDistrictReporter.DataBind();
    //    ddlDistrictReporter.Items.Insert(0, new ListItem("---Chọn Quận/Huyện---"));
    //}
    //void BindEnterprise()
    //{
    //    int EnterpriseId = 1;
    //    Enterprise enter = new Enterprise();
    //    enter = new EnterpriseService().FindByKey(EnterpriseId);
    //    if (enter != null)
    //    {
    //        txtEnterpriseName.Text = enter.Title;
    //        if (enter.SubAreaId > 0)
    //            ddlSubArea.SelectedValue = enter.SubAreaId.ToString();
    //        if (enter.AreaId > 0)
    //            ddlArea.SelectedValue = enter.AreaId.ToString();
    //        if (enter.ProvinceId > 0)
    //            ddlProvince.SelectedValue = enter.ProvinceId.ToString();
    //        if (enter.DistrictId > 0)
    //            ddlDistrict.SelectedValue = enter.DistrictId.ToString();
    //        txtAddress.Text = enter.Address;
    //        txtEmail.Text = enter.Email;
    //        txtFax.Text = enter.Fax;
    //        txtPhone.Text = enter.Phone;
    //        txtReportName.Text = enter.ManPerson;
    //        if (enter.ManProvinceId > 0)
    //            ddlProvinceReporter.SelectedValue = enter.ManProvinceId.ToString();
    //        if (enter.ManDistrictId > 0)
    //            ddlDistrictReporter.SelectedValue = enter.ManDistrictId.ToString();
    //        txtAddressReporter.Text = enter.ManAddress;
    //        txtEmail.Text = enter.ManEmail;
    //        txtFaxReporter.Text = enter.ManFax;
    //        txtPhoneReporter.Text = enter.ManPhone;
    //    }
    //}

    private void BindData()
    {
        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int AreaId    = 0;
        int SubAreaId = 0;
        int Year      = 0;

        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        Admin admin = new AdminBSO().GetAdminById(m_UserValidation.UserId);

        list = comBSO.FindList(false, AreaId, SubAreaId, admin.AdminOrganizationId, 0, 0, 0, 1, false, Year, null, null, "", paging);
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltNotice.Text  = "Có tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = false;
            }
            else
            {
                ltNotice.Text  = "Có " + list.Rows.Count + " trong tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = true;
            }
        }
        else
        {
            ltNotice.Text  = "";
            Paging.Visible = false;
        }
        rptNoFuelCurrent.DataSource = list;

        rptNoFuelCurrent.DataBind();
    }
Beispiel #13
0
    void BindData()
    {
        FuelService objFuelService = new FuelService();
        DataTable   list           = new DataTable();

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(1000, 1);
        int    groupId = 0;
        string strKey  = string.Empty;

        if (ddlParent.SelectedIndex > 0)
        {
            groupId = Convert.ToInt32(ddlParent.SelectedValue);
        }

        list = objFuelService.FindFuelList(strKey, 0, groupId, paging, true);

        grvFuel.DataSource = list;
        grvFuel.DataBind();
    }
Beispiel #14
0
    void BindData()
    {
        int EnterpriseId = 0;
        int OrgId        = 0;

        if (ddlEnterprise.SelectedIndex > 0)
        {
            EnterpriseId = Convert.ToInt32(ddlEnterprise.SelectedValue);
        }
        if (ddlOrg.SelectedIndex > 0)
        {
            OrgId = Convert.ToInt32(ddlOrg.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        DataTable dt = new MemberService().FindList(OrgId, EnterpriseId, null, null, null, txtKeyword.Text.Trim(), paging);

        grvAdmin.DataSource = dt;
        grvAdmin.DataBind();
        paging.RowsCount   = Convert.ToInt32(dt.Rows[0]["Total"]);
        Paging.PageSize    = PageSize;
        Paging.CurrentPage = CurrentPage;
        Paging.TotalRecord = Convert.ToInt32(dt.Rows[0]["Total"]);
        Paging.DataLoad();
        if (dt != null && dt.Rows.Count > 0)
        {
            if (Paging.TotalPages <= 1)
            {
                ltTotal.Text   = "Có tổng số " + paging.RowsCount + " tài khoản";
                Paging.Visible = false;
            }
            else
            {
                ltTotal.Text   = "Có " + dt.Rows.Count + " trong tổng số " + paging.RowsCount + " tài  khoản";
                Paging.Visible = true;
            }
        }
        else
        {
            ltTotal.Text   = "Có tổng số " + paging.RowsCount + " tài khoản";
            Paging.Visible = false;
        }
    }
    private void BindData()
    {
        EnterpriseService  comBSO = new EnterpriseService();
        IList <Enterprise> list   = new List <Enterprise>();
        int AreaId    = 0;
        int SubAreaId = 0;
        int OrgId     = 0;

        if (ddlOrg.SelectedIndex > 0)
        {
            OrgId = Convert.ToInt32(ddlOrg.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        list = comBSO.FindList(0, AreaId, SubAreaId, OrgId, 0, 0, null, txtKeyword.Text.Trim(), paging);
        if (list != null && list.Count() > 0)
        {
            paging.RowsCount   = list[0].Total;
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = list[0].Total;
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                clientview.Text = "Có tổng số " + paging.RowsCount + " doanh nghiệp";
                Paging.Visible  = false;
            }
            else
            {
                clientview.Text = "Có " + list.Count() + " trong tổng số " + paging.RowsCount + " doanh nghiệp";
                Paging.Visible  = true;
            }
        }
        else
        {
            clientview.Text = "";
            Paging.Visible  = false;
        }
        grvNewsGroup.DataSource = list;

        grvNewsGroup.DataBind();
    }
    void BindTOEOld()
    {
        IList <GroupFuel> listGroupFuel = new List <GroupFuel>();

        if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_GroupFuel_All))
        {
            listGroupFuel = new GroupFuelService().FindAll();
            AspNetCache.SetCache(Constants.Cache_ReportFuel_GroupFuel_All, listGroupFuel);
        }
        else
        {
            listGroupFuel = (IList <GroupFuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_GroupFuel_All);
        }

        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int AreaId    = 0;
        int SubAreaId = 0;
        int Year      = 0;
        int iOrgId    = 0;

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(100, 1);
        list = comBSO.GetReportTOETemp2014(AreaId, SubAreaId, iOrgId, ItemId, Year, "", paging);
        rptData.DataSource = list;
        rptData.DataBind();
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            ltNotice.Text = "Tổng số có " + paging.RowsCount + " báo cáo";
        }
        else
        {
            ltNotice.Text = "";
        }
    }
Beispiel #17
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        int ProvinceId           = Convert.ToInt32(ViewState["ProvinceId"]);
        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int AreaId    = 0;
        int SubAreaId = 0;
        int Year      = 0;

        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(2000, CurrentPage);
        list = comBSO.TongHopMucNLTT(false, AreaId, 0, m_UserValidation.OrgId, 0, ProvinceId, 0, -1, true, Year, null, null, txtKeyword.Text.Trim(), paging);
        if (list == null)
        {
            return;
        }
        else
        {
            ExportExcel(list);
        }
    }
Beispiel #18
0
 private void BindData()
 {
     if (m_UserValidation != null && m_UserValidation.OrgId > 0)
     {
         ProductService         productService = new ProductService();
         ePower.Core.PagingInfo paging         = new ePower.Core.PagingInfo(PageSize, CurrentPage);
         int    startYear    = 0;
         int    endYear      = 0;
         int    isproduct    = -1;
         string strKey       = string.Empty;
         string strTotalInfo = string.Empty;
         if (txtKeyword.Text != "" && txtKeyword.Text.Trim() != "")
         {
             strKey = txtKeyword.Text.Trim();
         }
         if (ddlYearStart.SelectedIndex > 0)
         {
             startYear = Convert.ToInt32(ddlYearStart.SelectedValue);
         }
         if (ddlYearEnd.SelectedIndex > 0)
         {
             endYear = Convert.ToInt32(ddlYearEnd.SelectedValue);
         }
         if (ddlType.SelectedValue != "")
         {
             isproduct = Convert.ToInt32(ddlType.SelectedValue);
         }
         DataTable lstProduct = new DataTable();
         lstProduct = productService.FindProductList(startYear, endYear, isproduct, strKey, m_UserValidation.OrgId, paging, true);
         if (lstProduct != null && lstProduct.Rows.Count > 0)
         {
             paging.RowsCount   = Convert.ToInt32(lstProduct.Rows[0]["Total"]);
             Paging.PageSize    = PageSize;
             Paging.CurrentPage = CurrentPage;
             Paging.TotalRecord = Convert.ToInt32(lstProduct.Rows[0]["Total"]);
             Paging.DataLoad();
             if (paging.PagesCount <= 1)
             {
                 strTotalInfo   = "Tổng số " + paging.RowsCount + " sản phẩm";
                 Paging.Visible = false;
             }
             else
             {
                 int  st  = (CurrentPage - 1) * PageSize + 1;
                 long end = CurrentPage * PageSize;
                 if (end > paging.RowsCount)
                 {
                     end = paging.RowsCount;
                 }
                 strTotalInfo   = "Đang xem trang " + CurrentPage + ". Hiển thị từ " + st + " - " + end + " trên tổng số " + paging.RowsCount + " sản phẩm";
                 Paging.Visible = true;
             }
             rptProduct.DataSource = lstProduct;
             rptProduct.DataBind();
         }
         else
         {
             rptProduct.DataSource = null;
             rptProduct.DataBind();
             strTotalInfo   = "Không tìm thấy sản phẩm nào";
             Paging.Visible = false;
         }
         ltrTotal.Text = strTotalInfo;
     }
 }
Beispiel #19
0
    private void BindData()
    {
        EnterpriseService comBSO = new EnterpriseService();
        DataTable         dt     = new DataTable();
        int    AreaId            = 0;
        int    SubAreaId         = 0;
        int    OrgId             = 0;
        int    Year          = 0;
        string strclientview = string.Empty;
        string strKey        = string.Empty;

        if (txtKeyword.Text != "" && txtKeyword.Text.Trim() != "")
        {
            strKey = txtKeyword.Text.Trim();
        }
        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        if (ddlSubArea.SelectedIndex > 0)
        {
            SubAreaId = Convert.ToInt32(ddlSubArea.SelectedValue);
        }
        if (ddlOrg.SelectedIndex > 0)
        {
            OrgId = Convert.ToInt32(ddlOrg.SelectedValue);
        }
        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        dt = comBSO.GetDataTable(Year, AreaId, SubAreaId, OrgId, 0, 0, null, strKey, paging);
        if (dt != null && dt.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(dt.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(dt.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                strclientview  = "Tổng số có " + paging.RowsCount + " doanh nghiệp";
                Paging.Visible = false;
            }
            else
            {
                int  st  = (CurrentPage - 1) * PageSize + 1;
                long end = CurrentPage * PageSize;
                if (end > paging.RowsCount)
                {
                    end = paging.RowsCount;
                }
                strclientview  = "Đang xem trang " + CurrentPage + ". Hiển thị từ " + st + " - " + end + " trên tổng số " + paging.RowsCount + " doanh nghiệp";
                Paging.Visible = true;
            }
        }
        else
        {
            strclientview  = "";
            Paging.Visible = false;
        }
        grvNewsGroup.DataSource = dt;
        grvNewsGroup.DataBind();
        clientview.Text = strclientview;
    }
Beispiel #20
0
    //void BindEnterprise()
    //{
    //    int EnterpriseId = 1;
    //    Enterprise enter = new Enterprise();
    //    enter = new EnterpriseService().FindByKey(EnterpriseId);
    //    if (enter != null)
    //    {
    //        txtEnterpriseName.Text = enter.Title;
    //        if (enter.SubAreaId > 0)
    //            ddlSubArea.SelectedValue = enter.SubAreaId.ToString();
    //        if (enter.AreaId > 0)
    //            ddlArea.SelectedValue = enter.AreaId.ToString();
    //        if (enter.ProvinceId > 0)
    //            ddlProvince.SelectedValue = enter.ProvinceId.ToString();
    //        if (enter.DistrictId > 0)
    //            ddlDistrict.SelectedValue = enter.DistrictId.ToString();
    //        txtAddress.Text = enter.Address;
    //        txtEmail.Text = enter.Email;
    //        txtFax.Text = enter.Fax;
    //        txtPhone.Text = enter.Phone;
    //        txtReportName.Text = enter.ManPerson;
    //        if (enter.ManProvinceId > 0)
    //            ddlProvinceReporter.SelectedValue = enter.ManProvinceId.ToString();
    //        if (enter.ManDistrictId > 0)
    //            ddlDistrictReporter.SelectedValue = enter.ManDistrictId.ToString();
    //        txtAddressReporter.Text = enter.ManAddress;
    //        txtEmail.Text = enter.ManEmail;
    //        txtFaxReporter.Text = enter.ManFax;
    //        txtPhoneReporter.Text = enter.ManPhone;
    //    }
    //}
    //void BindOrganization()
    //{
    //    IList<Organization> list = new List<Organization>();
    //    if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Organization_All))
    //    {
    //        list = new OrganizationService().FindAll();
    //        AspNetCache.SetCache(Constants.Cache_ReportFuel_Organization_All, list);
    //    }
    //    else
    //        list = (IList<Organization>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Organization_All);
    //    ddlOrg.DataSource = list;
    //    ddlOrg.DataTextField = "Title";
    //    ddlOrg.DataValueField = "Id";
    //    ddlOrg.DataBind();
    //    ddlOrg.Items.Insert(0, new ListItem("---Tất cả---", ""));
    //}
    private void BindData()
    {
        int ProvinceId = Convert.ToInt32(ViewState["ProvinceId"]);

        ltData.Text = "";
        //IList<Fuel> listFuel = new List<Fuel>();
        //if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Fuel_All))
        //{
        //    listFuel = new FuelService().FindAll();
        //    AspNetCache.SetCache(Constants.Cache_ReportFuel_Fuel_All, listFuel);
        //}
        //else
        //    listFuel = (IList<Fuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Fuel_All);


        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int AreaId     = 0;
        int DistrictId = 0;
        int Year       = 0;

        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        if (ddlDistrict.SelectedIndex > 0)
        {
            DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue);
        }
        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        list = comBSO.TongHopMucNLTT(false, AreaId, 0, m_UserValidation.OrgId, 0, ProvinceId, 0, -1, true, Year, null, null, txtKeyword.Text.Trim(), paging);
        if (list == null)
        {
            return;
        }
        CreateList(list);



        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = list.Rows.Count;
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = list.Rows.Count;
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltNotice.Text  = "Có tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = false;
            }
            else
            {
                ltNotice.Text  = "Có" + list.Rows.Count + " trong tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = true;
            }
        }
        else
        {
            ltNotice.Text  = "";
            Paging.Visible = false;
        }
    }
Beispiel #21
0
    private void BindData()
    {
        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int  AreaId    = 0;
        int  SubAreaId = 0;
        int  Year      = 0;
        bool?status    = null;

        if (ddlStatus.SelectedIndex > 0)
        {
            status = (ddlStatus.SelectedValue == "1");
        }
        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }
        int orgid = 0;

        if (ddlOrg.SelectedIndex > 0)
        {
            orgid = Convert.ToInt32(ddlOrg.SelectedValue);
        }
        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        if (ddlSubArea.SelectedIndex > 0)
        {
            SubAreaId = Convert.ToInt32(ddlSubArea.SelectedValue);
        }
        Admin admin = new AdminBSO().GetAdminById(m_UserValidation.UserId);

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        list = comBSO.FindList(false, AreaId, SubAreaId, orgid, 0, 0, 0, -1, status, Year, null, null, txtKeyword.Text.Trim(), paging);
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltNotice.Text  = "Có tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = false;
            }
            else
            {
                ltNotice.Text  = "Có " + list.Rows.Count + " trong tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = true;
            }
        }
        else
        {
            ltNotice.Text  = "";
            Paging.Visible = false;
        }
        rptNoFuelCurrent.DataSource = list;

        rptNoFuelCurrent.DataBind();
    }
    void BindTOECurrent()
    {
        ltData.Text = "";
        IList <GroupFuel> listGroupFuel = new List <GroupFuel>();

        if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_GroupFuel_All))
        {
            listGroupFuel = new GroupFuelService().FindAll();
            AspNetCache.SetCache(Constants.Cache_ReportFuel_GroupFuel_All, listGroupFuel);
        }
        else
        {
            listGroupFuel = (IList <GroupFuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_GroupFuel_All);
        }

        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int AreaId    = 0;
        int SubAreaId = 0;
        int Year      = 0;

        //if (ddlOrg.SelectedIndex > 0)
        //    OrgId = Convert.ToInt32(ddlOrg.SelectedValue);
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        list          = comBSO.FindList(false, AreaId, SubAreaId, ItemId, 0, 0, 0, 1, true, Year, null, null, "", paging);
        ltHeader.Text = "";
        foreach (GroupFuel group in listGroupFuel)
        {
            ltHeader.Text = ltHeader.Text + "<th>" + group.Title + " (" + group.MeasurementName + ")</th>";
        }
        if (list != null && list.Rows.Count > 0)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < list.Rows.Count; i++)
            {
                sb.Append("<tr><td>" + (i + 1) + "</td>");
                sb.Append("<td>" + list.Rows[i]["Title"] + "</td>");
                sb.Append("<td>" + list.Rows[i]["Address"] + "</td>");
                sb.Append("<td>" + list.Rows[i]["ProvinceName"] + "</td>");
                sb.Append("<td></td>");//Vung
                //sb.Append("<td>" + list.Rows[i]["RegionName"] + "</td>");//Vung
                sb.Append("<td>" + list.Rows[i]["ParentAreaName"] + "</td>");
                sb.Append("<td>" + list.Rows[i]["AreaName"] + "</td>");
                if (list.Rows[i]["Id"] != null && list.Rows[i]["Id"].ToString() != "")
                {
                    int ReportId = Convert.ToInt32(list.Rows[i]["Id"]);
                    if (ReportId > 0)
                    {
                        DataTable listDetail = new ReportFuelDetailService().GetNoFuelDetailGroupByReport(ReportId, false);
                        int       SumTOE     = 0;
                        if (listDetail != null && listDetail.Rows.Count > 0)
                        {
                            foreach (GroupFuel group in listGroupFuel)
                            {
                                DataRow[] dr = listDetail.Select("GroupFuelId=" + group.Id);
                                if (dr != null && dr.Count() > 0)
                                {
                                    sb.Append("<td>" + dr[0]["NoFuel"]);
                                    SumTOE = SumTOE + Convert.ToInt32(dr[0]["NoFuel_TOE"]);
                                }
                                else
                                {
                                    sb.Append("<td>0</td>");
                                }
                            }
                            sb.Append("<td>" + SumTOE + "</td>");
                        }
                        else
                        {
                            for (int j = 0; j < listGroupFuel.Count; j++)
                            {
                                sb.Append("<td>0</td>");
                            }
                            sb.Append("<td>0</td>");
                        }
                    }
                    sb.Append("</tr>");
                }
            }
            ltData.Text = sb.ToString();
        }
    }
Beispiel #23
0
    private void BindData()
    {
        IList <GroupFuel> listGroupFuel = new List <GroupFuel>();

        if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_GroupFuel_All))
        {
            listGroupFuel = new GroupFuelService().FindAll();
            AspNetCache.SetCache(Constants.Cache_ReportFuel_GroupFuel_All, listGroupFuel);
        }
        else
        {
            listGroupFuel = (IList <GroupFuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_GroupFuel_All);
        }

        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int AreaId    = 0;
        int SubAreaId = 0;
        int Year      = 0;
        int OrgId     = 0;

        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        if (ddlSubArea.SelectedIndex > 0)
        {
            SubAreaId = Convert.ToInt32(ddlSubArea.SelectedValue);
        }
        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }
        if (ddlOrg.SelectedIndex > 0)
        {
            OrgId = Convert.ToInt32(ddlOrg.SelectedValue);
        }

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        list = comBSO.GetReportTOETemp2014(AreaId, SubAreaId, OrgId, 0, Year, txtKeyword.Text.Trim(), paging);
        rptData.DataSource = list;
        rptData.DataBind();
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltNotice.Text  = "Có tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = false;
            }
            else
            {
                int  st  = (CurrentPage - 1) * PageSize + 1;
                long end = CurrentPage * PageSize;
                if (end > paging.RowsCount)
                {
                    end = paging.RowsCount;
                }
                ltNotice.Text  = "Hiển thị từ " + st + " - " + end + " trong tổng số " + paging.RowsCount + " doanh nghiệp";
                Paging.Visible = true;
            }
        }
        else
        {
            ltNotice.Text  = "";
            Paging.Visible = false;
        }
    }
Beispiel #24
0
    //void BindEnterprise()
    //{
    //    int EnterpriseId = 1;
    //    Enterprise enter = new Enterprise();
    //    enter = new EnterpriseService().FindByKey(EnterpriseId);
    //    if (enter != null)
    //    {
    //        txtEnterpriseName.Text = enter.Title;
    //        if (enter.SubAreaId > 0)
    //            ddlSubArea.SelectedValue = enter.SubAreaId.ToString();
    //        if (enter.AreaId > 0)
    //            ddlArea.SelectedValue = enter.AreaId.ToString();
    //        if (enter.ProvinceId > 0)
    //            ddlProvince.SelectedValue = enter.ProvinceId.ToString();
    //        if (enter.DistrictId > 0)
    //            ddlDistrict.SelectedValue = enter.DistrictId.ToString();
    //        txtAddress.Text = enter.Address;
    //        txtEmail.Text = enter.Email;
    //        txtFax.Text = enter.Fax;
    //        txtPhone.Text = enter.Phone;
    //        txtReportName.Text = enter.ManPerson;
    //        if (enter.ManProvinceId > 0)
    //            ddlProvinceReporter.SelectedValue = enter.ManProvinceId.ToString();
    //        if (enter.ManDistrictId > 0)
    //            ddlDistrictReporter.SelectedValue = enter.ManDistrictId.ToString();
    //        txtAddressReporter.Text = enter.ManAddress;
    //        txtEmail.Text = enter.ManEmail;
    //        txtFaxReporter.Text = enter.ManFax;
    //        txtPhoneReporter.Text = enter.ManPhone;
    //    }
    //}
    //void BindOrganization()
    //{
    //    IList<Organization> list = new List<Organization>();
    //    if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Organization_All))
    //    {
    //        list = new OrganizationService().FindAll();
    //        AspNetCache.SetCache(Constants.Cache_ReportFuel_Organization_All, list);
    //    }
    //    else
    //        list = (IList<Organization>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Organization_All);
    //    ddlOrg.DataSource = list;
    //    ddlOrg.DataTextField = "Title";
    //    ddlOrg.DataValueField = "Id";
    //    ddlOrg.DataBind();
    //    ddlOrg.Items.Insert(0, new ListItem("---Tất cả---", ""));
    //}
    private void BindData()
    {
        ltData.Text = "";
        IList <Fuel> listFuel = new List <Fuel>();

        if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Fuel_All))
        {
            listFuel = new FuelService().FindAll();
            AspNetCache.SetCache(Constants.Cache_ReportFuel_Fuel_All, listFuel);
        }
        else
        {
            listFuel = (IList <Fuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Fuel_All);
        }

        //IList<GroupFuel> listGroupFuel = new List<GroupFuel>();
        //if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_GroupFuel_All))
        //{
        //    listGroupFuel = new GroupFuelService().FindAll();
        //    AspNetCache.SetCache(Constants.Cache_ReportFuel_GroupFuel_All, listGroupFuel);
        //}
        //else
        //    listGroupFuel = (IList<GroupFuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_GroupFuel_All);
        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int AreaId     = 0;
        int DistrictId = 0;
        int Year       = 0;

        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        if (ddlDistrict.SelectedIndex > 0)
        {
            DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue);
        }
        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        list          = comBSO.FindList(false, AreaId, 0, m_UserValidation.OrgId, 0, DistrictId, 0, -1, true, Year, null, null, txtKeyword.Text.Trim(), paging);
        ltHeader.Text = "";
        //foreach (GroupFuel group in listGroupFuel)
        //{
        //    ltHeader.Text = ltHeader.Text + "<th>" + group.Title + " (" + group.MeasurementName + ")</th>";
        //}
        foreach (Fuel fuel in listFuel)
        {
            ltHeader.Text = ltHeader.Text + "<th>" + fuel.FuelName + "</th>";
        }
        if (list != null && list.Rows.Count > 0)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < list.Rows.Count; i++)
            {
                sb.Append("<tr><td class='text-center'>" + (i + 1) + "</td>");
                sb.Append("<td>" + list.Rows[i]["Title"] + "</td>");
                sb.Append("<td>" + list.Rows[i]["Address"] + "</td>");
                //sb.Append("<td>" + list.Rows[i]["ProvinceName"] + "</td>");
                //sb.Append("<td></td>");//Vung
                //sb.Append("<td>" + list.Rows[i]["RegionName"] + "</td>");//Vung
                sb.Append("<td>" + list.Rows[i]["ParentAreaName"] + "</td>");
                sb.Append("<td>" + list.Rows[i]["AreaName"] + "</td>");
                if (list.Rows[i]["Id"] != null && list.Rows[i]["Id"].ToString() != "")
                {
                    int ReportId = Convert.ToInt32(list.Rows[i]["Id"]);
                    if (ReportId > 0)
                    {
                        DataTable listDetail = new ReportFuelDetailService().GetFuelTOEByReport(ReportId, false);
                        int       SumTOE     = 0;
                        if (listDetail != null && listDetail.Rows.Count > 0)
                        {
                            foreach (Fuel fuel in listFuel)
                            {
                                DataRow[] dr = listDetail.Select("FuelId=" + fuel.Id);
                                if (dr != null && dr.Count() > 0)
                                {
                                    sb.Append("<td>");

                                    for (int j = 0; j < dr.Count(); j++)
                                    {
                                        if (dr[j]["NoFuel_TOE"] != DBNull.Value)
                                        {
                                            SumTOE = SumTOE + Convert.ToInt32(dr[j]["NoFuel_TOE"]);
                                            sb.Append(dr[j]["NoFuel"] + " (" + dr[j]["MeasurementName"] + ")");
                                        }
                                    }
                                    sb.Append("</td>");
                                }
                                else
                                {
                                    sb.Append("<td>0</td>");
                                }
                            }
                            sb.Append("<td>" + SumTOE + "</td>");
                        }
                        else
                        {
                            for (int j = 0; j < listFuel.Count; j++)
                            {
                                sb.Append("<td>0</td>");
                            }
                            sb.Append("<td>0</td>");
                        }
                    }
                    sb.Append("</tr>");
                }
            }
            ltData.Text        = sb.ToString();
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltNotice.Text  = "Có tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = false;
            }
            else
            {
                ltNotice.Text  = "Có" + list.Rows.Count + " trong tổng số " + paging.RowsCount + " báo cáo";
                Paging.Visible = true;
            }
        }
        else
        {
            ltNotice.Text  = "";
            Paging.Visible = false;
        }
    }
Beispiel #25
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        Response.ContentType = "application/force-download";
        Response.AddHeader("content-disposition", "attachment; filename=Bao-cao-sct-" + ddlYear.SelectedValue + ".xls");
        Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
        Response.Write("<head>");
        Response.Write("<META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
        Response.Write("<!--[if gte mso 9]><xml>");
        Response.Write("<x:ExcelWorkbook>");
        Response.Write("<x:ExcelWorksheets>");
        Response.Write("<x:ExcelWorksheet>");
        Response.Write("<x:Name>Report Data</x:Name>");
        Response.Write("<x:WorksheetOptions>");
        Response.Write("<x:Print>");
        Response.Write("<x:ValidPrinterInfo/>");
        Response.Write("</x:Print>");
        Response.Write("</x:WorksheetOptions>");
        Response.Write("</x:ExcelWorksheet>");
        Response.Write("</x:ExcelWorksheets>");
        Response.Write("</x:ExcelWorkbook>");
        Response.Write("</xml>");
        Response.Write("<![endif]--> ");
        Response.Write("</head><body>");
        //IList<GroupFuel> listGroupFuel = new List<GroupFuel>();
        //if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_GroupFuel_All))
        //{
        //    listGroupFuel = new GroupFuelService().FindAll();
        //    AspNetCache.SetCache(Constants.Cache_ReportFuel_GroupFuel_All, listGroupFuel);
        //}
        //else
        //    listGroupFuel = (IList<GroupFuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_GroupFuel_All);
        IList <Fuel> listFuel = new List <Fuel>();

        if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Fuel_All))
        {
            listFuel = new FuelService().FindAll();
            AspNetCache.SetCache(Constants.Cache_ReportFuel_Fuel_All, listFuel);
        }
        else
        {
            listFuel = (IList <Fuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Fuel_All);
        }
        ReportFuelService comBSO = new ReportFuelService();
        DataTable         list   = new DataTable();
        int AreaId    = 0;
        int SubAreaId = 0;
        int Year      = 0;

        if (ddlYear.SelectedIndex > 0)
        {
            Year = Convert.ToInt32(ddlYear.SelectedValue);
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(2000, CurrentPage);
        list = comBSO.FindList(false, AreaId, SubAreaId, m_UserValidation.OrgId, 0, 0, 0, -1, true, Year, null, null, "", paging);
        string strHeader = "";

        foreach (Fuel group in listFuel)
        {
            strHeader = strHeader + "<th>" + group.FuelName + "</th>";
        }
        StringBuilder sb = new StringBuilder();

        sb.Append("<table class='table table-bordered table-hover mbn' width='100%'>");
        sb.Append("<tr class='primary fs12'>");
        sb.Append("<th style='width:5%'>STT</th>");
        sb.Append("<th style='width:35%'>Tên doanh nghiệp</th>");
        sb.Append("<th style='width:10%'>Địa chỉ</th>");
        sb.Append("<th style='width:10%'>Tỉnh/TP</th>");
        sb.Append("<th style='width:10%'>Vùng</th>");
        sb.Append("<th style='width:10%'>Lĩnh vực SX</th>");
        sb.Append("<th style='width:10%'>Ngành nghề SX,KD</th>");
        sb.Append(strHeader);
        sb.Append("<th style='width:10%'>Năng lượng tiêu thụ quy đổi (TOE)</th>");
        sb.Append("</tr>");

        if (list != null && list.Rows.Count > 0)
        {
            for (int i = 0; i < list.Rows.Count; i++)
            {
                sb.Append("<tr><td>" + (i + 1) + "</td>");
                sb.Append("<td>" + list.Rows[i]["Title"] + "</td>");
                sb.Append("<td>" + list.Rows[i]["Address"] + "</td>");
                //sb.Append("<td>" + list.Rows[i]["ProvinceName"] + "</td>");
                //sb.Append("<td></td>");//Vung
                //sb.Append("<td>" + list.Rows[i]["RegionName"] + "</td>");//Vung
                sb.Append("<td>" + list.Rows[i]["ParentAreaName"] + "</td>");
                sb.Append("<td>" + list.Rows[i]["AreaName"] + "</td>");
                if (list.Rows[i]["Id"] != null && list.Rows[i]["Id"].ToString() != "")
                {
                    int ReportId = Convert.ToInt32(list.Rows[i]["Id"]);
                    if (ReportId > 0)
                    {
                        DataTable listDetail = new ReportFuelDetailService().GetFuelTOEByReport(ReportId, false);
                        int       SumTOE     = 0;
                        if (listDetail != null && listDetail.Rows.Count > 0)
                        {
                            foreach (Fuel group in listFuel)
                            {
                                DataRow[] dr = listDetail.Select("FuelId=" + group.Id);
                                if (dr != null && dr.Count() > 0)
                                {
                                    sb.Append("<td>");
                                    for (int j = 0; j < dr.Count(); j++)
                                    {
                                        sb.Append(dr[j]["NoFuel"] + " (" + dr[j]["MeasurementName"] + ")");
                                    }
                                    sb.Append("</td>");
                                }
                                else
                                {
                                    sb.Append("<td>0</td>");
                                }
                            }
                            sb.Append("<td>" + SumTOE + "</td>");
                        }
                        else
                        {
                            for (int j = 0; j < listFuel.Count; j++)
                            {
                                sb.Append("<td>0</td>");
                            }
                            sb.Append("<td>0</td>");
                        }
                    }
                    sb.Append("</tr>");
                }
            }
        }
        sb.Append("</table>");

        Response.Write(sb.ToString());
        Response.Write("</body></html>");
        Response.End();
    }
Beispiel #26
0
    private void BindData()
    {
        IList <Fuel> listFuel = new List <Fuel>();

        if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Fuel_All))
        {
            listFuel = new FuelService().FindAll();
            AspNetCache.SetCache(Constants.Cache_ReportFuel_Fuel_All, listFuel);
        }
        else
        {
            listFuel = (IList <Fuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Fuel_All);
        }
        foreach (Fuel fuel in listFuel)
        {
            ltHeaderFuel.Text = ltHeaderFuel.Text + "<th>" + fuel.FuelName + "</th>";
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        //if (m_UserValidation.OrgId > 0)
        //{
        int AuditYear = 0;

        if (ddlYear.SelectedIndex > 0)
        {
            AuditYear = Convert.ToInt32(ddlYear.SelectedValue);
        }
        int AreaId = 0;

        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        int DistrictId = 0;
        //if (ddlDistrict.SelectedIndex > 0)
        //    DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue);
        DataTable list = new AuditReportService().FindList(AreaId, 0, 0, 0, 0, DistrictId, Convert.ToInt32(AuditReportStatus.CONFIRMED), AuditYear, txtKeyword.Text.Trim(), paging);

        rptAuditReport.DataSource = list;
        rptAuditReport.DataBind();
        if (list != null && list.Rows.Count > 0)
        {
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.DataLoad();
            Paging2.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging2.PageSize    = PageSize;
            Paging2.DataLoad();
            if (Paging.TotalPages > 1)
            {
                ltTotal.Text    = "Có " + list.Rows.Count + " trong tổng số " + list.Rows[0]["Total"] + " báo cáo";
                Paging2.Visible = Paging.Visible = true;
            }
            else
            {
                ltTotal.Text    = "Có tổng số " + list.Rows[0]["Total"] + " báo cáo";
                Paging2.Visible = Paging.Visible = false;
            }
        }
        else
        {
            Paging2.Visible = Paging.Visible = false;
        }
        //}
    }