private void btn_cancelmatch_Click(object sender, EventArgs e)
 {
     if (this.dgvEPIDCompare.CurrentRow != null)
     {
         if (MessageBox.Show("确认取消匹配关系?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             LogedInUser           curUser    = ClientSession.GetInstance().CurrentUser;
             Gpo_Hosptail_MapModel enterprise = new Gpo_Hosptail_MapModel();
             enterprise.MapOrgId     = base.CurrentUserRegOrgId;
             enterprise.CorpId       = "";
             enterprise.CorpName     = this.dgvEPIDCompare.CurrentCell == null ? "" : this.dgvEPIDCompare.CurrentRow.Cells["FULL_NAME"].Value.ToString();
             enterprise.CorpAbbr     = this.dgvEPIDCompare.CurrentCell == null ? "" : this.dgvEPIDCompare.CurrentRow.Cells["EASY_NAME"].Value.ToString();
             enterprise.ModifyUserId = base.CurrentUserId;
             enterprise.Process      = "1";
             enterprise.IsMap        = "0";
             enterprise.CorpCode     = this.dgvEPIDCompare.CurrentCell == null ? "" : this.dgvEPIDCompare.CurrentRow.Cells["CODE"].Value.ToString();
             HosptailIDCompareBLL.GetInstance("ClientDB").cancelmatch(enterprise);
             this.bindingDsEnterPriseMapList();
             ItemFilter();
             foreach (DataGridViewRow row in this.dgvEPIDCompare.Rows)
             {
                 if (row.Cells["CODE"].Value.ToString() == enterprise.CorpCode)
                 {
                     this.dgvEPIDCompare.CurrentCell = this.dgvEPIDCompare["CODE", row.Index];
                 }
             }
             EmedMessageBox.ShowInformation("匹配关系已取消!");
         }
     }
 }
        /// <summary>
        /// 保存产品对照信息
        /// </summary>
        private void SaveProductHis()
        {
            try
            {
                ArrayList list1 = new ArrayList();
                for (int num1 = 0; num1 < this.dataGridView.RowCount; num1++)
                {
                    DataGridViewRow row1 = this.dataGridView.Rows[num1];
                    Emedchina.TradeAssistant.Model.User.LogedInUser usr = ClientSession.GetInstance().CurrentUser;

                    string boolstr;
                    if (row1.Cells[0].Value != null && row1.Cells[0].Value.ToString().ToLower() == "true")
                    {
                        boolstr = "True";
                    }
                    else
                    {
                        boolstr = "False";
                    }


                    string orgId = row1.Cells["ORG_ID"].Value.ToString();
                    if (boolstr == "True") //&& !string.IsNullOrEmpty(orgId)
                    {
                        if (bll.IsExistCode(row1.Cells["CODE"].Value.ToString(), usr.UserOrg.Reg_org_id.ToString()))
                        {
                            list1.Add(bll.UpdateHisEnterpriseMapSQL(row1, row1.Cells["CODE"].Value.ToString(), base.CurrentUserId, usr.UserOrg.Reg_org_id.ToString()));
                        }
                        else
                        {
                            list1.Add(bll.InsertHisEnterpriseMapSQL(row1, base.CurrentUserId, usr.UserOrg.Reg_org_id.ToString()));
                        }
                    }
                }
                if (list1.Count < 1)
                {
                    return;
                }
                string[] textArray1 = new string[list1.Count];
                list1.CopyTo(textArray1);
                if (bll.HisOperation(textArray1))
                {
                    //this.IsSave = true;
                    EmedMessageBox.ShowInformation("保存成功!");
                }
                else
                {
                    EmedMessageBox.ShowInformation("保存失败!");
                }
            }
            catch (Exception exception1)
            {
                EmedErrorLog.SaveLog("保存失败", exception1);
            }
        }
        /// <summary>
        /// 获取企业数据输入和校验
        /// </summary>
        private bool getCorpInput()
        {
            this.enterprise.CorpId = this.FCorpMapOrgId;
            Emedchina.TradeAssistant.Model.User.LogedInUser usr = ClientSession.GetInstance().CurrentUser;
            //转换异常字符
            CharConvert();
            this.enterprise.MapOrgId     = usr.UserOrg.Reg_org_id.ToString();
            this.enterprise.CorpCode     = tb_CorpCode.Text.Trim();
            this.enterprise.CorpName     = tb_CorpName.Text.Trim();
            this.enterprise.CorpAbbr     = tb_CorpAbbr.Text.Trim();
            this.enterprise.ModifyUserId = base.CurrentUserId;
            this.enterprise.Process      = this.cb_Process.Checked ? "1" : "0";
            if (string.IsNullOrEmpty(this.FCorpMapOrgId))
            {
                enterprise.IsMap = "0";
            }
            else
            {
                enterprise.IsMap = "1";
            }

            if (String.IsNullOrEmpty(this.enterprise.CorpCode))
            {
                EmedMessageBox.ShowWarning("买方编码不允许为空!");
                this.tb_CorpCode.Focus();
                this.tb_CorpCode.SelectAll();
                return(false);
            }
            else if (String.IsNullOrEmpty(this.enterprise.CorpName))
            {
                EmedMessageBox.ShowWarning("买方全称不允许为空!");
                this.tb_CorpName.Focus();
                this.tb_CorpName.SelectAll();
                return(false);
            }
            else if (String.IsNullOrEmpty(this.enterprise.CorpAbbr))
            {
                EmedMessageBox.ShowWarning("买方简称不允许为空!");
                this.tb_CorpAbbr.Focus();
                this.tb_CorpAbbr.SelectAll();
                return(false);
            }
            return(true);
        }
 /// <summary>
 /// 保存对照信息
 /// </summary>
 private void SaveCorpMap()
 {
     if (this.getCorpInput())
     {
         try
         {
             if (flag == "ADD")
             {
                 if (bll.JudgeHIScode(this.enterprise.CorpCode, this.enterprise.MapOrgId) < 1)
                 {
                     bll.InsertHisErpCorpMap(this.enterprise);
                     EmedMessageBox.ShowInformation("保存成功!");
                     this.ClearAll();
                     this.IsSave = true;
                     this.bindingDsEmedCorpList();
                     searchInput.SearchSendName = tb_sendName.Text;
                     filterDsEmedCorpList(searchInput);
                 }
                 else
                 {
                     EmedMessageBox.ShowInformation("此买方编码已存在!");
                 }
             }
             else if (flag == "MODIFY")
             {
                 bll.UpdateHisErpCorpMap(this.enterprise);
                 EmedMessageBox.ShowInformation("保存成功!");
                 this.IsSave = true;
                 this.bindingDsEmedCorpList();
                 searchInput.SearchSendName = tb_sendName.Text;
                 filterDsEmedCorpList(searchInput);
             }
         }
         catch (Exception ex)
         {
             EmedMessageBox.ShowError("保存时发送错误:" + ex.Message.ToString());
         }
     }
 }
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (this.dgvEPIDCompare.CurrentRow != null)
     {
         if (MessageBox.Show("确认删除HIS记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             try
             {
                 string mapId = this.dgvEPIDCompare.CurrentCell == null ? "" : this.dgvEPIDCompare.CurrentRow.Cells["ID"].Value.ToString();
                 HosptailIDCompareBLL.GetInstance("ClientDB").DeleteHisErpCorpMap(mapId);
             }
             catch (Exception ex)
             {
                 EmedMessageBox.ShowError("保存时发送错误:" + ex.Message.ToString());
             }
             finally
             {
                 isdeleted = true;
                 this.bindingDsEnterPriseMapList();
                 MessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
 }