Exemplo n.º 1
0
 private MsDataFileImpl GetDataFile(bool ignoreZeroIntensityPoints)
 {
     if (_dataFile == null)
     {
         if (DataFilePath is MsDataFilePath)
         {
             string dataFilePath       = FindDataFilePath();
             var    lockMassParameters = DataFilePath.GetLockMassParameters();
             if (dataFilePath == null)
             {
                 throw new FileNotFoundException(string.Format(
                                                     Resources
                                                     .ScanProvider_GetScans_The_data_file__0__could_not_be_found__either_at_its_original_location_or_in_the_document_or_document_parent_folder_,
                                                     DataFilePath));
             }
             int sampleIndex = SampleHelp.GetPathSampleIndexPart(dataFilePath);
             if (sampleIndex == -1)
             {
                 sampleIndex = 0;
             }
             // Full-scan extraction always uses SIM as spectra
             _dataFile = new MsDataFileImpl(dataFilePath, sampleIndex, lockMassParameters, true,
                                            combineIonMobilitySpectra: DataFilePath.GetCombineIonMobilitySpectra(),
                                            requireVendorCentroidedMS1: DataFilePath.GetCentroidMs1(),
                                            requireVendorCentroidedMS2: DataFilePath.GetCentroidMs2(),
                                            ignoreZeroIntensityPoints: ignoreZeroIntensityPoints);
         }
         else
         {
             _dataFile = DataFilePath.OpenMsDataFile(true, 0, null, ignoreZeroIntensityPoints);
         }
     }
     return(_dataFile);
 }
Exemplo n.º 2
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                string serpath = string.Empty;
                if (DataFilePath.HasFile)
                {
                    string typ = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
                    if (typ == "xls" || typ == "xlsx")
                    {
                        string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                        string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\ImportDeliver";
                        if (!Directory.Exists(partpath))
                        {
                            Directory.CreateDirectory(partpath);
                        }
                        serpath = partpath + "\\" + partname;
                        DataFilePath.SaveAs(serpath);
                        string paramMessage = string.Empty;

                        ImportManager.ImportClaimInfoXls(serpath, ref paramMessage);
                        //base.ImportManager.ImportImportDeliver(serpath, ref paramMessage);
                        this.txtResult.Text = paramMessage;
                    }
                }
            }
            catch (Exception err)
            {
                base.ProcessException(err, false);
                this.txtResult.Text = err.Message;
            }
        }
