Esempio n. 1
0
        private void btnLinkPath_Click(object sender, EventArgs e)
        {
            FolderDialog folderDialog = new FolderDialog();

            folderDialog.DisplayDialog();
            this.txtMonitorStfile.Text = folderDialog.Path;
        }
		void SelectProjectLocationButtonClicked(object sender, EventArgs e)
		{
			FolderDialog fdiag = new  FolderDialog();
			if (fdiag.DisplayDialog(StringParser.Parse("${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.SelectDefaultProjectLocationDialog.Title}")) == DialogResult.OK) {
				ControlDictionary["projectLocationTextBox"].Text = fdiag.Path;
			}
		}
Esempio n. 3
0
        /// <summary>
        /// 导入VIN
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImportVin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FuelDataSysClient.Tool.Tool_Mits.MitsUtils utils = new FuelDataSysClient.Tool.Tool_Mits.MitsUtils();
            this.gvCljbxx.PostEditor();
            int[] selectedHandle;
            selectedHandle = this.gvCljbxx.GetSelectedRows();
            if (selectedHandle.Count() > 0)
            {
                if (selectedHandle[0] < 0)
                {
                    MessageBox.Show("请选择数据");
                    return;
                }
            }
            else
            {
                MessageBox.Show("请选择数据");
                return;
            }
            FolderDialog openFolder = new FolderDialog();

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(openFolder.Path, utils.VinFileName);
                    if (fileNameList.Count > 0)
                    {
                        string fileNameMsg = string.Empty;
                        string returnMsg   = string.Empty;
                        // 获取全部主表数据,用作合并VIN数据
                        bool IsMainDataExist = utils.GetMainData();
                        if (!IsMainDataExist)
                        {
                            MessageBox.Show("系统中不存在车型数据,请首先导入车型数据", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            // 导入filename文件信息
                            returnMsg += utils.ImportVinData(fileName, openFolder.Path);
                        }
                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = "导入结果";
                        mf.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(String.Format("目录{0}下没有文件{1}", openFolder.Path, utils.VinFileName));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导入失败:" + ex.Message);
            }
        }
Esempio n. 4
0
        //文本页,添加根目录路径按钮单击事件
        private void btn_AddRootPath_Click(object sender, EventArgs e)
        {
            string       selectedPath = "";
            FolderDialog openFolder   = new FolderDialog();

            if (openFolder.DisplayDialog() == DialogResult.OK)
            {
                selectedPath = openFolder.Path.ToString();
            }
            else
            {
                return;
            }
            if (Directory.Exists(selectedPath))
            {
                string    newRootPath = selectedPath;
                DataTable dt          = (DataTable)(this.comboBox_RootPathSelector.DataSource);
                LandEvaluationBll.BindingDataTable.AddRowForRootPathDataTable(newRootPath, ref dt);
                string newValue = ConfigurationManager.AppSettings["RootPathes"] + separator + newRootPath;
                //ConfigurationHelper.SetAppSettingsKey("RootPathes",  newValue);
                ConfigurationHelper.UpdateNoteValue("appSettings", "RootPathes", newValue);

                this.comboBox_RootPathSelector.SelectedIndex = dt.Rows.Count - 1;
            }
        }
Esempio n. 5
0
        private void BtnImportData_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FolderDialog openFolder = new FolderDialog();
            string       strMsg     = string.Empty;

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = mu.GetFileName(openFolder.Path, mu.VinFileName);
                    if (fileNameList.Count > 0)
                    {
                        foreach (string str in fileNameList)
                        {
                            strMsg += mu.ImportVinData(str, openFolder.Path);
                        }
                    }
                    else
                    {
                        strMsg = string.Format("目录{0}下没有文件{1}", openFolder.Path, mu.VinFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                strMsg = String.Format("{0}\r\n{1}", ex.Message, strMsg);
            }
            MessageForm mf = new MessageForm("导入完成\r\n" + strMsg);

            mf.Show();
            searchLocal();
        }
