예제 #1
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        if (GridView1.Rows.Count > 0)
        {
            int VesselID      = int.Parse(hdnVesselID.Value);
            int UserCompanyID = UDFLib.ConvertToInteger(getSessionString("USERCOMPANYID"));

            DataTable dtexportdata = BLL_Crew_CrewList.Get_CrewMatrix_Report(VesselID, UDFLib.ConvertIntegerToNull(hdnVesselType.Value), UserCompanyID);
            if (dtexportdata.Rows.Count > 0)
            {
                string[] HeaderCaptions  = new string[] { "Department", "Rank", "Nationality", "Certificate Of Competency", " Issuing Country", "Adminstration Acceptance", "Tanker Certification", "STCW V Para For Current Cargo", "Radio Qualification", "Year With Operator", "Year in Rank", "Year in this type of Tanker", "Year on All types of Tanker", "Months on vessel this Tour of Duty", "English Proficiency" };
                string[] DataColumnsName = new string[] { "Dept", "Rank_Name", "Nationality", "Certificate_Of_Competency", "Country_Name", "Adminstration_Acceptance", "Tanker_Certification", "STCWVPara", "Radio_Qualification", "YearsOfOperator", "YearsOfRank", "YearsOfTanker", "YearsOfAllTanker", "Months", "English_Proficiency" };
                string   vesselType      = lblTankerType.Text == "N/A" ? "" : lblTankerType.Text + " - ";
                string   FileHeaderName  = "Crew Matrix: " + hdnVesselName.Value + " - " + vesselType + lblDate.Text;
                string   FileName        = "CrewMatrix-" + hdnVesselName.Value;
                GridViewExportUtil.ShowExcel(dtexportdata, HeaderCaptions, DataColumnsName, FileName, FileHeaderName);
            }
        }
        else
        {
            string CrewMatrix;
            if (ddlVessel.SelectedIndex == 0)
            {
                CrewMatrix = String.Format("alert('Select a vessel to export crew matrix.');");
            }
            else
            {
                CrewMatrix = String.Format("alert('No data found to export to excel.');");
            }
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "CrewMatrix", CrewMatrix, true);
        }
    }
예제 #2
0
    protected void btnImprimir_Click(object sender, ImageClickEventArgs e)
    {
        string estado = string.Empty;

        if (ddlEstado.SelectedIndex == 0)
        {
            estado = string.Empty;
        }
        else
        {
            estado = ddlEstado.SelectedValue.ToString();
        }

        string Centro = string.Empty;

        if (ddlcentro.SelectedIndex == 0)
        {
            Centro = string.Empty;
        }
        else
        {
            Centro = ddlcentro.SelectedValue.ToString();
        }

        estado = ddlEstado.SelectedValue.ToString();
        BL_TBL_RequerimientoSubDetalle obj = new BL_TBL_RequerimientoSubDetalle();
        DataTable dtResultadoeExcel        = new DataTable();



        TextBox txtRequerimientosa_H = (TextBox)GridView1.HeaderRow.FindControl("txtRequerimientosa_H");
        TextBox txtFamilia_H         = (TextBox)GridView1.HeaderRow.FindControl("txtFamilia_H");
        TextBox txtSUBFAMILIA_H      = (TextBox)GridView1.HeaderRow.FindControl("txtSUBFAMILIA_H");
        TextBox txtSOLPED_H          = (TextBox)GridView1.HeaderRow.FindControl("txtSOLPED_H");
        TextBox txtPDC_H             = (TextBox)GridView1.HeaderRow.FindControl("txtGPO_H");
        TextBox txtGPO_H             = (TextBox)GridView1.HeaderRow.FindControl("txtPDC_H");



        dtResultadoeExcel = obj.USP_SEL_TBL_REQUERIMIENTO_EQUIPO_MAYOR("", estado, ddlanio.SelectedValue.ToString(), Centro,
                                                                       txtRequerimientosa_H.Text.Trim(), txtFamilia_H.Text.Trim(), txtSUBFAMILIA_H.Text.Trim(),
                                                                       txtSOLPED_H.Text.Trim(),
                                                                       txtPDC_H.Text.Trim(), txtGPO_H.Text.Trim(), "1", "");

        if (dtResultadoeExcel.Rows.Count > 0)
        {
            //ExcelHelper.ToExcel(dtResultadoeExcel, "CJI3_" + ddlEstados.SelectedItem + ".xls", Page.Response);

            gvExcel.DataSource = dtResultadoeExcel;
            gvExcel.DataBind();



            GridViewExportUtil.Export("ARRIENDOS_" + DateTime.Now + ".xls", gvExcel);
            return;
        }
        else
        {
        }
    }