Exemplo n.º 3
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                int PlatformTypeId = Convert.ToInt16(ddPlatformTypeId.SelectedValue);
                if (PlatformTypeId == -1)
                {
                    base.ShowMessage("平台必须选择!");
                    return;
                }
                string serpath   = string.Empty;
                string fieldName = "";
                switch (PlatformTypeId)
                {
                case 259:
                    fieldName = "SO";
                    break;

                case 251:
                    fieldName = "订单编号";
                    break;

                case 383:
                    fieldName = "订单号";
                    break;

                case 250:
                    fieldName = "商户订单号";
                    break;
                }
                if (DataFilePath.HasFile)
                {
                    string typ = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
                    if (typ == "xls" || typ == "xlsx")
                    {
                        string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                        string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\ImportAlipayStatementData";
                        if (!Directory.Exists(partpath))
                        {
                            Directory.CreateDirectory(partpath);
                        }
                        serpath = partpath + "\\" + partname;
                        DataFilePath.SaveAs(serpath);
                        string paramMessage = string.Empty;
                        base.ImportManager.ImportAlipaymentData(serpath, ref paramMessage, PlatformTypeId, fieldName);
                        this.txtResult.Text = paramMessage;
                    }
                }
            }
            catch (Exception err)
            {
                base.ProcessException(err, false);
                this.txtResult.Text = err.Message;
            }
        }
 protected void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         //店铺id
         int    ProjectId = Convert.ToInt16(this.ddXMProject.SelectedValue.ToString());
         int    NickId    = Convert.ToInt32(this.ddlNick.SelectedValue.ToString());
         string Begin     = this.txtBeginDate.Value.Trim();
         if (ProjectId == -1)
         {
             base.ShowMessage("请选择需要导入日销单所属项目!");
             return;
         }
         if (NickId == -1 || NickId == 99)
         {
             base.ShowMessage("请选择需要导入日销售单所属店铺!");
             return;
         }
         DateTime date = DateTime.Now;
         if (Begin != "")
         {
             if (Begin == "" || !DateTime.TryParse(Begin, out date))
             {
                 base.ShowMessage("日期格式不正确!");
                 return;
             }
         }
         string serpath = string.Empty;
         if (DataFilePath.HasFile)
         {
             string typ = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
             if (typ == "xls" || typ == "xlsx")
             {
                 string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                 string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\XMDailySaleInfo";
                 if (!Directory.Exists(partpath))
                 {
                     Directory.CreateDirectory(partpath);
                 }
                 serpath = partpath + "\\" + partname;
                 DataFilePath.SaveAs(serpath);
                 string paramMessage = string.Empty;
                 base.ImportManager.ImportDailySaleProductList(serpath, ref paramMessage, NickId, Begin);
                 this.txtResult.Text = paramMessage;
             }
         }
     }
     catch (Exception err)
     {
         base.ProcessException(err, false);
         this.txtResult.Text = err.Message;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 读取数据
        /// </summary>
        /// <param name="typeList"></param>
        private static void ReadData(params Type[] typeList)
        {
            foreach (var type in typeList)
            {
                if (!DataFilePath.ContainsKey(type))
                {
                    DataFilePath.Add(type, StaticDao.GetDataFilePath(type, DataDirPath));
                }

                if (!GlobalData.ContainsKey(type))
                {
                    var data = StaticDao.ReadGlobalData(type, DataFilePath[type]);
                    GlobalData.Add(type, data);
                }
            }
        }
Exemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         int expressID = !string.IsNullOrEmpty(ddlExpress.SelectedValue) ? int.Parse(ddlExpress.SelectedValue) : 0;
         //店铺id
         string   Begin = this.txtBeginDate.Value.Trim();
         DateTime date  = DateTime.Now;
         if (Begin != "")
         {
             if (Begin == "" || !DateTime.TryParse(Begin, out date))
             {
                 base.ShowMessage("日期格式不正确!");
                 return;
             }
         }
         int    year    = Convert.ToDateTime(Begin).Year;          //年份
         int    month   = Convert.ToDateTime(Begin).Month;         //月份
         string serpath = string.Empty;
         if (DataFilePath.HasFile)
         {
             string typ = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
             if (typ == "xls" || typ == "xlsx")
             {
                 string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                 string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\XMExpress";
                 if (!Directory.Exists(partpath))
                 {
                     Directory.CreateDirectory(partpath);
                 }
                 serpath = partpath + "\\" + partname;
                 DataFilePath.SaveAs(serpath);
                 string paramMessage = string.Empty;
                 base.ImportManager.ImportExpressList(serpath, ref paramMessage, expressID, year, month);
                 this.txtResult.Text = paramMessage;
             }
         }
     }
     catch (Exception err)
     {
         base.ProcessException(err, false);
         this.txtResult.Text = err.Message;
     }
 }
        protected void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                string serpath = string.Empty;
                if (DataFilePath.HasFile)
                {
                    int xMProjectID  = int.Parse(ddXMProject.SelectedValue);
                    int wareHoueseID = int.Parse(ddlWareHourses.SelectedValue);
                    //平台类型
                    // int PlatformTypeId = int.Parse(this.ddPlatformTypeId.SelectedValue);
                    int    DeliveryTypeId     = Convert.ToInt32(this.ddDeliveryTypeId.SelectedValue.ToString()); //发货单类型Id
                    string DeliveryTypeIdName = this.ddDeliveryTypeId.SelectedItem.ToString();                   //发货单类型名称
                    string typ = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
                    // string FileName = DataFilePath.FileName.Substring(0, DataFilePath.FileName.Length - (typ.Length + 1));

                    if (xMProjectID == -1)
                    {
                        base.ShowMessage("请先选择项目!");
                        return;
                    }

                    if (typ == "xls" || typ == "xlsx")
                    {
                        string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                        string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\ImportLogisticsNumberData";
                        if (!Directory.Exists(partpath))
                        {
                            Directory.CreateDirectory(partpath);
                        }
                        serpath = partpath + "\\" + partname;
                        DataFilePath.SaveAs(serpath);
                        string paramMessage = string.Empty;
                        base.ImportManager.ImportLogisticsNumberDataFromXls(serpath, DateTime.Now, DeliveryTypeId, DeliveryTypeIdName, ref paramMessage, xMProjectID, wareHoueseID);
                        this.txtResult.Text = paramMessage;
                    }
                }
            }
            catch (Exception err)
            {
                base.ProcessException(err, false);
                this.txtResult.Text = err.Message;
            }
        }
