Ejemplo n.º 1
0
        /// <summary>
        /// 删除属性按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelProp_Click(object sender, EventArgs e)
        {
            doc_attached_property docp = (doc_attached_property)gridView1.GetFocusedRow();

            if (docp == null)
            {
                MessageBox.Show("请先选择一列值!");
                return;
            }
            List <doc_attached_property> remainlist = new List <doc_attached_property>();

            // 获取选中的行
            for (int i = 0; i < this.gridView1.RowCount; i++)
            {
                if (this.gridView1.GetRowCellValue(i, this.gridView1.Columns[0]).ToString() != docp.en_name)
                {
                    remainlist.Add((doc_attached_property)this.gridView1.GetRow(i));
                }
            }
            // 删除某一行
            DialogResult result = MessageBox.Show("确定删除这行数据!", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (result == DialogResult.OK)
            {
                list = remainlist;
                this.gridDocProperty.DataSource = list;
                this.gridDocProperty.RefreshDataSource();
                MessageBox.Show("删除成功!");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 属性修改按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdateProp_Click(object sender, EventArgs e)
        {
            doc_attached_property docp = (doc_attached_property)gridView1.GetFocusedRow();

            if (docp == null)
            {
                MessageBox.Show("请先选择一列值!");
                return;
            }
            int location = 0;

            // 获取选中的行
            for (int i = 0; i < this.gridView1.RowCount; i++)
            {
                if (this.gridView1.GetRowCellValue(i, this.gridView1.Columns[0]).ToString() == docp.en_name)
                {
                    docp     = (doc_attached_property)this.gridView1.GetRow(i);
                    location = i;
                }
            }
            // 弹出新增属性框
            AddDocProperty add = new AddDocProperty(docp);

            if (DialogResult.OK == add.ShowDialog())
            {
                list[location] = add.docProperty;
                this.gridDocProperty.DataSource = list;
                this.gridDocProperty.RefreshDataSource();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 根据文档属性来查询文档属性
        /// </summary>
        /// <param name="docType"></param>
        /// <returns></returns>
        public document_type getDocumentColumnByType(document_type docType)
        {
            //根据文档类型,查找文档的属性
            document_type         type = new document_type();
            doc_attached_property p1   = new doc_attached_property();

            p1.cn_name = "";
            p1.en_name = "";

            return(type);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 调整到末尾事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEnd_Click(object sender, EventArgs e)
        {
            // 调整到最后一行
            int i = gridView1.GetFocusedDataSourceRowIndex();

            if (i > 0 && gridView1.RowCount >= 1 && i + 1 < gridView1.RowCount)
            {
                doc_attached_property docp = list[gridView1.RowCount - 1];
                list[gridView1.RowCount - 1] = list[i];
                list[i] = docp;
                this.gridDocProperty.DataSource = list;
                this.gridDocProperty.RefreshDataSource();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 调整到第一行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnHome_Click(object sender, EventArgs e)
        {
            // 调整到第一行
            //doc_attached_property docp = (doc_attached_property)gridView1.GetFocusedRow();

            int i = gridView1.GetFocusedDataSourceRowIndex();

            //MessageBox.Show(i.ToString());
            if (i > 0 && gridView1.RowCount >= 1)
            {
                doc_attached_property docp = list[0];
                list[0] = list[i];
                list[i] = docp;
                this.gridDocProperty.DataSource = list;
                this.gridDocProperty.RefreshDataSource();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        ///  保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            doc_attached_property docp = new doc_attached_property();

            docp.cn_name       = this.txtCnName.Text;
            docp.data_length   = this.txtWidth.Text;
            docp.data_type     = this.cmbDataType.Text;
            docp.default_value = this.txtDefaultValue.Text;
            docp.en_name       = this.txtEnName.Text;
            docp.required      = this.chkRequired.Checked ? "Y" : "N";
            if (this.rgInputType.SelectedIndex == 0)
            {
                docp.input_type = "TXT";
            }
            else
            {
                docp.input_type = "SEL";
                List <doc_combobox_value> list = new List <doc_combobox_value>();
                // 循环获取下拉框值,是选中列表框
                for (int i = 0; i < this.lbSelectValue.ItemCount; i++)
                {
                    doc_combobox_value v = new doc_combobox_value();
                    v.value = this.lbSelectValue.Items[i].ToString();
                    list.Add(v);
                }
                docp.ComboxValue = list;
            }
            /// 设置默认值
            docp.is_display     = true;
            docp.display_width  = "100";
            docp.is_user_define = "是";
            this.docProperty    = docp;
            MessageBox.Show("录入成功");
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Ejemplo n.º 7
0
 /// <summary>
 ///  自定义扩展列
 /// </summary>
 private void extendPropertyGen()
 {
     // 自动加载扩展的列
     try
     {
         document doc = new document();
         doc.document_type_id   = docType.id;
         doc.document_type_name = docType.name;
         document_type doctype = WcfServiceLocator.Create <IDocPropertyBuild>().getDocumentProperty(doc);
         docPropertyList = doctype.DocProperty;
         int Location_y  = 10;
         int actlocation = 0;
         for (int i = 0; i < docPropertyList.Count; i++)
         {
             doc_attached_property docp = docPropertyList[i];
             if (!docp.is_display)
             {
                 continue;
             }
             if (actlocation % 2 == 0)
             {
                 // 为第一列
                 LabelControl lbk1 = new LabelControl();
                 lbk1.Name     = "lbk1" + i;
                 lbk1.Text     = docp.cn_name + ":";
                 lbk1.Size     = new System.Drawing.Size(60, 15);
                 lbk1.Location = new System.Drawing.Point(25, Location_y);
                 this.xtraTabPage2.Controls.Add(lbk1);
                 if (docp.input_type == "SEL")
                 {
                     ComboBoxEdit cbx1 = new ComboBoxEdit();
                     // 添加下拉框的值
                     foreach (doc_combobox_value boxvalue in docp.ComboxValue)
                     {
                         cbx1.Properties.Items.Add(boxvalue.value);
                     }
                     cbx1.Name     = docp.en_name;
                     cbx1.Size     = new System.Drawing.Size(280, 20);
                     cbx1.Location = new System.Drawing.Point(108, Location_y - 4);
                     this.xtraTabPage2.Controls.Add(cbx1);
                 }
                 else
                 {
                     TextEdit txtk1 = new TextEdit();
                     txtk1.Name     = docp.en_name;
                     txtk1.Size     = new System.Drawing.Size(280, 20);
                     txtk1.Location = new System.Drawing.Point(108, Location_y - 4);
                     this.xtraTabPage2.Controls.Add(txtk1);
                 }
             }
             else
             {
                 // 为第二列
                 LabelControl lbk2 = new LabelControl();
                 lbk2.Name     = "lbk2" + i;
                 lbk2.Text     = docp.cn_name + ":";
                 lbk2.Size     = new System.Drawing.Size(60, 15);
                 lbk2.Location = new System.Drawing.Point(412, Location_y);
                 this.xtraTabPage2.Controls.Add(lbk2);
                 if (docp.input_type == "SEL")
                 {
                     ComboBoxEdit cbx1 = new ComboBoxEdit();
                     // 添加下拉框的值
                     foreach (doc_combobox_value boxvalue in docp.ComboxValue)
                     {
                         cbx1.Properties.Items.Add(boxvalue.value);
                     }
                     cbx1.Name     = docp.en_name;
                     cbx1.Size     = new System.Drawing.Size(280, 20);
                     cbx1.Location = new System.Drawing.Point(108, Location_y - 4);
                     this.xtraTabPage2.Controls.Add(cbx1);
                 }
                 else
                 {
                     TextEdit txtk2 = new TextEdit();
                     txtk2.Name     = docp.en_name;
                     txtk2.Size     = new System.Drawing.Size(264, 20);
                     txtk2.Location = new System.Drawing.Point(500, Location_y - 4);
                     this.xtraTabPage2.Controls.Add(txtk2);
                 }
                 Location_y = Location_y + 30;
             }
             actlocation++;
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 根据文档类型,查询文档的扩展属性
        /// </summary>
        /// <returns></returns>
        public document_type getDocumentProperty(document doc)
        {
            document_type doctype = new document_type();
            List <doc_attached_property> docProList = new List <doc_attached_property>();
            doc_attached_property        dp1        = new doc_attached_property();

            dp1.en_name        = "Docdep";
            dp1.cn_name        = "文档部门";
            dp1.is_user_define = "";
            dp1.is_display     = true;
            dp1.display_width  = "100";
            dp1.input_type     = "";
            dp1.data_type      = "字符型";
            dp1.default_value  = "测试001";
            dp1.data_length    = "100";
            dp1.order          = "1";
            docProList.Add(dp1);
            doc_attached_property dp2 = new doc_attached_property();

            dp2.en_name        = "wordsize";
            dp2.cn_name        = "文档大小";
            dp2.is_user_define = "";
            dp2.is_display     = false;
            dp2.display_width  = "100";
            dp2.data_type      = "数值型";
            dp2.default_value  = "测试002";
            dp2.data_length    = "80";
            dp2.order          = "2";
            docProList.Add(dp2);
            doc_attached_property dp3 = new doc_attached_property();

            dp3.en_name        = "wordsize";
            dp3.cn_name        = "文档大小";
            dp3.is_user_define = "";
            dp3.is_display     = true;
            dp3.display_width  = "100";
            dp3.data_type      = "数值型";
            dp3.default_value  = "测试002";
            dp3.data_length    = "80";
            dp3.order          = "2";
            docProList.Add(dp3);
            doc_attached_property dp4 = new doc_attached_property();

            dp4.en_name        = "column4";
            dp4.cn_name        = "文档扩展属性1";
            dp4.is_user_define = "是";
            dp4.is_display     = true;
            dp4.display_width  = "100";
            dp4.order          = "4";
            dp4.input_type     = "SEL";

            List <doc_combobox_value> selectvlaue = new List <doc_combobox_value>();
            doc_combobox_value        v1          = new doc_combobox_value();

            v1.value = "1000";
            doc_combobox_value v2 = new doc_combobox_value();

            v2.value = "2000";
            selectvlaue.Add(v1);
            selectvlaue.Add(v2);
            dp4.ComboxValue = selectvlaue;
            docProList.Add(dp4);
            doctype.DocProperty = docProList;
            return(doctype);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 自定义构造函数
 /// </summary>
 /// <param name="docp"></param>
 public AddDocProperty(doc_attached_property docp)
 {
     InitializeComponent();
     this.docProperty = docp;
 }