Exemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.CommListDt == null)
            {
                CommListDt = ProductCodeCompareBLL.GetInstance().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();
        }
Exemplo n.º 2
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            DataRow drow = gridView3.GetDataRow(gridView3.FocusedRowHandle);

            if (drow != null)
            {
                if (this.CommListDt == null)
                {
                    CommListDt = ProductCodeCompareBLL.GetInstance().GetGpoHitCommList();
                }

                ProductCodeForm frm = new ProductCodeForm();
                frm.CommListDt = this.CommListDt.Copy();
                frm.IsAdd      = false;
                frm.productid  = drow["PROJECT_PROD_ID"].ToString().Trim();
                frm.mODEL_ID   = drow["HH_MODE_ID"].ToString().Trim();
                frm.sPEC_ID    = drow["HH_SPEC_ID"].ToString().Trim();
                int currentrowindex = gridView3.FocusedRowHandle;
                frm.productcode = drow == null ? "" : drow["HIS_PRODUCT_ID"].ToString();
                frm.strID       = drow == null ? "" : drow["ID"].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];
                //    }
                //}

                for (int i = 0; i < this.gridView3.RowCount; i++)
                {
                    DataRow drrow = gridView3.GetDataRow(i);
                    if (drrow["PROJECT_PROD_ID"].ToString() == drow["PROJECT_PROD_ID"] && drrow["HH_MODE_ID"].ToString() == drow["HH_MODE_ID"] && drrow["HH_SPEC_ID"].ToString() == drow["HH_SPEC_ID"])
                    {
                        this.gridView3.FocusedRowHandle = i;
                    }
                }
            }
        }