コード例 #1
0
ファイル: DocModify.cs プロジェクト: gofixiao/HYPDM_Pro
        /// <summary>
        /// 保存按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            //Document doc = new Document();
            docSave = document;
            // 获取基本属性
            docSave.number = this.txtDocNumber.Text;
            docSave.en_name = this.txtEnName.Text;
            docSave.cn_name = this.txtDocName.Text;
            docSave.version = this.txtDocVersion.Text;
            docSave.format_name = this.txtDocFormat.Text;
            docSave.modify_count = this.txtModifyCount.Text;
            //docSave.modify_date = DateTime.Parse( this.txtModifyTime.Text);
            docSave.doc_page = this.txtDocPage.Text;
            docSave.doc_template_name = this.txtDocModel.Text;
            docSave.valid_time = this.txtValidTime.Text;
            docSave.in_valid_time = this.txtInValidTime.Text;
            docSave.abstract_content = this.txtAbstract.Text;
            docSave.remark = this.txtRemark.Text;
            docSave.key = this.txtKey.Text;
            docSave.dense_name = this.cbxDocDense.SelectedText;
            // 获取扩展属性的值
            foreach (doc_attached_property p in docPropertyList)
            {
                // 获取控件的文本框值
                String text = this.DocManagement_DocModify_tabContr_AdditionalInfor.Controls.Find(p.en_name, true)[0].Text;
                Type t = typeof(document);
                t.GetProperty("column" + p.order).SetValue(docSave, text, null);
            }
            // 添加包含文档
            docSave.sub_document = hashDocList;
            if (actionType == 2 || actionType == 4)
            {

            }
            else
            {
                Random rand = new Random();
                //生成文件
                string genfile = DateTime.Today.ToString("yyyyMMddhhmmssfffffff") + rand.Next(1000).ToString() + "." + docSave.format_name;
                // 从后台获取ip地址和端口号,发文件发送到后台保存起来。
                Client c = new Client(txtDocUpload.Text,genfile, docSave.ipaddress, docSave.port);
                c.start();
                //插入数据库
                docSave = WcfServiceLocator.Create<IDocManageTool>().insertDocument(docSave);

            }
            if (docSave != null)
            {
                docSave.id= 10;
                MessageBox.Show("更新成功!");
                DialogResult = DialogResult.OK;
                this.Close();
            }
        }
コード例 #2
0
ファイル: DocBulkImport.cs プロジェクト: gofixiao/HYPDM_Pro
        /// <summary>
        /// 导入数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            List<document> docSaveList = new List<document>();

            Random rand = new Random();
            // 批量导入数据
            for (int i = 0; i < docList.Count; i++)
            {

                document d = docList[i];
                d.in_valid_time = this.DocManagement_DocModify_ButtonEdit_InValidTime.Text;
                d.valid_time = this.DocManagement_DocModify_ButtonEdit_ValidTime.Text;
                d.dense_name = this.dateEdit1.Text;
                //获取扩展属性
                foreach (doc_attached_property p in docPropertyList)
                {
                    // 获取控件的文本框值
                    String text = this.xtraTabPage2.Controls.Find(p.en_name, true)[0].Text;
                    Type t = typeof(document);
                    t.GetProperty("column" + p.order).SetValue(d, text, null);
                }
                d.sub_document = hashDocList;
                //生成文件
                string genfile = DateTime.Today.ToString("yyyyMMddhhmmssfffffff") + rand.Next(1000).ToString()  + "." + d.format_name;
                // 循环启动导入数据库
                Client client = new Client(d.physical_file_location, genfile, "127.0.0.1", 7775);
                client.start();
                docSaveList.Add(d);
            }
            // 批量导入后台
            //插入数据库
            docSaveList = WcfServiceLocator.Create<IDocManageTool>().insertDocuments(docSaveList);

            // 批量导入到后台保存
            this.DialogResult = DialogResult.OK;
            this.Close();
        }