Esempio n. 6
0
        /// <summary>
        /// 导入VIN
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImportVin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                ChryslerUtils utils      = new ChryslerUtils();
                FolderDialog  openFolder = new FolderDialog();
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.MainFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.VinFileName);
                    if (fileNameList.Count > 0)
                    {
                        string fileNameMsg = string.Empty;
                        string returnMsg   = string.Empty;

                        // 获取全部车型参数数据,用作合并VIN数据
                        bool IsMainDataExist = utils.GetMainData("MAIN_RLLX"); // "MAIN_RLLX"表示燃料数据表(传统,非插电式混合动力等)
                        if (!IsMainDataExist)
                        {
                            MessageBox.Show("系统中不存在车型参数数据,请首先导入车型参数数据", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        bool IsCposDataExist = utils.GetMainData("MAIN_FUEL"); // "MAIN_FUEL"表示油耗值数据
                        if (!IsCposDataExist)
                        {
                            MessageBox.Show("系统中不存在油耗值数据,请首先导入油耗值数据", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            // fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportVinData(fileName, folderPath);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = "导入结果";
                        mf.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + utils.VinFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导入失败:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        void SelectProjectLocationButtonClicked(object sender, EventArgs e)
        {
            FolderDialog fdiag = new  FolderDialog();

            if (fdiag.DisplayDialog(StringParser.Parse("${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.SelectDefaultProjectLocationDialog.Title}")) == DialogResult.OK)
            {
                ControlDictionary["projectLocationTextBox"].Text = fdiag.Path;
            }
        }
Esempio n. 8
0
        private void btnLocalPath_Click(object sender, EventArgs e)
        {
            FolderDialog folderDialog = new FolderDialog();

            if (folderDialog.DisplayDialog() == DialogResult.OK)
            {
                this.txtLocalPath.Text = folderDialog.Path;
            }
        }
Esempio n. 9
0
        //导出模板
        private void barBtnExportFloder_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                var    dtExport = (DataTable)this.gcDataInfo.DataSource;
                string msg      = string.Empty;
                if (dtExport == null || dtExport.Rows.Count < 1)
                {
                    MessageBox.Show("当前没有数据可以操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                FolderDialog openFolder = new FolderDialog();
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    if (string.IsNullOrEmpty(Settings.Default.ClearYear) || string.IsNullOrEmpty(Settings.Default.Vehicle_MFCS))
                    {
                        MessageBox.Show("请先设置车辆生存企业名称和清算年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    DialogResult dr = MessageBox.Show(String.Format("确定要导出【{0}】,清算年份为【{1}】的数据吗?", Settings.Default.Vehicle_MFCS, Settings.Default.ClearYear), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    if (dr == DialogResult.OK)
                    {
                        try
                        {
                            LoadingHandler.Show(this, args =>
                            {
                                var exutils = new ExportNewInfoUtils();
                                msg         = exutils.ExportNewTemplate(openFolder.Path, "");
                            });
                            if (String.IsNullOrEmpty(msg))
                            {
                                MessageBox.Show("导出完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                using (var mf = new MessageForm(msg)
                                {
                                    Text = "校验结果"
                                })
                                {
                                    mf.ShowDialog();
                                }
                            }
                        }
                        catch (System.Exception ex)
                        {
                            MessageBox.Show("操作出现错误:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
            }
        }
Esempio n. 10
0
        void LookInBrowseButtonClicked(object sender, EventArgs e)
        {
            FolderDialog dlg = new FolderDialog();

            if (dlg.DisplayDialog("${res:Dialog.NewProject.SearchReplace.LookIn.SelectDirectory}") == DialogResult.OK)
            {
                Get <ComboBox>("lookIn").SelectedIndex = customDirectoryIndex;
                Get <ComboBox>("lookIn").Text          = dlg.Path;
            }
        }
Esempio n. 11
0
        private void _button导入文华数据_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            FolderDialog sfd = new FolderDialog();

            if (sfd.DisplayDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Thread th = new Thread(new ThreadStart(() => ImportStocksFromWh6MonthStatement(sfd.Path)));
                th.Start();
            }
        }
Esempio n. 12
0
        void BrowseDirectories(object sender, EventArgs e)
        {
            FolderDialog fd = new FolderDialog();

            if (fd.DisplayDialog("${res:Dialog.NewProject.SelectDirectoryForProject}") == DialogResult.OK)
            {
                ((TextBox)ControlDictionary["locationTextBox"]).Text = fd.Path;
            }
            // End
        }
Esempio n. 13
0
        /// <summary>
        /// 导入VIN
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImportVin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            NissanUtils  utils      = new NissanUtils();
            FolderDialog openFolder = new FolderDialog();

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path;

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.VinFileName);
                    if (fileNameList.Count > 0)
                    {
                        string fileNameMsg = string.Empty;
                        string returnMsg   = string.Empty;

                        // 获取全部主表数据,用作合并VIN数据
                        bool IsMainDataExist = utils.GetMainData();
                        if (!IsMainDataExist)
                        {
                            MessageBox.Show("系统中不存在主表数据,请首先导入主表数据", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            // fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportVinData(fileName, folderPath);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = "导入结果";
                        mf.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(String.Format("目录{0}下没有文件{1}", folderPath, utils.VinFileName));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导入失败:" + ex.Message);
            }
        }
Esempio n. 14
0
        private void btnSelectRootPath_Click(object sender, EventArgs e)
        {
            FolderDialog folder = new FolderDialog();

            if (folder.DisplayDialog() == DialogResult.OK)
            {
                tbRootPath.Text = folder.Path;
            }
            else
            {
                MessageBox.Show("你没有选择目录");
            }
        }
Esempio n. 15
0
        //选择文件夹
        private void sbtnSelectDir_Click(object sender, EventArgs e)
        {
            string       dirpath    = string.Empty;
            FolderDialog openFolder = new FolderDialog();

            if (openFolder.DisplayDialog() == DialogResult.OK)
            {
                FileTable.Clear();
                dirpath          = openFolder.Path.ToString();
                txtfilename.Text = dirpath;
                FileTable        = GetFiles(dirpath, ".xls");
                ShowFiles();
            }
        }
Esempio n. 16
0
        private void BtnScarnProductDir_Click(object sender, EventArgs e)
        {
            FolderDialog openFolder = new FolderDialog();

            if (openFolder.DisplayDialog() == DialogResult.OK)
            {
                textBox_ProductDir.Text = openFolder.Path.ToString();
                ParamSetMgr.GetInstance().CurrentWorkDir = textBox_ProductDir.Text;
                ConfigToolMgr.GetInstance().SaveProductDir();
            }
            else
            {
                textBox_ProductDir.Text = "你没有选择目录";
            }
        }
Esempio n. 17
0
 /// <summary>
 /// 选择文件夹
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cbBoxFolder_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.cbBoxFolder.SelectedIndex == 1)
     {
         FolderDialog folderDialog = new FolderDialog();
         if (folderDialog.DisplayDialog() == DialogResult.OK)
         {
             this.lblFolder.Text = folderDialog.Path;
         }
     }
     else if (this.cbBoxFolder.SelectedItem != null)
     {
         this.lblFolder.Text = this.cbBoxFolder.SelectedItem.ToString();
     }
     else
     {
         this.lblFolder.Text = "すべて";
     }
 }
Esempio n. 18
0
        private void btnReference_Click(object sender, EventArgs e)
        {
            FolderDialog folderDialog = new FolderDialog();

            folderDialog.DisplayDialog();
            if (!String.IsNullOrEmpty(folderDialog.Path))
            {
                string[] pathList = folderDialog.Path.Split('\\');
                if (pathList.Count() > 3)
                {
                    string pathName = "";
                    for (int i = 3; i < pathList.Count(); i++)
                    {
                        pathName = pathName + pathList[i] + "\\";
                    }
                    this.txtTrStfile.Text = pathName.TrimEnd('\\');
                }
            }
        }
Esempio n. 19
0
        private void button4_Click(object sender, EventArgs e)
        {
            FolderDialog folderDialog = new FolderDialog();

            if (DialogResult.OK == folderDialog.DisplayDialog())
            {
                //判断是否已经存在
                if (this.listBox1.Items.Count > 5)
                {
                    for (int i = 0; i < this.listBox1.Items.Count; i++)
                    {
                        if (folderDialog.Path.Equals(this.listBox1.Items[i] as string))
                        {
                            this.listBox1.SelectedIndex = i;
                            MessageBox.Show(MessageUtil.GetMessage("existed"));
                            return;
                        }
                    }
                }

                this.listBox1.Items.Add(folderDialog.Path);
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 导入VIN
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImportVin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            PorscheUtils utils      = new PorscheUtils(true);
            FolderDialog openFolder = new FolderDialog();

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.VinFileName);
                    if (fileNameList.Count > 0)
                    {
                        string fileNameMsg = string.Empty;
                        string returnMsg   = string.Empty;

                        // 获取全部车型参数数据,用作合并VIN数据
                        bool          IsMainDataExist = utils.GetMainData();
                        bool          IsLtggExist     = utils.GetOtherMainData("LTGG");
                        bool          IsLjExist       = utils.GetOtherMainData("LJ");
                        bool          IsZczbzlExist   = utils.GetOtherMainData("ZCZBZL");
                        StringBuilder sbMsg           = new StringBuilder("系统中不存在");
                        bool          flag            = false;
                        if (!IsMainDataExist)
                        {
                            flag = true;
                            sbMsg.Append("\r\n \t车型参数数据");
                        }
                        if (!IsLtggExist)
                        {
                            flag = true;
                            sbMsg.Append("\r\n \t轮胎规格数据");
                        }
                        if (!IsLjExist)
                        {
                            flag = true;
                            sbMsg.Append("\r\n \t轮距数据");
                        }
                        if (!IsZczbzlExist)
                        {
                            flag = true;
                            sbMsg.Append("\r\n \t整车整备质量数据");
                        }

                        if (flag)
                        {
                            MessageBox.Show(sbMsg.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            // fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportVinData(fileName, folderPath);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = "导入结果";
                        mf.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + utils.VinFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导入失败:" + ex.Message);
            }
        }
Esempio n. 21
0
        /// <summary>
        /// 导入或修改车型参数
        /// </summary>
        /// <param name="importType"></param>
        protected void ImportMainData(string importType)
        {
            string operateType = string.Empty;

            if (importType == "IMPORT")
            {
                operateType = "导入";
            }
            else if (importType == "UPDATE")
            {
                operateType = "修改";
            }

            FuelDataSysClient.Tool.Tool_Mits.MitsUtils utils = new FuelDataSysClient.Tool.Tool_Mits.MitsUtils();
            FolderDialog openFolder = new FolderDialog();

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.MainFileName);
                    if (fileNameList.Count > 0)
                    {
                        string        fileNameMsg    = string.Empty;
                        string        returnMsg      = string.Empty;
                        List <string> mainUpdateList = new List <string>();

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportMainData(fileName, folderPath, importType, mainUpdateList);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = operateType + "结果";
                        mf.ShowDialog();

                        if (importType == "IMPORT")
                        {
                            this.ShowMainData();
                        }
                        else if (importType == "UPDATE")
                        {
                            this.ShowUpdatedMainData(mainUpdateList);
                        }
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + utils.MainFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(operateType + "失败:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 导入VIN
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImportVin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            MitsUtils utils = new MitsUtils();
            //this.gvCtny.PostEditor();
            //int[] selectedHandle;
            ////selectedHandle = this.gvCtny.GetSelectedRows();
            //if (selectedHandle.Count() > 0)
            //{
            //    if (selectedHandle[0] < 0)
            //    {
            //        MessageBox.Show("请选择车型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //        return;
            //    }
            //}
            //else
            //{
            //    MessageBox.Show("请选择车型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            FolderDialog openFolder = new FolderDialog();

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.VinFileName);
                    if (fileNameList.Count > 0)
                    {
                        string fileNameMsg = string.Empty;
                        string returnMsg   = string.Empty;

                        // 获取全部主表数据,用作合并VIN数据
                        bool IsMainDataExist = utils.GetMainData();
                        if (!IsMainDataExist)
                        {
                            MessageBox.Show("系统中不存在车型数据,请首先导入车型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            // fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportVinData(fileName, folderPath);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = "导入结果";
                        mf.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + utils.VinFileName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导入失败:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 23
0
        protected void ImportMainData(string importType)
        {
            string operateType = string.Empty;

            if (importType == "IMPORT")
            {
                operateType = "导入";
            }
            else if (importType == "UPDATE")
            {
                operateType = "修改";
            }

            NissanUtils  utils      = new NissanUtils();
            FolderDialog openFolder = new FolderDialog();

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path;

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.MainFileName);
                    if (fileNameList.Count > 0)
                    {
                        string        fileNameMsg    = string.Empty;
                        string        returnMsg      = string.Empty;
                        List <string> mainUpdateList = new List <string>();

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            fileNameMsg += Path.GetFileName(fileName) + Environment.NewLine;

                            // 导入filename文件信息
                            returnMsg += utils.ImportMainData(fileName, folderPath, importType, mainUpdateList);
                        }

                        if (string.IsNullOrEmpty(returnMsg))
                        {
                            MessageForm mf = new MessageForm(String.Format("以下文件{0}成功:\r\n{1}", operateType, fileNameMsg));
                            Utils.SetFormMid(mf);
                            mf.Text = operateType + "成功";
                            mf.ShowDialog();
                        }
                        else
                        {
                            MessageForm mf = new MessageForm(returnMsg);
                            Utils.SetFormMid(mf);
                            mf.Text = operateType + "结果";
                            mf.ShowDialog();
                        }

                        if (importType == "IMPORT")
                        {
                            this.ShowMainData();
                        }
                        else if (importType == "UPDATE")
                        {
                            this.ShowUpdatedMainData(mainUpdateList);
                        }
                    }
                    else
                    {
                        MessageBox.Show(String.Format("目录{0}下没有文件{1}", folderPath, utils.MainFileName));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("{0}失败:{1}", operateType, ex.Message), "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 24
0
        //指定某个Excel导入COC
        protected void ImportCOCData(string importType)
        {
            JaguarUtils   utils      = new JaguarUtils();
            FolderDialog  openFolder = new FolderDialog();
            List <string> cocIdList  = new List <string>();

            string genFileName = string.Empty;
            string promptMsg   = string.Empty;

            if (importType == "IMPORT")
            {
                genFileName = utils.CocFileName;
                promptMsg   = "导入";
            }
            else if (importType == "UPDATE")
            {
                genFileName = utils.UpdateCocFileName;
                promptMsg   = "修改";
            }
            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, genFileName);
                    if (fileNameList.Count > 0)
                    {
                        string returnMsg = string.Empty;

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            // 导入filename文件信息
                            returnMsg += utils.ReadCtnyCOCExcel(fileName, folderPath, importType, cocIdList, promptMsg);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = promptMsg + "结果";
                        mf.ShowDialog();

                        if (importType == "IMPORT")
                        {
                            this.SearchAllCocData();
                        }
                        else if (importType == "UPDATE")
                        {
                            this.SearchUpdatedCocData(cocIdList);
                        }
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + genFileName, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(promptMsg + "失败:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="importType"></param>
        /// <param name="paramName"></param>
        /// <param name="fileType">文件类别,如轮胎规格文件</param>
        protected void ImportOtherMainData(string importType, string paramName, string fileType)
        {
            string operateType = string.Empty;

            if (importType == "IMPORT")
            {
                operateType = "导入";
            }
            else if (importType == "UPDATE")
            {
                operateType = "修改";
            }

            PorscheUtils utils      = new PorscheUtils(true);
            FolderDialog openFolder = new FolderDialog();

            //openFolder.

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.GetMainFileName(fileType));
                    if (fileNameList.Count > 0)
                    {
                        string        fileNameMsg    = string.Empty;
                        string        returnMsg      = string.Empty;
                        List <string> mainUpdateList = new List <string>();

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportOtherMainData(fileName, folderPath, paramName, importType, mainUpdateList);
                        }

                        if (string.IsNullOrEmpty(returnMsg))
                        {
                            MessageForm mf = new MessageForm("以下文件" + operateType + "成功:\r\n" + fileNameMsg);
                            Utils.SetFormMid(mf);
                            mf.Text = operateType + "成功";
                            mf.ShowDialog();
                        }
                        else
                        {
                            MessageForm mf = new MessageForm(returnMsg);
                            Utils.SetFormMid(mf);
                            mf.Text = operateType + "结果";
                            mf.ShowDialog();
                        }


                        if (importType == "IMPORT")
                        {
                            switch (paramName)
                            {
                            case "LTGG":
                                this.ShowOtherMainData("LTGG");
                                break;

                            case "LJ":
                                this.ShowOtherMainData("LJ");
                                break;

                            case "ZCZBZL":
                                this.ShowOtherMainData("ZCZBZL");
                                break;

                            default: break;
                            }
                        }
                        else if (importType == "UPDATE")
                        {
                            this.ShowUpdatedMainData(mainUpdateList);
                        }
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + utils.MainFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(operateType + "失败:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 26
0
        /// <summary>
        /// 导入或修改CPOS
        /// </summary>
        /// <param name="importType">操作类型:“IMPORT”表示新导入;“UPDATE”表示修改已导入的轮胎信息/param>
        protected void ImportFuelData(string importType)
        {
            string operateType = string.Empty;

            if (importType == "IMPORT")
            {
                operateType = "导入";
            }
            else if (importType == "UPDATE")
            {
                operateType = "修改";
            }

            try
            {
                ChryslerUtils utils      = new ChryslerUtils();
                FolderDialog  openFolder = new FolderDialog();
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.MainFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.CposFileName);
                    if (fileNameList.Count > 0)
                    {
                        string fileNameMsg = string.Empty;
                        string returnMsg   = string.Empty;

                        //更新列表,记录更新的数据。存油耗值编号,初始为空
                        List <string> fuelUpdateList = new List <string>();

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportFuelData(fileName, folderPath, importType, fuelUpdateList);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = operateType + "结果";
                        mf.ShowDialog();

                        // 如果是新导入数据,导入完成后显示所有数据
                        if (importType == "IMPORT")
                        {
                            this.ShowCposFuelData();
                        }
                        else if (importType == "UPDATE")
                        {
                            // 如果是修改数据,界面只显示修改过的数据(为了接下来修改和这些轮胎信心关联的燃料数据)。
                            this.ShowUpdatedCposFuelData(fuelUpdateList);
                        }
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + utils.CposFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导入失败:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 27
0
        /// <summary>
        /// 导入或修改车型参数
        /// </summary>
        /// <param name="importType"></param>
        protected void ImportMainData(string importType)
        {
            string operateType = string.Empty;

            if (importType == "IMPORT")
            {
                operateType = "导入";
            }
            else if (importType == "UPDATE")
            {
                operateType = "修改";
            }
            MitsUtils    utils      = new MitsUtils();
            FolderDialog openFolder = new FolderDialog();

            if (openFolder.DisplayDialog() == DialogResult.OK)
            {
                // 获取folderPath下以格式为utils.CocFileName的所有文件
                List <string> fileNameList = utils.GetFileName(openFolder.Path, utils.MainFileName);
                if (fileNameList.Count > 0)
                {
                    try
                    {
                        SplashScreenManager.ShowForm(typeof(DevWaitForm));
                        string        fileNameMsg    = string.Empty;
                        string        returnMsg      = string.Empty;
                        List <string> mainUpdateList = new List <string>();
                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            fileNameMsg += Path.GetFileName(fileName) + Environment.NewLine;
                            // 导入filename文件信息
                            returnMsg += utils.ImportMainData(fileName, openFolder.Path, importType, mainUpdateList);
                        }
                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = operateType + "结果";
                        mf.ShowDialog();
                        if (importType == "IMPORT")
                        {
                            this.ShowMainData();
                        }
                        else if (importType == "UPDATE")
                        {
                            this.ShowUpdatedMainData(mainUpdateList);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("操作出现错误:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    finally
                    {
                        SplashScreenManager.CloseForm();
                    }
                }
                else
                {
                    MessageBox.Show(String.Format("目录{0}下没有文件{1}", openFolder.Path, utils.MainFileName), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }