Ejemplo n.º 1
0
 public int SubmitHJDataImport(string sharePath)
 {
     //检核文件是否存在
     if (!Directory.Exists(sharePath))
     {
         return(-2);                               //共享的工作空间不存在
     }
     string[] files = Directory.GetFiles(sharePath, "*.tar.gz");
     if (files.Length == 0)
     {
         return(-1);                            //文件未找到
     }
     try
     {
         TSPCommonReference.Create();
         List <OrderClass> orderclassLst = OrderManager.CreateInstalledBatchOrder("IONormalHJBatchImport", new string[] { sharePath });
         foreach (OrderClass orderclass in orderclassLst)
         {
             orderclass.Priority = EnumOrderPriority.High;
             OrderManager.AddNewOrder2DB(orderclass);
         }
         return(1);              //成功触发入库
     }
     catch (Exception)
     {
         return(0);                                 //未知原因
     }
 }
Ejemplo n.º 2
0
 public SubmitOrder()
 {
     if (!Constant.Created)
     {
         Constant.Create();
     }
     TSPCommonReference.Create();
     //如果使用设计的组件,请取消注释以下行
     //InitializeComponent();
 }
Ejemplo n.º 3
0
    public int SubmitDataImport(string datatype, string sharePath)
    {
        //检核文件是否存在
        if (!Directory.Exists(sharePath))
        {
            return(-2);                               //共享的工作空间不存在
        }

        try
        {
            TSPCommonReference.Create();
            if (datatype.ToLower() == "modis")
            {
                string[] files = Directory.GetFiles(sharePath, "*.hdf");
                if (files.Length == 0)
                {
                    return(-1);                                    //文件未找到
                }
                else
                {
                    List <OrderClass> orderLst = new IORasterDataImportNew().CreateRasterDataBatchImport(datatype, files);
                    foreach (OrderClass orderclass in orderLst)
                    {
                        orderclass.Priority = EnumOrderPriority.High;
                        OrderManager.AddNewOrder2DB(orderclass);
                    }
                    return(1);
                }
            }
            else if (datatype.ToLower() == "noaa")
            {
                List <OrderClass> orderLst = new IONoaaBatchImport().CreateNoaaBatchImport(sharePath);
                foreach (OrderClass orderclass in orderLst)
                {
                    orderclass.Priority = EnumOrderPriority.High;
                    OrderManager.AddNewOrder2DB(orderclass);
                }
                return(1);
            }
            else
            {
                return(-3);
            }
        }
        catch (Exception)
        {
            return(0);                                 //未知原因
        }
    }
Ejemplo n.º 4
0
    public int SubmitImportOrder(string dataType, string sharePath)
    {
        //检核文件是否存在
        if (!Directory.Exists(sharePath))
        {
            return(-2);                               //共享的工作空间不存在
        }

        try
        {
            TSPCommonReference.Create();
            switch (dataType)
            {
            case "HJCorrectedData":
            {
                string[] files = Directory.GetFiles(sharePath, "*.tar.gz");
                if (files.Length == 0)
                {
                    return(-1);                                                    //文件未找到
                }
                List <OrderClass> orderclassLst = OrderManager.CreateInstalledBatchOrder("IONormalHJBatchImport", new string[] { sharePath });
                foreach (OrderClass orderclass in orderclassLst)
                {
                    orderclass.Priority = EnumOrderPriority.High;
                    OrderManager.AddNewOrder2DB(orderclass);
                }
                return(1);                                  //成功触发入库
            }

            case "AlgorithmCmp":
            {
                string[] files = Directory.GetFiles(sharePath, "*.tar");
                if (files.Length == 0)
                {
                    return(-1);
                }
                OrderClass orderclass = new IOImportStandCmp().CreateStandCmpImport(sharePath);
                orderclass.Priority = EnumOrderPriority.High;
                OrderManager.AddNewOrder2DB(orderclass);
                return(1);
            }

            case "ProductWFL":
            {
                string[] files = Directory.GetFiles(sharePath, "*.tar");
                if (files.Length == 0)
                {
                    return(-1);
                }
                OrderClass orderclass = new IOImportStandWfl().CreateStandWflImport(sharePath);
                orderclass.Priority = EnumOrderPriority.High;
                OrderManager.AddNewOrder2DB(orderclass);
                return(1);
            }

            case "UserProduct":
            {
                OrderClass orderclass = new IOImportUserProduct().CreateUserProductImport(sharePath);
                orderclass.Priority = EnumOrderPriority.High;
                OrderManager.AddNewOrder2DB(orderclass);
                return(1);
            }

            default:
                return(-3);                            //没有对应的数据入库类型
            }
        }
        catch (Exception)
        {
            return(0);                                 //未知原因
        }
    }