예제 #3
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataSet dt = objBLL.CRUD_OilMajorsRules("", "R", 0, 0, txtfilter.Text != "" ? txtfilter.Text : null, sortbycoloumn, sortdirection
                                                    , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount, ref Result);


            string[] HeaderCaptions  = { "Rules" };
            string[] DataColumnsName = { "Rule_Name" };

            GridViewExportUtil.ShowExcel(dt.Tables[0], HeaderCaptions, DataColumnsName, "OilMajorsRules", "Oil Majors Rules", "");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
예제 #4
0
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString());

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }


        DataTable dt = BLL_QMS_RestHours.Get_RestHours_Index(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(ddlvessel.SelectedValue), UDFLib.ConvertStringToNull(txtCrew.Text), UDFLib.ConvertStringToNull(ddlRank.SelectedValue),
                                                             UDFLib.ConvertDateToNull(txtfrom.Text), UDFLib.ConvertDateToNull(txtto.Text), sortbycoloumn, sortdirection
                                                             , 1, null, ref rowcount);


        string[] HeaderCaptions  = { "Vessel", "Date", "Code", "Crew Name", "Rank", "Ship's Clocked Hours", "Working Hours", "Rest Hours", "Rest Hours Any 24", "Over Time", "Seafarer's Remarks", "Verifier's Remarks" };
        string[] DataColumnsName = { "Vessel_Name", "REST_HOURS_DATE", "Staff_Code", "Staff_Name", "Staff_rank_Code", "SHIPS_CLOCKED_HOURS", "WORKING_HOURS", "REST_HOURS", "REST_HOURS_ANY24", "OverTime_HOURS", "Seafarer_Remarks", "Verifier_Remarks" };

        GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Rest Hour", "Rest_Hours_Index", "");

        //ExcelDataExport objexp = new ExcelDataExport();
        //objexp.WriteExcell(dt);
    }
예제 #5
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ImgBtnExportUnionBook_Click(object sender, EventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            BLL_Crew_Admin objBLL = new BLL_Crew_Admin();
            DataTable      dt     = objBLL.CRUD_UnionBook("", "R", 0, 0, txtUnionBookFilter.Text != "" ? txtUnionBookFilter.Text : null, sortbycoloumn, sortdirection, null, null, ref rowcount, ref Result);

            string[] HeaderCaptions  = { "Union Book" };
            string[] DataColumnsName = { "UnionBook" };

            GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Union Book", "Union Book", "");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
    public static void Export(string fileName, GridView gv)
    {
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", fileName));
        HttpContext.Current.Response.ContentType = "application/ms-excel";
        StringWriter   sw  = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        //  Create a form to contain the grid
        Table table = new Table();

        table.GridLines = gv.GridLines;
        //  add the header row to the table
        if ((((gv.HeaderRow) != null)))
        {
            GridViewExportUtil.PrepareControlForExport(gv.HeaderRow);
            table.Rows.Add(gv.HeaderRow);
        }
        //  add each of the data rows to the table
        foreach (GridViewRow row in gv.Rows)
        {
            GridViewExportUtil.PrepareControlForExport(row);
            table.Rows.Add(row);
        }
        //  add the footer row to the table
        if ((((gv.FooterRow) != null)))
        {
            GridViewExportUtil.PrepareControlForExport(gv.FooterRow);
            table.Rows.Add(gv.FooterRow);
        }
        //  render the table into the htmlwriter
        table.RenderControl(htw);
        //  render the htmlwriter into the response
        HttpContext.Current.Response.Write(sw.ToString());
        HttpContext.Current.Response.End();
    }
예제 #7
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        int rowcount   = ucCustomPagerItems.isCountRecord;
        int?isfavorite = null; if (ddlFavorite.SelectedValue != "2")
        {
            isfavorite = Convert.ToInt32(ddlFavorite.SelectedValue.ToString());
        }
        int?countrycode = null; if (ddlSearchCountry.SelectedValue != "0")
        {
            countrycode = Convert.ToInt32(ddlSearchCountry.SelectedValue.ToString());
        }

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }


        DataTable dt = objBLL.SearchCurrency(txtfilter.Text != "" ? txtfilter.Text : null, countrycode, isfavorite, sortbycoloumn, sortdirection
                                             , null, null, ref rowcount);

        string[] HeaderCaptions  = { "Code", "Description", "Country", "Favorite" };
        string[] DataColumnsName = { "Currency_Code", "Currency_Discription", "Country_Name", "Favorite" };

        GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Currency", "Currency", "");
    }
