Exemple #1
0
        private void tsb_select_Click(object sender, EventArgs e)
        {
            if(this.dgv_DocList.RowCount<=0)return;

            int rowIndex = this.dgv_DocList.CurrentCell.RowIndex;
            if (rowIndex < 0)return;

            if (MessageBox.Show("您确认要添加此关联文档?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                DataGridViewRow row = dgv_DocList.Rows[rowIndex];
                ObjectRelation objrl = new ObjectRelation();

                objrl.ORID=Guid.NewGuid().ToString();
                objrl.MASTEROBJECTID = row.Cells["DOCID"].Value.ToString();
                objrl.MASTEROBJECTTYPE="Document";
                objrl.MASTEROBJECTVERSION = row.Cells["DOCVERSION"].Value.ToString();
                objrl.RELATIONOBJECTID = this.m_Product.PRODUCTID;
                objrl.RELATIONOBJECTTYPE="Parts";
                objrl.RELATIONOBJECTVERSION = this.m_Product.VERSION;
                objrl.DEL_FALG = "N";
                try
                {
                    objrl.Save();
                    MessageBox.Show("添加成功");
                    DocList_Init();
                }catch(Exception e1){
                    MessageBox.Show("添加失败:"+ e1.Message);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 删除关联
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelRelation_Click(object sender, EventArgs e)
        {
            //tabProduct
            //  MessageBox.Show(this.tabControl2.SelectedTab.Name.ToString());
            if (this.tabControl2.SelectedTab.Name.ToString() == "tabProduct")
            {
                if (this.dGVProduct.CurrentRow == null)
                {
                    MessageBox.Show("当前没有选中任何可以删除的对象,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    ObjectRelation or = new ObjectRelation();

                    IObjectRelationService _orDocProd = ServiceContainer.GetService <ObjectRelationService>();
                    or = _orDocProd.getObjectRelation(DataType.RelationObjectType.Drawing.ToString(), this.document.DOCID, DataType.RelationObjectType.Product.ToString(), this.dGVProduct.CurrentRow.Cells["PRODUCTID"].Value.ToString());
                    if (or != null)
                    {
                        or.DEL_FALG = "Y";
                        or.Save();
                        MessageBox.Show("关联删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        InitialObjectRelation();
                    }
                }
            }
            else if (this.tabControl2.SelectedTab.Name.ToString() == "tabMaterial")
            {
                if (this.dgvMaterial.CurrentRow == null)
                {
                    MessageBox.Show("当前没有选中任何可以删除的对象,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    ObjectRelation or = new ObjectRelation();

                    IObjectRelationService _orDocProd = ServiceContainer.GetService <ObjectRelationService>();
                    // or = _orDocProd.getDocMaterialObjectRelation(this.Document.DOCID, this.dgvMaterial.CurrentRow.Cells["MATERIALID"].Value.ToString());
                    or = _orDocProd.getObjectRelation(DataType.RelationObjectType.Drawing.ToString(), this.document.DOCID, DataType.RelationObjectType.Material.ToString(), this.dgvMaterial.CurrentRow.Cells["MATERIALID"].Value.ToString());
                    if (or != null)
                    {
                        or.DEL_FALG = "Y";
                        or.Save();
                        MessageBox.Show("关联删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        InitialObjectRelation();
                    }
                }
            }
            else
            {
            }
        }
Exemple #3
0
        private void tsb_select_Click(object sender, EventArgs e)
        {
            if (this.dgv_DocList.RowCount <= 0)
            {
                return;
            }

            int rowIndex = this.dgv_DocList.CurrentCell.RowIndex;

            if (rowIndex < 0)
            {
                return;
            }

            if (MessageBox.Show("您确认要添加此关联文档?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                DataGridViewRow row   = dgv_DocList.Rows[rowIndex];
                ObjectRelation  objrl = new ObjectRelation();

                objrl.ORID                  = Guid.NewGuid().ToString();
                objrl.MASTEROBJECTID        = row.Cells["DOCID"].Value.ToString();
                objrl.MASTEROBJECTTYPE      = "Drawing";
                objrl.MASTEROBJECTVERSION   = row.Cells["DOCVERSION"].Value.ToString();
                objrl.RELATIONOBJECTID      = this.m_Product.PRODUCTID;
                objrl.RELATIONOBJECTTYPE    = "Product";
                objrl.RELATIONOBJECTVERSION = this.m_Product.VERSION;
                objrl.DEL_FALG              = "N";
                try
                {
                    objrl.Save();
                    MessageBox.Show("添加成功");
                    DocList_Init();
                }catch (Exception e1) {
                    MessageBox.Show("添加失败:" + e1.Message);
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// 删除关联
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelRelation_Click(object sender, EventArgs e)
        {
            //tabProduct
            //  MessageBox.Show(this.tabControl2.SelectedTab.Name.ToString());
            if (this.tabControl2.SelectedTab.Name.ToString() == "tabProduct")
            {
                if (this.dGVProduct.CurrentRow == null)
                {
                    MessageBox.Show("当前没有选中任何可以删除的对象,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    ObjectRelation or = new ObjectRelation();

                    IObjectRelationService _orDocProd = ServiceContainer.GetService<ObjectRelationService>();
                    or = _orDocProd.getDocProdObjectRelation(this.Document.DOCID, this.dGVProduct.CurrentRow.Cells["PRODUCTID"].Value.ToString());
                    if (or != null)
                    {
                        or.DEL_FALG = "Y";
                        or.Save();
                        MessageBox.Show("关联删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        InitialObjectRelation();
                    }

                }
            }
            else if (this.tabControl2.SelectedTab.Name.ToString() == "tabMaterial")
            {
                if (this.dgvMaterial.CurrentRow == null)
                {
                    MessageBox.Show("当前没有选中任何可以删除的对象,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    ObjectRelation or = new ObjectRelation();

                    IObjectRelationService _orDocProd = ServiceContainer.GetService<ObjectRelationService>();
                    or = _orDocProd.getDocMaterialObjectRelation(this.Document.DOCID, this.dgvMaterial.CurrentRow.Cells["MATERIALID"].Value.ToString());
                    if (or != null)
                    {
                        or.DEL_FALG = "Y";
                        or.Save();
                        MessageBox.Show("关联删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        InitialObjectRelation();
                    }
                }
            }
            else
            {

            }
        }