예제 #1
0
        /// <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();
                }
            }
        }
예제 #2
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);
            }
        }