/// <summary>
        /// Date Modified:  01/12/2011
        /// Modified By:    Josephine Gad
        /// (description)   change datasource of hotel branch from SeafarerTravelBLL.GetSFHotelTravelListView2
        ///                 to HotelManifestBLL.GetHotelBranchListByUser
        /// </summary>
        private void GetHotelFilter()
        {
            DataTable dt = null;

            try
            {
                dt = HotelManifestBLL.GetHotelBranchListByUser("", uoHiddenFieldUser.Value, uoHiddenFieldRole.Value, "");

                int iRowCount = dt.Rows.Count;
                if (iRowCount == 1)
                {
                    Session["Hotel"] = dt.Rows[0]["BranchID"].ToString();
                }
                if (iRowCount > 0)
                {
                    uoDropDownListHotel.Items.Clear();
                    uoDropDownListHotel.DataSource     = dt;
                    uoDropDownListHotel.DataTextField  = "BranchName";
                    uoDropDownListHotel.DataValueField = "BranchID";
                    uoDropDownListHotel.DataBind();
                    uoDropDownListHotel.Items.Insert(0, new ListItem("--Select Hotel--", "0"));
                    RemoveDuplicateItems(uoDropDownListHotel);
                    uoDropDownListHotel.Enabled = true;

                    if (uoDropDownListHotel.Items.FindByValue(GlobalCode.Field2String(Session["Hotel"])) != null)
                    {
                        uoDropDownListHotel.SelectedValue = GlobalCode.Field2String(Session["Hotel"]);
                        SetCalendarDashboard();
                    }
                }
                else
                {
                    uoDropDownListHotel.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
        //#region uoButtonRequestSendEmail_Click
        //protected void uoButtonRequestSendEmail_Click(object sender, EventArgs e)
        //{
        //    BindHotelManifestExcel();
        //}
        //#endregion

        //#region VerifyRenderingInServerForm
        //public override void VerifyRenderingInServerForm(Control control)
        //{
        //    //Confirms that an HtmlForm control is rendered for the
        //    //specified ASP.NET server control at run time.
        //}
        //#endregion

        //#region uoGridViewHotelManifest_DataBound
        //protected void uoGridViewHotelManifest_DataBound(object sender, EventArgs e)
        //{
        //    GridView grid = sender as GridView;
        //    if (grid != null)
        //    {
        //        Label SFStatus = (Label)Master.FindControl("uclabelStatus");

        //        GridViewRow ManifestRow = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);
        //        TableCell ManifestCell = new TableCell();
        //        ManifestCell.ColumnSpan = uoGridViewHotelManifest.Columns.Count;
        //        ManifestCell.Text = "Hotel Manifest: " + SFStatus.Text;
        //        ManifestCell.BackColor = ColorTranslator.FromHtml("#1f497d");
        //        ManifestCell.ForeColor = Color.White;
        //        ManifestCell.Font.Bold = true;
        //        ManifestRow.Font.Size = 14;
        //        ManifestRow.Cells.Add(ManifestCell);

        //        Table t = grid.Controls[0] as Table;
        //        {
        //            if (t != null)
        //            {
        //                t.Rows.AddAt(0, ManifestRow);
        //            }
        //        }
        //    }
        //}
        //#endregion

        #region uoButtonLock_Click
        protected void uoButtonLock_Click(object sender, EventArgs e)
        {
            string strLogDescription;
            string strFunction;

            if (uoDropDownListHotel.SelectedValue != "")
            {
                if (uoDropDownListHotel.SelectedValue != "0")
                {
                    Int32 ID = HotelManifestBLL.InsertHotelManifestLockHeader(uoDropDownListHours.SelectedValue, uoDropDownListHotel.SelectedValue,
                                                                              uoHiddenFieldUser.Value, GlobalCode.Field2DateTime((uoHiddenFieldDate.Value)).ToString());

                    //HotelManifestBLL.InsertHotelManifestLockDetails((DataTable)ViewState["Table"], ID);

                    //Insert log audit trail (Gabriel Oquialda - 16/02/2012)
                    strLogDescription = "Hotel tentative manifest locked.";
                    strFunction       = "uoButtonLock_Click";

                    DateTime dateNow = CommonFunctions.GetCurrentDateTime();

                    AuditTrailBLL.InsertLogAuditTrail(ID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                      CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, uoHiddenFieldUser.Value);

                    uoButtonLock.Enabled = false;
                    AlertMessage("Manifest has been locked.");
                }
                else
                {
                    AlertMessage("Select hotel.");
                }
            }
            else
            {
                AlertMessage("Select hotel.");
            }
        }
        /// <summary>
        /// Date Created:   06/02/2011
        /// Created By:     Josephine Gad
        /// (description)   Set the Calendar Dashboard count
        /// </summary>
        /// <returns></returns>
        private List <ManifestCalendar> GetCalendarTable()
        {
            DataTable               dt      = null;
            ManifestCalendar        cal     = new ManifestCalendar();
            List <ManifestCalendar> calList = new List <ManifestCalendar>();

            try
            {
                if (Session["TentativeManifestCalendarDashboard"] == null)
                {
                    DateTime day            = GlobalCode.Field2DateTime(Request.QueryString["dt"].ToString());
                    string   sPendingFilter = "0";
                    string   sRegion        = "0";
                    string   sCountry       = "0";
                    string   sCity          = "0";
                    string   sPort          = "0";
                    string   sHotel         = "0";
                    string   sVehicle       = "0";
                    string   sManifestHrs   = "0";
                    if (Session["strPendingFilter"] != null && GlobalCode.Field2String(Session["strPendingFilter"]) != "")
                    {
                        sPendingFilter = GlobalCode.Field2String(Session["strPendingFilter"]);
                    }
                    if (Session["Region"] != null && GlobalCode.Field2String(Session["Region"]) != "")
                    {
                        sRegion = GlobalCode.Field2String(Session["Region"]);
                    }
                    if (Session["Country"] != null && GlobalCode.Field2String(Session["Country"]) != "")
                    {
                        sCountry = GlobalCode.Field2String(Session["Country"]);
                    }
                    if (Session["City"] != null && GlobalCode.Field2String(Session["City"]) != "")
                    {
                        sCity = GlobalCode.Field2String(Session["City"]);
                    }
                    if (Session["Port"] != null && GlobalCode.Field2String(Session["Port"]) != "")
                    {
                        sPort = GlobalCode.Field2String(Session["Port"]);
                    }
                    if (Session["Hotel"] != null && GlobalCode.Field2String(Session["Hotel"]) != "")
                    {
                        sHotel = GlobalCode.Field2String(Session["Hotel"]);
                    }
                    if (Session["Vehicle"] != null && GlobalCode.Field2String(Session["Vehicle"]) != "")
                    {
                        sVehicle = Session["Vehicle"].ToString();
                    }
                    if (Session["ManifestHrs"] != null && GlobalCode.Field2String(Session["ManifestHrs"]) != "")
                    {
                        sManifestHrs = Session["ManifestHrs"].ToString();
                    }

                    calList = HotelManifestBLL.GetTentativeManifestDashboard(day.ToString("MM/dd/yyyy"),
                                                                             "", uoHiddenFieldUser.Value, "1",
                                                                             "1", "", "0",
                                                                             "0", "0", "0",
                                                                             sRegion, sCountry,
                                                                             sCity, sPort, sHotel, "0",
                                                                             uoHiddenFieldRole.Value, sManifestHrs);

                    //Cache.Remove("TentativeManifestCalendarDashboard");
                    //Store TentativeManifestCalendarDashboard dr in Cache for 5 minutes
                    //Cache.Insert("TentativeManifestCalendarDashboard", dt, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(5));

                    //calList = (from a in dt.AsEnumerable()
                    //           select new ManifestCalendar
                    //           {
                    //               colDate = GlobalCode.Field2DateTime(a["colDate"]),
                    //               TotalCount = GlobalCode.Field2Int(a["TotalCount"])
                    //           }).ToList();

                    Session["TentativeManifestCalendarDashboard"] = calList;
                    //dt.WriteXml(sw);
                    ////sw.Flush();
                    ////Cache.Remove("TentativeManifestCalendarDashboard");
                    ////Store TentativeManifestCalendarDashboard dr in Cache for 5 minutes
                    ////Cache.Insert("TentativeManifestCalendarDashboard", dt, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(5));
                    //XmlSerializer serializer = new XmlSerializer(typeof(ManifestCalendar));

                    //serializer.Serialize(sw, cal);
                    //Session["TentativeManifestCalendarDashboard"] = sw;// sw.ToString();
                    return(calList);
                }
                else
                {
                    calList = (List <ManifestCalendar>)Session["TentativeManifestCalendarDashboard"];
                    return(calList);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
示例#4
0
        /// <summary>
        /// Date Created:   06/02/2011
        /// Created By:     Josephine Gad
        /// (description)   Set the Calendar Dashboard count
        /// </summary>
        /// <returns></returns>
        private List <ManifestCalendar> GetCalendarTable()
        {
            if (uoCalendarDashboard.Visible)
            {
                //DataTable dt = null;
                //StringWriter sw = new StringWriter();
                //XmlReader sr = null;
                //XmlDataDocument xmlDoc = null;
                //StringReader strReader = null;
                //TextWriter txtWriter = null;
                ManifestCalendar        cal     = new ManifestCalendar();
                List <ManifestCalendar> calList = new List <ManifestCalendar>();
                //IDataReader dr = null;
                try
                {
                    if (Session["TentativeManifestCalendarDashboard"] == null)
                    {
                        DateTime day            = GlobalCode.Field2DateTime(uoHiddenFieldDateFrom.Value);
                        string   sPendingFilter = "0";
                        string   sRegion        = "0";
                        string   sCountry       = "0";
                        string   sCity          = "0";
                        string   sPort          = "0";
                        string   sHotel         = "0";
                        string   sVehicle       = "0";
                        string   sManifestHrs   = "0";
                        if (GlobalCode.Field2String(Session["strPendingFilter"]) != "")
                        {
                            sPendingFilter = GlobalCode.Field2String(Session["strPendingFilter"]);
                        }
                        if (GlobalCode.Field2String(Session["Region"]) != "")
                        {
                            sRegion = GlobalCode.Field2String(Session["Region"]);
                        }
                        if (GlobalCode.Field2String(Session["Country"]) != "")
                        {
                            sCountry = GlobalCode.Field2String(Session["Country"]);
                        }
                        if (GlobalCode.Field2String(Session["City"]) != "")
                        {
                            sCity = GlobalCode.Field2String(Session["City"]);
                        }
                        if (GlobalCode.Field2String(Session["Port"]) != "")
                        {
                            sPort = GlobalCode.Field2String(Session["Port"]);
                        }
                        if (GlobalCode.Field2String(Session["Hotel"]) != "")
                        {
                            sHotel = GlobalCode.Field2String(Session["Hotel"]);
                        }
                        if (GlobalCode.Field2String(Session["Vehicle"]) != "")
                        {
                            sVehicle = GlobalCode.Field2String(Session["Vehicle"]);
                        }
                        if (GlobalCode.Field2String(Session["ManifestHrs"]) != "")
                        {
                            sManifestHrs = GlobalCode.Field2String(Session["ManifestHrs"]);
                        }
                        if (uoHiddenFieldCurrentPage.Value == "~/Hotel/HotelManifest2.aspx")
                        {
                            LockedManifestBLL lockedBLL = new LockedManifestBLL();
                            calList = lockedBLL.LoadLockedManifestCalendar(GlobalCode.Field2String(Session["UserName"]), day, Int32.Parse(sManifestHrs),
                                                                           Int32.Parse(sHotel));
                        }
                        else
                        {
                            calList = HotelManifestBLL.GetTentativeManifestDashboard(day.ToString("MM/dd/yyyy"),
                                                                                     "", GlobalCode.Field2String(Session["UserName"]), "1",
                                                                                     "1", "", "0",
                                                                                     "0", "0", "0",
                                                                                     sRegion, sCountry,
                                                                                     sCity, sPort, sHotel, "0",
                                                                                     uoHiddenFieldRole.Value, sManifestHrs);
                        }
                        //calList = (from a in dt.AsEnumerable()
                        //           select new  ManifestCalendar
                        //           {
                        //               colDate = GlobalCode.Field2DateTime(a["colDate"]),
                        //               TotalCount = GlobalCode.Field2Int(a["TotalCount"])
                        //            }).ToList();

                        Session["TentativeManifestCalendarDashboard"] = calList;
                        return(calList);
                    }
                    else
                    {
                        calList = (List <ManifestCalendar>)Session["TentativeManifestCalendarDashboard"];
                        return(calList);
                        ////XmlSerializer deserializer = new XmlSerializer(typeof(List<ManifestCalendar>));
                        //////TextReader rd = new StreamReader((Stream)Session["TentativeManifestCalendarDashboard"]);
                        //////deserializer = (XmlSerializer)Session["TentativeManifestCalendarDashboard"];
                        ////xmlDoc = new XmlDataDocument();
                        //////xmlDoc.LoadXml((XmlText)Session["TentativeManifestCalendarDashboard"]);
                        ////TextReader textReader = new StreamReader(xmlDoc.Value); //(@"C:\movie.xml");
                        //////calList = (List<ManifestCalendar>)deserializer.Deserialize();
                        ////calList = (List<ManifestCalendar>)deserializer.Deserialize(textReader);
                        ////textReader.Close();
                        ////textReader.Dispose();

                        // return calList;

                        //XmlSerializer deserializer = new XmlSerializer(typeof(List<ManifestCalendar>));
                        //xmlDoc = new XmlDataDocument();
                        //xmlDoc.LoadXml(GlobalCode.Field2String(Session["TentativeManifestCalendarDashboard"]));
                        //TextReader textReader = new StreamReader(xmlDoc.InnerXml); //(@"C:\movie.xml");

                        //calList = (List<ManifestCalendar>)deserializer.Deserialize(textReader);
                        //textReader.Close();

                        //return calList;

                        //sr = new StringReader(GlobalCode.Field2String(Session["TentativeManifestCalendarDashboard"]));
                        //dt = (DataTable)Cache["TentativeManifestCalendarDashboard"];
                        //dt.ReadXml(sr);
                        //xmlDoc = new XmlDataDocument();
                        //xmlDoc.LoadXml(GlobalCode.Field2String(Session["TentativeManifestCalendarDashboard"]));
                        ////strReader = new StringReader(GlobalCode.Field2String(Session["TentativeManifestCalendarDashboard"]));
                        //strReader = new StringReader(xmlDoc.InnerXml);
                        ////sr = new XmlNodeReader(xmlDoc);
                        //dt.ReadXml(strReader);
                        //return dt;

                        //sr = new XmlReader.Create("");
                        //XmlSerializer  ser =  new XmlSerializer(typeof(DataTable) );
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    //if (dt != null)
                    //{
                    //    dt.Dispose();
                    //}
                    //if (sw != null)
                    //{
                    //    sw.Close();
                    //    sw.Dispose();
                    //}
                    //if (sr != null)
                    //{
                    //    sr.Close();
                    //}
                    //if (strReader != null)
                    //{
                    //    strReader.Close();
                    //    strReader.Dispose();
                    //}
                    //if (txtWriter != null)
                    //{
                    //    txtWriter.Close();
                    //    txtWriter.Dispose();
                    //}
                }
            }
            else
            {
                return(null);
            }
        }