private void butimp_Click(object sender, EventArgs e) { try { DataTable dt = ProductCodeCompareBLL.GetInstance("ClientDB").GetExportGpoProductMapList(); this.saveFileDialog1.Filter = "Excel文件(*.xls)|*.xls"; if (this.saveFileDialog1.ShowDialog() == DialogResult.OK) { if (this.saveFileDialog1.FileName != "") { string[] strarr = { "海虹通用名", "海虹商品名", "海虹剂型", "海虹规格", "海虹生产企业", "产品id", "his产品编号", "His产品名称", "通用名", "HIS剂型", "HIS规格包装", "HIS包装单位", "HIS使用单位", "HIS包装转换比", "海虹单位转换比", "HIS生产企业", "备注", "处理标记", "是否匹配" }; FileOperation.ExportExcelFile(dt, this.saveFileDialog1.FileName, strarr); ComUtil.MsgBox("导出产品对照表成功!"); } } } catch { ComUtil.MsgBox("导出产品对照表出错!"); } }
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(); }
//修改操作 private void SaveUpdate(Gpo_Product_MapModel productmapitem) { issaved = true; ProductCodeCompareBLL.GetInstance("ClientDB").Edit_Gpo_Product_Map(productmapitem); InitCommListDT(); Filter(); ComUtil.MsgBox("保存成功!"); }
/// <summary> /// 窗体加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProductMapAuto_Load(object sender, EventArgs e) { this.ERPbindingSource.DataSource = dtNotMap.DefaultView; InitFromCacheByData(ProductCodeCompareBLL.GetInstance("ClientDB").GetGpoHitCommList()); EmedbindingSource.DataSource = base.gridDataView; pageNavigator1.ItemCount = base.cachedDataView.Count; this.labNoMap.Text = dgvERPdprolist.Rows.Count.ToString() + "条记录"; this.cmbMapStutas.Text = "全部"; }
//修改操作 private void SaveUpdate(Gpo_Product_MapModel productmapitem) { issaved = true; ProductCodeCompareBLL.GetInstance().Edit_Gpo_Product_Map(productmapitem); InitCommListDT(); Filter(); XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void DataBind() { int index, size; commDT = ProductCodeCompareBLL.GetInstance().GetGpoHitCommList(); if (commDT == null) { return; } this.bindingSource1.DataSource = commDT.DefaultView; InitFromCacheByData(commDT); }
private void btnCancleMatch_Click(object sender, EventArgs e) { DataRow drow = gridView3.GetDataRow(gridView3.FocusedRowHandle); if (drow != null) { if (XtraMessageBox.Show("确认取消匹配关系?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //Gpo_Product_MapModel productmapitem = new Gpo_Product_MapModel(); string strId = drow["ID"].ToString(); //productmapitem.ProductID = this.dgvProIDCompare.CurrentRow.Cells["PRODUCT_ID"].Value.ToString(); //string ProductCode = this.dgvProIDCompare.CurrentCell == null ? "" : this.dgvProIDCompare.CurrentRow.Cells["PRODUCT_CODE"].Value.ToString(); //取消匹配 bool flag = ProductCodeCompareBLL.GetInstance().CancelComparion(strId); if (flag == true) { DataColumn[] keys = new DataColumn[1]; DataColumn myColumn = new DataColumn(); keys[0] = this.dtCompare.Columns["ID"]; this.dtCompare.PrimaryKey = keys; DataRow dr = dtCompare.Rows.Find(strId); dr["IsMap"] = "0"; dr["Is_Map"] = "未匹配"; dr["PROJECT_PROD_ID"] = "0"; IniData(); } //原foreach //foreach (DataGridViewRow row in this.dgvProIDCompare.Rows) //{ // if (row.Cells["ID"].Value.ToString() == strId) // { // this.dgvProIDCompare.CurrentCell = this.dgvProIDCompare["ID", row.Index]; // } //} //修改如下 for (int i = 0; i < this.gridView3.RowCount; i++) { DataRow drrow = gridView3.GetDataRow(i); if (drrow["ID"].ToString() == strId) { this.gridView3.FocusedRowHandle = i; } } XtraMessageBox.Show("匹配关系已取消!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void InitDataProjectType() { DataTable dt = ProductCodeCompareBLL.GetInstance("ClientDB").GetProjectTypeDt(); string[] data = { "", "全部", "" }; dt.Rows.Add(data); cbbsourcetype.DataSource = dt; cbbsourcetype.DisplayMember = "Name"; cbbsourcetype.ValueMember = "Code"; cbbsourcetype.SelectedIndex = cbbsourcetype.Items.Count - 1; }
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; } } } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (!bSave) { ArrayList arrayExec = new ArrayList(); foreach (Gpo_Product_MapModel model in hashMap.Values) { string sRecord_ID = string.Empty; //如果已存在匹配数据 if (ProductCodeCompareBLL.GetInstance().JudgeProductCode(model.ProductCode, model.Map_Orgid, ref sRecord_ID)) { try { ProductCodeCompareBLL.GetInstance().UpdateProductMap(sRecord_ID, model.ProductID); } catch (Exception me) { MessageBox.Show(me.Message); } } else { arrayExec.Add(ProductCodeCompareBLL.GetInstance().CreateProductComprison(model, out sRecord_ID)); } if (!hashSave.ContainsKey(model.ProductCode)) { hashSave.Add(model.ProductCode, sRecord_ID); } } try { string[] sExecs = new string[arrayExec.Count]; arrayExec.CopyTo(sExecs); if (ProductCodeCompareBLL.GetInstance().Add_Gpo_Product_Map_Batch(sExecs)) { MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); hashMap.Clear(); HideSaveData(); bSave = true; } } catch { MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.labNoMap.Text = dgvERPdprolist.Rows.Count.ToString() + "条记录"; } }
private void dgvProItem_CurrentCellChanged(object sender, EventArgs e) { if (this.dgvProItem.CurrentRow != null) { proID = this.dgvProItem.CurrentCell == null ? "" : this.dgvProItem.CurrentRow.Cells["PRODUCT_ID"].Value.ToString(); proItemDT = ProductCodeCompareBLL.GetInstance("ClientDB").GetGpoMapList(proID); this.bindingSource2.DataSource = proItemDT.DefaultView; this.lblHiscount.Text = proItemDT.DefaultView.Count.ToString() + "条记录"; } else { this.bindingSource2.DataSource = null; this.lblHiscount.Text = "0条记录"; } }
/// <summary> /// 删除匹配 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { if (dgvERPdprolist.CurrentRow != null && hashSave.ContainsKey(dgvERPdprolist.CurrentRow.Cells["product_code"].Value)) { if (MessageBox.Show("确实要删除吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { ProductCodeCompareBLL.GetInstance().DeleteGpo_Product(hashSave[dgvERPdprolist.CurrentRow.Cells["product_code"].Value].ToString()); string sCode = dgvERPdprolist.CurrentRow.Cells["product_code"].Value.ToString(); dtNotMap.DefaultView.RowFilter = " product_code <> '" + sCode + "'"; dtNotMap.Select("product_code = '" + sCode + "'")[0]["IsMap"] = "未匹配"; bSave = false; this.cmbMapStutas.Text = "未匹配"; } } }
private void DataBind() { int index, size; index = pageNavigatorProIDComItem.CurrentPageIndex; size = this.pageNavigatorProIDComItem.PageSize; commDT = ProductCodeCompareBLL.GetInstance("ClientDB").GetGpoHitCommList(); if (commDT == null) { return; } this.bindingSource1.DataSource = commDT.DefaultView; InitFromCacheByData(commDT, index, size); this.bindingSource1.DataSource = base.gridDataView; this.pageNavigatorProIDComItem.ItemCount = base.cachedDataView.Count; }
//插入操作 private void SaveAdd(Gpo_Product_MapModel productmapitem) { bool flag = ProductCodeCompareBLL.GetInstance().JudgeHisProductCode(productmapitem.ProductCode); if (flag == false) { //产品编码没有重复 ProductCodeCompareBLL.GetInstance().Add_Gpo_Product_Map(productmapitem, out strID); InitCommListDT(); Filter(); issaved = true; XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { XtraMessageBox.Show("该产品编码已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//插入操作 private void SaveAdd(Gpo_Product_MapModel productmapitem) { bool flag = ProductCodeCompareBLL.GetInstance("ClientDB").JudgeHisProductCode(productmapitem.ProductCode); if (flag == false) { //产品编码没有重复 ProductCodeCompareBLL.GetInstance("ClientDB").Add_Gpo_Product_Map(productmapitem, out strID); InitCommListDT(); Filter(); issaved = true; ComUtil.MsgBox("保存成功!"); } else { ComUtil.MsgBox("该产品编码已存在!"); } }
/// <summary> /// 取消匹配 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancelMap_Click(object sender, EventArgs e) { if (dgvERPdprolist.CurrentRow != null && dgvEmedProduct.CurrentRow != null && dgvERPdprolist.CurrentRow.Cells["IsMap"].Value.ToString() == "已匹配") { if (hashMap.ContainsKey(dgvERPdprolist.CurrentRow.Cells["product_code"].Value)) { hashMap.Remove(dgvERPdprolist.CurrentRow.Cells["product_code"].Value); } //如果已保存过 if (hashSave.ContainsKey(dgvERPdprolist.CurrentRow.Cells["product_code"].Value)) { ProductCodeCompareBLL.GetInstance().CancelComparion(hashSave[dgvERPdprolist.CurrentRow.Cells["product_code"].Value].ToString()); hashSave.Remove(dgvERPdprolist.CurrentRow.Cells["product_code"].Value); dgvERPdprolist_RowEnter(sender, new DataGridViewCellEventArgs(0, 0)); } dtNotMap.Select("product_code ='" + dgvERPdprolist.CurrentRow.Cells["product_code"].Value + "'")[0]["IsMap"] = "未匹配"; bSave = false; } }
/// <summary> /// 查询数据 /// </summary> private void IniData() { int index, size; //查询总的数据集 if (dtCompare == null) { dtCompare = ProductCodeCompareBLL.GetInstance().GetCommList(); } //CommListDt = ProductCodeCompareBLL.GetInstance("ClientDB").GetGpoHitCommList(); if (dtCompare == null) { return; } base.InitFromCacheByData(dtCompare); this.bindingSource1.DataSource = dtCompare.DefaultView; }
private void ModifyLoadPage() { if (!string.IsNullOrEmpty(this.productid)) { foreach (DataGridViewRow row in this.dgvComm.Rows) { if (row.Cells["PRODUCT_ID"].Value.ToString() == this.productid) { this.dgvComm.CurrentCell = this.dgvComm["MEDICAL_NAME", row.Index]; this.bindingSource2.DataSource = CompareDt.DefaultView; CompareDt.DefaultView.RowFilter = "PRODUCT_ID ='" + row.Cells["PRODUCT_ID"].Value.ToString() + "'"; break; } } } Gpo_Product_MapModel productmapitem = ProductCodeCompareBLL.GetInstance("ClientDB").GetGpoMapModelById(this.strID); ShowHISItemInfo(productmapitem); }
private void gridView3_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { DataRow dr = gridView3.GetDataRow(gridView3.FocusedRowHandle); if (dr != null) { proID = dr["PROJECT_PROD_ID"].ToString(); modelID = dr["MODEL_ID"].ToString(); specID = dr["SPEC_ID"].ToString(); proItemDT = ProductCodeCompareBLL.GetInstance().GetGpoMapList(proID, modelID, specID); this.bindingSource2.DataSource = proItemDT.DefaultView; this.lblHiscount.Text = proItemDT.DefaultView.Count.ToString() + "条记录"; } else { this.bindingSource2.DataSource = null; this.lblHiscount.Text = "0条记录"; } }
public void Comprison() { DataRow row = gridView5.GetDataRow(gridView5.FocusedRowHandle); if (row != null) { string proID = row["PROJECT_PROD_ID"].ToString(); string specID = row["SPEC_ID"].ToString(); string modelID = row["MODEL_ID"].ToString(); DataTable dt = ProductCodeCompareBLL.GetInstance().GetGpoMapList(proID, modelID, specID); int MapSum = dt.Rows.Count; if (MapSum > 0) { ContProductModel productModel = new ContProductModel(); productModel.MedicalName = row["COMMON_NAME"].ToString(); productModel.FactoryName = row["MANU_NAME"].ToString(); productModel.Model = row["MODEL"].ToString(); productModel.UncSpec = row["SPEC"].ToString(); productModel.TradeName = row["product_name"].ToString(); productModel.MatchHisDT = dt; ProIDMatchShowBoxForm proshowbox = new ProIDMatchShowBoxForm(productModel); proshowbox.IsAdd = this.IsAdd; proshowbox.ShowDialog(); if (proshowbox.DialogResult == DialogResult.OK) { this.bindingSource2.DataSource = CompareDt.DefaultView; CompareDt.DefaultView.RowFilter = " PROJECT_PROD_ID ='" + row["PROJECT_PROD_ID"].ToString() + "' AND MODEL_ID = '" + row["MODEL_ID"].ToString() + " ' AND SPEC_ID = '" + row["SPEC_ID"].ToString() + "'"; } } else { this.bindingSource2.DataSource = CompareDt.DefaultView; CompareDt.DefaultView.RowFilter = " PROJECT_PROD_ID ='" + row["PROJECT_PROD_ID"].ToString() + "' AND MODEL_ID = '" + row["MODEL_ID"].ToString() + " ' AND SPEC_ID = '" + row["SPEC_ID"].ToString() + "'"; } } }
private void ModifyLoadPage() { if (!string.IsNullOrEmpty(this.productid)) { for (int i = 0; i < this.gridView5.RowCount; i++) { DataRow drrow = gridView5.GetDataRow(i); if (drrow["PROJECT_PROD_ID"].ToString() == this.productid && drrow["MODEL_ID"].ToString() == this.mODEL_ID && drrow["SPEC_ID"].ToString() == this.sPEC_ID) { this.gridView5.FocusedRowHandle = i; this.bindingSource2.DataSource = CompareDt.DefaultView; CompareDt.DefaultView.RowFilter = " PROJECT_PROD_ID ='" + drrow["PROJECT_PROD_ID"].ToString() + "' AND MODEL_ID = '" + drrow["MODEL_ID"].ToString() + " ' AND SPEC_ID = '" + drrow["SPEC_ID"].ToString() + "'"; break; } } } Gpo_Product_MapModel productmapitem = ProductCodeCompareBLL.GetInstance().GetGpoMapModelById(this.strID); ShowHISItemInfo(productmapitem); }
private void btnDelete_Click(object sender, EventArgs e) { DataRow drow = gridView3.GetDataRow(gridView3.FocusedRowHandle); if (drow != null) { if (XtraMessageBox.Show("确认删除HIS记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string strid = drow == null ? "" : drow["ID"].ToString(); try { ProductCodeCompareBLL.GetInstance().DeleteGpo_Product(strid); } catch (Exception ex) { throw ex; } finally { isdelete = true; DataColumn[] keys = new DataColumn[1]; DataColumn myColumn = new DataColumn(); keys[0] = this.dtCompare.Columns["ID"]; this.dtCompare.PrimaryKey = keys; DataRow dr = dtCompare.Rows.Find(strid); if (dr != null) { dtCompare.Rows.Remove(dr); } //重新绑定查询数据 IniData(); XtraMessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
public void Comprison() { DataGridViewRow row = this.dgvComm.CurrentRow; if (row != null) { string proID = row.Cells["PRODUCT_ID"].Value.ToString(); DataTable dt = ProductCodeCompareBLL.GetInstance("ClientDB").GetGpoMapList(proID); int MapSum = dt.Rows.Count; if (MapSum > 0) { ContProductModel productModel = new ContProductModel(); productModel.MedicalName = row.Cells["MEDICAL_NAME"].Value.ToString(); productModel.FactoryName = row.Cells["FACTORY_NAME"].Value.ToString(); productModel.DoseageForm = row.Cells["DOSEAGE_FORM"].Value.ToString(); productModel.UncSpec = row.Cells["unc_spec"].Value.ToString(); productModel.MatchHisDT = dt; ProIDMatchShowBoxForm proshowbox = new ProIDMatchShowBoxForm(productModel); proshowbox.IsAdd = this.IsAdd; proshowbox.ShowDialog(); if (proshowbox.DialogResult == DialogResult.OK) { this.bindingSource2.DataSource = CompareDt.DefaultView; CompareDt.DefaultView.RowFilter = " PRODUCT_ID ='" + row.Cells["PRODUCT_ID"].Value.ToString() + "'"; } } else { this.bindingSource2.DataSource = CompareDt.DefaultView; CompareDt.DefaultView.RowFilter = " PRODUCT_ID ='" + row.Cells["PRODUCT_ID"].Value.ToString() + "'"; } } }
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]; } } } }
private void btnDelete_Click(object sender, EventArgs e) { if (this.dgvProIDCompare.CurrentRow != null) { if (MessageBox.Show("确认删除HIS记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { string strid = this.dgvProIDCompare.CurrentCell == null ? "" : this.dgvProIDCompare.CurrentRow.Cells["ID"].Value.ToString(); try { ProductCodeCompareBLL.GetInstance("ClientDB").DeleteGpo_Product(strid); } catch (Exception ex) { throw ex; } finally { isdelete = true; DataColumn[] keys = new DataColumn[1]; DataColumn myColumn = new DataColumn(); keys[0] = this.dtCompare.Columns["ID"]; this.dtCompare.PrimaryKey = keys; DataRow dr = dtCompare.Rows.Find(strid); if (dr != null) { dtCompare.Rows.Remove(dr); } //重新绑定查询数据 IniData(); MessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void btnCancleMatch_Click(object sender, EventArgs e) { if (MessageBox.Show("确认取消匹配关系?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { //Gpo_Product_MapModel productmapitem = new Gpo_Product_MapModel(); string strId = this.dgvProIDCompare.CurrentRow.Cells["ID"].Value.ToString(); //productmapitem.ProductID = this.dgvProIDCompare.CurrentRow.Cells["PRODUCT_ID"].Value.ToString(); //string ProductCode = this.dgvProIDCompare.CurrentCell == null ? "" : this.dgvProIDCompare.CurrentRow.Cells["PRODUCT_CODE"].Value.ToString(); //取消匹配 bool flag = ProductCodeCompareBLL.GetInstance("ClientDB").CancelComparion(strId); if (flag == true) { DataColumn[] keys = new DataColumn[1]; DataColumn myColumn = new DataColumn(); keys[0] = this.dtCompare.Columns["ID"]; this.dtCompare.PrimaryKey = keys; DataRow dr = dtCompare.Rows.Find(strId); dr["IsMap"] = "0"; dr["Is_Map"] = "未匹配"; dr["PRODUCT_ID"] = ""; IniData(); } foreach (DataGridViewRow row in this.dgvProIDCompare.Rows) { if (row.Cells["ID"].Value.ToString() == strId) { this.dgvProIDCompare.CurrentCell = this.dgvProIDCompare["ID", row.Index]; } } MessageBox.Show("匹配关系已取消!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 查询数据 /// </summary> private void IniData() { int index, size; index = pageNavigator1.CurrentPageIndex; size = pageNavigator1.PageSize; //查询总的数据集 if (dtCompare == null) { dtCompare = ProductCodeCompareBLL.GetInstance("ClientDB").GetCommList(); } //CommListDt = ProductCodeCompareBLL.GetInstance("ClientDB").GetGpoHitCommList(); if (dtCompare == null) { return; } InitFromCacheByData(dtCompare); this.InitGridTableView(pageNavigator1.CurrentPageIndex, pageNavigator1.PageSize); this.bindingSource1.DataSource = base.gridDataView; this.pageNavigator1.ItemCount = base.cachedDataView.Count; }
private void btnImport_Click(object sender, EventArgs e) { if (dataGridView.Rows.Count == 0) { return; } bool flag = true; IList <Gpo_Product_MapModel> productModelList = new List <Gpo_Product_MapModel>(); try { foreach (DataGridViewRow row in this.dataGridView.Rows) { if (row.Cells[0].Value != null && row.Cells[0].Value.ToString().ToLower() == "true") { Gpo_Product_MapModel model = new Gpo_Product_MapModel(); model.ProductCode = row.Cells["PRODUCT_CODE"].Value.ToString(); model.MedicalCode = row.Cells["MEDICAL_CODE"].Value.ToString(); model.CommonName = row.Cells["COMMON_NAME"].Value.ToString(); model.Product_Name = row.Cells["PRODUCT_NAME"].Value.ToString(); model.Mode_ID = row.Cells["MODE_ID"].Value.ToString(); model.Mode_Name = row.Cells["MODE_NAME"].Value.ToString(); model.Medical_Spec_Id = row.Cells["MEDICAL_SPEC_ID"].Value.ToString(); model.Medical_Spec = row.Cells["MEDICAL_SPEC"].Value.ToString(); model.UseUnitCode = row.Cells["USE_UNIT_ID"].Value.ToString(); model.Use_Unit = row.Cells["USE_UNIT"].Value.ToString(); model.Spec_Unit_Id = row.Cells["SPEC_UNIT_ID"].Value.ToString(); model.Spec_Unit = row.Cells["SPEC_UNIT"].Value.ToString(); model.Stand_Rate = row.Cells["STAND_RATE"].Value.ToString(); model.Factory_Code = row.Cells["FACTORY_CODE"].Value.ToString(); model.Factory_Name = row.Cells["FACTORY_NAME"].Value.ToString(); model.ProductID = row.Cells["product_id"].Value.ToString(); model.DataProductID = row.Cells["data_product_id"].Value.ToString(); model.Permit_No = row.Cells["PERMIT_NO"].Value.ToString(); model.Saler_Code = row.Cells["SALER_CODE"].Value.ToString(); model.Saler_Name = row.Cells["SALER_NAME"].Value.ToString(); model.Sender_Code = row.Cells["SENDER_CODE"].Value.ToString(); model.Sender_Name = row.Cells["SENDER_NAME"].Value.ToString(); model.Category_Id = row.Cells["CATEGORY_ID"].Value.ToString(); model.Category_Name = row.Cells["CATEGORY_NAME"].Value.ToString(); model.Stock_Id = row.Cells["STOCK_ID"].Value.ToString(); model.Stock_Name = row.Cells["STOCK_NAME"].Value.ToString(); model.Package_Rate = string.IsNullOrEmpty(row.Cells["PACKAGE_RATE"].Value.ToString()) ? "1" : row.Cells["PACKAGE_RATE"].Value.ToString(); productModelList.Add(model); } } if (productModelList.Count == 0) { ComUtil.MsgBox("请选择所要的导入产品信息!"); return; } //获取当前用户ORGID string orgid = ClientSession.GetInstance().CurrentUser.UserOrg.Reg_org_id.ToString(); flag = ProductCodeCompareBLL.GetInstance("ClientDB").Import_Gpo_Product(orgid, productModelList); if (flag == true) { ComUtil.MsgBox("导入产品信息成功!"); } else { ComUtil.MsgBox("导入产品信息失败!"); } }catch (Exception ex) { ComUtil.MsgBox("导入产品信息失败!"); //throw ex; } }