Exemplo n.º 8
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                int    SuppliersId = int.Parse(this.ddSuppliers.Text); //供应商ID
                string serpath     = string.Empty;
                if (this.ddSuppliers.Text == "-1")
                {
                    this.txtResult.Text = "供应商必选";
                    return;
                }
                this.btnImport.Enabled = false;
                if (this.DataFilePath.HasFile)
                {
                    string typ      = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
                    string FileName = DataFilePath.FileName.Substring(0, DataFilePath.FileName.Length - (typ.Length + 1));
                    if (typ == "xls" || typ == "xlsx")
                    {
                        string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                        string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\OrderInfoImporting";
                        if (!Directory.Exists(partpath))
                        {
                            Directory.CreateDirectory(partpath);
                        }
                        serpath = partpath + "\\" + partname;
                        DataFilePath.SaveAs(serpath);
                        string paramMessage = string.Empty;
                        lock (lockobject)
                        {
                            base.ImportManager.ImportBillsXls(serpath, SuppliersId, ref paramMessage);
                        }
                        this.txtResult.Text = paramMessage;
                    }
                }

                this.btnImport.Enabled = true;
            }
            catch (Exception err)
            {
                base.ProcessException(err, false);
                this.txtResult.Text = err.Message;
            }
        }
        private void SelectDataFileButton_Click(object sender, RoutedEventArgs e)
        {
            var fileDialog = new OpenFileDialog
            {
                DefaultExt       = ".csv",
                Filter           = "All files (*.*)|*.*|Text files (.txt)|*.txt|CSV files (*.csv)|*.csv",
                FilterIndex      = 3,
                InitialDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
            };

            var result = fileDialog.ShowDialog();

            if (result == true)
            {
                DataFilePath = fileDialog.FileName;
                var textShown = DataFilePath.Length > 40 ? $"...{DataFilePath.Substring(DataFilePath.Length - 40)}" : DataFilePath;
                DataFilePathText.Text = textShown;
            }
        }
Exemplo n.º 10
0
        private MsDataFileImpl GetDataFile(bool ignoreZeroIntensityPoints)
        {
            if (_dataFile == null)
            {
                const bool simAsSpectra  = true;  // SIM always as spectra here
                const bool preferOnlyMs1 = false; // Open with all available spectra indexed

                if (DataFilePath is MsDataFilePath)
                {
                    string dataFilePath       = FindDataFilePath();
                    var    lockMassParameters = DataFilePath.GetLockMassParameters();
                    if (dataFilePath == null)
                    {
                        throw new FileNotFoundException(string.Format(
                                                            Resources
                                                            .ScanProvider_GetScans_The_data_file__0__could_not_be_found__either_at_its_original_location_or_in_the_document_or_document_parent_folder_,
                                                            DataFilePath));
                    }
                    int sampleIndex = SampleHelp.GetPathSampleIndexPart(dataFilePath);
                    if (sampleIndex == -1)
                    {
                        sampleIndex = 0;
                    }
                    // Full-scan extraction always uses SIM as spectra
                    _dataFile = new MsDataFileImpl(dataFilePath, sampleIndex,
                                                   lockMassParameters,
                                                   simAsSpectra,
                                                   combineIonMobilitySpectra: _cachedFile.HasCombinedIonMobility,
                                                   requireVendorCentroidedMS1: _cachedFile.UsedMs1Centroids,
                                                   requireVendorCentroidedMS2: _cachedFile.UsedMs2Centroids,
                                                   ignoreZeroIntensityPoints: ignoreZeroIntensityPoints);
                }
                else
                {
                    _dataFile = DataFilePath.OpenMsDataFile(simAsSpectra, preferOnlyMs1,
                                                            _cachedFile.UsedMs1Centroids, _cachedFile.UsedMs2Centroids, ignoreZeroIntensityPoints);
                }
            }
            return(_dataFile);
        }