예제 #8
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }
            int DownloadRequired = 0;
            if (chkRequireSync.Checked)
            {
                DownloadRequired = 1;
            }

            DataTable dt = objQMS.QMS_SP_Files_SyncApproval_Search(txtfilter.Text != "" ? txtfilter.Text : null, Convert.ToInt32(optApprove.SelectedValue), null
                                                                   , sortbycoloumn, sortdirection
                                                                   , null, null, DownloadRequired, (DataTable)ddlSizeRange.SelectedValues, ref rowcount);


            string[] HeaderCaptions  = { "File Name", "Created Date", "Version", };
            string[] DataColumnsName = { "LogFileID", "LogDate", "Version", };

            GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "QMSSyncApproval", "QMS Sync Status", "");
        }
        catch (Exception)
        {
            throw;
        }
    }
예제 #9
0
    /// <summary>
    /// Excel export
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            int    rowcount      = ucCustomPagerItems.isCountRecord;
            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataSet ds = objJobStatus.TecMachineryRunningHoursSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue)
                                                                     , UDFLib.ConvertDateToNull(txtFromDate.Text), UDFLib.ConvertDateToNull(txtToDate.Text), null, null, ViewState["RecordDisplayType"].ToString(),
                                                                     UDFLib.ConvertIntegerToNull(ddlFunction.SelectedValue), UDFLib.ConvertStringToNull(ddlSystem_location.SelectedValue.Split(',')[1]),
                                                                     UDFLib.ConvertIntegerToNull(ddlSystem_location.SelectedValue.Split(',')[0]), UDFLib.ConvertIntegerToNull(ddlSubSystem_location.SelectedValue.Split(',')[1]),
                                                                     UDFLib.ConvertIntegerToNull(ddlSubSystem_location.SelectedValue.Split(',')[0]), sortbycoloumn, sortdirection, null, null,
                                                                     ref rowcount, chkDisplayInheritingCounter.Checked == true ? 1 : 0);

            string[] HeaderCaptions  = { "Vessel", "System Location", "Sub-System Location", "Date Hours Read", "Differential R.Hours", "Running Hours", "Created by", "Created Date" };
            string[] DataColumnsName = { "Vessel_Name", "Location", "SubLocation", "Date_Hours_Read", "diff_in_Rhrs", "Runing_Hours", "Created_By", "Created_On" };

            GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "Machinery Running Hours", "Machinery Running Hours", "");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }
예제 #10
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }


            DataTable dt = objBLL.Get_Survey_Category_Search(txtfilter.Text != "" ? txtfilter.Text : null, sortbycoloumn, sortdirection
                                                             , null, null, ref rowcount);


            string[] HeaderCaptions  = { "Main Category", "Sub Category" };
            string[] DataColumnsName = { "MainCategory", "Survey_Category" };

            GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Survey Category", "SurveyCategory", "");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
    protected void exportarXLS()
    {
        con.Open();
        //string query = "SELECT DISTINCT [DES_RESPONSABLE] , (SELECT UPPER(U.NOMBRE_USUARIO) FROM dbo.TBUSUARIO U WHERE U.IDE_USUARIO = R.[DES_RESPONSABLE]) RESPONSABLE FROM [RRHH_MOI] R WHERE  YEAR([FEC_FECHA_APROBACION]) =" + ddlAnio.SelectedValue;
        string     query = "exec sp_listar_gestion_cambio";
        SqlCommand cmd   = new SqlCommand(query, con);
        DataTable  t1    = new DataTable();

        using (SqlDataAdapter a = new SqlDataAdapter(cmd))
        {
            a.Fill(t1);
        }
        con.Close();
        if (t1.Rows.Count > 0)
        {
            //ExcelHelper.ToExcel(dtResultadoeExcel, "CJI3_" + ddlEstados.SelectedItem + ".xls", Page.Response);

            gvExcel.DataSource = t1;
            gvExcel.DataBind();

            //GOP - GC - K15002 -

            DateTime fecha = DateTime.Now;



            GridViewExportUtil.Export("GOP-GC-K15002-" + fecha.ToString("yyyyMMdd") + "-" + fecha.ToString("hhmm") + ".xls", gvExcel);
            return;
        }
        else
        {
        }
    }
예제 #12
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        string sortdirection = null;

        if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = ViewState["SORTDIRECTION"].ToString();
        }



        DataTable dt = BLL_JRA_Hazards.GET_HAZARD_TEMPLATE_LIST(
            null,
            ddlChildWorkCateg.SelectedIndex <= 0 ? null : ddlChildWorkCateg.SelectedValue,
            "",
            ucCustomPagerItems.CurrentPageIndex, null, sortbycoloumn,
            sortdirection, ref rowcount).Tables[0];

        string Header = (ddlChildWorkCateg.SelectedIndex > 0 ? ddlChildWorkCateg.SelectedItem.Text : "") + " Hazard Template";

        string[] HeaderCaptions  = { "Work Category", "Hazard Description", "Control Measure", "Severity", "Likelihood", "Initial Risk", "Additional Control Measures", "Modified Risk" };
        string[] DataColumnsName = { "Work_Category_Name", "Hazard_Description", "Control_Measure", "Severity", "Likelihood", "Initial_Risk", "Additional_Control_Measures", "Modified_Risk" };

        GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "HazardTemplate", Header, "");
    }
예제 #13
0
 /// <summary>
 /// Method to export data to excel
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnExport_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         int    rowcount = ucCustomPager1.isCountRecord;
         string PIName   = "PI Name: ";
         PI_ID = Convert.ToInt32(Request.QueryString["PI_ID"]);
         DateTime?dtWEF = null;
         DateTime?dtWET = null;
         if (txtSearchFrom.Text != "")
         {
             dtWEF = Convert.ToDateTime(txtSearchFrom.Text);
         }
         if (txtSearchTo.Text != "")
         {
             dtWET = Convert.ToDateTime(txtSearchTo.Text);
         }
         if (ViewState["PI_Name"] != null)
         {
             PIName = PIName + ViewState["PI_Name"].ToString();
         }
         DataTable dt              = BLL_TMSA_PI.Get_Vessel_Values(Convert.ToInt32(ddlVessel.SelectedValue), dtWEF, dtWET, PI_ID, null, null, ref rowcount).Tables[0];
         string[]  HeaderCaptions  = { "Vessel", "Effect From", "Effect To", "PI Value", "Created ON" };
         string[]  DataColumnsName = { "Vessel_Name", "Effective_From", "Effective_To", "Value", "Date_Of_Creation" };
         GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, PIName, PIName);
     }
     catch (Exception ex)
     {
         UDFLib.WriteExceptionLog(ex);
     }
 }
    /// <summary>
    /// Method to export data to excel
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        int    rowcount = ucCustomPager1.isCountRecord;
        string PIName   = "PI Name: ";

        PI_ID = Convert.ToInt32(Request.QueryString["PI_ID"]);
        DateTime?dtWEF = null;
        DateTime?dtWET = null;

        if (txtSearchFrom.Text != "")
        {
            dtWEF = Convert.ToDateTime(txtSearchFrom.Text);
        }
        if (txtSearchTo.Text != "")
        {
            dtWET = Convert.ToDateTime(txtSearchTo.Text);
        }

        DataSet   ds = BLL_TMSA_PI.Get_RankWise_Values(Convert.ToInt32(ddlRank.SelectedValue), dtWEF, dtWET, PI_ID, null, null, ref rowcount);
        DataTable dt = ds.Tables[0];

        PIName = "PI Rankwise : " + ds.Tables[1].Rows[0]["Name"];

        string[] HeaderCaptions  = { "Rank", "Effect From", "Effect To", "PI Value", "Created On", "Last Modified" };
        string[] DataColumnsName = { "Rank", "Effective_From_Str", "Effective_To", "Value", "Date_Of_Creation", "Date_Of_Modification" };
        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, PIName, PIName);
    }
예제 #15
0
    protected void exportarXLS()
    {
        BL_PERSONAL obj = new BL_PERSONAL();
        DataTable   dtResultadoeExcel = new DataTable();

        String danalistas = string.Empty;
        String destados   = string.Empty;
        String dcargos    = string.Empty;
        String dceco      = string.Empty;
        String dmano      = string.Empty;
        //lblSplit.Text = string.Empty;

        //dtResultadoeExcel = obj.ConsultarControlReporte_MOI(txtInicio.Text, txtFin.Text, danalistas, dcargos, dceco, destados, dmano, dfecha);
        Util oUtilitarios = new Util();

        dtResultadoeExcel = oUtilitarios.EjecutaDatatable("dbo.SP_PLA_RPT_CMO_DETALLE", 1, ddlAnio.SelectedValue.ToString(), ddlMeses.SelectedValue.ToString(), ddlSemana.SelectedValue.ToString(), ddlCentro.SelectedValue.ToString());

        if (dtResultadoeExcel.Rows.Count > 0)
        {
            //ExcelHelper.ToExcel(dtResultadoeExcel, "CJI3_" + ddlEstados.SelectedItem + ".xls", Page.Response);

            gvExcel.DataSource = dtResultadoeExcel;
            gvExcel.DataBind();


            GridViewExportUtil.Export("CMO_" + ddlCentro.SelectedItem + ".xls", gvExcel);
            return;
        }
        else
        {
            string cleanMessage = "No existen data registrada";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
    }
    //protected void grdvwRequest_RowEditing(object sender, GridViewEditEventArgs e)
    //{

    //    string  complaintid = grdvwRequest.Rows[e.NewEditIndex].Cells[0].Text;
    //    Session["csmid"] = complaintid;
    //    string myScript;
    //    myScript = "<script language=javascript>javascript:window.open('../reports/ViewcsmData.aspx','popupwindow','width=650,height=400,left=180,top=130,Scrollbars=yes');</script>";
    //    Page.RegisterClientScriptBlock("MyScript", myScript);
    //}
    protected void btnExcel_Click(object sender, EventArgs e)
    {
        //  Master_MasterReports myMaster = (Master_MasterReports)this.Master;
        //  ContentPlaceHolder mpContentPlaceHolder;
        //  mpContentPlaceHolder =
        //(ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");

        //  string attachment = "attachment; filename=Contacts.xls";
        //  GridView gv = new GridView();
        // // gv = (GridView)mpContentPlaceHolder.FindControl("grdvwRequest");
        //  gv = (GridView)myMaster.FindControl("grdvwRequest");
        //  Response.ClearContent();

        //  Response.AddHeader("content-disposition", attachment);

        //  Response.ContentType = "application/ms-excel";

        //  StringWriter sw = new StringWriter();

        //  HtmlTextWriter htw = new HtmlTextWriter(sw);

        // // grdvwRequest.RenderControl(htw);

        //  Response.Write(sw.ToString());

        //  Response.End();

        GridViewExportUtil.Export("callsheet.xls", this.grdvwRequest);
    }
예제 #17
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        int is_Fetch_Count = ucCustomPager.isCountRecord;

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }

        DataTable dt = objBLLCrew.Get_Crew_FeedBack_Viewer_Search((DataTable)DDLFleet.SelectedValues, (DataTable)DDLVessel.SelectedValues, (DataTable)DDLRank.SelectedValues
                                                                  , (DataTable)DDLNationality.SelectedValues, (DataTable)DDLManningOffice.SelectedValues, (DataTable)DDLCommentedBy.SelectedValues
                                                                  , UDFLib.ConvertDateToNull(txtCommentFromDate.Text), UDFLib.ConvertDateToNull(txtCommentToDate.Text), txtSearch.Text, UDFLib.ConvertIntegerToNull(DDLStatus.SelectedValue)
                                                                  , sortbycoloumn, sortdirection, null, null, ref is_Fetch_Count);

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


        ChangeColumnDataType(dt, "Comment_Date", typeof(string));

        foreach (DataRow item in dt.Rows)
        {
            if (!string.IsNullOrEmpty(item["Comment_Date"].ToString()))
            {
                item["Comment_Date"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(item["Comment_Date"]), UDFLib.GetDateFormat());
            }
        }

        string[] HeaderCaptions  = { "Staff Code", "Name", "Rank", "Comment Date", "Comment By", "Comment Vessel", "Comment" };
        string[] DataColumnsName = { "Staff_Code", "Staff_Name", "Rank_Name", "Comment_Date", "Comment_By", "Comment_Vessel", "Remark" };

        GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "CrewFeedbackViewer", "Crew Feedback Viewer", "");
    }
