protected void btnSearch_click(object sender, EventArgs e)
        {
            try
            {
                string LoeNo    = "";
                string IDNumber = "";

                ImmigrationBLL BLL = new ImmigrationBLL();
                LoeNo    = txtLOEControlNo.Text;
                IDNumber = txtUniqeID.Text;

                if (IDNumber == "" && LoeNo == "")
                {
                    AlertMessage("Please enter Unique ID or LOE Control No to search crew verification.");
                    return;
                }
                ClearGridCrewVerification();

                List <CrewImmigration> Immigration = new List <CrewImmigration>();
                Immigration = BLL.CrewImmigration(0, GlobalCode.Field2Long(IDNumber), 0, LoeNo, "");

                Session["immigration"] = Immigration;

                if (Immigration.Count == 0)
                {
                    if (GlobalCode.Field2Long(IDNumber) > 0 && LoeNo == "")

                    {
                        txtUniqeID.Text = IDNumber.ToString();
                        AlertMessage("Unique ID does not exist in the system.");
                        txtUniqeID.Text = "";
                    }

                    else if (IDNumber == "" && LoeNo != "")
                    {
                        txtLOEControlNo.Text = LoeNo;
                        AlertMessage("This LOE is either invalid or does not exists in the system, please try search by Unique ID..");
                        txtLOEControlNo.Text = "";
                    }
                    else if (GlobalCode.Field2Long(IDNumber) > 0 && LoeNo != "")
                    {
                        txtLOEControlNo.Text = LoeNo;
                        txtUniqeID.Text      = IDNumber.ToString();
                        AlertMessage("This Unique ID and LOE combination does not exist in our system, please try seaching by Unique ID only");
                        txtLOEControlNo.Text = "";
                        txtUniqeID.Text      = "";
                    }
                    return;
                }

                crewverification(Immigration, 0);

                PageAsyncTask TaskPort1 = new PageAsyncTask(OnBeginExceptions, OnEndExceptions, null, "Async1", true);
                Page.RegisterAsyncTask(TaskPort1);
            }
            catch (Exception ex)
            { throw ex; }
        }
        public void OnEndExceptions(IAsyncResult ar)
        {
            List <SeafarerImage> SeafarerImage = new List <SeafarerImage>();
            QRCodeEncoder        rq            = new QRCodeEncoder();

            Bitmap myImage;
            List <CrewImmigration> Immigration = new List <CrewImmigration>();

            Immigration = (List <CrewImmigration>)Session["immigration"];
            for (var i = 0; Immigration.Count > i; i++)
            {
                myImage = rq.Encode(txtUniqeID.Text + "+" + Immigration[i].LOEControlNumber + "+" + Immigration[i].Joindate.Value.ToString("MMMM") + " " + Immigration[i].Joindate.Value.Day.ToString() + " " + Immigration[i].Joindate.Value.Year.ToString() + "+" + Immigration[i].Vessel + "+" + Immigration[i].Seaport);


                SeafarerImage.Add(new SeafarerImage
                {
                    Image      = GlobalCode.Field2BitmapByte(myImage),
                    ImageType  = "jpg",
                    LOENumber  = Immigration[i].LOEControlNumber,
                    SeaparerID = GlobalCode.Field2Long(txtUniqeID.Text),
                    LogInUser  = GlobalCode.Field2String(Session["UserName"])
                });
            }



            ImmigrationBLL BLL = new ImmigrationBLL();

            BLL.InsertQRCode(SeafarerImage);


            //foreach (ListViewItem item in Immigration.Items)
            //{
            //    txtJoindate = (TextBox)item.FindControl("txtJoindate");
            //    txtJoinShip = (TextBox)item.FindControl("txtJoinShip");
            //    txtJoinPort = (TextBox)item.FindControl("txtJoinPort");
            //    HPLOENumber = (HiddenField)item.FindControl("uoHiddenFieldControlNo");

            //    myImage = rq.Encode(txtUniqeID.Text + "+" + HPLOENumber.Value + "+" + txtJoindate.Text + "+" + txtJoinShip.Text + "+" + txtJoinPort.Text);


            //    SeafarerImage.Add(new SeafarerImage
            //    {
            //        Image = GlobalCode.Field2BitmapByte(myImage),
            //        ImageType = "jpg",
            //        LOENumber = HPLOENumber.Value,
            //        SeaparerID = GlobalCode.Field2Long(txtUniqeID.Text)
            //    });

            //}



            //if (immigration[0].SeafarerImage.Count > 0)
            //{
            //    uoImageCM.ImageUrl = GlobalCode.Field2PictureImage(GlobalCode.Field2BitmapByte(myImage), "jpg");
            //}
        }
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void uoButtonSend_click(object sender, EventArgs e)
        {
            //SendRequest();
            int    id     = GlobalCode.Field2Int(Request.QueryString["ufn"]);
            string Val    = GlobalCode.Field2String(Request.QueryString["Em"]);
            long   PortID = GlobalCode.Field2Long(Request.QueryString["porID"]);

            CrewAssistBLL CA = new CrewAssistBLL();

            CA.TblEmail(id, Val, Val, PortID, uoHiddenFieldUser.Value);

            OpenParent();
        }
Esempio n. 4
0
        protected void btnSaveCancelHotel_click(object sender, EventArgs e)
        {
            try
            {
                CrewAssistBLL BLL = new CrewAssistBLL();

                if (uoHiddenFieldIsVehicle.Value == "1")
                {
                    //AlertMessage("Request for hotel Transportation has been sent successfully.");
                    List <SeafarerDetailHeader> _SDetailList = new List <SeafarerDetailHeader>();
                    Session["SeafarerDetailList"] = null;
                    //_SDetailList = BLL.GetCrewAssistCancelTransportationRequest(GlobalCode.Field2TinyInt(uoHiddenFieldVendorType.Value == "PA" ? 1 : 0), GlobalCode.Field2Long(uoHiddenFieldHotelID.Value)

                    _SDetailList = BLL.GetCrewAssistCancelTransportationRequest(GlobalCode.Field2TinyInt(GlobalCode.Field2String(uoHiddenFieldVendorType.Value) == "True" ? 1 : 0), GlobalCode.Field2Long(uoHiddenFieldHotelID.Value)
                                                                                , GlobalCode.Field2Long(uoHiddenFieldHTravelRequestID.Value)
                                                                                , GlobalCode.Field2Long(uoHiddenFieldHIDBigint.Value)
                                                                                , GlobalCode.Field2Int(uoHiddenFieldSeqNo.Value)
                                                                                , GlobalCode.Field2String(uoHiddenFieldUser.Value)
                                                                                , GlobalCode.Field2String(txtEmailTo.Text)
                                                                                , GlobalCode.Field2String(txtEmailCC.Text)
                                                                                , GlobalCode.Field2String(uoTextBoxConfirmedBy.Text)
                                                                                , GlobalCode.Field2String(uoTextBoxComment.Text)
                                                                                , GlobalCode.Field2DateTime(uoHiddenFieldCurrentDate.Value)
                                                                                , GlobalCode.Field2String(uoHiddenFieldTimeZone.Value)
                                                                                , GlobalCode.Field2String(uoHiddenFieldCurrentDate.Value));
                    Session["SeafarerDetailList"] = _SDetailList;
                }
                else
                {
                    List <SeafarerDetailHeader> _SDetailList = new List <SeafarerDetailHeader>();
                    Session["SeafarerDetailList"] = null;
                    _SDetailList = BLL.GetCancelCrewAssistHotelRequest(GlobalCode.Field2TinyInt(uoHiddenFieldVendorType.Value == "PA" ? 1 : 0), GlobalCode.Field2Long(uoHiddenFieldHotelID.Value)
                                                                       , GlobalCode.Field2String(uoHiddenFieldUser.Value)
                                                                       , GlobalCode.Field2String(txtEmailTo.Text)
                                                                       , GlobalCode.Field2String(txtEmailCC.Text)
                                                                       , GlobalCode.Field2String(uoTextBoxConfirmedBy.Text)
                                                                       , GlobalCode.Field2String(uoTextBoxComment.Text)
                                                                       , GlobalCode.Field2DateTime(uoHiddenFieldCurrentDate.Value)
                                                                       , GlobalCode.Field2String(uoHiddenFieldTimeZone.Value)
                                                                       , GlobalCode.Field2String(uoHiddenFieldCurrentDate.Value));
                    Session["SeafarerDetailList"] = _SDetailList;
                    //AlertMessage("Request for hotel cancellation has been sent successfully.");
                }

                ClosePage();
            }
            catch (Exception ex)
            {
                AlertMessage(ex.Message);
            }
        }
Esempio n. 5
0
        protected void lstHotel_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.ListBox obj = (System.Web.UI.WebControls.ListBox)sender;
            ClearHotelObject(0);

            if (obj.SelectedItem.Text.Substring(0, 4) == "PA -")
            {
                GetCrewAssistPAHotelInformation(GlobalCode.Field2Long(obj.SelectedValue));
            }
            else if (obj.SelectedItem.Text.Substring(0, 4) == "HT -")
            {
                GetCrewAssistHotelInformation(obj);
            }
            else
            {
                //ClearHotelObject(0);
            }
        }
        /// Date Created:   05/Jan/2015
        /// Created By:     Josephine Monteza
        /// (description)   tag record to TblTag_Hotel
        /// -------------------------------------------
        private void TagSeafarer(string sIdBigint, string sTRId, string sVendorID, string sRecLoc, string sE1Id, string sStatusOnOff)
        {
            string sUser = uoHiddenFieldUser.Value;
            string sRole = uoHiddenFieldRole.Value;

            string   strLogDescription = "Tag Seafarer To Vehicle Service Provider";
            string   strFunction       = "TagSeafarer";
            DateTime dateNow           = CommonFunctions.GetCurrentDateTime();

            VehicleBLL.TagtoVehicle(GlobalCode.Field2Long(sIdBigint), GlobalCode.Field2Long(sTRId), sRecLoc,
                                    GlobalCode.Field2Long(sE1Id), sStatusOnOff, 0, GlobalCode.Field2Int(sVendorID), "1",
                                    uoHiddenFieldUser.Value, strLogDescription, strFunction, Path.GetFileName(Request.Path));

            if (sVendorID != "0")
            {
                BindVehicleManifest(1);
            }
        }
Esempio n. 7
0
        DataTable FormatDataTable(DataTable dt)
        {
            DataTable tables = new DataTable();
            DataRow   dr;

            tables.Columns.Add("SeafarerID", typeof(string));
            tables.Columns.Add("Name", typeof(string));
            tables.Columns.Add("Gender", typeof(string));
            tables.Columns.Add("Ship", typeof(string));
            tables.Columns.Add("Location", typeof(string));
            tables.Columns.Add("PickUpTime", typeof(string));
            tables.Columns.Add("DropOffTime", typeof(string));
            tables.Columns.Add("AppntTime", typeof(string));
            tables.Columns.Add("DoctorAppntTypeAdd", typeof(string));
            tables.Columns.Add("Coordinator", typeof(string));
            tables.Columns.Add("RCCLCaseManager", typeof(string));
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow drow in dt.Rows)
                {
                    if (GlobalCode.Field2Long(drow[1].ToString()) > 0)
                    {
                        dr = tables.NewRow();
                        dr["SeafarerID"]         = drow[1].ToString();
                        dr["Name"]               = drow[0].ToString();
                        dr["Gender"]             = "";
                        dr["Ship"]               = drow[3].ToString();
                        dr["Location"]           = drow[4].ToString();
                        dr["PickUpTime"]         = drow[5].ToString();
                        dr["DropOffTime"]        = drow[6].ToString();
                        dr["AppntTime"]          = drow[7].ToString();
                        dr["DoctorAppntTypeAdd"] = drow[8].ToString();
                        dr["Coordinator"]        = drow[9].ToString();
                        dr["RCCLCaseManager"]    = drow[10].ToString();
                        tables.Rows.Add(dr);
                    }
                }
            }


            return(tables);
        }
Esempio n. 8
0
        /// Date Created:   05/Jan/2015
        /// Created By:     Josephine Monteza
        /// (description)   tag record to TblTag_Hotel
        /// -------------------------------------------
        private void TagSeafarer(string sIdBigint, string sTRId, string sBranch, string sRecLoc, string sE1Id, string sStatusOnOff)
        {
            string sUser = uoHiddenFieldUser.Value;
            string sRole = uoHiddenFieldRole.Value;

            string      strLogDescription = "Tag Seafarer To Hotel Service Provider";
            string      strFunction       = "TagSeafarer";
            DateTime    dateNow           = CommonFunctions.GetCurrentDateTime();
            ManifestBLL MBLL = new ManifestBLL();

            MBLL.TagToHotel(GlobalCode.Field2Long(sIdBigint), GlobalCode.Field2Long(sTRId), sRecLoc,
                            GlobalCode.Field2Long(sE1Id), sStatusOnOff, 0, GlobalCode.Field2Long(sBranch),
                            uoHiddenFieldUser.Value, strLogDescription, strFunction, Path.GetFileName(Request.Path),
                            CommonFunctions.GetDateTimeGMT(dateNow), dateNow);

            if (sBranch != "0")
            {
                BindHotelManifest(1);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Date Created:   03/Oct/2017
        /// Created By:     Josephine Monteza
        /// (description)   Remove vehicle Vendor from right to left
        /// </summary>
        private void RemoveVehicleVendor()
        {
            CheckBox    uoCheckBoxSelect;
            HiddenField uoHiddenFieldVehicleVendor;

            using (DataTable dtVendor = new DataTable())
            {
                dtVendor.Columns.Add("UserName", typeof(string));
                dtVendor.Columns.Add("VendorID", typeof(Int64));
                DataRow dRow;

                foreach (ListViewItem item in uoListViewVehicleSaved.Items)
                {
                    uoCheckBoxSelect = (CheckBox)item.FindControl("uoCheckBoxSelect");
                    if (uoCheckBoxSelect.Checked == true)
                    {
                        uoHiddenFieldVehicleVendor = (HiddenField)item.FindControl("uoHiddenFieldVehicleVendor");

                        dRow             = dtVendor.NewRow();
                        dRow["UserName"] = uoHiddenFieldUser.Value;
                        dRow["VendorID"] = GlobalCode.Field2Long(uoHiddenFieldVehicleVendor.Value);
                        dtVendor.Rows.Add(dRow);
                    }
                }
                if (dtVendor.Rows.Count > 0)
                {
                    DateTime currentDate = CommonFunctions.GetCurrentDateTime();

                    UserVendorBLL.DriverVendorAddEdit(uoHiddenFieldUser.Value, false, dtVendor,
                                                      "Vehicle", "Remove Driver Vehicle Vendor assignment", "RemoveVehicleVendor",
                                                      Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(currentDate),
                                                      uoHiddenFieldUserName.Value);
                }
            }
            uoHiddenFieldLoadType.Value = "0";
            uoHiddenFieldToLoad.Value   = "VehicleAdded";

            uoListViewVehicle.DataBind();
            uoListViewVehicleSaved.DataBind();
        }
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void uoButtonSend_click(object sender, EventArgs e)
        {
            CrewAssistBLL CA  = new CrewAssistBLL();
            string        res = CA.GetHotelTransactionOverFlow(GlobalCode.Field2Long(uoHiddenFieldEmployeeID.Value)
                                                               , GlobalCode.Field2DateTime(uoHiddenFieldCheckinDate.Value)
                                                               , GlobalCode.Field2DateTime(uoHiddenFieldCheckOutDate.Value)
                                                               , GlobalCode.Field2Long(uoHiddenFieldIDBigint.Value)
                                                               , GlobalCode.Field2TinyInt(uoHiddenFieldSeqNo.Value)
                                                               , GlobalCode.Field2Long(uoHiddenFieldTravelRequestID.Value)
                                                               , GlobalCode.Field2Int(uoHiddenFieldBranchID.Value)
                                                               , ""
                                                               , GlobalCode.Field2Int(uoHiddenFieldHotelTransID.Value));

            if (res == "Record has hotel request already on this date!")
            {
                OpenParentExistHotelRequest(TextBoxWhoConfirm.Text.ToString(), TextBoxConfirmrate.Text.ToString(), res);
            }
            else
            {
                OpenParentSend(TextBoxWhoConfirm.Text.ToString(), TextBoxConfirmrate.Text.ToString());
            }
        }
Esempio n. 11
0
        public void OnEndVehicleExecutions(IAsyncResult ar)
        {
            _ManifestListDeligate.EndInvoke(ar);
            string sChangeDate = "";

            if (Request.QueryString["dt"] != null)
            {
                sChangeDate = Request.QueryString["dt"];
            }

            HiddenField uoHiddenFieldPopupCalendar = (HiddenField)Master.FindControl("uoHiddenFieldPopupCalendar");

            if (uoHiddenFieldPopupCalendar.Value == "1" || (sChangeDate == "1"))
            {
                uoHiddenFieldDate.Value = GlobalCode.Field2DateTime(Session["DateFrom"]).ToString("MM/dd/yyyy");
            }

            uoDropDownListDays.SelectedIndex = GlobalCode.GetselectedIndex(uoDropDownListDays, GlobalCode.Field2String(Request.QueryString["Dy"]));

            uoDropDownListPortAgent.SelectedIndex = GlobalCode.GetselectedIndex(uoDropDownListPortAgent, GlobalCode.Field2Int(Request.QueryString["PA"]));

            int    iStatusID    = GlobalCode.Field2TinyInt(Request.QueryString["st"]);
            string sType        = "New";
            int    iPortAgentID = GlobalCode.Field2Int(Request.QueryString["PA"]);
            string sDate        = uoHiddenFieldDate.Value;
            string sUserID      = uoHiddenFieldUser.Value;
            string sRole        = uoHiddenFieldRole.Value;
            string sOrderBy     = "EmployeeID";
            short  iLoadType    = 0;
            int    iNoOfDay     = GlobalCode.Field2Int(Request.QueryString["Dy"]);
            long   iSFID        = GlobalCode.Field2Long(uoTextBoxSeafarerID.Text);
            int    iStartRow    = 0;
            int    iMaxRow      = 50;



            GetVehicleConfirmManifestList(iStatusID, sType, iPortAgentID, sDate, sUserID, sRole, sOrderBy, iLoadType, iNoOfDay, iSFID, iStartRow, iMaxRow);
        }
Esempio n. 12
0
        /// <summary>
        /// Created by:     Josephine Monteza
        /// Date Created:   06/May/2014
        /// Description:    Show Report
        /// ----------------------------------------------------
        /// </summary>
        private void ViewReport()
        {
            string sReport     = GlobalCode.Field2String(Request.QueryString["report"]);
            string sEmployeeID = GlobalCode.Field2Long(Request.QueryString["sfID"]).ToString();
            string sRecLoc     = GlobalCode.Field2String(Request.QueryString["recLoc"]);
            string sUserID     = GlobalCode.Field2String(Request.QueryString["uID"]);

            string sTitle;

            if (sRecLoc == "")
            {
                sRecLoc = " ";
            }

            // Set the processing mode for the ReportViewer to Remote
            ReportViewer1.ProcessingMode = ProcessingMode.Remote;
            ServerReport serverReport = ReportViewer1.ServerReport;

            string sServerURL    = ConfigurationSettings.AppSettings["ReportServerURL"].ToString();
            string sReportFolder = ConfigurationSettings.AppSettings["ReportFolder"].ToString();


            // Set the report server URL and report path
            serverReport.ReportServerUrl = new Uri(sServerURL);
            //serverReport.ReportServerCredentials = irsc;

            //ReportViewer1.ServerReport.Refresh();

            //if (sReport == "FlightItinerary")
            //{
            //    serverReport.ReportPath = "/TravelmartReport/FlightItinerary";

            //    // Create report parameter
            //    ReportParameter paramEmployeeID = new ReportParameter();
            //    paramEmployeeID.Name = "pcolSeafarerIdInt";
            //    paramEmployeeID.Values.Add(sEmployeeID);

            //    ReportParameter paramRecLoc = new ReportParameter();
            //    paramRecLoc.Name = "pRecordLocator";
            //    paramRecLoc.Values.Add(sRecLoc);

            //    // Set the report parameters for the report
            //    ReportViewer1.ServerReport.SetParameters(
            //        new ReportParameter[] { paramEmployeeID, paramRecLoc });

            //    sTitle = "FlightItinerary_" + sEmployeeID;
            //    ExportPDF("PDF", sTitle);
            //}


            if (sReport == "FlightItineraryAll")
            {
                serverReport.ReportPath = "/" + sReportFolder + "/FlightItineraryAll";


                sTitle = "FlightItineraryAll";
                ExportPDFAll("PDF", sTitle, sUserID);
            }
            else if (sReport == "Immigration")
            {
                serverReport.ReportPath = "/" + sReportFolder + "/Immigration";

                string LOE = GlobalCode.Field2String(Request.QueryString["LOEControlNo"]);

                sTitle = "Crew Verification";
                ExportPDFCrewverification("PDF", sTitle, sUserID, LOE);
            }
            else if (sReport == "ImmigrationLOE")
            {
                string JoinDate = GlobalCode.Field2String(Request.QueryString["JoinDate"]).ToString();
                string Ship     = GlobalCode.Field2String(Request.QueryString["pVessel"]);
                string Port     = GlobalCode.Field2String(Request.QueryString["pport"]);


                serverReport.ReportPath = "/" + sReportFolder + "/Immigration";

                string LOE = GlobalCode.Field2String(Request.QueryString["LOEControlNo"]);

                sTitle = "Crew Verification";
                ExportPDFCrewverification("PDF", sTitle, sUserID, LOE, JoinDate, Ship, Port);
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Created by:     Josephine Monteza
        /// Date Created:   07/May/2014
        /// Description:    Export Report
        /// ----------------------------------------------------
        /// </summary>
        public bool ExportPDFCrewverification(string exportType, string reportsTitle, string SeafareID, string LOENumber, string joindate, string Vessel, string Port)
        {
            try
            {
                List <SeafarerImage>           SeafarerImage = new List <SeafarerImage>();
                MGW.QRCode.Codec.QRCodeEncoder rq            = new MGW.QRCode.Codec.QRCodeEncoder();

                System.Drawing.Bitmap  myImage;
                List <CrewImmigration> Immigration = new List <CrewImmigration>();

                DateTime Mydate = new DateTime();
                Mydate = GlobalCode.Field2DateTime(joindate);


                myImage = rq.Encode(SeafareID + "+" + LOENumber + "+" + Mydate.ToString("MMMM") + " " + Mydate.Day.ToString() + " " + Mydate.Year.ToString() + "+" + Vessel + "+" + Port);
                SeafarerImage.Add(new SeafarerImage
                {
                    Image      = GlobalCode.Field2BitmapByte(myImage),
                    ImageType  = "jpg",
                    LOENumber  = LOENumber,
                    SeaparerID = GlobalCode.Field2Long(SeafareID),
                    LogInUser  = GlobalCode.Field2String(Session["UserName"])
                });



                TRAVELMART.BLL.ImmigrationBLL BLL = new TRAVELMART.BLL.ImmigrationBLL();
                BLL.InsertQRCode(SeafarerImage);


                Warning[] warnings  = null;
                string[]  streamIds = null;
                string    mimeType  = string.Empty;
                string    encoding  = string.Empty;
                string    extension = string.Empty;
                string    filetype  = string.Empty;
                // just gets the Report title... make your own method
                //ReportViewer needs a specific type (not always the same as the extension)

                filetype = exportType == "PDF" ? "PDF" : exportType;

                string sServerUser   = ConfigurationSettings.AppSettings["ReportUser"].ToString();
                string sServerPwd    = ConfigurationSettings.AppSettings["ReportPwd"].ToString();
                string sServerDomain = ConfigurationSettings.AppSettings["ReportDomain"].ToString();

                IReportServerCredentials irsc = new ReportCredentials(sServerUser, sServerPwd, sServerDomain);

                ReportViewer1.ServerReport.ReportServerCredentials = irsc;
                ReportParameter[] ParamReport = new ReportParameter[2];
                ParamReport[0] = new ReportParameter("pSeafarerID", SeafareID);
                ParamReport[1] = new ReportParameter("pLOEControlNumber", LOENumber);

                //// Create report parameter
                //ReportParameter ParamReport = new ReportParameter();
                //ParamReport.Name = "pSeafarerID";
                //ParamReport.Values.Add(SeafareID);
                //ParamReport.Name = "pLOEControlNumber";
                //ParamReport.Values.Add(LOENumber);


                ReportViewer1.ServerReport.SetParameters(ParamReport);



                //paramUser.Values.Add(sUserID);

                // Set the report parameters for the report
                //ReportViewer1.ServerReport.SetParameters(
                //    new ReportParameter[] { ParamReport });


                byte[] bytes = ReportViewer1.ServerReport.Render(filetype, null, // deviceinfo not needed for csv
                                                                 out mimeType, out encoding, out extension, out streamIds, out warnings);
                System.Web.HttpContext.Current.Response.Buffer = true;
                System.Web.HttpContext.Current.Response.Clear();
                System.Web.HttpContext.Current.Response.ContentType = mimeType;
                System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + reportsTitle + "." + exportType);
                System.Web.HttpContext.Current.Response.BinaryWrite(bytes);

                FileStream fs = new FileStream(Server.MapPath("~/Extract/Immigration/" + reportsTitle + "." + exportType), FileMode.OpenOrCreate);

                fs.Write(bytes, 0, bytes.Length);
                fs.Close();

                System.Web.HttpContext.Current.Response.Flush();
                // System.Web.HttpContext.Current.Response.End();
                //HttpContext.Current.ApplicationInstance.CompleteRequest();
            }
            catch (Exception ex)
            {
                //throw ex;
            }
            finally
            {
            }
            return(true);
        }
        protected void btnApproved_click(object sender, EventArgs e)
        {
            try
            {
                ImmigrationBLL BLL = new ImmigrationBLL();

                if (uoListViewCrewverification.Items.Count == 0)
                {
                    AlertMessage("Crew member has no upcomming assigment, Please try other crew member! ");
                    return;
                }

                bool   IsApproved    = true;
                Button ApproveButton = (Button)sender;

                DateTime curDate = new DateTime();

                //curDate = GlobalCode.Field2DateTime("2015-05-05 16:11:28.680");
                //DateTime T = GlobalCode.Field2TimeZoneTime(GlobalCode.Field2DateTime("2015-05-05 16:11:28.680") , );


                if (ApproveButton.ID == "btnApproved")
                {
                    IsApproved = true;
                    rdbFraudulentDoc.Checked = false;
                    rdbPriorIIssue.Checked   = false;
                    rdbPriorConDep.Checked   = false;
                    rdbOther.Checked         = false;
                    txtOtherComment.Text     = "";
                }
                else
                {
                    IsApproved = false;
                }


                HiddenField uoCrewVericationID = null;
                HiddenField uoLOEControlNumber = null;

                HiddenField uoHDFVesselID = null;
                HiddenField uoHDFRankID   = null;

                TextBox txtJoindate = null;
                TextBox txtJoinPort = null;
                TextBox txtJoinCity = null;

                foreach (ListViewItem item in uoListViewCrewverification.Items)
                {
                    uoLOEControlNumber = (HiddenField)item.FindControl("uoHiddenFieldControlNo");
                    uoCrewVericationID = (HiddenField)item.FindControl("uoHiddenFieldCrewVericationID");

                    txtJoindate = (TextBox)item.FindControl("txtJoindate");
                    txtJoinPort = (TextBox)item.FindControl("txtJoinPort");
                    txtJoinCity = (TextBox)item.FindControl("txtJoinCity");


                    uoHDFRankID   = (HiddenField)item.FindControl("uoHDFRankID");
                    uoHDFVesselID = (HiddenField)item.FindControl("uoHDFVesselID");
                }



                List <CrewImmigration> Immigration = new List <CrewImmigration>();
                if (rdbOther.Checked == false)
                {
                    txtOtherComment.Text = "";
                }

                Immigration.Add(new CrewImmigration
                {
                    CrewVericationID = GlobalCode.Field2Long(uoCrewVericationID.Value),
                    SeaparerID       = GlobalCode.Field2Long(txtUniqeID.Text),

                    TravelReqID      = GlobalCode.Field2Long(uoHDFCrewVericationID.Value),
                    RecordLocator    = GlobalCode.Field2String(uoHDFRecordLocator.Value),
                    ItinerarySeqNo   = GlobalCode.Field2Int(uoHDFItinerarySeqID.Value),
                    LOEControlNumber = GlobalCode.Field2String(txtLOEControlNo.Text),

                    VesselID = GlobalCode.Field2Int(uoHDFVesselID.Value),
                    RankID   = GlobalCode.Field2Int(uoHDFRankID.Value),

                    Joindate = GlobalCode.Field2DateTime(txtJoindate.Text),
                    JoinPort = GlobalCode.Field2String(txtJoinPort.Text),
                    JoinCity = GlobalCode.Field2String(txtJoinCity.Text),

                    Reason             = 0,
                    IsFraudulentDoc    = GlobalCode.Field2Bool(rdbFraudulentDoc.Checked),
                    IsPriorImmigIssues = GlobalCode.Field2Bool(rdbPriorIIssue.Checked),
                    IsPriorConDep      = GlobalCode.Field2Bool(rdbPriorConDep.Checked),
                    IsOther            = GlobalCode.Field2Bool(rdbOther.Checked),
                    IsApproved         = GlobalCode.Field2Bool(IsApproved),
                    OtherDetail        = GlobalCode.Field2String(txtOtherComment.Text),
                    UserID             = GlobalCode.Field2String(uoHDFuserID.Value),
                });
                Immigration = BLL.InsertCrewImmigration(Immigration);

                Session["immigration"] = Immigration;

                int row = 0;

                if (Immigration.Count > 1)
                {
                    foreach (CrewImmigration item in Immigration)
                    {
                        if (item.CrewVericationID == GlobalCode.Field2Long(uoCrewVericationID.Value))
                        {
                            row = row + 1;
                        }
                    }
                }

                crewverification(Immigration, row);
            }
            catch (Exception ex)
            { throw ex; }
        }
        void crewverification(List <CrewImmigration> immigration, int RowIndex)
        {
            tblUCDate.Text = DateTime.Now.ToString("MM/dd/yyyy") + " [" + DateTime.Now.ToString("hh:mm tt") + "]";

            if (immigration.Count > 0)
            {
                txtUniqeID.Text   = immigration[RowIndex].SeaparerID.ToString();
                txtTelephone.Text = immigration[RowIndex].ContactNo;

                txtPassportNo.Text   = immigration[RowIndex].PassportNo;
                txtNationality.Text  = immigration[RowIndex].Nationality;
                txtLastName.Text     = immigration[RowIndex].LastName;
                txtFirstName.Text    = immigration[RowIndex].FirstName;
                txtLOEControlNo.Text = immigration[RowIndex].LOEControlNumber;
                txtExpiration.Text   = immigration[RowIndex].PassportExpiredate;
                txtDateOffBirth.Text = immigration[0].DateOfBirth == null ? "" : GlobalCode.Field2DateTime(immigration[0].DateOfBirth).ToString("MM/dd/yyyy");

                txtOtherComment.Text        = immigration[RowIndex].OtherDetail;
                uoHiddenFieldOldOther.Value = txtOtherComment.Text;
                txtEmailAdd.Text            = immigration[RowIndex].EmailAdd;

                //txtBrand.Text = immigration[0].Brand;
                //txtJoindate.Text = immigration[0].SignOnDate.ToString();
                //txtJoinShip.Text = immigration[0].Vessel;
                //txtJoinPort.Text = immigration[0].Seaport;
                //txtJoinCity.Text = immigration[0].Seaport;
                //txtPosition.Text = immigration[0].Rank;
                //txtPosition.Text = immigration[0].Rank;

                if (txtLOEControlNo.Text == "")
                {
                    txtLOEControlNo.BackColor = System.Drawing.Color.Red;
                    txtLOEControlNo.ToolTip   = "No LOE Available";

                    immigration[0].SignOnDate = null;
                    immigration[0].DateHired  = null;
                }
                else
                {
                    txtLOEControlNo.BackColor = System.Drawing.Color.White;
                    txtLOEControlNo.ToolTip   = immigration[RowIndex].LOEControlNumber;

                    //btnApproved.Enabled = true;
                    //btnDecline.Enabled = true;
                }

                uoListViewCrewverification.DataSource = immigration;
                uoListViewCrewverification.DataBind();

                rdbFraudulentDoc.Checked    = GlobalCode.Field2Bool(immigration[RowIndex].IsFraudulentDoc);
                rdbOther.Checked            = GlobalCode.Field2Bool(immigration[RowIndex].IsOther);
                rdbPriorConDep.Checked      = GlobalCode.Field2Bool(immigration[RowIndex].IsPriorConDep);
                rdbPriorIIssue.Checked      = GlobalCode.Field2Bool(immigration[RowIndex].IsPriorImmigIssues);
                chkNew.Checked              = GlobalCode.Field2Bool(immigration[RowIndex].NewHire);
                chkReHire.Checked           = GlobalCode.Field2Bool(immigration[RowIndex].NewHire) == true ? false : true;
                uoHDFCrewVericationID.Value = immigration[RowIndex].CrewVericationID.ToString();

                //uoHiddenFieldServerdate.Value = immigration[RowIndex].ProcessDate.ToString();

                if (immigration[RowIndex].CrewVericationID > 0)
                {
                    if (immigration[RowIndex].IsApproved == true)
                    {
                        uoHiddenFieldAppDecMessage.Value = "This immigration entry was approved by " + immigration[RowIndex].UserName + " on " + GlobalCode.Field2TimeZoneTime(GlobalCode.Field2DateTime(immigration[RowIndex].ProcessDate), uoHiddenFieldTimeZoneID.Value).ToString() + " are you sure you would like to ";

                        tblUCDate.Text = DateTime.Now.ToString("MM/dd/yyyy") + " [" + DateTime.Now.ToString("hh:mm tt") + "]" + "       Assignment Status : Approved   ";
                    }
                    else
                    {
                        uoHiddenFieldAppDecMessage.Value = "This immigration entry was declined by " + immigration[RowIndex].UserName + " on " + GlobalCode.Field2TimeZoneTime(GlobalCode.Field2DateTime(immigration[RowIndex].ProcessDate), uoHiddenFieldTimeZoneID.Value).ToString() + " are you sure you would like to ";
                        tblUCDate.Text = DateTime.Now.ToString("MM/dd/yyyy") + " [" + DateTime.Now.ToString("hh:mm tt") + "]" + "       Assignment Status : Declined   ";
                    }
                }
                else
                {
                    tblUCDate.Text = DateTime.Now.ToString("MM/dd/yyyy") + " [" + DateTime.Now.ToString("hh:mm tt") + "]";
                }

                //if (HiddenFieldIsImage.Value == "0")
                //{
                //    if (immigration[0].SeafarerImage.Count > 0)
                //    {
                //        uoImageCM.ImageUrl = GlobalCode.Field2PictureImage(immigration[0].SeafarerImage[0].Image, immigration[0].SeafarerImage[0].ImageType);
                //    }
                //    else {
                //        uoImageCM.ImageUrl = "~/Images/no-profile-image.jpg";
                //    }
                //}
                //else
                //{
                //    uoImageCM.ImageUrl = HiddenFieldCMImage.Value;
                //}

                string URL   = ConfigurationManager.AppSettings["MediaURL"];
                string Token = ConfigurationManager.AppSettings["MediaToken"];

                VehicleImageFile img = new VehicleImageFile();
                GlobalCode       k   = new GlobalCode();
                img = k.GetPhoto(URL + "/avatars/jde/" + txtUniqeID.Text.ToString() + "?at=" + Token);


                if (img.Image == null)
                {
                    if (GlobalCode.Field2Long(immigration[0].CtracDetail.user_id) > 0)
                    {
                        VehicleImageFile cimg = new VehicleImageFile();
                        cimg = k.GetPhoto(URL + "/avatars/ctrac/" + GlobalCode.Field2String(immigration[0].CtracDetail.user_id) + "?at=" + Token);
                        if (cimg.Image != null)
                        {
                            uoImageCM.ImageUrl = "data:image/*;base64," + cimg.Image;
                        }
                        else
                        {
                            if (immigration[0].SeafarerImage.Count > 0)
                            {
                                uoImageCM.ImageUrl = GlobalCode.Field2PictureImage(immigration[0].SeafarerImage[0].Image, immigration[0].SeafarerImage[0].ImageType);
                            }
                            else
                            {
                                uoImageCM.ImageUrl = "~/Images/no-profile-image.jpg";
                            }
                        }
                    }
                    else
                    {
                        if (immigration[0].SeafarerImage.Count > 0)
                        {
                            uoImageCM.ImageUrl = GlobalCode.Field2PictureImage(immigration[0].SeafarerImage[0].Image, immigration[0].SeafarerImage[0].ImageType);
                        }
                        else
                        {
                            uoImageCM.ImageUrl = "~/Images/no-profile-image.jpg";
                        }
                    }
                }
                else
                {
                    uoImageCM.ImageUrl = "data:image/*;base64," + img.Image;
                }

                if (immigration[0].ImmigrationAirTransaction.Count > 0)
                {
                    uoListviewAir.DataSource = immigration[0].ImmigrationAirTransaction;
                    uoListviewAir.DataBind();
                }
                else
                {
                    uoListviewAir.DataSource = null;
                    uoListviewAir.DataBind();
                }

                if (immigration[0].ImmigrationHotelBooking.Count > 0)
                {
                    uoListViewHotelBook.DataSource = immigration[0].ImmigrationHotelBooking;
                    uoListViewHotelBook.DataBind();
                }
                else
                {
                    uoListViewHotelBook.DataSource = null;
                    uoListViewHotelBook.DataBind();
                }

                if (immigration[0].ImmigrationTransportion.Count > 0)
                {
                    uoListViewTransportation.DataSource = immigration[0].ImmigrationTransportion;
                    uoListViewTransportation.DataBind();
                }
                else
                {
                    uoListViewTransportation.DataSource = null;
                    uoListViewTransportation.DataBind();
                }

                if (immigration[0].ImmigrationTransportion.Count > 0)
                {
                    uoListViewTransportation.DataSource = immigration[0].ImmigrationTransportion;
                    uoListViewTransportation.DataBind();
                }
                else
                {
                    uoListViewTransportation.DataSource = null;
                    uoListViewTransportation.DataBind();
                }


                if (immigration[0].ImmigrationEmploymentHistory.Count > 0)
                {
                    uoListViewRecentEmployment.DataSource = immigration[0].ImmigrationEmploymentHistory;
                    uoListViewRecentEmployment.DataBind();
                }
                else
                {
                    uoListViewRecentEmployment.DataSource = null;
                    uoListViewRecentEmployment.DataBind();
                }

                if (immigration[0].Parent.Count > 0)
                {
                    uoListViewParent.DataSource = immigration[0].Parent;
                    uoListViewParent.DataBind();
                }
                else
                {
                    uoListViewParent.DataSource = null;
                    uoListViewParent.DataBind();
                }
            }
            else
            {
                uoImageCM.ImageUrl = "~/Images/no-profile-image.jpg";
            }
        }
        void insertTransportationCancel(string spName)
        {
            Label       uoLblSfID;
            Label       uoLabelLast;
            LinkButton  SeafarerLinkButton;
            Label       uoLblCheckOut;
            Label       uoLblNites;
            Label       uoLblRoom;
            Label       uoLblVessel;
            Label       uoLblRank;
            Label       uoLblCostCenter;
            Label       uoLblRecLoc;
            HiddenField RecLocID;
            HiddenField TravelReqID;
            HiddenField SeqNo;
            Label       lblSFStatus;
            Label       lblRoutFrom;
            Label       lblRoutTo;
            HiddenField TransID;
            HiddenField uoHiddenFieldRouteFrom;
            HiddenField uoHiddenFieldRouteTo;

            List <NonTurnTransportationCancelRequest> PAH = new List <NonTurnTransportationCancelRequest>();

            foreach (ListViewDataItem item in uoListviewVehicleInfo.Items)
            {
                TransID            = (HiddenField)item.FindControl("uoHiddenFieldTransID");
                uoLblSfID          = (Label)item.FindControl("uoLblSfID");
                uoLabelLast        = (Label)item.FindControl("uoLabelLast");
                SeafarerLinkButton = (LinkButton)item.FindControl("SeafarerLinkButton");
                uoLblCheckOut      = (Label)item.FindControl("uoLblCheckOut");
                uoLblNites         = (Label)item.FindControl("uoLblNites");
                uoLblRoom          = (Label)item.FindControl("uoLblRoom");
                lblSFStatus        = (Label)item.FindControl("lblStatus");
                uoLblVessel        = (Label)item.FindControl("uoLblVessel");
                uoLblRank          = (Label)item.FindControl("uoLblRank");
                uoLblCostCenter    = (Label)item.FindControl("Label1");
                uoLblRecLoc        = (Label)item.FindControl("uoLblRecLoc");
                RecLocID           = (HiddenField)item.FindControl("uoHiddenFieldListRecLocID");
                TravelReqID        = (HiddenField)item.FindControl("uoHiddenFieldListTRID");
                SeqNo = (HiddenField)item.FindControl("uoHiddenFieldSeqNo");

                lblRoutFrom = (Label)item.FindControl("lblRouteFrom");
                lblRoutTo   = (Label)item.FindControl("lblRouteTo");

                uoHiddenFieldRouteFrom = (HiddenField)item.FindControl("uoHiddenFieldRouteFrom");
                uoHiddenFieldRouteTo   = (HiddenField)item.FindControl("uoHiddenFieldRouteTo");

                lblRoutFrom.Text = lblRoutFrom.Text == "" ? uoHiddenFieldRouteFrom.Value : lblRoutFrom.Text;
                lblRoutTo.Text   = lblRoutFrom.Text == "" ? uoHiddenFieldRouteTo.Value : lblRoutTo.Text;


                PAH.Add(new NonTurnTransportationCancelRequest
                {
                    TransVehicleID   = GlobalCode.Field2Long(TransID.Value),
                    TravelReqID      = GlobalCode.Field2Long(TravelReqID.Value),
                    SeafarerID       = GlobalCode.Field2Long(uoLblSfID.Text),
                    IdBigint         = GlobalCode.Field2Long(RecLocID.Value),
                    RecordLocator    = GlobalCode.Field2String(uoLblRecLoc.Text),
                    SeqNoInt         = GlobalCode.Field2Int(SeqNo.Value),
                    VehicleVendorID  = GlobalCode.Field2Int(uoVendorDropDownList.SelectedItem.Value),
                    PickUpDate       = GlobalCode.Field2DateTime(uoTextBoxPickupDate.Text),
                    PickUpTime       = GlobalCode.Field2DateTime(uoTextBoxPickupTime.Text),
                    DropOffDate      = GlobalCode.Field2DateTime(uoTextBoxPickupDate.Text),
                    DropOffTime      = GlobalCode.Field2DateTime(uoTextBoxPickupTime.Text),
                    ConfirmationNo   = GlobalCode.Field2String(uoTextBoxConfirmation.Text),
                    VehicleStatus    = "Cancel",
                    VehicleTypeId    = GlobalCode.Field2Int(uoDropDownListVehicleType.SelectedItem.Value),
                    RouteIDFrom      = GlobalCode.Field2Int(uoDropDownListTFrom.SelectedItem.Value),
                    RouteIDTo        = GlobalCode.Field2Int(uoDropDownListTTo.SelectedItem.Value),
                    RouteFromVarchar = GlobalCode.Field2String(lblRoutFrom.Text),
                    RouteToVarchar   = GlobalCode.Field2String(lblRoutTo.Text),
                    ContractId       = GlobalCode.Field2Int(uoHiddenFieldContractID.Value),
                    SFStatus         = GlobalCode.Field2String(lblSFStatus.Text),
                    ConfirmBy        = uoTextBoxConfirmedBy.Text,
                    Comments         = uoTextBoxComment.Text
                });
            }


            GlobalCode gc = new GlobalCode();
            DataTable  dt = new DataTable();

            dt = gc.getDataTable(PAH);

            PortAgentBLL PortBLL = new PortAgentBLL();

            PortBLL.InsertNonTurnTransactionRequestBooking(dt, spName, uoHiddenFieldUser.Value, uoTextBoxEmailAdd.Text, uoTextBoxCopy.Text);
        }
        /// <summary>
        /// Author:         Muhallidin G Wali
        /// Date Created:   12/Apr/2015
        /// Description:    Get the hotel to confirm from Non Turn Port Page
        /// </summary>
        private void GetVehicleManifestToConfirm()
        {
            try
            {
                ViewState["NonTurnTransportation"] = null;

                DataTable table = new DataTable();

                table = CreateTableCancelled();

                string dt = GlobalCode.Field2String(Request.QueryString["dt"]);

                var qRecLocRow  = Request.QueryString["RecLoc"];
                var qTReqIDRow  = Request.QueryString["TReqID"];
                var qTransIDRow = Request.QueryString["TransID"];

                int PortID      = GlobalCode.Field2Int(Request.QueryString["pID"]);
                int row         = GlobalCode.Field2Int(Request.QueryString["pRow"]);
                int PortAgentID = GlobalCode.Field2Int(Request.QueryString["pPAID"]);

                string   userID         = uoHiddenFieldUser.Value;
                string[] TRTableRow     = null;
                string[] ReclocTableRow = null;
                string[] TransTableRow  = null;

                if (qTReqIDRow != null)
                {
                    TRTableRow = qTReqIDRow.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }

                if (qRecLocRow != null)
                {
                    ReclocTableRow = qRecLocRow.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }
                if (qTransIDRow != null)
                {
                    TransTableRow = qTransIDRow.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }


                DataRow dr;


                //if (TRTableRow != null)
                //{
                for (var i = 0; i < row; i++)
                {
                    dr = table.NewRow();

                    dr["TransVehicleID"] = TransTableRow[i] == null ? 0 : GlobalCode.Field2Long(TransTableRow[i]);
                    dr["IDBigint"]       = ReclocTableRow[i] == null ? 0 : GlobalCode.Field2Long(ReclocTableRow[i]);
                    dr["TravelReqID"]    = TRTableRow[i] == null ? 0 : GlobalCode.Field2Long(TRTableRow[i]);


                    dr["SeqNoInt"] = 0;

                    dr["ReqDate"] = GlobalCode.Field2Time(dt);
                    dr["PortID"]  = PortID;
                    dr["UserID"]  = userID;
                    table.Rows.Add(dr);
                }



                PortAgentBLL PortBLL = new PortAgentBLL();
                List <NonTurnportGenericList> lst = new List <NonTurnportGenericList>();
                lst = PortBLL.GetPortNonTurnTransportationRequest(2, GlobalCode.Field2Time(dt), PortID, userID, table);

                uoVendorDropDownList.DataSource     = lst[0].NonTurnTransportation;
                uoVendorDropDownList.DataTextField  = "VendorName";
                uoVendorDropDownList.DataValueField = "VendorID";
                uoVendorDropDownList.DataBind();
                uoVendorDropDownList.Items.Insert(0, new ListItem("--Select Vendor--", "0"));


                uoVendorDropDownList.SelectedIndex = GlobalCode.GetselectedIndex(uoVendorDropDownList, PortAgentID);



                if (lst[0].NonTurnTransportation.Count > 0)
                {
                    var res = lst[0].NonTurnTransportation.Where(e => e.VendorID == PortAgentID).ToList();


                    if (res.Count > 0)
                    {
                        uoTextBoxEmailAdd.Text = res[0].Email.ToString();
                    }
                }



                uoDropDownListCurrency.DataSource     = lst[0].Currency;
                uoDropDownListCurrency.DataTextField  = "Name";
                uoDropDownListCurrency.DataValueField = "ID";
                uoDropDownListCurrency.DataBind();
                uoDropDownListCurrency.Items.Insert(0, new ListItem("--Select Currency--", "0"));



                uoDropDownListVehicleType.DataSource     = lst[0].VehicleType;
                uoDropDownListVehicleType.DataTextField  = "VehicleTypeName";
                uoDropDownListVehicleType.DataValueField = "VehicleTypeID";
                uoDropDownListVehicleType.DataBind();
                uoDropDownListVehicleType.Items.Insert(0, new ListItem("--Select Vehicle Type--", "0"));



                uoDropDownListRequestSource.DataSource     = lst[0].Requestor;
                uoDropDownListRequestSource.DataTextField  = "Name";
                uoDropDownListRequestSource.DataValueField = "ID";
                uoDropDownListRequestSource.DataBind();
                uoDropDownListRequestSource.Items.Insert(0, new ListItem("--Select Request Source--", "0"));
                uoDropDownListRequestSource.SelectedIndex = 2;

                ViewState["NonTurnTransportation"] = lst[0].NonTurnTransportation;

                uoListviewVehicleInfo.DataSource = lst[0].PortAgentVehicleManifestList;
                uoListviewVehicleInfo.DataBind();
                uoButtonEmail.Text = "Cancel";

                RadioButtonList1.Visible = false;

                if (lst[0].PortAgentVehicleManifestList.Count > 0)
                {
                    uoTextBoxPickupDate.Text   = GlobalCode.Field2Date(lst[0].PortAgentVehicleManifestList[0].PickupDate);
                    uoTextBoxPickupTime.Text   = GlobalCode.Field2String(lst[0].PortAgentVehicleManifestList[0].PickupTime);
                    uoTextBoxRateContract.Text = GlobalCode.Field2String(lst[0].PortAgentVehicleManifestList[0].RateContracted);


                    uoDropDownListTFrom.SelectedIndex    = GlobalCode.GetselectedIndex(uoDropDownListTFrom, lst[0].PortAgentVehicleManifestList[0].RouteFromID);
                    uoDropDownListTTo.SelectedIndex      = GlobalCode.GetselectedIndex(uoDropDownListTTo, lst[0].PortAgentVehicleManifestList[0].RouteToID);
                    uoDropDownListCurrency.SelectedIndex = GlobalCode.GetselectedIndex(uoDropDownListCurrency, lst[0].PortAgentVehicleManifestList[0].CurrencyID);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Modified By:    Josephine Gad
        /// Date Modified:  13/May/2014
        /// Description:    Add CountSummary to get name of Hotel to uoLabelHotel
        ///                 Add EmailRecipient to get vendor's email address
        /// </summary>
        public void OnEndExceptions(IAsyncResult ar)
        {
            uoListViewHotelCancel.DataSource = null;
            uoListViewHotelCancel.DataBind();
            uoHiddenFieldTravelReq.Value = "";
            List <HotelManifest> lst = new List <HotelManifest>();

            lst = (List <HotelManifest>)Session["ConfirmManifest_TentativeManifest"];

            List <HotelManifest> listConfirm = new List <HotelManifest>();

            listConfirm = (List <HotelManifest>)Session["ConfirmManifest_ConfirmedManifest"];

            List <HotelManifest> listResult = new List <HotelManifest>();
            string vID = GlobalCode.Field2String(Request.QueryString["VID"]);

            List <HotelDashboardList> CountSummary = new List <HotelDashboardList>();

            if (Session["ConfirmManifest_CountSummary"] != null)
            {
                CountSummary = (List <HotelDashboardList>)Session["ConfirmManifest_CountSummary"];
            }

            List <EmailRecipient> EmailRecipient = new List <EmailRecipient>();

            if (Session["ConfirmManifest_EmailRecipient"] != null)
            {
                EmailRecipient = (List <EmailRecipient>)Session["ConfirmManifest_EmailRecipient"];
            }

            char[] s           = { ',' };
            string strTravelID = "";

            if (vID.Length > 0)
            {
                strTravelID = vID.Substring(0, vID.Length - 1).Replace("|", ",").ToString();

                long[] TravelID = tolongarray(strTravelID, s);


                uoHiddenFieldTravelReq.Value = strTravelID.ToString();

                if (lst != null)
                {
                    var query = (from item in lst
                                 where TravelID.Contains(GlobalCode.Field2Long(item.HotelTransID))
                                 select item).ToList();
                    listResult.AddRange(query);
                }
                if (listConfirm != null)
                {
                    var queryConfirm = (from item in listConfirm
                                        where TravelID.Contains(GlobalCode.Field2Long(item.HotelTransID))
                                        select item).ToList();
                    listResult.AddRange(queryConfirm);
                }

                uoListViewHotelCancel.DataSource = listResult;
                uoListViewHotelCancel.DataBind();

                if (CountSummary.Count > 0)
                {
                    uoLabelHotel.Text = CountSummary[0].HotelBranchName.Trim();
                }
                if (EmailRecipient.Count > 0)
                {
                    txtEmailTo.Text = EmailRecipient[0].EmailTo.Trim();
                }
            }
        }
Esempio n. 19
0
        /// Date Modified: 26/03/2013
        /// Modified By:   Marco Abejar
        /// (description)  Get SF Request Info
        /// </summary>
        public static DataTable SeafarerGetCompanionDetails(string HotelRequestID)
        {
            Database  SFDatebase  = ConnectionSetting.GetConnection(); //  DatabaseFactory.CreateDatabase()
            DbCommand SFDbCommand = null;
            DataTable dt          = null;

            try
            {
                SFDbCommand = SFDatebase.GetStoredProcCommand("uspSelectSFCompanionHotelRequest");
                SFDatebase.AddInParameter(SFDbCommand, "@pHotelRequestID", DbType.Int64, GlobalCode.Field2Long(HotelRequestID));
                dt = SFDatebase.ExecuteDataSet(SFDbCommand).Tables[0];

                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (SFDbCommand != null)
                {
                    SFDbCommand.Dispose();
                }
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Author:         Josephine Gad
        /// Date Created:   04/Apr/2014
        /// Description:    Load details for Service Provider for 0 to 6 days
        /// ---------------------------------------------------------------
        /// </summary>
        public List <HotelTransactionOverflowGenericClass> LoadHotelOverflowPageDays(DateTime Date, string UserId, int Loadtype, int RegionID, int PortID)
        {
            List <HotelTransactionOverflowGenericClass> overflow = new List <HotelTransactionOverflowGenericClass>();
            Database  db          = ConnectionSetting.GetConnection(); //  DatabaseFactory.CreateDatabase()
            DbCommand dbCommand   = null;
            DataSet   ds          = null;
            DataTable dtException = null;
            DataTable dtHotels    = null;

            try
            {
                dbCommand = db.GetStoredProcCommand("uspGetHotelOverflowPageDays");
                // db.AddInParameter(dbCommand, "@pDate", DbType.Date, Date);
                db.AddInParameter(dbCommand, "@pUserId", DbType.String, UserId);
                db.AddInParameter(dbCommand, "@pRegionIDInt", DbType.Int32, RegionID);
                db.AddInParameter(dbCommand, "@pPortIDInt", DbType.Int32, PortID);
                ds          = db.ExecuteDataSet(dbCommand);
                dtHotels    = ds.Tables[0];
                dtException = ds.Tables[1];

                overflow.Add(new HotelTransactionOverflowGenericClass()
                {
                    Hotels = (from a in dtHotels.AsEnumerable()
                              select new Hotels
                    {
                        VendorId = a.Field <int>("VendorId"),
                        BranchId = a.Field <int>("BranchId"),
                        BranchName = a.Field <string>("BranchName"),
                        CountryId = a.Field <int>("CountryId"),
                        CityId = a.Field <int>("CityId"),
                        isAccredited = a.Field <bool>("isAccredited"),
                        withEvent = a.Field <bool>("withEvent"),
                        ContractId = a.Field <int>("ContractId"),
                        withContract = a.Field <bool>("withContract"),
                        colDate = a.Field <DateTime>("colDate"),
                    }).ToList(),
                    OverflowBooking2 = (from a in dtException.AsEnumerable()
                                        select new OverflowBooking2
                    {
                        TravelReqId = a.Field <int?>("TravelReqId"),
                        E1TravelReqId = a.Field <int?>("E1TravelReqId"),
                        SeafarerId = a.Field <int?>("SeafarerId"),
                        SeafarerName = a.Field <string>("SeafarerName"),
                        PortId = a.Field <int?>("PortId"),
                        PortName = a.Field <string>("PortName"),
                        SFStatus = a.Field <string>("SFStatus"),
                        OnOffDate = a.Field <DateTime?>("OnOffDate"),
                        CheckInDate = a.Field <DateTime?>("CheckInDate"),
                        ArrivalDepartureDatetime = a.Field <DateTime?>("ArrivalDepartureDatetime"),
                        Carrier = a.Field <string>("Carrier"),
                        FlightNo = a.Field <string>("FlightNo"),
                        FromCity = a.Field <string>("FromCity"),
                        ToCity = a.Field <string>("ToCity"),
                        RankName = a.Field <string>("RankName"),
                        Stripes = a.Field <decimal?>("Stripes"),
                        RecordLocator = a.Field <string>("RecordLocator"),
                        Gender = a.Field <string>("Gender"),
                        Nationality = a.Field <string>("Nationality"),
                        RoomTypeId = a.Field <int?>("RoomTypeId"),
                        RoomType = a.Field <string>("RoomType"),
                        ReasonCode = a.Field <string>("ReasonCode"),
                        VesselName = a.Field <string>("VesselName"),
                        HotelRequest = Convert.ToBoolean(a.Field <bool>("HotelRequest")),
                        BookingRemarks = a.Field <string>("colRemarksVarchar"),

                        IDBigint = GlobalCode.Field2Int(a["colIDBigint"]),
                        SeqNo = GlobalCode.Field2Int(a["colSeqNoInt"]),

                        HotelCity = GlobalCode.Field2String(a["HotelCity"]),
                        IsByPort = GlobalCode.Field2String(a["IsByPort"]),
                        HotelName = GlobalCode.Field2String(a["HotelName"]),
                        HotelOverflowID = GlobalCode.Field2Long(a["HotelOverflowID"])
                    }).ToList()
                });
                return(overflow);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommand != null)
                {
                    dbCommand.Dispose();
                }
                if (dtException != null)
                {
                    dtException.Dispose();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Date Created:   25/June/2015
        /// Created By:     Josephine Monteza
        /// (description)   Get Crew Assist Remarks
        /// ---------------------------------------
        /// </summary>
        public static List <CrewAssistRemarksList> GetCrewAssistRemarks(Int32 iYear,
                                                                        Int32 iMonth, string sCreatedBy, string sUserID, Int16 iLoadType,
                                                                        Int16 iFilterBy, string sFilterValue,
                                                                        string sOrderBy, short IR, int iStartRow, int iMaxRow)
        {
            Database  db   = ConnectionSetting.GetConnection(); //  DatabaseFactory.CreateDatabase()
            DbCommand comm = null;
            DataSet   ds   = null;
            DataTable dt   = null;
            int       iRow = 0;

            List <CrewAssistRemarksList> list = new List <CrewAssistRemarksList>();

            try
            {
                comm = db.GetStoredProcCommand("uspGetCrewAssistRemarks");
                db.AddInParameter(comm, "@pYear", DbType.Int32, iYear);
                db.AddInParameter(comm, "@pMonth", DbType.Int32, iMonth);

                db.AddInParameter(comm, "@pCreatedBy", DbType.String, sCreatedBy);
                db.AddInParameter(comm, "@pUserID", DbType.String, sUserID);
                db.AddInParameter(comm, "@pLoadType", DbType.Int16, iLoadType);

                db.AddInParameter(comm, "@pFilterBy", DbType.Int16, iFilterBy);
                db.AddInParameter(comm, "@pFilterValue", DbType.String, sFilterValue);

                db.AddInParameter(comm, "@pOrderBy", DbType.String, sOrderBy);
                db.AddInParameter(comm, "@pStartRow", DbType.Int32, iStartRow);
                db.AddInParameter(comm, "@pMaxRow", DbType.Int32, iMaxRow);
                db.AddInParameter(comm, "@pIncidentReport", DbType.Int16, IR);

                ds = db.ExecuteDataSet(comm);
                if (ds.Tables.Count > 0)
                {
                    iRow = GlobalCode.Field2Int(ds.Tables[0].Rows[0][0]);
                    dt   = ds.Tables[1];

                    list = (from a in dt.AsEnumerable()
                            select new CrewAssistRemarksList
                    {
                        TravelRequestID = GlobalCode.Field2Long(a["colTravelReqIdInt"]),
                        SeafarerID = GlobalCode.Field2Long(a["colSeafarerIDBigint"]),
                        Source = a.Field <string>("RequestSource"),
                        RequestHeader = a.Field <string>("RemarksTypeHeader"),
                        RequestType = a.Field <string>("RemarksType"),
                        Summary = a.Field <string>("Summary"),
                        Remarks = a.Field <string>("Remarks"),
                        RemarksStatus = a.Field <string>("RemarksStatus"),
                        Requestor = a.Field <string>("Requestor"),
                        CreatedDate = GlobalCode.Field2DateTime(a["colDateCreatedDateTime"]),
                        CreatedBy = a.Field <string>("colCreatedByVarchar"),
                        TransactionDate = a.Field <DateTime?>("colTransactionDate"),
                        TransactionTime = a.Field <TimeSpan?>("colTransactionTime"),
                        IR = GlobalCode.Field2Bool(a["IRBit"])
                    }).ToList();

                    HttpContext.Current.Session["CrewAssistRemarks_Count"] = iRow;
                }
                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (comm != null)
                {
                    comm.Dispose();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Date Created:  22/Oct/2013
        /// Created By:    Josephine Gad
        /// (description)  GetServiceRequestEmail
        /// ---------------------------------------
        /// Date Modified: 25/Oct/2013
        /// Modified By:   Josephine Gad
        /// (description)  Add Service Provider Email
        /// </summary>
        public void GetServiceRequestEmail(Int32 iHotelRequestID, Int32 iVehicleRequestID,
                                           int iPortAgentRequestID, Int32 iMeetGreetRequestID, Int16 iLoadType)
        {
            List <ServiceRequestEmailList> list           = new List <ServiceRequestEmailList>();
            List <CrewAssistEmailDetail>   hotelEmail     = new List <CrewAssistEmailDetail>();
            List <CrewAssistTranspo>       vehicleEmail   = new List <CrewAssistTranspo>();
            List <CrewAssistMeetAndGreet>  meetGreetEmail = new List <CrewAssistMeetAndGreet>();
            List <CopyEmail> copyMail = new List <CopyEmail>();

            Database  db          = ConnectionSetting.GetConnection(); //  DatabaseFactory.CreateDatabase()
            DbCommand dbComm      = null;
            DataSet   ds          = null;
            DataTable dt          = null;
            DataTable dtCopy      = null;
            DataTable dtHotel     = null;
            DataTable dtVehicle   = null;
            DataTable dtMeetGreet = null;
            DataTable dtAirDetail = null;

            if (iLoadType == 0)
            {
                HttpContext.Current.Session["ServiceRequestEmail_EmailList"]    = list;
                HttpContext.Current.Session["ServiceRequestEmail_CopyMailList"] = copyMail;
            }
            HttpContext.Current.Session["ServiceRequestEmail_HotelEmailDetails"]     = hotelEmail;
            HttpContext.Current.Session["ServiceRequestEmail_VehicleEmailDetails"]   = vehicleEmail;
            HttpContext.Current.Session["ServiceRequestEmail_MeetGreetEmailDetails"] = meetGreetEmail;

            try
            {
                dbComm = db.GetStoredProcCommand("uspGetServiceRequestEmail");
                db.AddInParameter(dbComm, "@pHotelRequestID", DbType.Int32, iHotelRequestID);
                db.AddInParameter(dbComm, "@pVehicleRequestID", DbType.Int32, iVehicleRequestID);
                db.AddInParameter(dbComm, "@pMeetGreetRequestID", DbType.Int32, iMeetGreetRequestID);
                db.AddInParameter(dbComm, "@pPortAgentRequestID", DbType.Int32, iPortAgentRequestID);
                db.AddInParameter(dbComm, "@pLoadType", DbType.Int16, iLoadType);
                ds = db.ExecuteDataSet(dbComm);

                if (iLoadType == 0)
                {
                    dt   = ds.Tables[0];
                    list = (from a in dt.AsEnumerable()
                            select new ServiceRequestEmailList
                    {
                        HotelID = GlobalCode.Field2Int(a["HotelID"]),
                        HotelEmailTo = a.Field <string>("HotelEmailTo"),
                        HotelName = a.Field <string>("HotelName"),

                        VehicleID = GlobalCode.Field2Int(a["VehicleID"]),
                        VehicleEmailTo = a.Field <string>("VehicleEmailTo"),
                        VehicleName = a.Field <string>("VehicleName"),

                        MeetGreetID = GlobalCode.Field2Int(a["MeetGreetID"]),
                        MeetGreetEmailTo = a.Field <string>("MeetGreetEmailTo"),
                        MeetGreetName = a.Field <string>("MeetGreetName"),

                        PortAgentID = GlobalCode.Field2Int(a["MeetGreetID"]),
                        PortAgentName = a.Field <string>("PortAgentName"),
                        PortAgentEmailTo = a.Field <string>("PortAgentEmailTo"),


                        VesselID = GlobalCode.Field2Int(a["VesselID"]),
                        VesselEmailTo = a.Field <string>("VesselEmail")
                    }).ToList();

                    dtCopy      = ds.Tables[1];
                    dtHotel     = ds.Tables[2];
                    dtVehicle   = ds.Tables[3];
                    dtMeetGreet = ds.Tables[4];
                    dtAirDetail = ds.Tables[5];

                    copyMail = (from a in dtCopy.AsEnumerable()
                                select new CopyEmail
                    {
                        EmailName = GlobalCode.Field2String(a["EmailType"]),
                        EmailType = GlobalCode.Field2Int(a["EmailID"]),
                        Email = GlobalCode.Field2String(a["Email"]),
                    }).ToList();

                    HttpContext.Current.Session["ServiceRequestEmail_EmailList"]    = list;
                    HttpContext.Current.Session["ServiceRequestEmail_CopyMailList"] = copyMail;
                }
                else if (iLoadType == 1)
                {
                    dtHotel     = ds.Tables[0];
                    dtVehicle   = ds.Tables[1];
                    dtMeetGreet = ds.Tables[2];
                    dtAirDetail = ds.Tables[3];
                }
                //----------------------------------Get the request details to be emailed----------------------------------
                if (dtHotel != null)
                {
                    hotelEmail = (from a in dtHotel.AsEnumerable()
                                  select new CrewAssistEmailDetail
                    {
                        SeafarerID = GlobalCode.Field2String(a["colSeafarerIDInt"]),
                        LastName = GlobalCode.Field2String(a["LastName"]),
                        FirstName = GlobalCode.Field2String(a["FirstName"]),
                        GenderDiscription = GlobalCode.Field2String(a["Gender"]),
                        BrandCode = GlobalCode.Field2String(a["Branch"]),
                        RankName = GlobalCode.Field2String(a["Rank"]),
                        SFStatus = GlobalCode.Field2String(a["Status"]),
                        Nationality = GlobalCode.Field2String(a["Nationality"]),
                        VesselName = GlobalCode.Field2String(a["Vessel"]),
                        VesselId = GlobalCode.Field2Int(a["colVesselIdInt"]),
                        CostCenterCode = GlobalCode.Field2String(a["CostCenter"]),
                        RoomDesc = GlobalCode.Field2String(a["RoomType"]),
                        SharingWith = GlobalCode.Field2String(a["SharingWith"]),
                        TimeSpanStartDate = GlobalCode.Field2Date(a["TimeSpanStartDate"]),
                        TimeSpanEndDate = GlobalCode.Field2Date(a["TimeSpanStartDate"]),
                        TimeSpanStartTime = GlobalCode.Field2String(a["TimeSpanStartTime"]),
                        TimeSpanEndTime = GlobalCode.Field2String(a["TimeSpanEndTime"]),
                        Mealvoucheramount = GlobalCode.Field2Double(a["Mealvoucheramount"]).ToString("n2"),
                        //Confirmedbyhotelvendor = GlobalCode.Field2Double(a["Confirmedbyhotelvendor"]).ToString(),
                        ConfirmedbyRCCL = GlobalCode.Field2String(a["ConfirmedbyRCCL"]),
                        VendorBranch = GlobalCode.Field2String(a["colVendorBranchNameVarchar"]),
                        Roomrate = GlobalCode.Field2Double(a["Roomrate"]).ToString("n2"),              // GlobalCode.Field2String(a["Roomrate"])
                        Comment = GlobalCode.Field2String(a["colCommentsVarchar"]),
                        Confirmedbyhotelvendor = GlobalCode.Field2String(a["colConfirmName"]),
                        CrewAssistEmailAirDetail = (from n in dtAirDetail.AsEnumerable()
                                                    select new CrewAssistEmailAirDetail
                        {
                            AirDetail = GlobalCode.Field2String(n["AirDetail"])
                        }).ToList()
                    }).ToList();

                    HttpContext.Current.Session["ServiceRequestEmail_HotelEmailDetails"] = hotelEmail;
                }
                if (dtVehicle != null)
                {
                    vehicleEmail = (from a in dtVehicle.AsEnumerable()
                                    select new CrewAssistTranspo
                    {
                        VehicleTransID = GlobalCode.Field2Int(a["colTransVehicleIDBigint"]),
                        IdBigint = GlobalCode.Field2Long(a["colIdBigint"]),
                        TravelReqIDInt = GlobalCode.Field2Long(a["colTravelReqIDInt"]),
                        SeqNoInt = GlobalCode.Field2TinyInt(a["colSeqNoInt"]),
                        RecordLocatorVarchar = GlobalCode.Field2String(a["colRecordLocatorVarchar"]),
                        VehicleVendorIDInt = GlobalCode.Field2Long(a["colVehicleVendorIDInt"]),
                        VehicleVendor = GlobalCode.Field2String(a["colVehicleVendorNameVarchar"]),

                        VehiclePlateNoVarchar = GlobalCode.Field2String(a["colVehiclePlateNoVarchar"]),
                        PickUpDate = GlobalCode.Field2DateTime(a["colPickUpDate"]),
                        PickUpTime = GlobalCode.Field2DateTime(a["colPickUpTime"]),
                        DropOffDate = GlobalCode.Field2DateTime(a["colDropOffDate"]),
                        DropOffTime = GlobalCode.Field2DateTime(a["colDropOffTime"]),
                        ConfirmationNoVarchar = GlobalCode.Field2String(a["colConfirmationNoVarchar"]),
                        VehicleStatusVarchar = GlobalCode.Field2String(a["colVehicleStatusVarchar"]),
                        VehicleTypeIdInt = GlobalCode.Field2Int(a["colVehicleTypeIdInt"]),
                        SFStatus = GlobalCode.Field2String(a["colSFStatus"]),
                        RouteIDFromInt = GlobalCode.Field2Int(a["colRouteIDFromInt"]),
                        RouteIDToInt = GlobalCode.Field2Int(a["colRouteIDToInt"]),
                        FromVarchar = GlobalCode.Field2String(a["colFromVarchar"]),
                        ToVarchar = GlobalCode.Field2String(a["colToVarchar"]),
                        Comment = GlobalCode.Field2String(a["colRemarksForAuditVarchar"]),

                        //TransSender = UserID,

                        SeaparerID = GlobalCode.Field2Long(a["colSeafarerIdInt"]),
                        FirstName = GlobalCode.Field2String(a["colFirstNameVarchar"]),
                        LastName = GlobalCode.Field2String(a["colLastNameVarchar"]),
                        RankName = GlobalCode.Field2String(a["RankName"]),
                        Gender = GlobalCode.Field2String(a["colGenderDiscription"]),
                        NationalityName = GlobalCode.Field2String(a["Nationality"]),
                    }).ToList();
                    HttpContext.Current.Session["ServiceRequestEmail_VehicleEmailDetails"] = vehicleEmail;
                }
                if (dtMeetGreet != null)
                {
                    meetGreetEmail = (from Q in dtMeetGreet.AsEnumerable()
                                      select new CrewAssistMeetAndGreet
                    {
                        ReqMeetAndGreetID = GlobalCode.Field2Long(Q["colReqMeetAndGreetIDBigint"]),
                        IdBigint = GlobalCode.Field2Long(Q["colIdBigint"]),
                        TravelReqID = GlobalCode.Field2Long(Q["colTravelReqIDInt"]),
                        SeqNo = GlobalCode.Field2Int(Q["colSeqNoInt"]),
                        RecordLocator = GlobalCode.Field2String(Q["colRecordLocatorVarchar"]),
                        MeetAndGreetVendorID = GlobalCode.Field2Int(Q["colMeetAndGreetVendorIDInt"]),
                        MeetAndGreetVendor = GlobalCode.Field2String(Q["colMeetAndGreetVendorNameVarchar"]),
                        ConfirmationNo = GlobalCode.Field2String(Q["colConfirmationNoVarchar"]),
                        AirportID = GlobalCode.Field2Int(Q["colAirportInt"]),
                        FligthNo = GlobalCode.Field2String(Q["colFligthNoVarchar"]),
                        ServiceDate = GlobalCode.Field2DateTime(Q["colServiceDatetime"]),
                        Rate = GlobalCode.Field2Double(Q["colRateFloat"]),
                        SFStatus = GlobalCode.Field2String(Q["colSFStatus"]),
                        Comment = GlobalCode.Field2String(Q["colCommentVarchar"]),
                        IsAir = GlobalCode.Field2Bool(Q["colIsAirBit"]),
                        Email = GlobalCode.Field2String(Q["colEmailToVarchar"])
                    }).ToList();
                    HttpContext.Current.Session["ServiceRequestEmail_MeetGreetEmailDetails"] = meetGreetEmail;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbComm != null)
                {
                    dbComm.Dispose();
                }
                if (dt != null)
                {
                    dt.Dispose();
                }
                if (dtCopy != null)
                {
                    dtCopy.Dispose();
                }
                if (dtHotel != null)
                {
                    dtHotel.Dispose();
                }
                if (dtVehicle != null)
                {
                    dtVehicle.Dispose();
                }
                if (dtMeetGreet != null)
                {
                    dtMeetGreet.Dispose();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
                if (dtAirDetail != null)
                {
                    dtAirDetail.Dispose();
                }
            }
        }
Esempio n. 23
0
        public void LoadImmigrationPage(Int16 LoadType, DateTime FromDate, DateTime ToDate,
                                        string UserID, string Role, string OrderBy, int SeaportID, string FilterByName,
                                        string SeafarerID, string NationalityID, string Gender, string RankID, string Status,
                                        Int16 iAirLeg, Int16 iRouteFrom, Int16 iRouteTo, int StartRow, int MaxRow)
        {
            List <ImmigrationManifestList> listImmigration = new List <ImmigrationManifestList>();

            HttpContext.Current.Session["Immigration_Manifest"]      = listImmigration;
            HttpContext.Current.Session["Immigration_ManifestCount"] = 0;

            Database  db        = ConnectionSetting.GetConnection(); //  DatabaseFactory.CreateDatabase()
            DbCommand dbCommand = null;

            Int32     maxRows       = 0;
            DataTable dtImmigration = null;
            DataTable dtNationality = null;
            DataTable dtGender      = null;
            DataTable dtRank        = null;
            DataTable dtCount       = null;
            DataTable dtSeaport     = null;
            DataTable dtRoute       = null;

            DataSet ds = null;

            try
            {
                dbCommand = db.GetStoredProcCommand("uspSelectImmigrationPage");
                db.AddInParameter(dbCommand, "@pLoadType", DbType.Int16, LoadType);
                db.AddInParameter(dbCommand, "@pFromDate", DbType.DateTime, FromDate);
                db.AddInParameter(dbCommand, "@pToDate", DbType.DateTime, ToDate);
                db.AddInParameter(dbCommand, "@pUserID", DbType.String, UserID);
                db.AddInParameter(dbCommand, "@pRole", DbType.String, Role);
                db.AddInParameter(dbCommand, "@pOrderBy", DbType.String, OrderBy);
                db.AddInParameter(dbCommand, "@pStartRow", DbType.Int32, StartRow);
                db.AddInParameter(dbCommand, "@pMaxRow", DbType.Int32, MaxRow);
                db.AddInParameter(dbCommand, "@pSeaportID", DbType.Int32, SeaportID);
                db.AddInParameter(dbCommand, "@pFilterByName", DbType.Int16, GlobalCode.Field2TinyInt(FilterByName));
                db.AddInParameter(dbCommand, "@pSeafarerID", DbType.String, SeafarerID);
                db.AddInParameter(dbCommand, "@pNationalityID", DbType.Int32, GlobalCode.Field2Int(NationalityID));
                db.AddInParameter(dbCommand, "@pGender", DbType.Int32, GlobalCode.Field2Int(Gender));
                db.AddInParameter(dbCommand, "@pRankID", DbType.Int32, GlobalCode.Field2Int(RankID));
                db.AddInParameter(dbCommand, "@pStatus", DbType.String, Status);
                db.AddInParameter(dbCommand, "@pShowLegInt", DbType.Int16, iAirLeg);
                db.AddInParameter(dbCommand, "@pRouteIDFrom", DbType.Int16, iRouteFrom);
                db.AddInParameter(dbCommand, "@pRouteIDTo", DbType.Int16, iRouteTo);

                dbCommand.CommandTimeout = 60;
                ds = db.ExecuteDataSet(dbCommand);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    maxRows = Int32.Parse(ds.Tables[0].Rows[0][0].ToString());
                    HttpContext.Current.Session["Immigration_ManifestCount"] = maxRows;
                }
                dtImmigration = ds.Tables[1];

                //if (dtCrewAdmin.Rows.Count > 0)
                //{
                //    DataView dv = dtCrewAdmin.DefaultView;
                //    dv.Sort = OrderBy;
                //    dtCrewAdmin = dv.ToTable();
                //}

                //List<CrewAdminList> recordList = new List<CrewAdminList>();
                listImmigration = (from a in dtImmigration.AsEnumerable()
                                   select new ImmigrationManifestList
                {
                    //IsManual = GlobalCode.Field2Bool(a["IsManual"]),
                    IDBigInt = GlobalCode.Field2Int(a["IDBigInt"]),
                    E1TravelRequest = GlobalCode.Field2Int(a["E1TravelRequest"]),
                    RequestID = GlobalCode.Field2Int(a["RequestID"]),
                    TravelRequestID = GlobalCode.Field2Long(a["TravelRequestID"]),
                    RecLoc = GlobalCode.Field2String(a["RecLoc"]),
                    SeafarerID = GlobalCode.Field2Long(a["SeafarerID"]),
                    Name = GlobalCode.Field2String(a["Name"]),
                    DateOnOff = a.Field <DateTime>("DateOnOff"),

                    Status = GlobalCode.Field2String(a["Status"]),
                    Brand = GlobalCode.Field2String(a["Brand"]),
                    Vessel = GlobalCode.Field2String(a["Vessel"]),
                    //PortCode = GlobalCode.Field2String(a["PortCode"]),
                    Port = GlobalCode.Field2String(a["Port"]),
                    //RankCode = GlobalCode.Field2String(a["RankCode"]),
                    Rank = GlobalCode.Field2String(a["Rank"]),

                    ReasonCode = GlobalCode.Field2String(a["ReasonCode"]),
                    IsWithSail = GlobalCode.Field2Bool(a["IsWithSail"]),

                    Arrival = GlobalCode.Field2String(a["AirportArrival"]),
                    Departure = GlobalCode.Field2String(a["AirportDeparture"]),
                    ArrivalDateTime = a.Field <DateTime?>("colArrivalDateTime"),
                    DepartureDateTime = a.Field <DateTime?>("colDepartureDateTime"),
                    FlightNo = GlobalCode.Field2String(a["colFlightNoVarchar"]),
                    Airline = GlobalCode.Field2String(a["Airline"]),

                    Hotel = GlobalCode.Field2String(a["Hotel"]),
                    IsMeetGreet = GlobalCode.Field2Bool(a["IsMeetGreet"]),
                    IsPortAgent = GlobalCode.Field2Bool(a["IsPortAgent"]),
                    IsHotelVendor = GlobalCode.Field2Bool(a["IsHotelVendor"]),
                    Remarks = a.Field <string>("Remarks"),

                    PassportNo = GlobalCode.Field2String(a["PassportNo"]),
                    PassportIssued = GlobalCode.Field2String(a["PassportIssued"]),
                    PassportExp = GlobalCode.Field2String(a["PassportExp"]),

                    Checkin = a.Field <DateTime?>("CheckIn"),
                    Checkout = a.Field <DateTime?>("Checkout"),
                    SingleDouble = a.Field <string>("colSingleDoubleFloat"),
                    Gender = a.Field <string>("colGender"),
                    CostCenter = a.Field <string>("colCostCenter"),
                    Nationality = a.Field <string>("colNationality"),
                    MealAllowance = a.Field <string>("colMealAllowance"),
                    Duration = GlobalCode.Field2Int(a["Duration"]),
                    Lastname = a.Field <string>("Lastname"),
                    Firstname = a.Field <string>("Firstname"),
                    IsVisible = GlobalCode.Field2Bool(a["IsVisible"]),
                    SequenceNo = GlobalCode.Field2Int(a["SeqNo"]),
                    Birthday = a.Field <DateTime?>("colBirthday"),

                    TransVehicleID = GlobalCode.Field2Int(a["TransVehicleID"]),
                    IsCheckBoxForVehicleVisible = GlobalCode.Field2Bool(a["IsCheckBoxForVehicleVisible"]),
                    IsVisibleToVehicleVendor = GlobalCode.Field2Bool(a["IsVisibleToVehicleVendor"]),
                    IsNeedVehicleBooking = GlobalCode.Field2Bool(a["IsNeedVehicleBooking"]),
                    IsToPrintItinerary = GlobalCode.Field2Bool(a["IsToPrintItinerary"]),

                    RouteFrom = a.Field <string>("RouteFrom"),
                    RouteTo = a.Field <string>("RouteTo"),
                    PickupDatetime = a.Field <DateTime?>("PickupDateTime"),
                    VehicleName = a["colVehicleVendorNameVarchar"].ToString(),
                    Confirm = a["Confirm"].ToString(),
                    ConfirmBy = a["colConfirmedBy"].ToString(),
                    ConfirmDate = a["colConfirmedDate"].ToString(),
                }
                                   ).ToList();

                if (LoadType == 0)
                {
                    List <SeaportDTO>      listSeaport     = new List <SeaportDTO>();
                    List <NationalityList> listNationality = new List <NationalityList>();
                    List <GenderList>      listGender      = new List <GenderList>();
                    List <RankList>        listRank        = new List <RankList>();
                    List <VehicleRoute>    listRoute       = new List <VehicleRoute>();

                    int iOnCount  = 0;
                    int iOffCount = 0;

                    HttpContext.Current.Session["Immigration_Seaport"]     = listSeaport;
                    HttpContext.Current.Session["Immigration_Nationality"] = listNationality;
                    HttpContext.Current.Session["Immigration_Gender"]      = listGender;
                    HttpContext.Current.Session["Immigration_Rank"]        = listRank;
                    HttpContext.Current.Session["Immigration_Route"]       = listRoute;

                    HttpContext.Current.Session["Immigration_OnCount"]  = iOnCount;
                    HttpContext.Current.Session["Immigration_OffCount"] = iOffCount;



                    dtSeaport   = ds.Tables[2];
                    listSeaport = (from a in dtSeaport.AsEnumerable()
                                   select new SeaportDTO
                    {
                        SeaportIDString = GlobalCode.Field2String(a["colPortIdInt"]),
                        SeaportNameString = GlobalCode.Field2String(a["PortName"]),
                    }).ToList();
                    HttpContext.Current.Session["Immigration_Seaport"] = listSeaport;


                    dtNationality = ds.Tables[3];
                    dtGender      = ds.Tables[4];
                    dtRank        = ds.Tables[5];
                    dtCount       = ds.Tables[6];
                    dtRoute       = ds.Tables[7];


                    listNationality = (from a in dtNationality.AsEnumerable()
                                       select new NationalityList
                    {
                        NationalityID = GlobalCode.Field2Int(a["NationalityID"]),
                        Nationality = GlobalCode.Field2String(a["Nationality"])
                    }).ToList();

                    HttpContext.Current.Session["Immigration_Nationality"] = listNationality;

                    listGender = (from a in dtGender.AsEnumerable()
                                  select new GenderList
                    {
                        GenderID = GlobalCode.Field2Int(a["GenderID"]),
                        Gender = GlobalCode.Field2String(a["Gender"])
                    }).ToList();
                    HttpContext.Current.Session["Immigration_Gender"] = listGender;

                    listRank = (from a in dtRank.AsEnumerable()
                                select new RankList
                    {
                        RankID = GlobalCode.Field2Int(a["RankID"]),
                        Rank = GlobalCode.Field2String(a["Rank"])
                    }).ToList();
                    HttpContext.Current.Session["Immigration_Rank"] = listRank;



                    //int iOnCount = 0;
                    //int iOffCount = 0;

                    if (dtCount.Rows.Count > 0)
                    {
                        var StatusCount = (from a in dtCount.AsEnumerable()
                                           //where GlobalCode.Field2String(a["Status"]).Equals("On")
                                           select new
                        {
                            iCount = GlobalCode.Field2Int(a["StatusCount"]),
                            status = GlobalCode.Field2String(a["Status"])
                        }
                                           ).ToList();
                        if (StatusCount.Count > 0)
                        {
                            var on = (from a in StatusCount
                                      where a.status.ToUpper().Equals("ON")
                                      select new
                            {
                                iCount = a.iCount
                            }).ToList();
                            var off = (from a in StatusCount
                                       where a.status.ToUpper().Equals("OFF")
                                       select new
                            {
                                iCount = a.iCount
                            }).ToList();
                            if (on.Count > 0)
                            {
                                iOnCount = GlobalCode.Field2Int(on[0].iCount);
                            }
                            if (off.Count > 0)
                            {
                                iOffCount = GlobalCode.Field2Int(off[0].iCount);
                            }
                        }
                    }


                    HttpContext.Current.Session["Immigration_OnCount"]  = iOnCount;
                    HttpContext.Current.Session["Immigration_OffCount"] = iOffCount;

                    listRoute = (from a in dtRoute.AsEnumerable()
                                 select new VehicleRoute
                    {
                        RouteID = GlobalCode.Field2Int(a["colRouteIDInt"]),
                        RouteDesc = GlobalCode.Field2String(a["colRouteNameVarchar"]),
                    }).ToList();
                    HttpContext.Current.Session["Immigration_Route"] = listRoute;
                }
                else
                {
                    dtCount = ds.Tables[2];

                    int iOnCount  = 0;
                    int iOffCount = 0;

                    if (dtCount.Rows.Count > 0)
                    {
                        var StatusCount = (from a in dtCount.AsEnumerable()
                                           //where GlobalCode.Field2String(a["Status"]).Equals("On")
                                           select new
                        {
                            iCount = GlobalCode.Field2Int(a["StatusCount"]),
                            status = GlobalCode.Field2String(a["Status"])
                        }
                                           ).ToList();
                        if (StatusCount.Count > 0)
                        {
                            var on = (from a in StatusCount
                                      where a.status.ToUpper().Equals("ON")
                                      select new
                            {
                                iCount = a.iCount
                            }).ToList();
                            var off = (from a in StatusCount
                                       where a.status.ToUpper().Equals("OFF")
                                       select new
                            {
                                iCount = a.iCount
                            }).ToList();
                            if (on.Count > 0)
                            {
                                iOnCount = GlobalCode.Field2Int(on[0].iCount);
                            }
                            if (off.Count > 0)
                            {
                                iOffCount = GlobalCode.Field2Int(off[0].iCount);
                            }
                        }
                    }

                    //CrewAdminTables.Add(new CrewAdminGenericClass()
                    //{
                    //    CrewAdminList = recordList,
                    //    CrewAdminListCount = maxRows,
                    //    OnCount = iOnCount,
                    //    OffCount = iOffCount
                    //});

                    HttpContext.Current.Session["Immigration_OnCount"]  = iOnCount;
                    HttpContext.Current.Session["Immigration_OffCount"] = iOffCount;
                }

                HttpContext.Current.Session["Immigration_Manifest"] = listImmigration;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommand != null)
                {
                    dbCommand.Dispose();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
                if (dtImmigration != null)
                {
                    dtImmigration.Dispose();
                }
                if (dtNationality != null)
                {
                    dtNationality.Dispose();
                }
                if (dtGender != null)
                {
                    dtGender.Dispose();
                }
                if (dtRank != null)
                {
                    dtRank.Dispose();
                }
                if (dtCount != null)
                {
                    dtCount.Dispose();
                }
                if (dtSeaport != null)
                {
                    dtSeaport.Dispose();
                }
                if (dtRoute != null)
                {
                    dtRoute.Dispose();
                }
            }
        }
Esempio n. 24
0
        void insertHotelrequest(string spName, string status)
        {
            int?StatusID = null;

            List <NonTurnRequestBooking> PAH = new List <NonTurnRequestBooking>();

            foreach (ListViewDataItem item in uolistviewHotelInfo.Items)
            {
                if (status == "Cancel")
                {
                    StatusID = 5;
                }
                else
                {
                    StatusID = GlobalCode.Field2Int(((HiddenField)item.FindControl("uoHiddenFieldStatusID")).Value);
                }


                PAH.Add(new NonTurnRequestBooking
                {
                    TransHotelID  = GlobalCode.Field2Long(((HiddenField)item.FindControl("uoHiddenFieldTransHotelID")).Value),
                    TravelReqID   = GlobalCode.Field2Long(((HiddenField)item.FindControl("uoHiddenFieldListTRID")).Value),
                    SeafarerID    = GlobalCode.Field2Long(((Label)item.FindControl("uoLblSfID")).Text),
                    IdBigint      = GlobalCode.Field2Long(((HiddenField)item.FindControl("uoHiddenFieldListRecLocID")).Value),
                    RecordLocator = GlobalCode.Field2String(((Label)item.FindControl("uoLblRecLoc")).Text),
                    SeqNo         = GlobalCode.Field2Int(((HiddenField)item.FindControl("uoHiddenFieldSeqNo")).Value),
                    VendorID      = GlobalCode.Field2Int(uoVendorDropDownList.SelectedItem.Value),
                    RoomTypeID    = ((Label)item.FindControl("uoLblRoom")).Text == "double" ? 2 : 1,
                    CheckIn       = GlobalCode.Field2DateTime(uoTextBoxCheckInDate.Text),
                    CheckOut      = GlobalCode.Field2DateTime(((Label)item.FindControl("uoLblCheckOut")).Text),
                    Duration      = GlobalCode.Field2Int(((Label)item.FindControl("uoLblNites")).Text) <= 0 ? 1 : GlobalCode.Field2Int(((Label)item.FindControl("uoLblNites")).Text),
                    VoucherAmount = GlobalCode.Field2Double(uoHiddenFieldVoucher.Value),
                    ContractID    = GlobalCode.Field2Int(uoHiddenFieldContractID.Value),
                    ApprovedBy    = GlobalCode.Field2String(uoTextBoxConfirmedBy.Text),
                    ApprovedDate  = DateTime.Now.Date,
                    RoomCount     = GlobalCode.Field2Float((((Label)item.FindControl("uoLblRoom"))).Text == "double" ? 0.5 : 1.0),
                    HotelName     = GlobalCode.Field2String(uoTextBoxHotelname.Text),
                    //ConfirmRateMoney = GlobalCode.Field2Double(uoTextBoxRateConfirmed.Text),
                    //ContractedRateMoney = GlobalCode.Field2Double(uoTextBoxRateContract.Text),

                    ConfirmRateMoney    = GlobalCode.Field2Double(((TextBox)item.FindControl("txtContractedRate")).Text),
                    ContractedRateMoney = GlobalCode.Field2Double(((Label)item.FindControl("lblContractedRate")).Text),

                    EmailTo   = GlobalCode.Field2String(uoTextBoxEmailAdd.Text),
                    EmailCC   = GlobalCode.Field2String(uoTextBoxCopy.Text),
                    Comment   = GlobalCode.Field2String(uoTextBoxComment.Text),
                    Currency  = GlobalCode.Field2Int(uoDropDownListCurrency.SelectedItem.Value),
                    ConfirmBy = GlobalCode.Field2String(uoTextBoxConfirmedBy.Text),
                    StatusID  = StatusID,//GlobalCode.Field2Int(((HiddenField)item.FindControl("uoHiddenFieldStatusID")).Value),// == 1 ? 2 : 4 ,
                    IsMedical = GlobalCode.Field2Bool(((HiddenField)item.FindControl("uoHiddenFieldIsMedical")).Value),
                    UserID    = uoHiddenFieldUser.Value
                });
            }

            GlobalCode gc = new GlobalCode();
            DataTable  dt = new DataTable();

            dt = gc.getDataTable(PAH);

            PortBLL = new PortAgentBLL();
            PortBLL.InsertNonTurnTransactionRequestBooking(dt, spName, uoHiddenFieldUser.Value, uoTextBoxEmailAdd.Text, uoTextBoxCopy.Text);
        }
Esempio n. 25
0
        /// ---------------------------------------------
        /// Created By:     Josephine Gad
        /// Date Created:   19/Mar/2014
        /// Description:    Create the XML-excel format file
        /// ---------------------------------------------
        public static void CreateExcel(DataTable dtSource, string strFileName)
        {
            try
            {
                string sPortAgentName = GlobalCode.Field2String(dtSource.Rows[0]["PortAgentName"]);
                sPortAgentName = (sPortAgentName.Trim() == "" ? "PortAgentManifest" : sPortAgentName);

                int iLength;
                iLength = sPortAgentName.Length;
                if (iLength > 25)
                {
                    iLength = 25;
                }

                sPortAgentName = sPortAgentName.Substring(0, iLength);

                // Create XMLWriter
                using (XmlTextWriter xtwWriter = new XmlTextWriter(strFileName, Encoding.UTF8))
                {
                    int iColCount = (dtSource.Columns.Count - 3);
                    //Format the output file for reading easier
                    xtwWriter.Formatting = Formatting.Indented;

                    // <?xml version="1.0"?>
                    xtwWriter.WriteStartDocument();

                    // <?mso-application progid="Excel.Sheet"?>
                    xtwWriter.WriteProcessingInstruction("mso-application", "progid=\"Excel.Sheet\"");

                    // <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet >"
                    xtwWriter.WriteStartElement("Workbook", "urn:schemas-microsoft-com:office:spreadsheet");

                    //Write definition of namespace
                    xtwWriter.WriteAttributeString("xmlns", "o", null, "urn:schemas-microsoft-com:office:office");
                    xtwWriter.WriteAttributeString("xmlns", "x", null, "urn:schemas-microsoft-com:office:excel");
                    xtwWriter.WriteAttributeString("xmlns", "ss", null, "urn:schemas-microsoft-com:office:spreadsheet");
                    xtwWriter.WriteAttributeString("xmlns", "html", null, "http://www.w3.org/TR/REC-html40");

                    // <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
                    xtwWriter.WriteStartElement("DocumentProperties", "urn:schemas-microsoft-com:office:office");

                    // Write document properties
                    xtwWriter.WriteElementString("Author", "Travelmart");
                    xtwWriter.WriteElementString("LastAuthor", Environment.UserName);
                    xtwWriter.WriteElementString("Created", DateTime.Now.ToString("u") + "Z");
                    xtwWriter.WriteElementString("Company", "RCCL");
                    xtwWriter.WriteElementString("Version", "1");

                    // </DocumentProperties>
                    xtwWriter.WriteEndElement();

                    // <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
                    xtwWriter.WriteStartElement("ExcelWorkbook", "urn:schemas-microsoft-com:office:excel");

                    // Write settings of workbook
                    xtwWriter.WriteElementString("WindowHeight", "13170");
                    xtwWriter.WriteElementString("WindowWidth", "17580");
                    xtwWriter.WriteElementString("WindowTopX", "120");
                    xtwWriter.WriteElementString("WindowTopY", "60");
                    xtwWriter.WriteElementString("ProtectStructure", "False");
                    xtwWriter.WriteElementString("ProtectWindows", "False");

                    // </ExcelWorkbook>
                    xtwWriter.WriteEndElement();

                    // <Styles>
                    xtwWriter.WriteStartElement("Styles");

                    // <Style ss:ID="Default" ss:Name="Normal">
                    xtwWriter.WriteStartElement("Style");
                    xtwWriter.WriteAttributeString("ss", "ID", null, "Default");
                    xtwWriter.WriteAttributeString("ss", "Name", null, "Normal");

                    // <Alignment ss:Vertical="Bottom"/>
                    xtwWriter.WriteStartElement("Alignment");
                    xtwWriter.WriteAttributeString("ss", "Vertical", null, "Bottom");
                    xtwWriter.WriteEndElement();

                    // Write null on the other properties
                    xtwWriter.WriteElementString("Borders", null);
                    xtwWriter.WriteElementString("Font", null);
                    xtwWriter.WriteElementString("Interior", null);
                    xtwWriter.WriteElementString("NumberFormat", null);
                    xtwWriter.WriteElementString("Protection", null);
                    // </Style>
                    xtwWriter.WriteEndElement();

                    //Style for header
                    xtwWriter.WriteStartElement("Style");
                    //<Style ss:ID="s62">
                    xtwWriter.WriteAttributeString("ss", "ID", null, "s62");
                    xtwWriter.WriteStartElement("Font");
                    // <Font ss:Bold="1"/>
                    xtwWriter.WriteAttributeString("ss", "Bold", null, "1");
                    //end of font
                    xtwWriter.WriteEndElement();
                    //End Style for header
                    xtwWriter.WriteEndElement();


                    //Style for total summary numbers
                    xtwWriter.WriteStartElement("Style");
                    //<Style ss:ID="s64">
                    xtwWriter.WriteAttributeString("ss", "ID", null, "s64");
                    xtwWriter.WriteStartElement("Alignment");
                    xtwWriter.WriteAttributeString("ss", "Horizontal", null, "Right");
                    xtwWriter.WriteAttributeString("ss", "Vertical", null, "Bottom");
                    xtwWriter.WriteEndElement();
                    //End Style for header
                    xtwWriter.WriteEndElement();


                    //Style for Rows
                    xtwWriter.WriteStartElement("Style");
                    //<Style ss:ID="s64">
                    xtwWriter.WriteAttributeString("ss", "ID", null, "s65");
                    xtwWriter.WriteStartElement("Alignment");
                    xtwWriter.WriteAttributeString("ss", "Horizontal", null, "Left");
                    xtwWriter.WriteAttributeString("ss", "Vertical", null, "Bottom");
                    xtwWriter.WriteEndElement();
                    //End Style for Rows
                    xtwWriter.WriteEndElement();


                    // </Styles>
                    xtwWriter.WriteEndElement();

                    // <Worksheet ss:Name="xxx">
                    xtwWriter.WriteStartElement("Worksheet");
                    xtwWriter.WriteAttributeString("ss", "Name", null, sPortAgentName);

                    // <Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="3" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="60">
                    xtwWriter.WriteStartElement("Table");

                    int iRow = dtSource.Rows.Count + 15;

                    xtwWriter.WriteAttributeString("ss", "ExpandedColumnCount", null, iColCount.ToString());
                    xtwWriter.WriteAttributeString("ss", "ExpandedRowCount", null, iRow.ToString());

                    xtwWriter.WriteAttributeString("x", "FullColumns", null, "1");
                    xtwWriter.WriteAttributeString("x", "FullRows", null, "1");
                    xtwWriter.WriteAttributeString("ss", "DefaultColumnWidth", null, "60");


                    //Header
                    xtwWriter.WriteStartElement("Row");
                    xtwWriter.WriteAttributeString("ss", "StyleID", null, "s62");
                    int i = 1;
                    foreach (DataColumn Header in dtSource.Columns)
                    {
                        if (i <= iColCount)
                        {
                            xtwWriter.WriteStartElement("Cell");
                            // xxx
                            xtwWriter.WriteStartElement("Data");
                            xtwWriter.WriteAttributeString("ss", "Type", null, "String");
                            // Write content of cell
                            xtwWriter.WriteValue(Header.ColumnName);
                            xtwWriter.WriteEndElement();
                            xtwWriter.WriteEndElement();
                        }
                        i++;
                    }
                    xtwWriter.WriteEndElement();


                    // Run through all rows of data source
                    foreach (DataRow row in dtSource.Rows)
                    {
                        // <Row>
                        xtwWriter.WriteStartElement("Row");
                        xtwWriter.WriteAttributeString("ss", "StyleID", null, "s65");

                        i = 1;
                        // Run through all cell of current rows
                        foreach (object cellValue in row.ItemArray)
                        {
                            if (i <= iColCount)
                            {
                                // <Cell>
                                xtwWriter.WriteStartElement("Cell");

                                // <Data ss:Type="String">xxx</Data>
                                xtwWriter.WriteStartElement("Data");

                                if (dtSource.Columns[i - 1].Caption.ToUpper() == "EMPLOYEEID" ||
                                    dtSource.Columns[i - 1].Caption.ToUpper() == "HOTELNITES" ||
                                    dtSource.Columns[i - 1].Caption.ToUpper() == "SINGLEDOUBLE" ||
                                    dtSource.Columns[i - 1].Caption.ToUpper() == "VOUCHER" ||
                                    dtSource.Columns[i - 1].Caption.ToUpper() == "CONTRACTEDRATE" ||
                                    dtSource.Columns[i - 1].Caption.ToUpper() == "CONFIRMEDRATE")
                                {
                                    xtwWriter.WriteAttributeString("ss", "Type", null, "Number");
                                }
                                //check cost center if number or not
                                else if (dtSource.Columns[i - 1].Caption.ToUpper() == "COSTCENTER")
                                {
                                    if (GlobalCode.Field2Long(cellValue) > 0)
                                    {
                                        xtwWriter.WriteAttributeString("ss", "Type", null, "Number");
                                    }
                                    else
                                    {
                                        xtwWriter.WriteAttributeString("ss", "Type", null, "String");
                                    }
                                }
                                else
                                {
                                    xtwWriter.WriteAttributeString("ss", "Type", null, "String");
                                }
                                // Write content of cell
                                xtwWriter.WriteValue(cellValue);

                                // </Data>
                                xtwWriter.WriteEndElement();

                                // </Cell>
                                xtwWriter.WriteEndElement();
                            }
                            i++;
                        }
                        // </Row>
                        xtwWriter.WriteEndElement();
                    }

                    // </Table>
                    xtwWriter.WriteEndElement();

                    // <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
                    xtwWriter.WriteStartElement("WorksheetOptions", "urn:schemas-microsoft-com:office:excel");

                    // Write settings of page
                    xtwWriter.WriteStartElement("PageSetup");
                    xtwWriter.WriteStartElement("Header");
                    xtwWriter.WriteAttributeString("x", "Margin", null, "0.4921259845");
                    xtwWriter.WriteEndElement();
                    xtwWriter.WriteStartElement("Footer");
                    xtwWriter.WriteAttributeString("x", "Margin", null, "0.4921259845");
                    xtwWriter.WriteEndElement();
                    xtwWriter.WriteStartElement("PageMargins");
                    xtwWriter.WriteAttributeString("x", "Bottom", null, "0.984251969");
                    xtwWriter.WriteAttributeString("x", "Left", null, "0.78740157499999996");
                    xtwWriter.WriteAttributeString("x", "Right", null, "0.78740157499999996");
                    xtwWriter.WriteAttributeString("x", "Top", null, "0.984251969");
                    xtwWriter.WriteEndElement();
                    xtwWriter.WriteEndElement();

                    // <Selected/>
                    xtwWriter.WriteElementString("Selected", null);

                    // <Panes>
                    xtwWriter.WriteStartElement("Panes");

                    // <Pane>
                    xtwWriter.WriteStartElement("Pane");

                    // Write settings of active field
                    xtwWriter.WriteElementString("Number", "1");
                    xtwWriter.WriteElementString("ActiveRow", "1");
                    xtwWriter.WriteElementString("ActiveCol", "1");

                    // </Pane>
                    xtwWriter.WriteEndElement();

                    // </Panes>
                    xtwWriter.WriteEndElement();

                    // <ProtectObjects>False</ProtectObjects>
                    xtwWriter.WriteElementString("ProtectObjects", "False");

                    // <ProtectScenarios>False</ProtectScenarios>
                    xtwWriter.WriteElementString("ProtectScenarios", "False");

                    // </WorksheetOptions>
                    xtwWriter.WriteEndElement();

                    // </Worksheet>
                    xtwWriter.WriteEndElement();

                    // </Workbook>
                    xtwWriter.WriteEndElement();

                    // Write file on hard disk
                    xtwWriter.Flush();
                    xtwWriter.Close();

                    //FileInfo FileName = new FileInfo(strFileName);
                    //FileStream fs = new FileStream(FileName.FullName, FileMode.Create);
                    //fs.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dtSource != null)
                {
                    dtSource.Dispose();
                }
            }
        }
        /// <summary>
        /// Author:         Josephine Gad
        /// Date Created:   10/Apr/2014
        /// Description:    Bind LisView Manifest, Manifest to Cancel, vendor name and other details
        /// </summary>
        private void BindListViewManifest()
        {
            //Bind New Hotel Request
            List <PortAgentHotelManifestList> listHotel = new List <PortAgentHotelManifestList>();

            if (Session["PortAgentHotelManifestListToConfirmToAdd"] != null)
            {
                listHotel = (List <PortAgentHotelManifestList>)Session["PortAgentHotelManifestListToConfirmToAdd"];
            }
            uolistviewHotelInfo.DataSource = listHotel;
            uolistviewHotelInfo.DataBind();

            //Bind Cancelled Hotel
            List <PortAgentHotelManifestList> listHotelCancel = new List <PortAgentHotelManifestList>();

            if (Session["PortAgentHotelManifestListToConfirmToCancel"] != null)
            {
                listHotelCancel = (List <PortAgentHotelManifestList>)Session["PortAgentHotelManifestListToConfirmToCancel"];
            }
            uoListViewCancelDetails.DataSource = listHotelCancel;
            uoListViewCancelDetails.DataBind();


            uoHiddenFieldCountAdd.Value    = GlobalCode.Field2String(listHotel.Count);
            uoHiddenFieldCountDelete.Value = GlobalCode.Field2String(listHotelCancel.Count);


            uoTextBoxCheckInDate.Text = "";
            string sCurrency = "0";

            System.DateTime?checkindate     = null;
            System.DateTime?dtEndcontract   = null;
            System.DateTime?dtBegincontract = null;

            if (listHotel.Count > 0)
            {
                uoTextBoxCheckInDate.Text = string.Format("{0:dd-MMM-yyyy}", listHotel[0].Checkin);

                checkindate = listHotel[0].Checkin;

                if (listHotel[0].RateContracted > 0)
                {
                    uoTextBoxRateContract.Text = string.Format("{0:#,##0.00}", listHotel[0].RateContracted);
                }
                if (listHotel[0].RateConfirmed > 0)
                {
                    uoTextBoxRateConfirmed.Text = string.Format("{0:#,##0.00}", listHotel[0].RateConfirmed);
                }
                uoTextBoxConfirmation.Text = GlobalCode.Field2String(listHotel[0].ConfirmationNo).Trim();
                uoTextBoxHotelname.Text    = listHotel[0].HotelName;

                sCurrency = GlobalCode.Field2Int(listHotel[0].CurrencyID).ToString();
            }
            else
            {
                if (listHotelCancel.Count > 0)
                {
                    uoTextBoxCheckInDate.Text = string.Format("{0:dd-MMM-yyyy}", listHotelCancel[0].Checkin);
                    checkindate = listHotelCancel[0].Checkin;
                }
            }

            if (uoDropDownListCurrency.Items.FindByValue(sCurrency) != null)
            {
                uoDropDownListCurrency.SelectedValue = sCurrency;
            }

            uoTextBoxVendor.Text = "";
            List <PortAgentDTO> listPortAgent = new List <PortAgentDTO>();

            if (Session["PortAgentDetails"] != null)
            {
                listPortAgent = (List <PortAgentDTO>)Session["PortAgentDetails"];
                if (listPortAgent.Count > 0)
                {
                    uoTextBoxVendor.Text             = listPortAgent[0].PortAgentName;
                    uoHiddenfieldEndOfContract.Value = listPortAgent[0].EndOfContract.ToString();
                    dtEndcontract   = listPortAgent[0].EndOfContract;
                    dtBegincontract = listPortAgent[0].BeginOfContract;
                }
            }
            uoTextBoxEmailAdd.Text = GlobalCode.Field2String(Session["PortAgentEmailVendor"]);


            System.TimeSpan?diffResult = dtEndcontract - checkindate;

            uoButtonEmail.Enabled = true;

            if (listHotel.Count > 0)
            {
                if (GlobalCode.Field2Long(diffResult.Value.Days) < 0)
                {
                    uoHiddenfieldEndOfContract.Value = "Contract not valid for requested date!!! \n valid date between " + dtBegincontract.Value.Month + "/" + dtBegincontract.Value.Day + "/" + dtBegincontract.Value.Year + " and " + dtEndcontract.Value.Month + "/" + dtEndcontract.Value.Day + "/" + dtEndcontract.Value.Year;// dtEndcontract.Value.Date.ToString();
                    AlertContractMessages("Contract not valid for requested date!!! \n valid date between " + dtBegincontract.ToString() + " and " + dtEndcontract.ToString());

                    uoButtonEmail.Enabled = false;
                }
            }
        }
Esempio n. 27
0
        private List <CrewImmigration> ProcessCrewImmigration(DataSet ds)
        {
            List <CrewImmigration> immigration = new List <CrewImmigration>();

            try
            {
                string  user_id = "", jde_id = "";
                DataRow dr;
                if (ds.Tables[7].Rows.Count > 0)
                {
                    dr      = ds.Tables[7].Rows[0];
                    user_id = dr["user_id"].ToString();
                    jde_id  = dr["jde_id"].ToString();
                }

                immigration = (from a in ds.Tables[0].AsEnumerable()
                               select new CrewImmigration
                {
                    CrewVericationID = GlobalCode.Field2Long(a["colCrewVericationIDBigint"]),
                    SeaparerID = GlobalCode.Field2Long(a["IDNumber"]),
                    FirstName = GlobalCode.Field2String(a["FirstName"]),
                    LastName = GlobalCode.Field2String(a["LastName"]),
                    LOEControlNumber = GlobalCode.Field2String(a["LOEControlNumber"]),
                    Nationality = GlobalCode.Field2String(a["NationalityName"]),
                    ContactNo = GlobalCode.Field2String(a["ContactNo"]),
                    EmailAdd = GlobalCode.Field2String(a["EmailAdd"]),
                    PassportNo = GlobalCode.Field2String(a["PassportNo"]),
                    PassportExpiredate = GlobalCode.Field2DateTimeNull(a["ExpirationDate"]) == null ? null : GlobalCode.Field2DateTime(a["ExpirationDate"]).ToString("MM/dd/yyyy"),
                    PassportIssuedate = GlobalCode.Field2String(a["IssueDate"]),
                    Vessel = GlobalCode.Field2String(a["Ship"]),
                    Brand = GlobalCode.Field2String(a["BrandName"]),
                    SignOnDate = GlobalCode.Field2DateTime(a["SignOnDateAdj"]),
                    Seaport = GlobalCode.Field2String(a["PortName"]),
                    Rank = GlobalCode.Field2String(a["PositionName"]),
                    NewHire = GlobalCode.Field2Bool(a["NewHire"]),
                    Joindate = GlobalCode.Field2DateTime(a["SignOnDateAdj"]),
                    JoinPort = GlobalCode.Field2String(a["SeaportCode"]),
                    JoinCity = GlobalCode.Field2String(a["AirportCode"]),
                    DateHired = GlobalCode.Field2DateTimeNull(a["DateHired"]),
                    Reason = GlobalCode.Field2Int(a["colReasonInt"]),
                    IsFraudulentDoc = GlobalCode.Field2Bool(a["colIsFraudulentDocBit"]),
                    IsPriorImmigIssues = GlobalCode.Field2Bool(a["colIsPriorImmigIssuesBit"]),
                    IsPriorConDep = GlobalCode.Field2Bool(a["colIsPriorConDepBit"]),
                    IsOther = GlobalCode.Field2Bool(a["colIsOtherBit"]),
                    OtherDetail = GlobalCode.Field2String(a["colOtherDetailVarchar"]),
                    IsApproved = GlobalCode.Field2Bool(a["colIsApprovedBit"]),
                    DateOfBirth = GlobalCode.Field2DateTimeNull(a["DateOfBirth"]),
                    UserName = GlobalCode.Field2String(a["UserName"]),
                    ProcessDate = GlobalCode.Field2DateTimeNull(a["ProcessDate"]),

                    ImmigrationAirTransaction = (from n in ds.Tables[1].AsEnumerable()
                                                 select new ImmigrationAirTransaction
                    {
                        SeqNo = GlobalCode.Field2Int(n["colSeqNoInt"]),
                        AirLine = GlobalCode.Field2String(n["AirlineName"]),
                        DepartureDateTime = GlobalCode.Field2DateTime(n["DepartureDateTime"]),
                        ArrivalDateTime = GlobalCode.Field2DateTime(n["ArrivalDateTime"]),
                        DepartureAirportLocationCode = GlobalCode.Field2String(n["DepartureAirportCode"]),
                        ArrivalAirportLocationCode = GlobalCode.Field2String(n["ArrivalAirportCode"]),
                    }).ToList(),


                    ImmigrationHotelBooking = (from i in ds.Tables[2].AsEnumerable()
                                               select new ImmigrationHotelBooking
                    {
                        BranchName = GlobalCode.Field2String(i["BranchName"]),
                        TimeSpanStartDate = GlobalCode.Field2DateTime(i["CheckInDate"]),
                        TimeSpanStartTime = GlobalCode.Field2DateTime(i["CheckInTime"]),
                        TimeSpanEndDate = GlobalCode.Field2DateTime(i["CheckOutDate"]),
                        TimeSpanEndTime = GlobalCode.Field2DateTime(i["CheckOutTime"]),
                        TimeSpanDurationInt = GlobalCode.Field2Int(i["TimeSpanDuration"]),
                        RoomType = GlobalCode.Field2String(i["RoomType"]),
                        ForeColor = GlobalCode.Field2String(i["coldForeColorVarchar"]),
                        ColorCode = GlobalCode.Field2String(i["colColorCodevarchar"]),
                    }).ToList(),

                    ImmigrationTransportion = (from e in ds.Tables[3].AsEnumerable()
                                               select new ImmigrationTransportion
                    {
                        VehicleVendorName = GlobalCode.Field2String(e["Transportation"]),
                        RouteFrom = GlobalCode.Field2String(e["RouteFrom"]),
                        RouteTo = GlobalCode.Field2String(e["RouteTo"]),
                        PickUpDate = GlobalCode.Field2DateTime(e["colPickUpDate"]),
                        PickUpTime = GlobalCode.Field2DateTime(e["colPickUpTime"]),
                        ForeColor = GlobalCode.Field2String(e["coldForeColorVarchar"]),
                        ColorCode = GlobalCode.Field2String(e["colColorCodevarchar"]),
                    }).ToList(),

                    ImmigrationEmploymentHistory = (from b in ds.Tables[4].AsEnumerable()
                                                    select new ImmigrationEmploymentHistory
                    {
                        CrewVericationID = GlobalCode.Field2Long(b["colCrewVericationIDBigint"]),
                        SeaparerID = GlobalCode.Field2Long(b["IDNumber"]),
                        FirstName = GlobalCode.Field2String(b["FirstName"]),
                        LastName = GlobalCode.Field2String(b["LastName"]),
                        LOEControlNumber = GlobalCode.Field2String(b["LOEControlNumber"]),
                        Nationality = GlobalCode.Field2String(b["NationalityName"]),
                        ContactNo = GlobalCode.Field2String(b["ContactNo"]),
                        EmailAdd = GlobalCode.Field2String(b["EmailAdd"]),
                        PassportNo = GlobalCode.Field2String(b["PassportNo"]),
                        PassportExpiredate = GlobalCode.Field2DateTime(b["ExpirationDate"]).ToString("MM/dd/yyyy"),
                        PassportIssuedate = GlobalCode.Field2String(b["IssueDate"]),
                        Vessel = GlobalCode.Field2String(b["Ship"]),
                        Brand = GlobalCode.Field2String(b["BrandName"]),
                        SignOnDate = GlobalCode.Field2DateTime(b["SignOnDate"]),
                        Seaport = GlobalCode.Field2String(b["PortName"]),
                        NewHire = GlobalCode.Field2Bool(b["NewHire"]),
                        Joindate = GlobalCode.Field2DateTime(b["SignOnDate"]),
                        JoinPort = GlobalCode.Field2String(b["SeaportCode"]),
                        JoinCity = GlobalCode.Field2String(b["AirportCode"]),
                        DateHired = GlobalCode.Field2DateTime(b["DateHired"]),
                        Reason = GlobalCode.Field2Int(b["colReasonInt"]),
                        IsFraudulentDoc = GlobalCode.Field2Bool(b["colIsFraudulentDocBit"]),
                        IsPriorImmigIssues = GlobalCode.Field2Bool(b["colIsPriorImmigIssuesBit"]),
                        IsPriorConDep = GlobalCode.Field2Bool(b["colIsPriorConDepBit"]),
                        IsOther = GlobalCode.Field2Bool(b["colIsOtherBit"]),
                        OtherDetail = GlobalCode.Field2String(b["colOtherDetailVarchar"]),
                        IsApproved = GlobalCode.Field2Bool(b["colIsApprovedBit"]),
                        DateOfBirth = GlobalCode.Field2DateTime(b["DateOfBirth"]),
                        ShipID = GlobalCode.Field2Int(b["ShipID"]),
                        Ship = GlobalCode.Field2String(b["Ship"]),
                        RankID = GlobalCode.Field2Int(b["RankID"]),
                        Rank = GlobalCode.Field2String(b["PositionName"]),
                        ColorCode = GlobalCode.Field2String(b["ColorCode"]),
                        ForeColor = GlobalCode.Field2String(b["ForeColor"]),
                    }).ToList(),

                    SeafarerImage = (from k in ds.Tables[5].AsEnumerable()
                                     where GlobalCode.Field2Long(k["SeafarerID"]) == GlobalCode.Field2Long(a["IDNumber"])
                                     select new SeafarerImage
                    {
                        SeaparerID = GlobalCode.Field2Int(k["SeafarerID"]),
                        Image = GlobalCode.Field2PictureByte(k["PictureImage"]),
                        ImageType = GlobalCode.Field2String(k["PictureType"]),
                    }).ToList(),

                    Parent = (from p in ds.Tables[6].AsEnumerable()
                              select new EmployeeParent
                    {
                        EmployeeID = GlobalCode.Field2Long(p["EmployeeID"]),
                        FatherName = GlobalCode.Field2String(p["FatherName"]),
                        MotherName = GlobalCode.Field2String(p["MotherName"]),
                    }).ToList(),

                    CtracDetail = new CtracDetail {
                        user_id = user_id, jde_id = jde_id
                    }
                }).ToList();
            }
            catch (Exception ex) {
                throw ex;
            }

            return(immigration);
        }
Esempio n. 28
0
        /// <summary>
        /// Author:         Josephine Gad
        /// Date            29/Jan/2015
        /// Description:    Get Forecast from Micro
        /// </summary>
        /// <returns></returns>
        public List <HotelForecastForApprovalList> GetForecastManifestList(string sBranchName,
                                                                           string sDateFrom, string sDateTo,
                                                                           string sVesselCode, int sPortID,
                                                                           string sUser, string sRole, bool bIsHotelVendorView,
                                                                           Int16 LoadType, bool bShowAll, int StartRow, int MaxRow)
        {
            List <HotelForecastForApprovalList> list = new List <HotelForecastForApprovalList>();
            List <HotelForecastCurrency>        listCurrencySelected = new List <HotelForecastCurrency>();
            List <Currency> listCurrency = new List <Currency>();

            Database  db        = ConnectionSetting.GetConnection(); //  DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = null;

            Int32     maxRows    = 0;
            DataTable dt         = null;
            DataTable dtNoOfDays = null;

            DataTable dtCurrencySelected = null;
            DataTable dtCurrency         = null;
            DataTable dtHotelBranch      = null;

            DataSet ds = null;

            try
            {
                dbCommand = db.GetStoredProcCommand("uspHotelForecastGet");

                db.AddInParameter(dbCommand, "@pLoadType", DbType.Int16, LoadType);
                db.AddInParameter(dbCommand, "@pUserId", DbType.String, sUser);
                db.AddInParameter(dbCommand, "@pBranchName", DbType.String, sBranchName);

                db.AddInParameter(dbCommand, "@pDateFrom", DbType.DateTime, GlobalCode.Field2DateTime(sDateFrom));
                db.AddInParameter(dbCommand, "@pDateTo", DbType.DateTime, GlobalCode.Field2DateTime(sDateTo));

                db.AddInParameter(dbCommand, "@pVesselCode", DbType.String, "");

                db.AddInParameter(dbCommand, "@pAirportCode", DbType.String, "");
                db.AddInParameter(dbCommand, "@pHotelVendorView", DbType.Boolean, bIsHotelVendorView);

                db.AddInParameter(dbCommand, "@pShowAll", DbType.Boolean, bShowAll);


                //db.AddInParameter(dbCommand, "@pStartRow", DbType.String, StartRow);
                //db.AddInParameter(dbCommand, "@pMaxRow", DbType.String, MaxRow);
                //db.AddInParameter(dbCommand, "@pLoadType", DbType.String, LoadType);

                ds      = db.ExecuteDataSet(dbCommand);
                dt      = ds.Tables[1];
                maxRows = Int32.Parse(ds.Tables[0].Rows[0][0].ToString());


                list = (from a in dt.AsEnumerable()
                        select new HotelForecastForApprovalList
                {
                    colBranchIDInt = GlobalCode.Field2Long(a["colBranchIDInt"]),
                    colDate = GlobalCode.Field2DateTime(a["colDate"]),

                    // Confirmed_DBL = GlobalCode.Field2Int(a["Confirmed_DBL"]),
                    // Overflow_DBL = GlobalCode.Field2Int(a["Overflow_DBL"]),

                    // Confirmed_SGL = GlobalCode.Field2Int(a["Confirmed_SGL"]),
                    // Overflow_SGL = GlobalCode.Field2Int(a["Overflow_SGL"]),

                    Forecast_DBL = GlobalCode.Field2Int(a["colForecastDBL"]),
                    Forecast_SGL = GlobalCode.Field2Int(a["colForecastSGL"]),

                    Forecast_DBL_Adj = GlobalCode.Field2Int(a["colForecastDBLAdj"]),
                    Forecast_SGL_Adj = GlobalCode.Field2Int(a["colForecastSGLAdj"]),

                    RoomBlock_DBL = GlobalCode.Field2Int(a["colRoomBlockDBL"]),
                    RoomBlock_SGL = GlobalCode.Field2Int(a["colRoomBlockSGL"]),

                    RoomBlock_DBL_Total = GlobalCode.Field2Int(a["colRoomBlockDBLTotal"]),
                    RoomBlock_SGL_Total = GlobalCode.Field2Int(a["colRoomBlockSGLTotal"]),

                    TMBooked_DBL = GlobalCode.Field2Float(a["colTMBookedDBL"]),
                    TMBooked_SGL = GlobalCode.Field2Float(a["colTMBookedSGL"]),

                    ToBeAdded_DBL = GlobalCode.Field2Int(a["colToAddDBL"]),
                    ToBeAdded_SGL = GlobalCode.Field2Int(a["colToAddSGL"]),

                    IsEnable = GlobalCode.Field2Bool(a["colIsEnableBit"]),

                    Forecast_DBL_Old = GlobalCode.Field2Int(a["colForecastDBLOld"]),
                    Forecast_SGL_Old = GlobalCode.Field2Int(a["colForecastSGLOld"]),

                    ToBeAdded_DBL_Suggested = GlobalCode.Field2Int(a["colToAddDBLSuggested"]),
                    ToBeAdded_SGL_Suggested = GlobalCode.Field2Int(a["colToAddSGLSuggested"]),

                    Remarks = a.Field <string>("colRemarksVarchar"),

                    ApprovedDBL = GlobalCode.Field2Int(a["colApprovedDBL"]),
                    ApprovedSGL = GlobalCode.Field2Int(a["colApprovedSGL"]),
                    ActionDone = a.Field <string>("colActionVarchar"),

                    IsLinkToRequestVisibleDBL = GlobalCode.Field2Bool(a["IsLinkToRequestVisibleDBL"]),
                    IsLinkToRequestVisibleSGL = GlobalCode.Field2Bool(a["IsLinkToRequestVisibleSGL"]),

                    IsNeededHotelVisibleDBL = GlobalCode.Field2Bool(a["IsNeededHotelVisibleDBL"]),
                    IsNeededHotelVisibleSGL = GlobalCode.Field2Bool(a["IsNeededHotelVisibleSGL"]),

                    RoomToDropDBL = GlobalCode.Field2Int(a["colRoomToDropDBL"]),
                    RoomToDropSGL = GlobalCode.Field2Int(a["colRoomToDropSGL"]),

                    RoomToDropColorDBL = a.Field <string>("RoomToDropColorDBL"),
                    RoomToDropColorSGL = a.Field <string>("RoomToDropColorSGL"),

                    RatePerDayMoneySGL = GlobalCode.Field2Float(a["colRatePerDayMoneySGL"]),
                    RatePerDayMoneyDBL = GlobalCode.Field2Float(a["colRatePerDayMoneyDBL"]),
                    CurrencyID = GlobalCode.Field2Int(a["colCurrencyIDInt"]),
                    RoomRateTaxPercentage = GlobalCode.Field2Float(a["colRoomRateTaxPercentage"]),
                    RoomRateIsTaxInclusive = GlobalCode.Field2Bool(a["colRoomRateIsTaxInclusive"]),

                    IsRoomToDropVisibleToVendorBDL = GlobalCode.Field2Bool(a["IsRoomToDropVisibleToVendorBDL"]),
                    IsRoomToDropVisibleToVendorSGL = GlobalCode.Field2Bool(a["IsRoomToDropVisibleToVendorSGL"]),

                    IsRCCLApprovalVisible = GlobalCode.Field2Bool(a["IsRCCLApprovalVisible"]),
                    MessageToVendor = GlobalCode.Field2String(a["MessageToVendor"]),
                    CurrencyName = GlobalCode.Field2String(a["CurrencyName"]),
                }).ToList();

                HttpContext.Current.Session["HotelForecastMicroApproval_Count"] = GlobalCode.Field2Int(maxRows);

                dtCurrencySelected   = ds.Tables[2];
                listCurrencySelected = (from a in dtCurrencySelected.AsEnumerable()
                                        select new HotelForecastCurrency
                {
                    CurrencyID = GlobalCode.Field2Int(a["CurrencyID"]),
                    CurrencyName = a.Field <string>("CurrencyName"),

                    RateMoney = GlobalCode.Field2Decimal(a["RateMoney"]),
                    IsTaxInclusive = GlobalCode.Field2Bool(a["IsTaxInclusive"]),
                    Tax = GlobalCode.Field2Decimal(a["TaxPercentage"]),
                    RoomTypeID = GlobalCode.Field2TinyInt(a["colRoomTypeIDInt"]),
                }).ToList();

                HttpContext.Current.Session["HotelForecastMicroApproval_CurrencySelected"] = listCurrencySelected;

                dtHotelBranch = ds.Tables[3];
                List <ContractHotel> listBranch = new List <ContractHotel>();
                listBranch = (from a in dtHotelBranch.AsEnumerable()
                              select new ContractHotel
                {
                    contractID = GlobalCode.Field2Long(a["colContractIdInt"]),
                    contractStatus = GlobalCode.Field2String(a["colContractStatusVarchar"]),
                    contractStartDate = a.Field <DateTime?>("colContractDateStartedDate"),
                    contractEndDate = a.Field <DateTime?>("colContractDateEndDate"),
                }).ToList();
                HttpContext.Current.Session["HotelForecastMicroApproval_ContractHotel"] = listBranch;


                if (LoadType == 0)
                {
                    dtNoOfDays = ds.Tables[4];
                    TMSettings.NoOfDaysForecast       = GlobalCode.Field2TinyInt(dtNoOfDays.Rows[0]["colNoOfDays_Forecast"]);
                    TMSettings.NoOfDaysForecastVendor = GlobalCode.Field2TinyInt(dtNoOfDays.Rows[0]["colNoOfDays_Forecast_Vendor"]);


                    //dtCurrency = ds.Tables[5];
                    //listCurrency = (from a in dtCurrency.AsEnumerable()
                    //                select new Currency
                    //                {
                    //                    CurrencyID = GlobalCode.Field2Int(a["colCurrencyIDInt"]),
                    //                    CurrencyName = a.Field<string>("colCurrencyNameVarchar"),
                    //                }).ToList();

                    //HttpContext.Current.Session["HotelForecastMicroApproval_Currency"] = listCurrency;
                }
                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommand != null)
                {
                    dbCommand.Dispose();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
                if (dt != null)
                {
                    dt.Dispose();
                }
                if (dtCurrency != null)
                {
                    dtCurrency.Dispose();
                }
                if (dtCurrencySelected != null)
                {
                    dtCurrencySelected.Dispose();
                }
                if (dtNoOfDays != null)
                {
                    dtNoOfDays.Dispose();
                }
                if (dtHotelBranch != null)
                {
                    dtHotelBranch.Dispose();
                }
                if (list != null)
                {
                    list = null;
                }
            }
        }
Esempio n. 29
0
        private void InsertDriverTransaction()
        {
            try
            {
                VehicleManifestBLL BLL = new VehicleManifestBLL();
                DriverTransaction  d   = new DriverTransaction();

                DataTable dtparam = DriverTransaction();
                DataTable gtparam = GreeterTransaction();

                DataRow dr;

                HiddenField ConfirmedManifestID;
                HiddenField DriverRequestID;
                HiddenField uodfDriverPickupLatitude;
                HiddenField uodfDriverPickupLongitude;
                HiddenField uodfDriverDropOffLatitude;
                HiddenField uodfDriverDropOffLongitude;
                HiddenField uodfDriverParkingLatitude;
                HiddenField uodfDriverParkingLongitude;


                Label   Pickupdate;
                TextBox PickupTime;
                TextBox PickupLocation;
                TextBox DropOffLocation;


                foreach (ListViewDataItem list in uoListViewManifestConfirm.Items)
                {
                    ConfirmedManifestID = (HiddenField)list.FindControl("uoHiddenFieldConfirmedManifestID");
                    DriverRequestID     = (HiddenField)list.FindControl("uoHiddenFieldDriverRequestID");

                    uodfDriverPickupLatitude   = (HiddenField)list.FindControl("uodfDriverPickupLatitude");
                    uodfDriverPickupLongitude  = (HiddenField)list.FindControl("uodfDriverPickupLongitude");
                    uodfDriverDropOffLatitude  = (HiddenField)list.FindControl("uodfDriverDropOffLatitude");
                    uodfDriverDropOffLongitude = (HiddenField)list.FindControl("uodfDriverDropOffLongitude");
                    uodfDriverParkingLatitude  = (HiddenField)list.FindControl("uodfDriverParkingLatitude");
                    uodfDriverParkingLongitude = (HiddenField)list.FindControl("uodfDriverParkingLongitude");


                    Pickupdate      = (Label)list.FindControl("lblPickupDate");
                    PickupTime      = (TextBox)list.FindControl("txtPickupTime");
                    PickupLocation  = (TextBox)list.FindControl("txtPickupLocation");
                    DropOffLocation = (TextBox)list.FindControl("txtDropOffLocation");

                    if (GlobalCode.Field2Int(uoDropDownListDriver.SelectedIndex) > 0)
                    {
                        dr = dtparam.NewRow();
                        dr["DriverRequestID"] = GlobalCode.Field2Long(DriverRequestID.Value);
                        dr["UserID"]          = uoDropDownListDriver.SelectedItem.Value;
                        dr["PickupDate"]      = GlobalCode.Field2DateTime(Pickupdate.Text);
                        dr["PickupTime"]      = GlobalCode.Field2DateTime(PickupTime.Text);

                        dr["ParkingLocation"]  = GlobalCode.Field2String(uoTextBoxPakingLocation.Text);
                        dr["ParkingLatitude"]  = GlobalCode.Field2Double(uodfDriverParkingLatitude.Value);
                        dr["ParkingLongitude"] = GlobalCode.Field2Double(uodfDriverParkingLongitude.Value);

                        dr["PickupLocation"]  = GlobalCode.Field2String(PickupLocation.Text);
                        dr["PickupLatitude"]  = GlobalCode.Field2Double(uodfDriverPickupLatitude.Value);
                        dr["PickupLongitude"] = GlobalCode.Field2Double(uodfDriverPickupLongitude.Value);

                        dr["DropOffLocation"]  = GlobalCode.Field2String(DropOffLocation.Text);
                        dr["DropOffLatitude"]  = GlobalCode.Field2Double(uodfDriverDropOffLatitude.Value);
                        dr["DropOffLongitude"] = GlobalCode.Field2Double(uodfDriverParkingLongitude);

                        dr["VehicleDetailID"]     = GlobalCode.Field2Int(uoHiddenFieldVehicleHotelSPID.Value);
                        dr["ConfirmedManifestID"] = GlobalCode.Field2Long(ConfirmedManifestID.Value);

                        dtparam.Rows.Add(dr);
                    }


                    if (GlobalCode.Field2Int(uoDropDownListGreeter.SelectedIndex) > 0)
                    {
                        dr = gtparam.NewRow();
                        dr["GreeterRequestID"]    = GlobalCode.Field2Long(DriverRequestID.Value);
                        dr["UserID"]              = uoDropDownListGreeter.SelectedItem.Value;
                        dr["PickupDate"]          = GlobalCode.Field2DateTime(Pickupdate.Text);
                        dr["PickupTime"]          = GlobalCode.Field2DateTime(PickupTime.Text);
                        dr["PickupLocation"]      = GlobalCode.Field2String(PickupLocation.Text);
                        dr["PickupLatitude"]      = GlobalCode.Field2Double(uodfGreeterPickupLatitude.Value);
                        dr["PickupLongitude"]     = GlobalCode.Field2Double(uodfGreeterPickupLongitude.Value);
                        dr["DropOffLocation"]     = GlobalCode.Field2String(DropOffLocation.Text);
                        dr["DropOffLatitude"]     = GlobalCode.Field2Double(uodfGreeterDropOffLatitude.Value);
                        dr["DropOffLongitude"]    = GlobalCode.Field2Double(uodfGreterDropOffLongitude.Value);
                        dr["ConfirmedManifestID"] = GlobalCode.Field2Long(ConfirmedManifestID.Value);
                        gtparam.Rows.Add(dr);
                    }
                }

                BLL.SaveDriverTransaction(GlobalCode.Field2Int(uoHiddenFieldVendorID.Value), uoHiddenFieldsUserID.Value, uoHiddenFieldcmfid.Value, dtparam, gtparam);


                OpenParentPage("Created successfully.");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 30
0
        /// <summary>
        /// ===============================================================
        /// Modified By:    Josephine Gad
        /// Date Created:   17/Mar/2013
        /// Description:    Change List to Void
        ///                 Assign Session values here
        /// ===============================================================
        /// </summary>
        public static void GetNonTurnPortNotInTM(DateTime Date, string UserId, string PortCode, string OrderBy)
        {
            Database  db          = ConnectionSetting.GetConnection(); //  DatabaseFactory.CreateDatabase();
            DbCommand dbCommand   = null;
            DataSet   ds          = null;
            DataTable dtNew       = null;
            DataTable dtConfirmed = null;
            DataTable dtCancelled = null;
            DataTable dtEmail     = null;

            try
            {
                List <NonTurnPortsList> NonTurnPortsList = new List <NonTurnPortsList>();
                HttpContext.Current.Session["PortNotExistExceptionList"] = NonTurnPortsList;

                dbCommand = db.GetStoredProcCommand("uspGetNonTurnPortsNoInTM");
                db.AddInParameter(dbCommand, "@pDate", DbType.Date, Date);
                db.AddInParameter(dbCommand, "@pUserId", DbType.String, UserId);
                db.AddInParameter(dbCommand, "@pPortCode", DbType.String, PortCode);
                db.AddInParameter(dbCommand, "@pOrderby", DbType.String, OrderBy);

                ds = db.ExecuteDataSet(dbCommand);

                dtNew = ds.Tables[0];

                NonTurnPortsList = (from a in dtNew.AsEnumerable()
                                    select new NonTurnPortsList
                {
                    IDBigInt = GlobalCode.Field2Long(a["IDBigInt"]),
                    TravelReqID = GlobalCode.Field2Long(a["TravelReqID"]),
                    E1TravelReqID = GlobalCode.Field2Int(a["E1TravelReqID"]),
                    RoomTypeId = GlobalCode.Field2Int(a["RoomTypeId"]),
                    PortId = GlobalCode.Field2Int(a["PortId"]),
                    SFStatus = GlobalCode.Field2String(a["SFStatus"]),
                    HotelCity = GlobalCode.Field2String(a["HotelCity"]),
                    Checkin = GlobalCode.Field2String(a["Checkin"]),
                    CheckOut = GlobalCode.Field2String(a["CheckOut"]),
                    HotelNite = GlobalCode.Field2String(a["HotelNite"]),
                    LastName = GlobalCode.Field2String(a["colLastNameVarchar"]),
                    FirstName = GlobalCode.Field2String(a["colFirstNameVarchar"]),

                    Employee = GlobalCode.Field2Long(a["Employee"]),
                    Gender = GlobalCode.Field2String(a["Gender"]),
                    SingleDouble = GlobalCode.Field2String(a["SingleDouble"]),
                    Couple = GlobalCode.Field2String(a["Couple"]),
                    Title = GlobalCode.Field2String(a["Title"]),
                    Ship = GlobalCode.Field2String(a["Ship"]),
                    Costcenter = GlobalCode.Field2String(a["Costcenter"]),
                    Nationality = GlobalCode.Field2String(a["Natioality"]),
                    HotelRequest = GlobalCode.Field2String(a["HotelRequest"]),
                    RecLoc = GlobalCode.Field2String(a["RecLoc"]),
                    RecLocID = GlobalCode.Field2Long(a["RecLocID"]),
                    AirSequence = GlobalCode.Field2Int(a["AirSequence"]),
                    deptCity = GlobalCode.Field2String(a["DeptCity"]),
                    ArvlCity = GlobalCode.Field2String(a["ArvlCity"]),
                    Arvldate = GlobalCode.Field2String(a["ArrvlDate"]),
                    ArvlTime = GlobalCode.Field2String(a["ArrvlTime"]),
                    Carrier = GlobalCode.Field2String(a["Carrier"]),
                    FlightNo = GlobalCode.Field2String(a["FlightNo"]),
                    Voucher = GlobalCode.Field2String(a["Voucher"]),
                    PassportNo = GlobalCode.Field2String(a["PassportNo"]),
                    PassportExp = GlobalCode.Field2String(a["PassportExp"]),
                    PassportIssued = GlobalCode.Field2String(a["PassportIssued"]),
                    HotelBranch = GlobalCode.Field2String(a["HotelBranch"]),
                    Booking = GlobalCode.Field2String(a["Booking"]),
                    Bookingremark = GlobalCode.Field2String(a["Bookingremark"]),
                    IsVisible = GlobalCode.Field2Bool(a["IsVisible"]),
                    stripes = GlobalCode.Field2Decimal(a["colStripesDecimal"]),
                    GroupNo = GlobalCode.Field2TinyInt(a["GroupNo"]),
                    PortName = GlobalCode.Field2String(a["PortName"]),
                }).ToList();

                HttpContext.Current.Session["PortNotExistExceptionList"] = NonTurnPortsList;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommand != null)
                {
                    dbCommand.Dispose();
                }
                if (dtNew != null)
                {
                    dtNew.Dispose();
                }
                if (dtConfirmed != null)
                {
                    dtConfirmed.Dispose();
                }
                if (dtCancelled != null)
                {
                    dtCancelled.Dispose();
                }
                if (dtEmail != null)
                {
                    dtEmail.Dispose();
                }
            }
        }