/// <summary> /// Date Created: 04/10/2011 /// Created By: Gabriel Oquialda /// (description) Get vehicle manifest /// </summary> private void GetVehicleManifest() { DataTable VehicleManifestDataTable = null; try { VehicleManifestDataTable = SeafarerTravelBLL.GetSFVehicleTravelListView( GlobalCode.Field2String(Session["DateFrom"]), GlobalCode.Field2String(Session["DateTo"]), GlobalCode.Field2String(Session["strPendingFilter"]), uoDropDownListFilterBy.SelectedValue, uoTextBoxFilter.Text.Trim(), GlobalCode.Field2String(Session["UserName"]), uoDropDownListStatus.SelectedValue, uoDropDownListNationality.SelectedValue, uoDropDownListGender.SelectedValue, uoDropDownListRank.SelectedValue, uoDropDownListVessel.SelectedValue, GlobalCode.Field2String(Session["Region"]), GlobalCode.Field2String(Session["Country"]), GlobalCode.Field2String(Session["City"]), GlobalCode.Field2String(Session["Port"]), GlobalCode.Field2String(Session["Hotel"]), Session["Vehicle"].ToString(), GlobalCode.Field2String(Session["UserRole"])); //VehicleManifestDataTable = SeafarerTravelBLL.GetVehicleManifest(GlobalCode.Field2String(Session["DateFrom"]), GlobalCode.Field2String(Session["DateTo"]), // Session["UserName"].ToString(), GlobalCode.Field2String(Session["strPendingFilter"]), GlobalCode.Field2String(Session["Region"]), GlobalCode.Field2String(Session["Country"]), // GlobalCode.Field2String(Session["City"]), uoDropDownListStatus.SelectedValue, uoDropDownListFilterBy.SelectedValue, uoTextBoxFilter.Text.Trim(), // GlobalCode.Field2String(Session["Port"]), GlobalCode.Field2String(Session["Hotel"]), Session["Vehicle"].ToString(), uoDropDownListVessel.SelectedValue, // uoDropDownListNationality.SelectedValue, uoDropDownListGender.SelectedValue, uoDropDownListRank.SelectedValue); uoListViewVehicle.DataSource = VehicleManifestDataTable; uoListViewVehicle.DataBind(); } catch (Exception ex) { throw ex; } finally { if (VehicleManifestDataTable != null) { VehicleManifestDataTable.Dispose(); } } }
/// <summary> /// Date Created: 08/07/2011 /// Created By: Marco Abejar /// (description) Get seafarer air travel info /// ---------------------------------------------------------------- /// Date Created: 22/07/2011 /// Modifed By: Josephine Gad /// (description) uogridviewAirTravelInfo to uoListViewAirTravelInfo /// ---------------------------------------------------------------- /// Date Created: 02/08/2011 /// Modifed By: Josephine Gad /// (description) Add parameter seafarer name /// ---------------------------------------------------------------- /// Date Modified: 05/08/2011 /// Modifed By: Josephine Gad /// (description) Add Date Range parameter /// </summary> private void GetSFAirTravelDetails() { DataTable AirDataTable = null; try { //string DateFromString = (uoHiddenFieldDateFrom.Value == "" ? DateTime.Now.ToShortDateString() : uoHiddenFieldDateFrom.Value); //string DateToString = (uoHiddenFieldDateTo.Value == "" ? DateTime.Now.ToShortDateString() : uoHiddenFieldDateTo.Value); //AirDataTable = SeafarerTravelBLL.GetSFAirTravelDetails(strSFStatus, strFlightDateRange, strAirStatusFilter, uoTextBoxName.Text, // DateFromString, DateToString, GlobalCode.Field2String(Session["UserName"]), GlobalCode.Field2String(Session["Region"]), uoHiddenFieldFilterBy.Value); AirDataTable = SeafarerTravelBLL.GetSFAirTravelDetails(GlobalCode.Field2DateTime((uoHiddenFieldDate.Value)).ToString(), uoHiddenFieldDateTo.Value, GlobalCode.Field2String(Session["strAirStatusFilter"]), GlobalCode.Field2String(Session["UserName"]), GlobalCode.Field2String(Session["strPendingFilter"]), GlobalCode.Field2String(Session["Region"]), GlobalCode.Field2String(Session["Country"]), GlobalCode.Field2String(Session["City"]), uoDropDownListStatus.SelectedValue, uoDropDownListFilterBy.SelectedValue, uoTextBoxFilter.Text.Trim(), GlobalCode.Field2String(Session["Port"]), uoDropDownListVessel.SelectedValue, uoDropDownListNationality.SelectedValue, uoDropDownListGender.SelectedValue, uoDropDownListRank.SelectedValue); uoListViewAirTravelInfo.DataSource = AirDataTable; uoListViewAirTravelInfo.DataBind(); } catch (Exception ex) { throw ex; } finally { if (AirDataTable != null) { AirDataTable.Dispose(); } } }
/// <summary> /// Date Created: 24/10/2011 /// Created By: Josephine Gad /// (description) Show/Hide Scan button /// </summary> /// <param name="TravelReqID"></param> /// <param name="ManualReqID"></param> /// <param name="UserID"></param> /// <returns></returns> protected bool ShowScanBtn(object TravelReqID, object ManualReqID) { bool bReturn = false; bReturn = SeafarerTravelBLL.IsLOEScanned(TravelReqID.ToString(), ManualReqID.ToString(), uoHiddenFieldUser.Value); return(bReturn); }
/// <summary> /// Date Created: 13/10/2011 /// Created By: Josephine Gad /// (description) Get list of rank /// </summary> private void GetRank() { DataTable dt = null; try { dt = SeafarerTravelBLL.GetRankByVessel(uoDropDownListVessel.SelectedValue); ListItem item = new ListItem("--Select Rank--", "0"); uoDropDownListRank.Items.Clear(); uoDropDownListRank.Items.Add(item); uoDropDownListRank.DataSource = dt; uoDropDownListRank.DataTextField = "RankName"; uoDropDownListRank.DataValueField = "RankID"; uoDropDownListRank.DataBind(); } catch (Exception ex) { throw ex; } finally { if (dt != null) { dt.Dispose(); } } }
/// <summary> /// Date Created: 12/12/2011 /// Created By: Muhallidin G Wali /// description Use load time /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private string GetDateCount(DateTime day) { IDataReader dt = null; string sReturn = ""; try { dt = SeafarerTravelBLL.GetTravelRequestDashboard(1, GlobalCode.Field2DateTime(day.ToString("MM/dd/yyyy")), MUser.GetUserName(), GlobalCode.Field2String(Session["UserRole"])); if (dt.Read()) { if (dt["SIGNON"].ToString() != "0") { sReturn += " <span style=\"color:Green;\">*</span> "; } if (dt["SIGNOFF"].ToString() != "0") { sReturn += " <span style=\"color:Red;\">*</span> "; } } return(sReturn); } catch (Exception ex) { throw ex; } finally { if (dt != null) { dt.Dispose(); } } }
/// <summary> /// Date Created: 08/07/2011 /// Created By: Marco Abejar /// (description) Get seafarer port info /// ------------------------------------------------------ /// Modified Date: 21/07/2011 /// Modified By: Josephine Gad /// (description) Make header Onsigning/Offsigning dynamic /// ------------------------------------------------------ /// Date Modified: 02/08/2011 /// Modifed By: Josephine Gad /// (description) Add Date Range parameter /// ------------------------------------------------------ /// Date Created: 05/08/2011 /// Modifed By: Josephine gad /// (description) Add parameter seafarer's name, Close DataTable /// </summary> private void GetSFPortTravelDetails() { DataTable PortDataTable = null; try { PortDataTable = SeafarerTravelBLL.GetSFPortTravelDetails(GlobalCode.Field2String(Session["DateFrom"]), GlobalCode.Field2String(Session["DateTo"]), uoHiddenFieldUser.Value, GlobalCode.Field2String(Session["strPendingFilter"]), GlobalCode.Field2String(Session["Region"]), GlobalCode.Field2String(Session["Country"]), GlobalCode.Field2String(Session["City"]), uoDropDownListStatus.SelectedValue, uoDropDownListFilterBy.SelectedValue, uoTextBoxFilter.Text.Trim(), GlobalCode.Field2String(Session["Port"]), uoDropDownListVessel.SelectedValue, uoDropDownListNationality.SelectedValue, uoDropDownListGender.SelectedValue, uoDropDownListRank.SelectedValue, uoHiddenFieldRole.Value); uolistviewPortTravelInfo.DataSource = PortDataTable; uolistviewPortTravelInfo.DataBind(); } catch (Exception ex) { throw ex; } finally { if (PortDataTable != null) { PortDataTable.Dispose(); } } }
private void GetSFVehicleTravelDetails(string strSFStatus, string strFlightDateRange) { /// <summary> /// Date Created: 14/07/2011 /// Created By: Marco Abejar /// (description) Selecting list of vehicle travel details /// ------------------------------------------------------ /// Date Modified: 27/07/2011 /// Modified By: Josephine Gad /// (description) Make header ONSIGNING/OFFSIGNING dynamic /// ------------------------------------------------------ /// Date Modified: 08/05/2011 /// Modifed By: Josephine Gad /// (description) Add Date Range parameter, Close DataTable /// </summary> /// DataTable VehicleDataTable = null; try { string DateFromString = (uoHiddenFieldDateFrom.Value == "" ? DateTime.Now.ToShortDateString() : uoHiddenFieldDateFrom.Value); string DateToString = (uoHiddenFieldDateTo.Value == "" ? DateTime.Now.ToShortDateString() : uoHiddenFieldDateTo.Value); VehicleDataTable = SeafarerTravelBLL.GetSFVehicleTravelDetails(strSFStatus, strFlightDateRange, uoTextBoxName.Text, DateFromString, DateToString, GlobalCode.Field2String(Session["UserName"]), uoDropDownListMapRef.SelectedValue, uoHiddenFieldFilterBy.Value); uolistviewVehicleTravelInfo.DataSource = VehicleDataTable; uolistviewVehicleTravelInfo.DataBind(); Label ucLabelONOFF = (Label)uolistviewVehicleTravelInfo.FindControl("ucLabelONOFF"); if (ucLabelONOFF != null) { if (Session["strSFStatus"] == "ON") { ucLabelONOFF.Text = "Onsigning"; } else { ucLabelONOFF.Text = "Offsigning"; } } } catch (Exception ex) { throw ex; } finally { if (VehicleDataTable != null) { VehicleDataTable.Dispose(); } } }
private void loadSFPendingCounter() { /// <summary> /// Date Created: 04/08/2011 /// Created By: Marco Abejar /// (description) quick link for pending transactions /// </summary> Session["strSFStatus"] = Request.QueryString["st"]; Session["strSFFlightDateRange"] = Request.QueryString["dt"]; uoPendingAirTrans.Text = SeafarerTravelBLL.GetPendingTransactionCount(GlobalCode.Field2String(Session["strSFStatus"]), GlobalCode.Field2String(Session["strSFFlightDateRange"]), "Air", uoHiddenFieldDateFrom.Value, uoHiddenFieldDateTo.Value, uoHiddenFieldFilterBy.Value); uoPendingHotelTrans.Text = SeafarerTravelBLL.GetPendingTransactionCount(GlobalCode.Field2String(Session["strSFStatus"]), GlobalCode.Field2String(Session["strSFFlightDateRange"]), "Hotel", uoHiddenFieldDateFrom.Value, uoHiddenFieldDateTo.Value, uoHiddenFieldFilterBy.Value); uoPendingVehicleTrans.Text = SeafarerTravelBLL.GetPendingTransactionCount(GlobalCode.Field2String(Session["strSFStatus"]), GlobalCode.Field2String(Session["strSFFlightDateRange"]), "Vehicle", uoHiddenFieldDateFrom.Value, uoHiddenFieldDateTo.Value, uoHiddenFieldFilterBy.Value); }
private void loadSeafarerCount() { /// <summary> /// Date Created: 08/08/2011 /// Created By: Marco Abejar /// (description) quick link for seafarer count /// </summary> Session["strSFStatus"] = Request.QueryString["st"]; uohl0_3Count.Text = SeafarerTravelBLL.GetSeafarerCountByDateRange(GlobalCode.Field2String(Session["strSFStatus"]), "0-3", uoHiddenFieldFilterBy.Value); uohl4_7Count.Text = SeafarerTravelBLL.GetSeafarerCountByDateRange(GlobalCode.Field2String(Session["strSFStatus"]), "4-7", uoHiddenFieldFilterBy.Value); uohl8_15Count.Text = SeafarerTravelBLL.GetSeafarerCountByDateRange(GlobalCode.Field2String(Session["strSFStatus"]), "8-15", uoHiddenFieldFilterBy.Value); uohl16_30Count.Text = SeafarerTravelBLL.GetSeafarerCountByDateRange(GlobalCode.Field2String(Session["strSFStatus"]), "16-30", uoHiddenFieldFilterBy.Value); uohl31_100Count.Text = SeafarerTravelBLL.GetSeafarerCountByDateRange(GlobalCode.Field2String(Session["strSFStatus"]), "31-100", uoHiddenFieldFilterBy.Value); }
private void loadSFFlightStatusCounter() { /// <summary> /// Date Created: 04/08/2011 /// Created By: Marco Abejar /// (description) quick link for flight status count /// </summary> Session["strSFStatus"] = Request.QueryString["st"]; Session["strSFFlightDateRange"] = Request.QueryString["dt"]; uoFlownFlightCount.Text = SeafarerTravelBLL.GetAirStatusCount(GlobalCode.Field2String(Session["strSFStatus"]), GlobalCode.Field2String(Session["strSFFlightDateRange"]), "Flown", uoHiddenFieldDateFrom.Value, uoHiddenFieldDateTo.Value, uoHiddenFieldFilterBy.Value); uoArrivedFlightCount.Text = SeafarerTravelBLL.GetAirStatusCount(GlobalCode.Field2String(Session["strSFStatus"]), GlobalCode.Field2String(Session["strSFFlightDateRange"]), "Arrived", uoHiddenFieldDateFrom.Value, uoHiddenFieldDateTo.Value, uoHiddenFieldFilterBy.Value); uoDelayedFlightCount.Text = SeafarerTravelBLL.GetAirStatusCount(GlobalCode.Field2String(Session["strSFStatus"]), GlobalCode.Field2String(Session["strSFFlightDateRange"]), "Delayed", uoHiddenFieldDateFrom.Value, uoHiddenFieldDateTo.Value, uoHiddenFieldFilterBy.Value); uoCancelledFlightCount.Text = SeafarerTravelBLL.GetAirStatusCount(GlobalCode.Field2String(Session["strSFStatus"]), GlobalCode.Field2String(Session["strSFFlightDateRange"]), "Cancelled", uoHiddenFieldDateFrom.Value, uoHiddenFieldDateTo.Value, uoHiddenFieldFilterBy.Value); }
/// <summary> /// Date Created: 13/10/2011 /// Created By: Josephine Gad /// (description) Get list of rank /// </summary> private void GetCostCenter() { try { string[] arg = new string[2]; char[] splitter = { '-' }; arg = SeafarerTravelBLL.GetCostCenterByRank(uoDropDownListRank.SelectedValue).Split(splitter); uoTextBoxCostCenter.Text = arg[1].ToString(); uoHiddenFieldCostCenterID.Value = arg[0].ToString(); } catch (Exception ex) { throw ex; } }
/// <summary> /// Created By: Josephine Gad /// Date Created: 16/08/2012 /// Description: Tag Seafarer /// --------------------------------- /// Modified By: Mabejar /// Date Modified: 10/04/2013 /// Description: Add TagTime /// --------------------------------- /// Modified By: Josephine Gad /// Date Modified: 19/Jul/2013 /// Description: Add Rec Loc, E1ID, Status On/Off and Audit Trail data /// </summary> /// <param name="sIdBigint"></param> /// <param name="sTRId"></param> /// <param name="sAirport"></param> /// <param name="sPort"></param> private void TagSeafarer(string sIdBigint, string sTRId, string sAirport, string sPort, string sRecLoc, string sE1Id, string sStatusOnOff) { string sUser = uoHiddenFieldUser.Value; string sRole = uoHiddenFieldRole.Value; string sTagTime = uoHiddenFieldTagTime.Value; string strLogDescription = "Tag Seafarer by Meet & Greet"; string strFunction = "TagSeafarer"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); SeafarerTravelBLL.InsertTag(sIdBigint, sTRId, sUser, sRole, sAirport, sPort, "0", sTagTime, sRecLoc, sE1Id, sStatusOnOff, strLogDescription, strFunction, Path.GetFileName(Request.Path), TimeZone.CurrentTimeZone.StandardName.ToString(), CommonFunctions.GetDateTimeGMT(dateNow)); BindSeaportManifest(); }
/// <summary> /// Date Created: 25/07/2011 /// Created By: Ryan Bautista /// (description) Load all hotel travel details. /// ------------------------------------------------------ /// Date Modified: 27/07/2011 /// Modified By: Josephine Gad /// (description) Make header ONSIGNING/OFFSIGNING dynamic /// ------------------------------------------------------ /// Date Modified: 09/08/2011 /// Modified By: Josephine Gad /// (description) Close DataTable /// </summary> private void GetSFHotelTravelDetails(string strSFStatus, string strFlightDateRange) { DataTable HotelDataTable = null; try { string DateFromString = (uoHiddenFieldDateFrom.Value == "" ? DateTime.Now.ToShortDateString() : uoHiddenFieldDateFrom.Value); string DateToString = (uoHiddenFieldDateTo.Value == "" ? DateTime.Now.ToShortDateString() : uoHiddenFieldDateTo.Value); HotelDataTable = SeafarerTravelBLL.GetSFHotelTravelList(strSFStatus, strFlightDateRange, DateFromString, DateToString, uoTextBoxName.Text, GlobalCode.Field2String(Session["UserName"]), uoDropDownListMapRef.SelectedValue, uoHiddenFieldFilterBy.Value); uolistviewHotelInfo.DataSource = HotelDataTable; uolistviewHotelInfo.DataBind(); Label ucLabelONOFF = (Label)uolistviewHotelInfo.FindControl("ucLabelONOFF"); if (ucLabelONOFF != null) { if (Session["strSFStatus"] == "ON") { ucLabelONOFF.Text = "Onsigning"; } else { ucLabelONOFF.Text = "Offsigning"; } } } catch (Exception ex) { throw ex; } finally { if (HotelDataTable != null) { HotelDataTable.Dispose(); } } }
/// <summary> /// Date Created: 25/07/2011 /// Created By: Ryan Bautista /// (description) Search hotel travel details /// ------------------------------------------------------ /// Date Modified: 09/08/2011 /// Modified By: Josephine Gad /// (description) Close DataTable /// </summary> private void GetSFHotelTravelListSearch(string strSFStatus, string strFlightDateRange, string SFname) { DataTable dt = null; try { dt = SeafarerTravelBLL.GetSFHotelTravelListSearch(strSFStatus, strFlightDateRange, SFname); uolistviewHotelInfo.DataSource = dt; uolistviewHotelInfo.DataBind(); } catch (Exception ex) { throw ex; } finally { if (dt != null) { dt.Dispose(); } } }
/// <summary> /// Created By: Josephine Gad /// Date Created: 14/Jun/2013 /// description Add Fields for Audit Trail Use /// </summary> private void AddUpdateConfirmation(string sIdBigint, string sTRId, string sBranch, string sConfirmation) { string strLogDescription; string sConfirmationNo = GlobalCode.Field2String((Request.QueryString["tType"])); if (sConfirmation.Trim() == "") { strLogDescription = "Hotel Confirmation No. Added"; } else { strLogDescription = "Hotel Confirmation No. Edited"; } DateTime dateNow = CommonFunctions.GetCurrentDateTime(); SeafarerTravelBLL.UpdateConfirmation(sIdBigint, sTRId, GlobalCode.Field2String(Session["UserName"]), GlobalCode.Field2String(Session["UserRole"]), sBranch, sConfirmation, strLogDescription, "AddUpdateConfirmation", Path.GetFileName(Request.UrlReferrer.AbsolutePath), CommonFunctions.GetDateTimeGMT(dateNow), dateNow); OpenParent(); Session["ConfirmationTag"] = "1"; }
private void GetSFTravelList(string strSFStatus, string strFlightDateRange, string strPendingFilter, string strAirStatusFilter) { /// <summary> /// Date Created: 08/07/2011 /// Created By: Marco Abejar /// (description) Get general view of seafarers list with regards to flight sched /// --------------------------------------------------------------------------------------------------- /// Date Modified: 20/07/2011 /// Modifed By: Josephine Gad /// (description) Change the GridView uogridviewGeneralListInfo to ListView uoListViewGeneralList /// --------------------------------------------------------------------------------------------------- /// Date Modified: 01/08/2011 /// Modified By: Josephine Gad /// (description) Add seafarer name parameter /// --------------------------------------------------------------------------------------------------- /// Date Modified: 05/08/2011 /// Modifed By: Josephine Gad /// (description) Add Date Range parameter, Add Try and Catch, Hide Vessel Column if Group By is Vessel /// </summary> DataView GeneralListDataView = null; try { string DateFromString = (uoHiddenFieldDateFrom.Value == "" ? DateTime.Now.ToShortDateString() : uoHiddenFieldDateFrom.Value); string DateToString = (uoHiddenFieldDateTo.Value == "" ? DateTime.Now.ToShortDateString() : uoHiddenFieldDateTo.Value); GeneralListDataView = SeafarerTravelBLL.GetSFTravelList(strSFStatus, strFlightDateRange, strPendingFilter, strAirStatusFilter, uoTextBoxName.Text, DateFromString, DateToString, GlobalCode.Field2String(Session["UserName"]), uoDropDownListRegion.SelectedValue, uoHiddenFieldFilterBy.Value).DefaultView; GeneralListDataView.Sort = uoDropDownListGroupBy.SelectedValue + ", Name "; uoListViewGeneralList.DataSource = GeneralListDataView; uoListViewGeneralList.DataBind(); Label HeaderLabel; Label HeaderFlightLabel; HeaderLabel = (Label)uoListViewGeneralList.FindControl("ucLabelDate"); HeaderFlightLabel = (Label)uoListViewGeneralList.FindControl("ucLabelFlightDate"); if (HeaderLabel != null) { if (strSFStatus == "ON") { HeaderLabel.Text = "Onsigning"; HeaderFlightLabel.Text = "Arrival Date"; } else { HeaderLabel.Text = "Offsigning"; HeaderFlightLabel.Text = "Departure Date"; } } HtmlControl VesselHeader = (HtmlControl)uoListViewGeneralList.FindControl("ucTHVessel"); HtmlControl OnOffHeader = (HtmlControl)uoListViewGeneralList.FindControl("ucTHOnOffDate"); HtmlControl FlightHeader = (HtmlControl)uoListViewGeneralList.FindControl("ucTHFlightDate"); HtmlControl Port = (HtmlControl)uoListViewGeneralList.FindControl("ucTHPort"); if (VesselHeader != null) { if (uoDropDownListGroupBy.SelectedValue == "Vessel") { VesselHeader.Visible = false; OnOffHeader.Visible = true; FlightHeader.Visible = true; Port.Visible = true; } //else //{ // VesselHeader.Visible = true; // OnOffHeader.Visible = false; // FlightHeader.Visible = false; //} else if (uoDropDownListGroupBy.SelectedValue == "OnOffDate") { VesselHeader.Visible = true; OnOffHeader.Visible = false; FlightHeader.Visible = true; Port.Visible = true; } else if (uoDropDownListGroupBy.SelectedValue == "colArrivalDate") { VesselHeader.Visible = true; OnOffHeader.Visible = true; FlightHeader.Visible = false; Port.Visible = true; } else if (uoDropDownListGroupBy.SelectedValue == "colPortNameVarchar") { VesselHeader.Visible = true; OnOffHeader.Visible = true; FlightHeader.Visible = true; Port.Visible = false; } else { VesselHeader.Visible = true; OnOffHeader.Visible = false; FlightHeader.Visible = false; Port.Visible = true; } } } catch (Exception ex) { throw ex; } finally { if (GeneralListDataView != null) { GeneralListDataView.Dispose(); } } }
/// <summary> /// Date Created: 16/11/2011 /// Created By: Josephine Gad /// (description) Create excel file of hotel manifest and email /// --------------------------------------------------------------------------- /// </summary> private void BindPortManifestExcel() { DataTable dt = null; try { SeafarerTravelBLL bll = new SeafarerTravelBLL(); dt = bll.GetSFPortTravelDetailsWithCount(GlobalCode.Field2String(Session["DateFrom"]), Session["Date"].ToString(), uoHiddenFieldUser.Value, GlobalCode.Field2String(Session["strPendingFilter"]), GlobalCode.Field2String(Session["Region"]), GlobalCode.Field2String(Session["Country"]), GlobalCode.Field2String(Session["City"]), uoDropDownListStatus.SelectedValue, uoDropDownListFilterBy.SelectedValue, uoTextBoxFilter.Text.Trim(), GlobalCode.Field2String(Session["Port"]), uoDropDownListVessel.SelectedValue, uoDropDownListNationality.SelectedValue, uoDropDownListGender.SelectedValue, uoDropDownListRank.SelectedValue, uoHiddenFieldRole.Value, Int16.Parse(uoHiddenFieldByVessel.Value), Int16.Parse(uoHiddenFieldByName.Value), Int16.Parse(uoHiddenFieldByRecLoc.Value), Int16.Parse(uoHiddenFieldByE1ID.Value), Int16.Parse(uoHiddenFieldByDateOnOff.Value), Int16.Parse(uoHiddenFieldByStatus.Value), Int16.Parse(uoHiddenFieldByPort.Value), Int16.Parse(uoHiddenFieldByRank.Value), Int16.Parse(uoHiddenFieldByPortStatus.Value), Int16.Parse(uoHiddenFieldByNationality.Value), 0, uolistviewPortTravelInfoPager.TotalRowCount); uoGridViewPortManifest.Visible = true; if (dt.Rows.Count > 0) { uoGridViewPortManifest.DataSource = dt; } else { uoGridViewPortManifest.EmptyDataText = "No Record."; } uoGridViewPortManifest.DataBind(); ////auto save string FilePath = MapPath("~/Extract/PortManifest/"); string sDate = DateTime.Now.ToString(TravelMartVariable.DateTimeFormatFileExtension); FileInfo FileName = new FileInfo(FilePath + "PortManifest_" + sDate + ".xls"); Response.Clear(); Response.ClearContent(); StringWriter stringWrite = new StringWriter(); HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); uoGridViewPortManifest.RenderControl(htmlWrite); FileStream fs = new FileStream(FileName.FullName, FileMode.Create); StreamWriter sWriter = new StreamWriter(fs, Encoding.GetEncoding("UTF-8")); sWriter.Write(stringWrite.ToString().Trim()); sWriter.Close(); fs.Close(); //Use below line instead of Response.End() to avoid Error: Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.; HttpContext.Current.ApplicationInstance.CompleteRequest(); ManifestSendEmail("Travelmart: Port Manifest", "This is a sample Port Manifest", FileName.FullName); AlertMessage("Email sent."); } catch (Exception ex) { DateTime currentDate = CommonFunctions.GetCurrentDateTime(); ErrorBLL.InsertError(ex.Message, ex.StackTrace.ToString(), Request.Url.AbsolutePath, currentDate, CommonFunctions.GetDateTimeGMT(currentDate), GlobalCode.Field2String(Session["UserName"])); AlertMessage(ex.Message); } finally { if (dt != null) { dt.Dispose(); } uoGridViewPortManifest.Visible = false; } }
protected void uoCalendarDashboard_DayRender(object sender, DayRenderEventArgs e) { DateTime day = e.Day.Date; //DataTable dt = null; IDataReader dr = null; try { string sPendingFilter = "0"; string sRegion = "0"; string sCountry = "0"; string sCity = "0"; string sPort = "0"; string sHotel = "0"; string sVehicle = "0"; sPendingFilter = GlobalCode.Field2Int(Session["strPendingFilter"]).ToString(); sRegion = GlobalCode.Field2Int(Session["Region"]).ToString(); sCountry = GlobalCode.Field2Int(Session["Country"]).ToString(); sCity = GlobalCode.Field2Int(Session["City"]).ToString(); sPort = GlobalCode.Field2Int(Session["Port"]).ToString(); sHotel = GlobalCode.Field2Int(Session["Hotel"]).ToString(); sVehicle = GlobalCode.Field2Int(Session["Vehicle"]).ToString(); dr = SeafarerTravelBLL.GetTravelManifestDashboard(day.ToString("MM/dd/yyyy"), day.ToString("MM/dd/yyyy"), GlobalCode.Field2String(Session["UserName"]), sPendingFilter, sRegion, sCountry, sCity, "", "1", "", sPort, sHotel, sVehicle, "0", "0", "0", "0", uoHiddenFieldRole.Value); if (dr.Read()) { //Label lblOnOff = new Label(); //lblOnOff.Text = "<br/>On:" + dr["SignOn"].ToString() + "<br/>"; //lblOnOff.Text += "Off:" + dr["SignOff"].ToString() + "<br/>"; //lblOnOff.ForeColor = Color.Red; //lblOnOff.Font.Size = 8; //e.Cell.Controls.Add(lblOnOff); ////e.Cell.ToolTip = "On:" + dr["SignOn"].ToString() + " Off: " + dr["SignOff"].ToString(); ////e.Cell.CssClass = "testCSS"; if (dr["SignOn"].ToString() != "0") { Label lblOn = new Label(); lblOn.Text = "*"; lblOn.ForeColor = Color.Green; e.Cell.Controls.Add(lblOn); } if (dr["SignOff"].ToString() != "0") { Label lblOff = new Label(); lblOff.Text = "*"; lblOff.ForeColor = Color.Red; e.Cell.Controls.Add(lblOff); } e.Cell.CssClass = "hoverDate"; e.Cell.ID = day.ToString("MM_dd_yyyy"); } } catch (Exception ex) { throw ex; } finally { if (dr != null) { dr.Close(); dr.Dispose(); } } }
/// <summary> /// Date Created: 09/12/2011 /// Created By: Josephine Gad /// description Create calendar /// ---------------------------------------------- /// Date Modified: 14/12/2011 /// Modified By: Muhallidin G Wali /// (description) Optimized calendar binding /// ---------------------------------------------- /// Date Modified: 27/12/2011 /// Modified By: Josephine Gad /// (description) Optimization (close IDataReader Res) /// ---------------------------------------------- /// </summary> private void BindCalendar() { bool boolBindAgain = false; IDataReader Res = null; try { string CalendarString = ""; string CalendarAsterisk; string sID; DateTime dSelectedDate = DateTime.Parse(GlobalCode.Field2String(Session["DateFrom"])); string sMonthYear = dSelectedDate.ToString("MMMM yyyy"); string sUser = ""; if (Request.QueryString["ufn"].ToString() != null) { sUser = Request.QueryString["ufn"].ToString(); } string sSelectedDate = ""; //string sURL = Request.Url.AbsolutePath; string sURL = "/Manifest.aspx"; if (Cache["CalendarDashboard"] == null) { CalendarString = "<table id=\"uoCalendarDashboard\" cellspacing=\"0\" cellpadding=\"2\" title=\"Calendar\" border=\"0\" "; CalendarString += " style=\"width:300px;height:190px;font-size:9pt;font-family:Verdana;color:Black;border-width:1px;border-style:solid;border-color:White;background-color:#ECDFC4;border-collapse:collapse;\"> "; //First row of calendar CalendarString += " <tr> <td colspan=\"7\" style=\"background-color:White;border-color:Black;border-width:4px;border-style:solid;\"> "; CalendarString += " <table cellspacing=\"0\" border=\"0\" style=\"color:#333399;font-family:Verdana;font-size:12pt;font-weight:bold;width:100%;border-collapse:collapse;\"> "; CalendarString += " <tr> "; CalendarString += " <td valign=\"bottom\" style=\"color:#333333;font-size:8pt;font-weight:bold;width:15%;\"> "; //CalendarString += " <a href=\"" + Request.Url.AbsolutePath + "?ufn=" + sUser + "&mt=" + dSelectedDate.AddMonths(-1).Month.ToString() + "\" style=\"color:#333333\" title=\"Go to the previous month\"> " + sPrevMonth + " </a> </td> "; //CalendarString += sPrevMonth + "</td> "; CalendarString += " </td> "; CalendarString += " <td align=\"center\" style=\"width:70%;\">" + sMonthYear + " </td> "; CalendarString += " <td align=\"right\" valign=\"bottom\" style=\"color:#333333;font-size:8pt;font-weight:bold;width:15%;\"> "; //CalendarString += " <a href=\"" + Request.Url.AbsolutePath + "?ufn=" + sUser + "&mt=" + dSelectedDate.AddMonths(1).Month.ToString() + "\" style=\"color:#333333\" title=\"Go to the next month\">" + sNextMonth + "</a> </td> "; //CalendarString += sNextMonth + "</td> "; CalendarString += " </td> "; CalendarString += " </tr> </table> </td> </tr> "; //Second row of calendar (Header) CalendarString += " <tr> <th align=\"center\" abbr=\"Sunday\" scope=\"col\" style=\"font-size:8pt;font-weight:bold;\">Sun</th> "; CalendarString += " <th align=\"center\" abbr=\"Monday\" scope=\"col\" style=\"font-size:8pt;font-weight:bold;\">Mon</th> "; CalendarString += " <th align=\"center\" abbr=\"Tuesday\" scope=\"col\" style=\"font-size:8pt;font-weight:bold;\">Tue</th> "; CalendarString += " <th align=\"center\" abbr=\"Wednesday\" scope=\"col\" style=\"font-size:8pt;font-weight:bold;\">Wed</th> "; CalendarString += " <th align=\"center\" abbr=\"Thursday\" scope=\"col\" style=\"font-size:8pt;font-weight:bold;\">Thu</th> "; CalendarString += " <th align=\"center\" abbr=\"Friday\" scope=\"col\" style=\"font-size:8pt;font-weight:bold;\">Fri</th> "; CalendarString += " <th align=\"center\" abbr=\"Saturday\" scope=\"col\" style=\"font-size:8pt;font-weight:bold;\">Sat</th> </tr> "; Res = SeafarerTravelBLL.GetTravelRequestDashboard(0, dSelectedDate, MUser.GetUserName(), GlobalCode.Field2String(Session["UserRole"])); List <DashboardCounter> DBCountet = new List <DashboardCounter>(); while (Res.Read()) { DBCountet.Add(new DashboardCounter() { DataOnOff = DateTime.Parse(Res["DataOnOff"].ToString()), DateOnOffName = Res["DateOnOffName"].ToString(), SINGON = Res["SIGNON"].ToString(), SINGOFF = Res["SIGNOFF"].ToString() }); } DateTime dDay = DateTime.Now; int count = 0; for (int iRow = 1; iRow <= 6; iRow++) { CalendarString += " <tr> "; for (int iCol = 1; iCol <= 7; iCol++) { //add asterisk if there is ON or OFF crew CalendarAsterisk = ""; if (DBCountet.Count > 0) { dDay = GlobalCode.Field2DateTime(DBCountet[count].DataOnOff); if (DBCountet[count].SINGON != "0") { CalendarAsterisk += " <span style=\"color:Green;\">*</span> "; } if (DBCountet[count].SINGOFF != "0") { CalendarAsterisk += " <span style=\"color:Red;\">*</span> "; } } sID = " id=\"" + dDay.ToString("MM_dd_yyyy") + "\""; if (CalendarAsterisk.Trim() != "") { sID += " class=\"hoverDate\" "; } if (dDay.Month != dSelectedDate.Month) { CalendarString += "<td " + sID + " align=\"left\" style=\"font-size:8.5pt; color:#999999;border-color:#666699;border-width:1px;border-style:solid;width:14%;\"> "; CalendarString += " <a href=\"" + sURL + "?ufn=" + sUser + "&dt=" + dDay.ToString("MM_dd_yyyy") + "\" style=\"color:#999999\" title=\"" + dDay.ToString("MMMM dd") + "\">" + dDay.ToString("dd") + "</a> "; } else { if (dDay == dSelectedDate) { //make style bold if selected CalendarString += " <td " + sID + " align=\"left\" style=\"white-space: nowrap;font-size:8.5pt; color:Black;background-color:#FFFFCC;border-color:#666699;border-width:1px;border-style:solid;font-weight:bold;width:14%;\"> "; sSelectedDate = dDay.ToString("MM/dd/yyyy") + ",<td " + sID + " align=\"left\" style=\"white-space: nowrap;font-size:8.5pt; color:Black;background-color:#FFFFCC;border-color:#666699;border-width:1px;border-style:solid;font-weight:bold;width:14%;\">"; } else { CalendarString += " <td " + sID + " align=\"left\" style=\"font-size:8.5pt; border-color:#666699;border-width:1px;border-style:solid;width:14%;\"> "; } CalendarString += " <a href=\"" + sURL + "?ufn=" + sUser + "&dt=" + dDay.ToString("MM_dd_yyyy") + "\" style=\"color:Black\" title=\"" + dDay.ToString("MMMM dd") + "\"> " + dDay.ToString("dd") + " </a> "; } //add asterisk if there is ON or OFF crew CalendarString += CalendarAsterisk; CalendarString += " </td> "; count += 1; } CalendarString += " </tr> "; } CalendarString += "</table>"; //Store calendar string in Cache for 5 minutes Cache.Insert("CalendarDashboard", CalendarString, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(300)); Cache.Insert("CalendarSelectedDate", sSelectedDate, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(300)); } else { sSelectedDate = Cache["CalendarSelectedDate"].ToString(); string[] sSelectedArray = sSelectedDate.Split(",".ToCharArray()); if (sSelectedArray[0].ToString() != dSelectedDate.ToString("MM/dd/yyyy")) { DateTime dDay = DateTime.Parse(sSelectedArray[0]); if (dDay.Month != dSelectedDate.Month) { Cache.Remove("CalendarDashboard"); boolBindAgain = true; return; } CalendarString = Cache["CalendarDashboard"].ToString(); string sSelectedOldStyle; string sSelectedNewStyle; string sSelectedDateNew; string sOld; string sIDOld; string sIDNew; //add asterisk if there is ON or OFF crew for OLD Selected CalendarAsterisk = GetDateCount(dDay); sIDOld = " id=\"" + dDay.ToString("MM_dd_yyyy") + "\""; if (CalendarAsterisk.Trim() != "") { sIDOld += " class=\"hoverDate\" "; } //add asterisk if there is ON or OFF crew for NEW Selected //CalendarAsterisk = GetDateCount(dSelectedDate); sIDNew = " id=\"" + dSelectedDate.ToString("MM_dd_yyyy") + "\""; if (CalendarAsterisk.Trim() != "") { sIDNew += " class=\"hoverDate\" "; } sOld = "<td " + sIDOld + " align=\"left\" style=\"font-size:8.5pt; color:#999999;border-color:#666699;border-width:1px;border-style:solid;width:14%;\"> "; CalendarString = CalendarString.Replace(sSelectedArray[1], sOld); if (dDay.Month != dSelectedDate.Month) { //style of new selected date sSelectedOldStyle = "<td " + sIDNew + " align=\"left\" style=\"font-size:8.5pt; color:#999999;border-color:#666699;border-width:1px;border-style:solid;width:14%;\">"; sSelectedNewStyle = "<td " + sIDNew + " align=\"left\" style=\"white-space: nowrap;font-size:8.5pt; color:Black;background-color:#FFFFCC;border-color:#666699;border-width:1px;border-style:solid;font-weight:bold;width:14%;\">"; CalendarString = CalendarString.Replace(sSelectedOldStyle, sSelectedNewStyle); } else { //style of new selected date sSelectedOldStyle = "<td " + sIDNew + " align=\"left\" style=\"font-size:8.5pt; border-color:#666699;border-width:1px;border-style:solid;width:14%;\">"; sSelectedNewStyle = "<td " + sIDNew + " align=\"left\" style=\"white-space: nowrap;font-size:8.5pt; color:Black;background-color:#FFFFCC;border-color:#666699;border-width:1px;border-style:solid;font-weight:bold;width:14%;\">"; CalendarString = CalendarString.Replace(sSelectedOldStyle, sSelectedNewStyle); } sSelectedDateNew = dSelectedDate.ToString("MM/dd/yyyy") + ",<td " + sIDNew + " align=\"left\" style=\"white-space: nowrap;font-size:8.5pt; color:Black;background-color:#FFFFCC;border-color:#666699;border-width:1px;border-style:solid;font-weight:bold;width:14%;\">"; Cache["CalendarDashboard"] = CalendarString; Cache["CalendarSelectedDate"] = sSelectedDateNew; } } CalendarString = Cache["CalendarDashboard"].ToString(); ucLiteralCalendar.Text = CalendarString; } catch (Exception ex) { throw ex; } finally { if (boolBindAgain) { BindCalendar(); } if (Res != null) { Res.Close(); Res.Dispose(); } } }
/// Date Created: 16/11/2011 /// Created By: Josephine Gad /// (description) Create excel file of hotel manifest and email /// --------------------------------------------------------------------------- /// </summary> private void BindVehicleManifestExcel() { string strLogDescription; string strFunction; DataTable dt = null; try { dt = SeafarerTravelBLL.GetSFVehicleTravelListView( GlobalCode.Field2String(Session["DateFrom"]), GlobalCode.Field2String(Session["DateTo"]), GlobalCode.Field2String(Session["strPendingFilter"]), uoDropDownListFilterBy.SelectedValue, uoTextBoxFilter.Text.Trim(), GlobalCode.Field2String(Session["UserName"]), uoDropDownListStatus.SelectedValue, uoDropDownListNationality.SelectedValue, uoDropDownListGender.SelectedValue, uoDropDownListRank.SelectedValue, uoDropDownListVessel.SelectedValue, GlobalCode.Field2String(Session["Region"]), GlobalCode.Field2String(Session["Country"]), GlobalCode.Field2String(Session["City"]), GlobalCode.Field2String(Session["Port"]), GlobalCode.Field2String(Session["Hotel"]), Session["Vehicle"].ToString(), GlobalCode.Field2String(Session["UserRole"])); uoGridViewVehicleManifest.Visible = true; if (dt.Rows.Count > 0) { uoGridViewVehicleManifest.DataSource = dt; } else { uoGridViewVehicleManifest.EmptyDataText = "No Record."; } uoGridViewVehicleManifest.DataBind(); ////auto save string FilePath = MapPath("~/Extract/VehicleManifest/"); string sDate = DateTime.Now.ToString(TravelMartVariable.DateTimeFormatFileExtension); FileInfo FileName = new FileInfo(FilePath + "VehicleManifest_" + sDate + ".xls"); Response.Clear(); Response.ClearContent(); StringWriter stringWrite = new StringWriter(); HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); uoGridViewVehicleManifest.RenderControl(htmlWrite); FileStream fs = new FileStream(FileName.FullName, FileMode.Create); StreamWriter sWriter = new StreamWriter(fs, Encoding.GetEncoding("UTF-8")); sWriter.Write(stringWrite.ToString().Trim()); sWriter.Close(); fs.Close(); //Use below line instead of Response.End() to avoid Error: Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.; HttpContext.Current.ApplicationInstance.CompleteRequest(); ManifestSendEmail("Travelmart: Vehicle Manifest", "This is a sample Vehicle Manifest", FileName.FullName); AlertMessage("Email sent."); //Insert log audit trail (Gabriel Oquialda - 17/11/2011) strLogDescription = "Vehicle manifest as .xls file was sent to e-mail."; strFunction = "BindVehicleManifestExcel"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); //BLL.AuditTrailBLL.InsertLogAuditTrail(strLogDescription, strFunction, Path.GetFileName(Request.Path), // CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"])); } catch (Exception ex) { DateTime currentDate = CommonFunctions.GetCurrentDateTime(); ErrorBLL.InsertError(ex.Message, ex.StackTrace.ToString(), Request.Url.AbsolutePath, currentDate, CommonFunctions.GetDateTimeGMT(currentDate), GlobalCode.Field2String(Session["UserName"])); AlertMessage(ex.Message); } finally { if (dt != null) { dt.Dispose(); } uoGridViewVehicleManifest.Visible = false; } }