예제 #18
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataTable dt = objBLLDept.Department_Search(txtSearchName.Text != "" ? txtSearchName.Text : null, UDFLib.ConvertStringToNull(ddlFormType.SelectedValue), null, sortbycoloumn, sortdirection
                                                        , null, null, ref rowcount);

            string[] HeaderCaptions  = { "Name", "Code", "Form Type", "A/c Classification Code", "Approval Group" };
            string[] DataColumnsName = { "name_dept", "code", "Form_Type", "Ac_Classi_Code", "Approval_Group_Name" };

            GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Department", "Department", "");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
예제 #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!SysVisitor.Instance.IsGuest)
            {
                string fields    = PublicMethod.GetString(Request["fields"]);
                string filters   = PublicMethod.GetString(Request["filters"]);
                string tableName = PublicMethod.GetString(Request["tableName"]);


                var pcp = new ProcCustomPage(tableName)
                {
                    ShowFields  = fields,
                    PageIndex   = 1,
                    PageSize    = 9999999,
                    OrderFields = "",
                    WhereString = FilterTranslator.ToSql(filters)
                };
                int       recordCount;
                DataTable dt = DbUtils.GetPageWithSp(pcp, out recordCount);


                GridViewExportUtil.Export(DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xls", dt);
            }
            else
            {
                Response.Write("<h1>没有登录啊,你懂的!</h1>");
            }
        }
예제 #20
0
    protected void btnView_Click(object sender, ImageClickEventArgs e)
    {
        string sFromDate = "";
        string sToDate   = "";

        if (ViewState["sFromDT"].ToString() == "")
        {
            sFromDate = "1900/01/01";
        }
        else
        {
            sFromDate = ViewState["sFromDT"].ToString();
        }
        if (ViewState["sToDT"].ToString() == "")
        {
            sToDate = "1900/01/01";
        }
        else
        {
            sToDate = ViewState["sToDT"].ToString();
        }


        int       Record_count = ucCustomPagerItems.isCountRecord;
        DataTable dtReport     = BLL_ASM_OPS_VoyageReport.Get_DailyVoyageReportIndex(ViewState["sReportType"].ToString(), Convert.ToInt32(ViewState["iVesselID"]), Convert.ToInt32(ViewState["iLocationID"]), sFromDate, sToDate, Convert.ToInt32(ViewState["iFleetID"]),
                                                                                     null, null, ref Record_count, UDFLib.ConvertStringToNull(ViewState["Sort_Column"]), UDFLib.ConvertStringToNull(ViewState["Sort_Direction"]));

        string[] HeaderCaptions  = { "Vessel", "Report Date", "Report Type", "Voyage", "Location", "Next Port", "UTC HR", "Average Speed", "HSFO %S ROB", "LSFO %S ROB", "DO %S ROB" };
        string[] DataColumnsName = { "VESSEL_NAME", "TELEGRAM_DATE", "TELEGRAM_TYPE_TEXT", "VOYAGE", "LOCATION_NAME", "NEXT_PORT", "UTC_HR", "AVERAGE_SPEED", "HO_ROB", "LSFO_ROB", "DO_ROB" };

        GridViewExportUtil.ShowExcel(dtReport, HeaderCaptions, DataColumnsName, "VoyageReportList", "Voyage Report List", "");
    }
예제 #21
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataTable dt = objBLL.Get_Survey_Certificate_Search(txtfilter.Text != "" ? txtfilter.Text : null, UDFLib.ConvertIntegerToNull(ddlMainCategory.SelectedValue), UDFLib.ConvertIntegerToNull(ddlCategoryFilter.SelectedValue), sortbycoloumn, sortdirection
                                                                , null, null, ref rowcount);


            string[] HeaderCaptions  = { "Name", "Main Category", "Sub Category", "Remark", "Term", "Alert(Insurance)", "Range(Months)", "Inspection Required?" };
            string[] DataColumnsName = { "Survey_Cert_Name", "Survey_MainCategory", "Survey_Category", "Survey_Cert_remarks", "Term", "Alert_Insurance_Excel", "GraceRange", "InspectionRequired_Excel" };

            GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Survey Certificate", "SurveyCertificate", "");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
