Ejemplo n.º 1
0
        private List <RegFileWrapper> GetRegFileWrappers(RegFileSetupResult fileSetup)
        {
            List <RegFileWrapper> list = new List <RegFileWrapper>();

            if (fileSetup != null)
            {
                if (fileSetup.NormalRegFiles != null)
                {
                    foreach (RegFileInfo info in fileSetup.NormalRegFiles)
                    {
                        RegFileWrapper item = this.NewFileWrapper(info, RegFileType.Normal);
                        if (item != null)
                        {
                            list.Add(item);
                        }
                    }
                }
                if (fileSetup.OutOfDateRegFiles == null)
                {
                    return(list);
                }
                foreach (RegFileInfo info2 in fileSetup.OutOfDateRegFiles)
                {
                    RegFileWrapper wrapper2 = this.NewFileWrapper(info2, RegFileType.OutOfDate);
                    if (wrapper2 != null)
                    {
                        list.Add(wrapper2);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
 private void ShowSetupFileTip()
 {
     this.rtxtInsVersions.Text = "";
     foreach (TreeNode node in this.tvRegVersion.Nodes[0].Nodes)
     {
         RegFileWrapper tag = node.Tag as RegFileWrapper;
         if (tag != null)
         {
             this.rtxtInsVersions.Text = this.rtxtInsVersions.Text + string.Format("{0} : 安装成功! \n", tag.DisplayName);
         }
     }
 }
Ejemplo n.º 3
0
        private void delToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = this.tvRegVersion.SelectedNode;

            if ((selectedNode != null) && (DialogResult.Yes == MessageBoxHelper.Show("确定删除此注册文件?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question)))
            {
                RegFileWrapper tag = selectedNode.Tag as RegFileWrapper;
                if (File.Exists(tag.FileName))
                {
                    this.tvRegVersion.Nodes.Remove(selectedNode);
                    File.Delete(tag.FileName);
                    if (!File.Exists(tag.FileName))
                    {
                        MessageBoxHelper.Show("删除注册文件成功,将重启开票软件。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        FormMain.ResetForm();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = this.tvRegVersion.SelectedNode;

            if ((selectedNode != null) && (selectedNode.Tag is RegFileWrapper))
            {
                RegFileWrapper tag = (RegFileWrapper)selectedNode.Tag;
                if (RegisterManager.MakeExportedRegFile(tag.VerFlag.ToString(), base.TaxCardInstance))
                {
                    string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
                    int    num           = tag.FileName.LastIndexOf(@"\");
                    if ((num > 0) && (num < (tag.FileName.Length - 1)))
                    {
                        string         str2           = tag.FileName.Substring(num + 1).Replace(".RFHX", ".TFHX");
                        string         sourceFileName = Path.Combine(baseDirectory, str2);
                        SaveFileDialog dialog         = new SaveFileDialog {
                            Filter   = "注册文件 (*.RFHX;*.TFHX)|*.RFHX;*.TFHX",
                            FileName = str2
                        };
                        if (dialog.ShowDialog() == DialogResult.OK)
                        {
                            string fileName = dialog.FileName;
                            try
                            {
                                File.Copy(sourceFileName, fileName, true);
                                File.Delete(sourceFileName);
                                MessageManager.ShowMsgBox("INP-111001", "提示", new string[] { "导出注册文件成功!" });
                            }
                            catch (Exception exception)
                            {
                                this.loger.Error(exception.Message, exception);
                            }
                        }
                    }
                }
                else
                {
                    MessageManager.ShowMsgBox("INP-111001", "提示", new string[] { "导出注册文件失败。\r\n可能原因:该注册文件已被修改或删除" });
                }
            }
        }
Ejemplo n.º 5
0
 private void AddRegFileNode(RegFileWrapper file)
 {
     if (file != null)
     {
         TreeNode node;
         if (this.rootNode.Nodes.ContainsKey(file.DisplayName))
         {
             node     = this.rootNode.Nodes[file.DisplayName];
             node.Tag = file;
         }
         else
         {
             node = new TreeNode(file.DisplayName)
             {
                 Name = file.DisplayName,
                 Tag  = file
             };
             this.rootNode.Nodes.Add(node);
         }
         this.SetNodeImage(node, file.VerFlag);
     }
 }
Ejemplo n.º 6
0
        private RegFileWrapper NewFileWrapper(RegFileInfo file, RegFileType type)
        {
            RegFileWrapper wrapper = null;

            if ((file != null) && (file.VerFlag != null))
            {
                wrapper = new RegFileWrapper(file)
                {
                    FileType = type
                };
                foreach (VersionInfo info in this.versionList)
                {
                    if ((info != null) && (info.Sign == file.VerFlag))
                    {
                        wrapper.DisplayName = info.Name;
                        wrapper.VersionDesc = info.Description;
                        wrapper.ExportFlag  = info.ExportFlag;
                    }
                }
            }
            return(wrapper);
        }
Ejemplo n.º 7
0
 private void InitFileCheckInfo(TreeNode treeNode)
 {
     if (treeNode != null)
     {
         RegFileWrapper tag = treeNode.Tag as RegFileWrapper;
         this.lblNSDJH.Text = base.TaxCardInstance.TaxCode;
         this.lblKPJH.Text  = base.TaxCardInstance.Machine.ToString();
         if (tag != null)
         {
             qwe fileContent = tag.FileContent;
             this.lblRJBH.Text  = new string(fileContent.SoftwareID);
             this.lblRJXLH.Text = fileContent.SerialNo.ToString();
             string str = new string(fileContent.StopDate);
             this.lblSQJZRQ.Text = string.Format("{0}年{1}月{2}日", str.Substring(0, 4), str.Substring(4, 2), str.Substring(6, 2));
             this.lblRJZL.Text   = fileContent.SoftwareType.ToString();
             string str2 = PropertyUtil.GetValue("MAIN_VER");
             string bBDY = "";
             string str4 = new string(fileContent.SoftwareID);
             if (str4.Length == 6)
             {
                 bBDY = this.GetBBDY(str4.Substring(4, 2));
             }
             this.lblZCDY.Text     = bBDY;
             this.lblBBH.Text      = str2;
             this.rtxtVersion.Text = tag.VersionDesc;
             if (tag.ExportFlag && ((int)base.TaxCardInstance.TaxMode == 2))
             {
                 this.btnExport.Visible = true;
             }
             else
             {
                 this.btnExport.Visible = false;
             }
         }
     }
 }