Exemplo n.º 11
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                //string Warehouse = this.ddlWarehouse.SelectedValue.Trim();
                //if (Warehouse == "-1")
                //{
                //    base.ShowMessage("请先选择仓库!");
                //    return;
                //}

                string serpath = string.Empty;
                if (DataFilePath.HasFile)
                {
                    string typ = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
                    if (typ == "xls" || typ == "xlsx")
                    {
                        string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                        string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\ImportXLMInventory";
                        if (!Directory.Exists(partpath))
                        {
                            Directory.CreateDirectory(partpath);
                        }
                        serpath = partpath + "\\" + partname;
                        DataFilePath.SaveAs(serpath);
                        string paramMessage = string.Empty;

                        base.ImportManager.ImportXLMInventory(serpath, ref paramMessage);
                        this.txtResult.Text = paramMessage;
                    }
                }
            }
            catch (Exception err)
            {
                base.ProcessException(err, false);
                this.txtResult.Text = err.Message;
            }
        }
Exemplo n.º 12
0
 protected void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         //店铺id
         int    NickId  = Convert.ToInt32(this.ddlNick.SelectedValue.ToString());
         string serpath = string.Empty;
         if (NickId == -1 || NickId == 99)
         {
             base.ShowMessage("请选择需要导入销售单所属店铺!");
             return;
         }
         if (DataFilePath.HasFile)
         {
             string typ = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
             if (typ == "xls" || typ == "xlsx")
             {
                 string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                 string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\ImportJDRealTimeInventory";
                 if (!Directory.Exists(partpath))
                 {
                     Directory.CreateDirectory(partpath);
                 }
                 serpath = partpath + "\\" + partname;
                 DataFilePath.SaveAs(serpath);
                 string paramMessage = string.Empty;
                 base.ImportManager.ImportJDRealTimeInventory(serpath, ref paramMessage, NickId);
                 this.txtResult.Text = paramMessage;
             }
         }
     }
     catch (Exception err)
     {
         base.ProcessException(err, false);
         this.txtResult.Text = err.Message;
     }
 }
Exemplo n.º 13
0
        public void Run()
        {
            //convert all properties and run C++ code!
            if (string.IsNullOrEmpty(DataFilePath))
            {
                MessageBox.Show("Необходимо указать файл!", "Error");
                return;
            }

            if (IsAlgoEnabled)
            {
                if (!IsLevenshtein && !IsHuffman)
                {
                    MessageBox.Show("Необходимо выбрать префиксный код!", "Error");
                    return;
                }

                if (!IsHeuristic && !IsGenAgglo && !IsNaive && !IsFull && !IsFWC && !IsBin)
                {
                    MessageBox.Show("Необходимо выбрать алгоритм нахождения схемы конкатенации!", "Error");
                    return;
                }

                int   algoNum = 0, codeNum = 0, size = 0;
                int[] args;
                if (IsHeuristic)
                {
                    algoNum = 1;
                }
                if (IsGenAgglo)
                {
                    algoNum = 2;
                }
                if (IsNaive)
                {
                    algoNum = 3;
                }
                if (IsFull)
                {
                    algoNum = 4;
                }
                if (IsFWC)
                {
                    algoNum = 5;
                }
                if (IsBin)
                {
                    algoNum = 6;
                }

                if (IsHuffman)
                {
                    codeNum = 1;
                }
                else
                {
                    codeNum = 2;
                }

                if (algoNum == 1)
                {
                    size = 7;
                    args = new int[size];

                    int subAlgoNum = 0;
                    if (hvm.IsNaive)
                    {
                        subAlgoNum = 1;
                    }
                    if (hvm.IsFull)
                    {
                        subAlgoNum = 2;
                    }
                    if (hvm.IsFWC)
                    {
                        subAlgoNum = 3;
                    }
                    if (hvm.IsBin)
                    {
                        subAlgoNum = 4;
                    }
                    if (hvm.IsAuto)
                    {
                        subAlgoNum = 5;
                    }

                    int minLen, maxLen;
                    if (hvm.IsAutoLen)
                    {
                        minLen = -1;
                        maxLen = -1;
                    }
                    else
                    {
                        minLen = int.Parse(hvm.MinLen);
                        maxLen = int.Parse(hvm.MaxLen);
                    }

                    int useDicts = 0;
                    if (hvm.IsUseDicts)
                    {
                        useDicts = 1;
                    }

                    int words = 0;
                    if (hvm.IsFirstWord)
                    {
                        words = 1;
                    }
                    if (hvm.IsAllWords)
                    {
                        words = 2;
                    }
                    if (hvm.IsRandWord)
                    {
                        words = 3;
                    }

                    args[0] = algoNum;
                    args[1] = codeNum;
                    args[2] = subAlgoNum;
                    args[3] = minLen;
                    args[4] = maxLen;
                    args[5] = useDicts;
                    args[6] = words;
                }
                else
                if (algoNum == 2)
                {
                    size = 4;
                    args = new int[size];

                    int subAlgoNum = 0;
                    if (gavm.IsNaive)
                    {
                        subAlgoNum = 1;
                    }
                    if (gavm.IsFull)
                    {
                        subAlgoNum = 2;
                    }
                    if (gavm.IsFWC)
                    {
                        subAlgoNum = 3;
                    }
                    if (gavm.IsBin)
                    {
                        subAlgoNum = 4;
                    }
                    if (gavm.IsAuto)
                    {
                        subAlgoNum = 5;
                    }

                    int len;
                    if (gavm.IsAutoLen)
                    {
                        len = -1;
                    }
                    else
                    {
                        len = int.Parse(gavm.Klen);
                    }

                    args[0] = algoNum;
                    args[1] = codeNum;
                    args[2] = subAlgoNum;
                    args[3] = len;
                }
                else
                {
                    size    = 2;
                    args    = new int[size];
                    args[0] = algoNum;
                    args[1] = codeNum;
                }

                /**
                 * var pth = Encoding.Default.GetBytes(DataFilePath.ToArray());
                 * var ch = Encoding.Convert(Encoding.Default, Encoding.GetEncoding("Windows-1251"), pth);
                 * var str = Encoding.GetEncoding("Windows-1251").GetChars(ch);
                 */
                var str = DataFilePath + "\0";
                encode_file(str.ToArray(), size, args);

                MessageBox.Show("Сжатие прошло успешно!");
            }
            else
            {
                int type = 0;
                if (DataFilePath.Substring(DataFilePath.Length - 5) == ".aslv")
                {
                    type = 2;
                }
                else
                if (DataFilePath.Substring(DataFilePath.Length - 5) == ".ashf")
                {
                    type = 1;
                }
                else
                {
                    MessageBox.Show("Архиватор поддерживает только файлы с расширением .aslv или .ashf", "Error");
                    return;
                }
                var str = DataFilePath + "\0";
                decode_file(str.ToArray(), type);
                MessageBox.Show("Разархивирование прошло успешно!");
            }
        }
Exemplo n.º 14
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                string serpath    = string.Empty;
                string serpath2   = string.Empty;
                string sourceType = this.ddlSourceType.SelectedValue;
                this.btnImport.Enabled = false;
                if (DataFilePath.HasFile && DataFilePath2.HasFile)
                {
                    //平台类型
                    // int PlatformTypeId = int.Parse(this.ddPlatformTypeId.SelectedValue);
                    string PlatformTypeNameId = this.ddPlatformTypeId.SelectedValue.ToString(); //平台类型Id
                    string PlatformTypeName   = this.ddPlatformTypeId.SelectedItem.ToString();  //平台类型名称
                    string NickId             = this.ddlNick.SelectedValue.ToString();          //平台类型Id
                    string typ      = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
                    string FileName = DataFilePath.FileName.Substring(0, DataFilePath.FileName.Length - (typ.Length + 1));

                    string typ2      = DataFilePath2.FileName.Substring(DataFilePath2.FileName.LastIndexOf(".") + 1).ToLower();
                    string FileName2 = DataFilePath2.FileName.Substring(0, DataFilePath2.FileName.Length - (typ2.Length + 1));

                    if (typ == "xls" || typ == "xlsx" || typ2 == "xls" || typ2 == "xlsx")
                    {
                        string partname  = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                        string partname2 = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath2.FileName;

                        string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\OrderInfoImporting";
                        if (!Directory.Exists(partpath))
                        {
                            Directory.CreateDirectory(partpath);
                        }
                        serpath  = partpath + "\\" + partname;
                        serpath2 = partpath + "\\" + partname2;
                        DataFilePath.SaveAs(serpath);
                        DataFilePath2.SaveAs(serpath2);
                        string paramMessage = string.Empty;
                        lock (lockobject)
                        {
                            base.ImportManager.ImportOrderFromXlsTM(serpath, serpath2, DateTime.Now, System.Convert.ToInt32(PlatformTypeNameId), System.Convert.ToInt32(NickId), PlatformTypeName, FileName, FileName2, ref paramMessage, sourceType);
                        }
                        this.txtResult.Text = paramMessage;
                    }
                }
                else if (DataFilePath.HasFile)
                {
                    //平台类型
                    // int PlatformTypeId = int.Parse(this.ddPlatformTypeId.SelectedValue);
                    string PlatformTypeNameId = this.ddPlatformTypeId.SelectedValue.ToString(); //平台类型Id
                    string PlatformTypeName   = this.ddPlatformTypeId.SelectedItem.ToString();  //平台类型名称
                    string NickId             = this.ddlNick.SelectedValue.ToString();          //平台类型Id
                    string typ      = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
                    string FileName = DataFilePath.FileName.Substring(0, DataFilePath.FileName.Length - (typ.Length + 1));
                    if (typ == "xls" || typ == "xlsx")
                    {
                        string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                        string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\OrderInfoImporting";
                        if (!Directory.Exists(partpath))
                        {
                            Directory.CreateDirectory(partpath);
                        }
                        serpath = partpath + "\\" + partname;
                        DataFilePath.SaveAs(serpath);
                        string paramMessage = string.Empty;
                        //this.Page;
                        lock (lockobject)
                        {
                            base.ImportManager.ImportOrderFromXls(serpath, DateTime.Now, System.Convert.ToInt32(PlatformTypeNameId), System.Convert.ToInt32(NickId), PlatformTypeName, FileName, ref paramMessage, sourceType);
                        }
                        this.txtResult.Text = paramMessage;
                    }
                    else if (typ == "csv")
                    {
                        string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                        string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\OrderInfoImporting";
                        if (!Directory.Exists(partpath))
                        {
                            Directory.CreateDirectory(partpath);
                        }
                        serpath = partpath + "\\" + partname;
                        DataFilePath.SaveAs(serpath);
                        string paramMessage = string.Empty;
                        if (PlatformTypeNameId == "376")
                        {
                            lock (lockobject)
                            {
                                //亚马逊
                                base.ImportManager.ImportAmazonOrderDataFromXls(serpath, ref paramMessage, sourceType);
                            }
                        }
                        this.txtResult.Text = paramMessage;
                    }
                }
                this.btnImport.Enabled = true;
            }
            catch (Exception err)
            {
                base.ProcessException(err, false);
                this.txtResult.Text = err.Message;
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Retrieve a run of raw spectra with common retention time and changing ion mobility, or a single raw spectrum if no drift info
        /// </summary>
        /// <param name="internalScanIndex">an index in pwiz.Skyline.Model.Results space</param>
        /// <returns>Array of spectra with the same retention time (potentially different ion mobility values for IMS, or just one spectrum)</returns>
        public MsDataSpectrum[] GetMsDataFileSpectraWithCommonRetentionTime(int internalScanIndex)
        {
            var spectra = new List <MsDataSpectrum>();

            if (_getMsDataFileScanIds != null)
            {
                _msDataFileScanIds    = _getMsDataFileScanIds();
                _getMsDataFileScanIds = null;
            }
            int dataFileSpectrumStartIndex = internalScanIndex;

            // For backward compatibility support SKYD files that did not store scan ID bytes
            if (_msDataFileScanIds != null)
            {
                var scanIdText = _msDataFileScanIds.GetMsDataFileSpectrumId(internalScanIndex);
                dataFileSpectrumStartIndex = GetDataFile().GetSpectrumIndex(scanIdText);
                if (dataFileSpectrumStartIndex == -1)
                {
                    throw new IOException(string.Format(Resources.ScanProvider_GetScans_The_scan_ID__0__was_not_found_in_the_file__1__, scanIdText, DataFilePath.GetFileName()));
                }
            }
            var currentSpectrum = GetDataFile().GetSpectrum(dataFileSpectrumStartIndex);

            spectra.Add(currentSpectrum);
            if (currentSpectrum.IonMobility.HasValue)
            {
                // Look for spectra with identical retention time and changing ion mobility values
                while (true)
                {
                    dataFileSpectrumStartIndex++;
                    var nextSpectrum = GetDataFile().GetSpectrum(dataFileSpectrumStartIndex);
                    if (!nextSpectrum.IonMobility.HasValue ||
                        nextSpectrum.RetentionTime != currentSpectrum.RetentionTime)
                    {
                        break;
                    }
                    spectra.Add(nextSpectrum);
                    currentSpectrum = nextSpectrum;
                }
            }
            return(spectra.ToArray());
        }
 private bool IsFrontendNamespace()
 {
     return(DataFilePath.Contains("Frontend"));
 }
Exemplo n.º 17
0
        private string GenerateNewmanCommand()
        {
            string environmentArg = string.IsNullOrEmpty(EnvironmentFilePath) ? string.Empty : string.Format("-e {0}", EnvironmentFilePath.EnquoteIfSpaces());
            string globalsArg     = string.IsNullOrEmpty(GlobalsFilePath) ? string.Empty : string.Format("-g {0}", GlobalsFilePath.EnquoteIfSpaces());
            string dataArg        = string.IsNullOrEmpty(DataFilePath) ? string.Empty : string.Format("-d {0}", DataFilePath.EnquoteIfSpaces());

            return(string.Format("newman run \"{0}\" --folder {1} {2} {3} {4} --reporters cli,json --reporter-json-export \"{5}\" -n 1", CollectionFilePath, folder, globalsArg, dataArg, environmentArg, OutputFilePath));
        }
Exemplo n.º 18
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                //string serpath = string.Empty;
                //string serpath2 = string.Empty;
                //if (DataFilePath.HasFile && DataFilePath2.HasFile)
                //{
                ////平台类型
                //string PlatformTypeNameId = this.ddPlatformTypeId.SelectedValue.ToString();//平台类型Id
                //string PlatformTypeName = this.ddPlatformTypeId.SelectedItem.ToString();//平台类型名称
                //string NickId = this.ddlNick.SelectedValue.ToString();//平台类型Id
                //string NickName = this.ddlNick.SelectedItem.ToString();
                //string type = this.excelType.SelectedValue.ToString();//excel的类型
                //string typ = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
                //string FileName = DataFilePath.FileName.Substring(0, DataFilePath.FileName.Length - (typ.Length + 1));

                //string typ2 = DataFilePath2.FileName.Substring(DataFilePath2.FileName.LastIndexOf(".") + 1).ToLower();
                //string FileName2 = DataFilePath2.FileName.Substring(0, DataFilePath2.FileName.Length - (typ2.Length + 1));

                //if (typ == "xls" || typ == "xlsx" ||  typ2 == "xls" || typ2 == "xlsx")
                //{
                //    string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                //    string partname2 = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath2.FileName;

                //    string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\PreOrderInfoImporting";
                //    if (!Directory.Exists(partpath))
                //    {
                //        Directory.CreateDirectory(partpath);
                //    }
                //    serpath = partpath + "\\" + partname;
                //    serpath2 = partpath + "\\" + partname2;
                //    DataFilePath.SaveAs(serpath);
                //    DataFilePath2.SaveAs(serpath2);
                //    string paramMessage = string.Empty;
                //    //base.ImportManager.ImportPreOrderFromXlsTM(serpath, serpath2, DateTime.Now, System.Convert.ToInt32(PlatformTypeNameId), System.Convert.ToInt32(NickId), PlatformTypeName, FileName, FileName2, ref paramMessage);
                //    this.txtResult.Text = paramMessage;
                //}
                //}
                string serpath = string.Empty;
                if (DataFilePath.HasFile)
                {
                    //平台类型
                    string PlatformTypeNameId = this.ddPlatformTypeId.SelectedValue.ToString(); //平台类型Id
                    string PlatformTypeName   = this.ddPlatformTypeId.SelectedItem.ToString();  //平台类型名称
                    string NickId             = this.ddlNick.SelectedValue.ToString();          //平台类型Id
                    string NickName           = this.ddlNick.SelectedItem.ToString();           //平台名称
                    string type = this.excelType.SelectedValue.ToString();                      //excel的类型格式
                    if ((type == "1" && PlatformTypeName != "京东") || (type != "1" && PlatformTypeName != "天猫"))
                    {
                        this.txtResult.Text = "平台类型与导入类型不符!";
                        return;
                    }
                    string typ      = DataFilePath.FileName.Substring(DataFilePath.FileName.LastIndexOf(".") + 1).ToLower();
                    string FileName = DataFilePath.FileName.Substring(0, DataFilePath.FileName.Length - (typ.Length + 1));
                    if ((FileName.IndexOf("京东") != -1 && type != "1") || (FileName.IndexOf("超级店长") != -1 && type != "2") || (FileName.IndexOf("赤兔") != -1 && type != "3"))
                    {
                        this.txtResult.Text = "导入类型与Excel文件不符!";
                        return;
                    }
                    if (typ == "xls" || typ == "xlsx")
                    {
                        string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                        string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\PreOrderInfoImporting";
                        if (!Directory.Exists(partpath))
                        {
                            Directory.CreateDirectory(partpath);
                        }
                        serpath = partpath + "\\" + partname;
                        DataFilePath.SaveAs(serpath);
                        string paramMessage = string.Empty;
                        paramMessage        = base.ImportManager.ImportPreOrderFromXlsTM(serpath, NickName, FileName, type, int.Parse(PlatformTypeNameId), int.Parse(NickId));
                        this.txtResult.Text = paramMessage;
                    }
                    //else if (typ == "csv")
                    //{
                    //    string partname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + DataFilePath.FileName;
                    //    string partpath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + @"\UpLoad\PreOrderInfoImporting";
                    //    if (!Directory.Exists(partpath))
                    //    {
                    //        Directory.CreateDirectory(partpath);
                    //    }
                    //    serpath = partpath + "\\" + partname;
                    //    DataFilePath.SaveAs(serpath);
                    //    string paramMessage = string.Empty;
                    //    if (PlatformTypeNameId == "376")
                    //    {
                    //        //亚马逊
                    //        base.ImportManager.ImportAmazonOrderDataFromXls(serpath, ref paramMessage);
                    //    }
                    //    this.txtResult.Text = paramMessage;
                    //}
                }
                else
                {
                    this.txtResult.Text = "请先选择EXCEL文件地址!";
                }
            }
            catch (Exception err)
            {
                base.ProcessException(err, false);
                this.txtResult.Text = err.Message;
            }
        }
Exemplo n.º 19
0
        private void OnExecute()
        {
            string outPath = OutputFilePath ?? (Path.GetFileNameWithoutExtension(DataFilePath) + "_output" + Path.GetExtension(DataFilePath));

            // load configuration file
            // YamlConfigReader configFile = new YamlConfigReader(".\\resources\\config.yaml");
            YamlConfigReader     configFile       = new YamlConfigReader(MetadataFilePath);
            DataProtectionConfig protectionConfig = configFile.Read();

            bool   sourceIsEncrypted = false;
            bool   targetIsEncrypted = true;
            string outputFileName    = "";

            switch (Command.ToLower())
            {
            case "encrypt":
                sourceIsEncrypted = false;
                targetIsEncrypted = true;
                outputFileName    = DataFilePath.Split('.')[0] + "-encrypted." + DataFilePath.Split('.')[1];
                break;

            case "decrypt":
                sourceIsEncrypted = true;
                targetIsEncrypted = false;
                outputFileName    = DataFilePath.Split('.')[0] + "-decrypted." + DataFilePath.Split('.')[1];
                break;

            default:
                Console.WriteLine("Not a valid command. Try 'encrypt' or 'decrypt' as a command.");
                break;
            }


            // For encryption operations, we're going to remove output settings

            // open input and output file streams
            // Stream inputFile = File.OpenRead (".\\resources\\userdata.parquet");
            // Stream outputFile = File.OpenWrite (".\\resources\\userdata.parquet");
            Stream outputFile = File.OpenWrite(outputFileName);

            // Create reader
            // using ParquetFileReader reader = new ParquetFileReader (inputFile);
            CSVDataReader reader = new CSVDataReader(new StreamReader(DataFilePath), protectionConfig, TokenCredential, sourceIsEncrypted);

            // Copy source settings as target settings

            /*
             * List<FileEncryptionSettings> writerSettings = reader.FileEncryptionSettings
             *  .Select (s => Copy (s))
             *  .ToList ();
             */

            // Create and pass the target settings to the writer
            // using ParquetFileWriter writer = new ParquetFileWriter (outputFile, writerSettings);
            using CSVDataWriter writer = new CSVDataWriter(new StreamWriter(outputFile), protectionConfig, TokenCredential, reader.Header, targetIsEncrypted);

            // Process the file
            ColumnarCryptographer cryptographer = new ColumnarCryptographer(reader, writer);

            try
            {
                cryptographer.Transform();
                Console.WriteLine($"File processed successfully. Verify output file contains encrypted data.");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 20
0
 public string GetRelateiveDataFilePath(string leaguePath)
 {
     return(DataFilePath.Replace(leaguePath, ""));
 }