예제 #22
0
    /// <summary>
    /// Excel export.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }


            DataTable dt = objBLL.SearchPMSAccess(txtSearch.Text.Trim(), UDFLib.ConvertStringToNull(ddlAction_Type.SelectedValue), sortbycoloumn, sortdirection, null, null, ref rowcount);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    string[] HeaderCaptions  = { "Rank Name", "Action Type" };
                    string[] DataColumnsName = { "Rank_Name", "Action_Type" };

                    GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "PMS_Access", "PMS Access");
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
예제 #23
0
    protected void ImgExpExcel_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataTable dt = BLL_PB_PhoneCard.PhoneCord_Request_Export(txtCardNumber.Text != "" ? txtCardNumber.Text : null, (DataTable)Session["sVesselCode"], UDFLib.ConvertToDate(txtFromDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtToDate.Text).ToShortDateString(), ddlStatus.SelectedIndex == 0 ? null : ddlStatus.SelectedValue);

            UDFLib.ChangeColumnDataType(dt, "DATE_OF_CREATION", typeof(string));
            UDFLib.ChangeColumnDataType(dt, "PBILL_DATE", typeof(string));

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["DATE_OF_CREATION"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["DATE_OF_CREATION"]));
                dt.Rows[i]["PBILL_DATE"]       = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["PBILL_DATE"]));
            }

            string[] HeaderCaptions  = { "Request Number", "Vessel Name", "Status", "Request Date", "Total Cards", "Bill Date" };
            string[] DataColumnsName = { "REQUEST_NUMBER", "VESSEL_NAME", "REQUEST_STATUS", "DATE_OF_CREATION", "TOTAL_REQUEST", "PBILL_DATE" };

            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "PhoneCardRequest", "Request List");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
예제 #24
0
    protected void ImgBtnExportUnion_OnClick(object sender, EventArgs e)
    {
        try
        {
            BLL_Crew_Admin objBLL  = new BLL_Crew_Admin();
            DataTable      dtUnion = objBLL.CRW_LIB_ExportUnionWithBranchs(txtfilter.Text.Trim());

            string[] HeaderCaptions  = null;
            string[] DataColumnsName = null;

            if (hdnAddressType.Value == "0")//US
            {
                HeaderCaptions = new string[10] {
                    "Union ", "Union Branch", "Address Line 1", "Address Line 2", "City", "State", "ZipCode", "Country", "Phone Number", "Email"
                };
                DataColumnsName = new string[10] {
                    "UnionName", "UnionBranch", "AddressLine1", "AddressLine2", "City", "State", "ZipCode", "Country_Name", "PhoneNumber", "Email"
                };
            }
            else if (hdnAddressType.Value == "1")///International
            {
                HeaderCaptions = new string[6] {
                    "Union ", "Union Branch", "Address", "Country", "Phone Number", "Email"
                };
                DataColumnsName = new string[6] {
                    "UnionName", "UnionBranch", "Address", "Country_Name", "PhoneNumber", "Email"
                };
            }
            GridViewExportUtil.ShowExcel(dtUnion, HeaderCaptions, DataColumnsName, "Union", "Union", "");
        }
        catch (Exception ex)
        {
        }
    }
예제 #25
0
    protected void ImgExpExcel_Click(object sender, ImageClickEventArgs e)
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());

        DataTable dt = BLL_Tec_ErLog.ErLog_ME_00_Search(UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), txtFromDate.Text, txtToDate.Text, sortbycoloumn, sortdirection
            , 1, int.MaxValue, ref  rowcount);

        dt.Columns.Add("AML", typeof(string));
        foreach (DataRow item in dt.Rows)
        {
            if (item["Anomaly_Value"].ToString() == "1")
            {
                item["AML"] = "Yes";
            }
            else
            {
                item["AML"] = "No";
            }
        }

        string[] HeaderCaptions = { "Voyage Numbe", "Vessel Name", "From", "TO", "Date", "Remarks", "Anomaly Present" };
        string[] DataColumnsName = { "VOYAGE_NUM", "VESSEL_NAME", "FROMPORT", "TOPORT", "LOG_DATE", "CE_REMARKS", "AML" };

        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "EngineRoomLogBookIndex", "Engine Room Log Book Index ");
    }
예제 #26
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        string sortdirection = null;

        if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = ViewState["SORTDIRECTION"].ToString();
        }



        DataTable dt = BLL_JRA_Hazards.GET_ASSESSMENT_SEARCH(DDLVessel.SelectedIndex <= 0 ? null : DDLVessel.SelectedValue,
                                                             null,
                                                             ddlChildWorkCateg.SelectedIndex <= 0 ? null : ddlChildWorkCateg.SelectedValue, ddlAssessmentStatus.SelectedIndex <= 0 ? null : ddlAssessmentStatus.SelectedValue.ToString(),
                                                             UDFLib.ConvertDateToNull(txtFromDate.Text), UDFLib.ConvertDateToNull(txtToDate.Text),
                                                             "", GetSessionUserID(),
                                                             null, null, sortbycoloumn,
                                                             sortdirection, ref rowcount).Tables[0];

        string Header = (ddlChildWorkCateg.SelectedIndex > 0 ? ddlChildWorkCateg.SelectedItem.Text : "") + " Risk Assessment";

        string[] HeaderCaptions  = { "Vessel Name  ", "Assessment No.", "Job Assessed", "Current Assessment Date", "Last Assessment Date", "Assessment Status", };
        string[] DataColumnsName = { "Vessel_Name", "Work_Categ_Value", "Work_Category_Name", "Current_Assessment_Date", "Last_Assessment_Date", "Assessment_Status" };

        GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "JobRiskAssessmentIndex", Header, "");
    }
예제 #27
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }
        DataTable dt;

        if (chkMyApproval.Checked == true)
        {
            dt = objFMS.FMS_Files_Approval_Search(txtfilter.Text != "" ? txtfilter.Text : null, Convert.ToInt32(optApprove.SelectedValue), GetSessionUserID()
                                                  , sortbycoloumn, sortdirection
                                                  , null, null, ref rowcount);
        }
        else
        {
            dt = objFMS.FMS_Files_Approval_Search(txtfilter.Text != "" ? txtfilter.Text : null, Convert.ToInt32(optApprove.SelectedValue), null
                                                  , sortbycoloumn, sortdirection
                                                  , null, null, ref rowcount);
        }

        string[] HeaderCaptions  = { "File Name", "Created Date", "Version", "Approval Name", "Approval Date/Rejection Date", "Status" };
        string[] DataColumnsName = { "LogFileID", "LogDate", "Version", "ApproverName", "Date_Of_Approval", "App_Status" };

        GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "FMSFileApproval", "FMS File Approval Status", "");
    }
예제 #28
0
    //Байндва грида за експорта
    protected void ExportInXLS(string QueryString)
    {
        DataTable DataTbl = new DataTable();
        string    StrName = "";

        if (QueryString != "")
        {
            int lngt = xFunctions.GetIDFromString(0, "FROM", QueryString).Length + 5;
            StrName = xFunctions.GetIDFromString(lngt + 1, " ", QueryString);
        }

        else
        {
            return;
        }

        try
        {
            DataTbl = sql.ExecuteToDataTable(QueryString);
            GridView1.DataSource = DataTbl;
            GridView1.DataBind();
            GridViewExportUtil.Export(StrName + ".xls", GridView1);
        }

        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
예제 #29
0
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        try
        {
            int    rowcount      = ucCustomPagerItems.isCountRecord;
            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }


            DataTable dt = objBLL.Get_RankList_Search(txtfilter.Text != "" ? txtfilter.Text : null, UDFLib.ConvertIntegerToNull(DDLRankCategoryFilter.SelectedValue)
                                                      , UDFLib.ConvertIntegerToNull(optDeckEnginefilter.SelectedValue)
                                                      , sortbycoloumn, sortdirection, null, null, ref rowcount);


            string[] HeaderCaptions  = { "Name", "Short Name", "Category", "Deck/Engine", "ISDeckOfficer" };
            string[] DataColumnsName = { "Rank_Name", "Rank_Short_Name", "category_Name", "DeckOrEngine", "DeckOfficer" };

            GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "CrewRank", "Crew Rank", "");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        try
        {
            int    rowcount      = ucCustomPagerItems.isCountRecord;
            int    ParentType    = 0;
            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataTable dt = objBLL.PMS_Get_FunctionBySearch(txtSearch.Text.Trim(), ParentType, sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    string[] HeaderCaptions  = { "Function Name" };
                    string[] DataColumnsName = { "Description" };

                    GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "FunctionName", "Function Library");
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }
예제 #31
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     GridViewExportUtil objExport = new GridViewExportUtil();
     objExport.ExportGridView(hdnExport.Value, "");
 }