Ejemplo n.º 1
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);
        }
    }
Ejemplo n.º 2
0
    protected void BindItems()
    {
        try
        {
            int       Record_Count = 0;
            DataTable dt           = BLL_PB_PortageBill.Get_Lib_Crew_Welfare(UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), UDFLib.ConvertDateToNull(ddlEectiveDates.SelectedValue), pagerWf.CurrentPageIndex, pagerWf.PageSize, ref Record_Count);
            UDFLib.ChangeColumnDataType(dt, "Effective_Date", typeof(string));
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (!string.IsNullOrEmpty(dr["Effective_Date"].ToString()))
                    {
                        dr["Effective_Date"] = UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Effective_Date"].ToString()), UDFLib.GetDateFormat());
                    }
                }
            }
            gvWelfare.DataSource = dt;
            gvWelfare.DataBind();

            pagerWf.CountTotalRec = Record_Count.ToString();
            pagerWf.BuildPager();
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Ejemplo n.º 3
0
    public void BindReport()
    {
        try
        {
            CommonReports rpt = new CommonReports();
            DataTable     dt  = GetReportData();

            UDFLib.ChangeColumnDataType(dt, "PBILL_Date", typeof(string));

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

            rpt.ResourceName = _reportfile;
            rpt.SetDataSource(dt);
            rpt.Site = this.Site;

            CrystalReportViewer1.Visible      = true;
            CrystalReportViewer1.ReportSource = rpt;

            CrystalReportViewer1.DisplayToolbar           = true;
            CrystalReportViewer1.HasPrintButton           = false;
            CrystalReportViewer1.HasExportButton          = false;
            CrystalReportViewer1.HasToggleGroupTreeButton = false;
            CrystalReportViewer1.DisplayGroupTree         = false;
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
    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 = objBLL.Crew_Contract_Withhold_Search(txtfilter.Text != "" ? txtfilter.Text : null, "Percent"
                                                            , UDFLib.ConvertIntegerToNull(ddlEntryTypeFilter.SelectedValue), sortbycoloumn, sortdirection
                                                            , null, null, ref rowcount);

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

        string[] HeaderCaptions  = { "Contract No", "Withhold Amount", "Withhold Type", "Entry Type", "Effective Date" };
        string[] DataColumnsName = { "Contract_Number", "Withhold_Amount", "Withhold_Type", "Name", "Effective_Date" };

        GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Leave_Wages_Withhold_Rules", "Leave Wages Withhold Rules");
    }
Ejemplo n.º 5
0
    protected void Load_SeniorityRecords()
    {
        try
        {
            int PAGE_SIZE  = ucCustomPager.PageSize;
            int PAGE_INDEX = ucCustomPager.CurrentPageIndex;

            int SelectRecordCount = ucCustomPager.isCountRecord;

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

            int       RankId = int.Parse(ddlRank.SelectedValue.ToString());
            string    Status = ddlStaus.SelectedValue.ToString();
            int       CompanySeniorityYear = int.Parse(ddlCompanySeniorityFilter.SelectedValue.ToString());
            DataTable dt = BLL_PortageBill.Get_CrewSeniorityRecords(RankId, Status, CompanySeniorityYear, txtSearchText.Text.Trim(), PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount, sortbycoloumn, sortdirection);
            UDFLib.ChangeColumnDataType(dt, "RankEffective_date", typeof(string));
            UDFLib.ChangeColumnDataType(dt, "CompanyEffective_date", typeof(string));
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (!string.IsNullOrEmpty(dr["RankEffective_date"].ToString()))
                    {
                        dr["RankEffective_date"] = UDFLib.ConvertUserDateFormat(Convert.ToDateTime(dr["RankEffective_date"].ToString()).ToString("dd/MM/yyyy"), UDFLib.GetDateFormat());
                    }
                    if (!string.IsNullOrEmpty(dr["CompanyEffective_date"].ToString()))
                    {
                        dr["CompanyEffective_date"] = UDFLib.ConvertUserDateFormat(Convert.ToDateTime(dr["CompanyEffective_date"].ToString()).ToString("dd/MM/yyyy"), UDFLib.GetDateFormat());
                    }
                }
            }
            gvSeniorityRecords.DataSource = dt;
            gvSeniorityRecords.DataBind();
            if (ucCustomPager.isCountRecord == 1)
            {
                ucCustomPager.CountTotalRec = SelectRecordCount.ToString();
                ucCustomPager.BuildPager();
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Ejemplo n.º 6
0
    public string getCrewTransferDetails(string crewid, string voyageid, string userid)
    {
        BLL_Crew_CrewDetails objCrewBLL = new BLL_Crew_CrewDetails();
        DataTable            dt         = objCrewBLL.Get_Transfer_Promotions(UDFLib.ConvertToInteger(crewid), UDFLib.ConvertToInteger(voyageid), UDFLib.ConvertToInteger(userid));

        UDFLib.ChangeColumnDataType(dt, "Effective_Date", typeof(string));
        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                if (!string.IsNullOrEmpty(dr["Effective_Date"].ToString()))
                {
                    dr["Effective_Date"] = UDFLib.ConvertUserDateFormat(Convert.ToDateTime(dr["Effective_Date"].ToString()).ToString("dd/MM/yyyy"), UDFLib.GetDateFormat());
                }
            }
        }
        return(UDFLib.CreateHtmlTableFromDataTable(dt, new string[] { "From Vessel", "Current Rank", "To Vessel", "Joining Rank", "Effective Date" }, new string[] { "FromVessel", "FromRank", "ToVessel", "ToRank", "Effective_Date" }, "Crew Transfer/Promotion Details"));
    }
