예제 #1
0
 private void FormMaster_Load(object sender, EventArgs e)
 {
     try
     {
         HisCom = new HisComponent();
         StringBuilder sb = new StringBuilder(256);
         int           hr = NhLocalWrap.InitDLL(sb);
         if (hr < 0)
         {
             throw new Exception(sb.ToString());
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #2
0
        private void buttonQuery_Click(object sender, EventArgs e)
        {
            string        SelAreaID = ((AreaItem)this.comboBox1.SelectedItem).areaID;
            StringBuilder sb        = null;

            int    AiIDNo      = 1;
            int    hr          = -1;
            string nhCodeID    = this.textBox1.Text.Trim();
            object targetObj   = null;
            string CoopMedCode = nhCodeID;

            if (string.IsNullOrEmpty(nhCodeID))
            {
                return;
            }
            try
            {
                if (SelAreaID == GSettings.OrganIDLocal)
                {
                    //本地农合
                    if (radioButtonKh.Checked)
                    {
                        //通过卡号获取农合证号
                        sb = new StringBuilder(256);
                        hr = NhLocalWrap.GetCoopMedCodeByCardID(GSettings.ParamLocalOrganID, nhCodeID, sb);
                        if (hr < 0)
                        {
                            throw new Exception(sb.ToString());
                        }
                        CoopMedCode = sb.ToString().Split(new string[] { "$$" }, StringSplitOptions.None)[0];
                        AiIDNo      = int.Parse(sb.ToString().Split(new string[] { "$$" }, StringSplitOptions.None)[1]);
                    }
                    sb = new StringBuilder(256);
                    hr = NhLocalWrap.GetHzPersonInfo(GSettings.ParamLocalOrganID, CoopMedCode, sb);
                    if (hr < 0)
                    {
                        throw new Exception(sb.ToString());
                    }
                    targetObj = (HrGetHzPersonInfo)sb.ToString();
                }
                else
                {
                    //异地农合
                    if (radioButtonKh.Checked)
                    {
                        //通过卡号获取农合号
                        sb = new StringBuilder(256);
                        hr = NhLocalWrap.zzGetCoopMedCodeByCardID(GSettings.ParamRemoteOrganID, SelAreaID, nhCodeID, sb);
                        if (hr < 0)
                        {
                            throw new Exception(sb.ToString());
                        }
                        CoopMedCode = sb.ToString().Split(new string[] { "$$" }, StringSplitOptions.None)[0];
                        AiIDNo      = int.Parse(sb.ToString().Split(new string[] { "$$" }, StringSplitOptions.None)[1]);
                    }
                    sb = new StringBuilder(256);
                    hr = NhLocalWrap.GetZzinfo_zz(
                        string.Format(@"{0}$${1}", "1", GSettings.AccountYear),
                        string.Format("{0}$${1}$${2}$${3}", GSettings.OrganIDRemote, SelAreaID, CoopMedCode, AiIDNo),
                        sb
                        );
                    if (hr < 0)
                    {
                        throw new Exception(sb.ToString());
                    }

                    targetObj = (HrGetZzinfo_zz)sb.ToString();
                }

                this.propertyGrid1.SelectedObject = targetObj;
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }