예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.CommListDt == null)
            {
                CommListDt = ProductCodeCompareBLL.GetInstance("ClientDB").GetGpoHitCommList();
            }

            ProductCodeForm frm = new ProductCodeForm();

            frm.CommListDt = this.CommListDt.Copy();
            frm.IsAdd      = true;
            frm.ShowDialog();

            if (frm.strID == null)
            {
                return;
            }

            //更新DataTable
            frm.productmapitemOper.ID = frm.strID;
            UpdateDtCompare(frm.productmapitemOper);

            //重新绑定数据
            IniData();
        }
예제 #2
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (this.dgvProIDCompare.CurrentRow != null)
            {
                if (this.CommListDt == null)
                {
                    CommListDt = ProductCodeCompareBLL.GetInstance("ClientDB").GetGpoHitCommList();
                }

                ProductCodeForm frm = new ProductCodeForm();
                frm.CommListDt = this.CommListDt.Copy();
                frm.IsAdd      = false;
                frm.productid  = this.dgvProIDCompare.CurrentRow.Cells["PRODUCT_ID"].Value.ToString().Trim();
                int currentrowindex = this.dgvProIDCompare.CurrentRow.Index;
                frm.productcode = this.dgvProIDCompare.CurrentCell == null ? "" : this.dgvProIDCompare.CurrentRow.Cells["PRODUCT_CODE"].Value.ToString();
                frm.strID       = this.dgvProIDCompare.CurrentCell == null ? "" : this.dgvProIDCompare.CurrentRow.Cells["ID"].Value.ToString();
                frm.ShowDialog();

                if (frm.productmapitemOper == null)
                {
                    return;
                }

                //更新DataTable
                UpdateDtCompare(frm.productmapitemOper);

                //重新绑定数据
                IniData();

                foreach (DataGridViewRow row in this.dgvProIDCompare.Rows)
                {
                    if (row.Cells["PRODUCT_CODE"].Value.ToString() == frm.productcode)
                    {
                        this.dgvProIDCompare.CurrentCell = this.dgvProIDCompare["PRODUCT_CODE", row.Index];
                    }
                }
            }
        }