Ejemplo n.º 7
0
    protected void Load_EffectiveDates()
    {
        DataTable dt = BLL_PB_PortageBill.Get_Crew_Welfare_Effective_Dates(UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue));

        UDFLib.ChangeColumnDataType(dt, "Effective_Date", typeof(string));
        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                if (!string.IsNullOrEmpty(dr["Effective_Date"].ToString()))
                {
                    dr["Effective_Date"] = UDFLib.ConvertUserDateFormat(Convert.ToDateTime(dr["Effective_Date"].ToString()).ToString("dd/MM/yyyy"), UDFLib.GetDateFormat());
                }
            }
        }
        ddlEectiveDates.DataSource     = dt;
        ddlEectiveDates.DataTextField  = "EFFECTIVE_DATE";
        ddlEectiveDates.DataValueField = "EFFECTIVE_DATE";
        ddlEectiveDates.DataBind();
        ListItem liSelect = new ListItem("ALL", "0");

        ddlEectiveDates.Items.Insert(0, liSelect);
    }
Ejemplo n.º 8
0
    protected void btnExportExcel_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            string _SortOrderColumns = "DOA_HomePort , RANK_SORT_ORDER ";
            Dictionary <string, UDCHyperLink> DicLink = new Dictionary <string, UDCHyperLink>();
            lblPageTitle.Text = "Portage Bill : " + Convert.ToString(ViewState["Vessel_Name"]) + "&nbsp-&nbsp" + DateTime.Parse(ViewState["PBDt"].ToString()).ToString("MMM-yyyy");

            UDCHyperLink alink = new UDCHyperLink();
            alink.Target                = "_blank";
            alink.NaviagteURL           = "../crew/CrewDetails.aspx";
            alink.QueryStringDataColumn = new string[] { "VoyageID", "CrewID" };
            alink.QueryStringText       = new string[] { "VoyageID", "ID" };
            DicLink.Add("Code", alink);

            DataSet dsPb = BLL_PB_PortageBill.Get_PortageBill(Convert.ToInt32(DateTime.Parse(ViewState["PBDt"].ToString()).Month), Convert.ToInt32(DateTime.Parse(ViewState["PBDt"].ToString()).Year), Convert.ToInt32(ViewState["Vessel_ID"]), UDFLib.ConvertStringToNull(null), 0);
            dtcomment   = dsPb.Tables["Comment"];
            dtEntryType = dsPb.Tables["EntryType"];

            DataTable dtpb = UDFLib.PivotTable("Description",
                                               "Amount",
                                               "Sort_Order",
                                               new string[] { "VOYAGEID", "PBMONTH", "PBYEAR" },
                                               new string[] { "VOYAGEID", "PBMONTH", "PBYEAR", "RANK_SORT_ORDER", "IsFinalized", "DOA_HomePort", "RANK_SORT_ORDER", "Amount", "Description", "Sort_Order", "CrewID" },
                                               _SortOrderColumns,
                                               DicLink,
                                               dsPb.Tables["Data"]
                                               );
            totalEarnID = dtpb.Columns.IndexOf("Total Earning");
            totalDedID  = dtpb.Columns.IndexOf("Total Deduction");
            BFid        = dtpb.Columns.IndexOf("balance");
            dtpb.DefaultView.RowFilter = "rank <> ''";


            DataTable dt = new DataTable();
            dt = dtpb.DefaultView.ToTable();

            string[] HeaderCaptions  = { };
            string[] DataColumnsName = { };

            for (int i = 0; i < dt.Columns.Count; i++)
            {
                Array.Resize(ref HeaderCaptions, HeaderCaptions.Length + 1); HeaderCaptions[HeaderCaptions.Length - 1]     = dt.Columns[i].ColumnName;
                Array.Resize(ref DataColumnsName, DataColumnsName.Length + 1); DataColumnsName[DataColumnsName.Length - 1] = dt.Columns[i].ColumnName;
            }

            foreach (DataRow row in dt.Rows)
            {
                string st = row["Code"].ToString();

                int start = st.IndexOf('>');
                int end   = st.IndexOf('<', start);
                st = st.Substring(start + 1, end - start - 1);

                row["Code"] = st;
            }
            UDFLib.ChangeColumnDataType(dt, "To", typeof(string));
            UDFLib.ChangeColumnDataType(dt, "From", typeof(string));
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dt.Rows[i]["From"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["From"].ToString()), UDFLib.GetDateFormat());
                    dt.Rows[i]["To"]   = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["To"].ToString()), UDFLib.GetDateFormat());
                }
            }

            //RemoveLinks(GridViewPB);
            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "PortageBill-" + Request.QueryString["arg"].Split('~')[2] + "-" + DateTime.Parse(Request.QueryString["arg"].Split('~')[1]).ToString("MMM-yyyy") + ".xls", "PortageBill-" + Request.QueryString["arg"].Split('~')[2] + "-" + DateTime.Parse(Request.QueryString["arg"].Split('~')[1]).ToString("MMM-yyyy"));
            //GridViewExportUtil.Export("PortageBill-" + Request.QueryString["arg"].Split('~')[2] + "-" + DateTime.Parse(Request.QueryString["arg"].Split('~')[1]).ToString("MMM-yyyy") + ".xls", GridView1);

            // GridView1.GridLines = GridLines.None;
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Ejemplo n.º 9
0
    /// <summary>
    /// Method called when Export button is clicked
    /// </summary>
    protected void imgBtnExport_Click(object sender, ImageClickEventArgs e)
    {
        //Check whether date is proper
        if (txtFrom.Text.Trim() != "")
        {
            try
            {
                DateTime dt1 = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtFrom.Text));
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Nature", "alert('From date is invalid.')", true);
                return;
            }
        }
        if (txtTo.Text.Trim() != "")
        {
            try
            {
                DateTime dt1 = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtTo.Text));
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Nature", "alert('To date is invalid.')", true);
                return;
            }
        }
        //Compare From and To date
        if (DateTime.Compare(DateTime.Parse(UDFLib.ConvertToDefaultDt(txtTo.Text)), DateTime.Parse(UDFLib.ConvertToDefaultDt(txtFrom.Text))) < 0)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Nature", "alert('From date must be less than To date.')", true);
            return;
        }
        try
        {
            int Count = 1; string moduleName = "";
            if (ddlModule.SelectedItem.ToString() == "-SELECT-")
            {
                moduleName = "";
            }
            else
            {
                moduleName = ddlModule.SelectedItem.ToString();
            }
            //Take the values of Sorting order and sort column name
            string sortbycoloumn = (ViewState["SORTBYACOLOUMN"] == null) ? null : (ViewState["SORTBYACOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTADIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTADIRECTION"].ToString());
            }

            DataSet dt = objMenuBLL.Get_AccessRightChanges(UDFLib.ConvertDateToNull(UDFLib.ConvertToDefaultDt(txtFrom.Text)), UDFLib.ConvertDateToNull(UDFLib.ConvertToDefaultDt(txtTo.Text)), null, null, sortbycoloumn, sortdirection,
                                                           UDFLib.ConvertIntegerToNull(ddlUser.SelectedValue), UDFLib.ConvertStringToNull(moduleName), txtPage.Text, int.Parse(Session["USERID"].ToString()), ref Count);

            UDFLib.ChangeColumnDataType(dt.Tables[0], "Date", typeof(string));

            if (dt.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Tables[0].Rows)
                {
                    if (!string.IsNullOrEmpty(dr["Date"].ToString()))
                    {
                        dr["Date"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToDateTime(dr["Date"].ToString()).ToString("dd/MM/yyyy"), UDFLib.GetDateFormat());
                    }
                }
                string fileHeader = "<table><tr style='font-weight:bold;'><td  colspan='8'><center><h1>" + "Access Rights Changes Report</h1></center></td><td style='font-weight:bold;'>Client Name:</td><td>" + dt.Tables[1].Rows[0]["Company_Name"].ToString() + "</td></tr>";
                fileHeader += "<tr><td style='font-weight:bold;'>From Date:</td><td>&nbsp;" + txtFrom.Text + "</td><td style='font-weight:bold;'>To Date:</td><td>&nbsp;" + txtTo.Text + "</td><td style='font-weight:bold;'>Selected User:</td><td>"
                              + (ddlUser.SelectedItem.ToString() == "-SELECT-" ? "All" : ddlUser.SelectedItem.ToString()) + "</td><td style='font-weight:bold;'>Selected Module:</td><td>" + (ddlModule.SelectedItem.ToString() == "-SELECT-" ? "All" : ddlModule.SelectedItem.ToString()) + "</td><td style='font-weight:bold;'>Page:</td><td>" + txtPage.Text + "</td></tr>";

                fileHeader += "</table>";
                string[] HeaderCaptions  = { "Date", "User Name", "First Name", "Last Name", "Module", "Page Description", "Page Link", "Changes", "Changed By", "User IP" };
                string[] DataColumnsName = { "Date", "User_name", "First_Name", "Last_Name", "Module", "Description", "Page", "Changes", "Chaged_By", "UserIP" };

                GridViewExportUtil.ShowExcel(dt.Tables[0], HeaderCaptions, DataColumnsName, "AccessReport", fileHeader, "");
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }