Example #1
0
    public static List <NewestData> GetNewestDatas()
    {
        List <NewestData> list = new List <NewestData>();
        ProjectDataADO    get  = new ProjectDataADO("MRT_CK570J");

        list = get.GetGeoAutoMRTDataNewestData();

        return(list);
    }
    public static returnLastData GetNewestDatas()
    {
        returnLastData package = new returnLastData();

        if (HttpContext.Current.Session["user"] == null)
        {
            package.isOk    = false;
            package.Message = "尚未登入或連線逾時";
            return(package);
        }

        ProjectDataADO dao;
        User           user        = (User)HttpContext.Current.Session["user"];
        List <Project> projectList = user.ProjectList;
        string         projectName = HttpContext.Current.Session["showProjects"].ToString();

        try
        {
            foreach (Project item in projectList)
            {
                if (item.ProjectName.Equals(projectName))
                {
                    dao = new ProjectDataADO(item.GetPorjectDB());
                    package.ProjectInfo = item;
                    switch (item.DataBaseStyle)
                    {
                    case 0:
                        package.gageList = dao.GetGeoAutoInstructmentInfo();
                        break;

                    case 1:
                        package.gageList = dao.GetGeoMRTInstructmentInfo();
                        break;
                    }
                    package.DataPackage = dao.GetGeoAutoMRTDataNewestData();
                    package.isOk        = true;
                }
            }
            package.ProjectsList = (string[])HttpContext.Current.Session["selectedProjects"];
        }
        catch (Exception ex)
        {
            //package.message = "資料處理錯誤,請重新登入";
            package.Message = ex.Message.ToString();
            package.isOk    = false;
        }

        return(package);
    }