/// <summary> /// 临时增加身份证,用来最后转入房间 /// </summary> /// <returns></returns> public string add_ls_sfz() { string result_0 = ""; string tBkrxm = ""; string tBkrxb = ""; string tBnation = ""; string tBadd = ""; string tBid = ""; string tBkrsr = ""; string tBdepart = ""; string tBstart = ""; string tBend = ""; bool sh_massage = false; string massage_nr = ""; byte[] imakrxp = new byte[0]; get_sfz_info(ref tBkrxm, ref tBkrxb, ref tBnation, ref tBadd, ref tBid, ref tBkrsr, ref tBdepart, ref tBstart, ref tBend, ref imakrxp, sh_massage, ref massage_nr); result_0 = massage_nr; if (tBkrxm != "") { BLL.Common B_Common = new Hotel_app.BLL.Common(); DataSet DS_temp = B_Common.GetList("select * from Q_sfz_temp", " zjhm='" + tBid + "' and shcl=0"); if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0) { } else { BLL.Q_sfz_temp B_Q_sfz_temp = new Hotel_app.BLL.Q_sfz_temp(); Model.Q_sfz_temp M_Q_sfz_temp = new Hotel_app.Model.Q_sfz_temp(); M_Q_sfz_temp.zjhm = tBid; M_Q_sfz_temp.krxm = tBkrxm; M_Q_sfz_temp.krxb = tBkrxb; M_Q_sfz_temp.krmz = tBnation; M_Q_sfz_temp.krdz = tBadd; M_Q_sfz_temp.krsr = DateTime.Parse(tBkrsr.Substring(0, 4) + "-" + tBkrsr.Substring(4, 2) + "-" + tBkrsr.Substring(6, 2)); M_Q_sfz_temp.department = tBdepart; if (tBstart.Length > 7) { M_Q_sfz_temp.startdate = DateTime.Parse(tBstart.Substring(0, 4) + "-" + tBstart.Substring(4, 2) + "-" + tBstart.Substring(6, 2)); } else { M_Q_sfz_temp.startdate = DateTime.Parse(common_file.common_app.cssj); } if (tBend.Length > 8)//注意:这个字段有个可能是:长期 这样一个值,不一这下是时间 { M_Q_sfz_temp.enddate = DateTime.Parse(tBend.Substring(0, 4) + "-" + tBend.Substring(4, 2) + "-" + tBend.Substring(6, 2)); } else { M_Q_sfz_temp.enddate = DateTime.Parse(common_file.common_app.cssj); } M_Q_sfz_temp.krxp = imakrxp; B_Q_sfz_temp.Add(M_Q_sfz_temp); } } return(result_0); }
public void FillData() { try { if (IsInitComOK()) { int authenticate = CVR_Authenticate(); if (authenticate == 1) { int readContent = CVR_Read_Content(4); if (readContent == 1) { byte[] name = new byte[30]; int length = 30; GetPeopleName(ref name[0], ref length); byte[] number = new byte[30]; length = 36; GetPeopleIDCode(ref number[0], ref length); byte[] people = new byte[30]; length = 3; GetPeopleNation(ref people[0], ref length); byte[] validtermOfStart = new byte[30]; length = 16; GetStartDate(ref validtermOfStart[0], ref length); byte[] birthday = new byte[30]; length = 16; GetPeopleBirthday(ref birthday[0], ref length); byte[] address = new byte[30]; length = 70; GetPeopleAddress(ref address[0], ref length); byte[] validtermOfEnd = new byte[30]; length = 16; GetEndDate(ref validtermOfEnd[0], ref length); byte[] signdate = new byte[30]; length = 30; GetDepartment(ref signdate[0], ref length); byte[] sex = new byte[30]; length = 3; GetPeopleSex(ref sex[0], ref length); byte[] samid = new byte[32]; CVR_GetSAMID(ref samid[0]); //生成了照片 if (File.Exists(Application.StartupPath + "\\zp.bmp")) { if (!File.Exists(Application.StartupPath + "\\imgsfz\\" + System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim() + ".bmp")) { File.Copy(Application.StartupPath + "\\zp.bmp", Application.StartupPath + "\\imgsfz\\" + System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim() + ".bmp", true); } } //pb_photo.ImageLocation = Application.StartupPath + "\\imgsfz\\" + tBid_0.Text + ".bmp"; //检测临时表是否有存储当前客户的信息 BLL.Q_sfz_temp bll = new Hotel_app.BLL.Q_sfz_temp(); List <Model.Q_sfz_temp> lists = bll.GetModelList(" zjhm='" + System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim() + "' and shcl=0"); if (lists != null && lists.Count > 0) { } else { //ADD Model To Q_sfz_temp Model.Q_sfz_temp M_Q_sfz_temp = new Hotel_app.Model.Q_sfz_temp(); M_Q_sfz_temp.zjhm = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim(); M_Q_sfz_temp.krxm = System.Text.Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim(); M_Q_sfz_temp.krxb = System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim(); M_Q_sfz_temp.krmz = System.Text.Encoding.GetEncoding("GB2312").GetString(people).Replace("\0", "").Trim(); M_Q_sfz_temp.krdz = System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim(); M_Q_sfz_temp.krsr = DateTime.Parse(System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim()); M_Q_sfz_temp.department = System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim(); M_Q_sfz_temp.startdate = DateTime.Parse(System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim()); M_Q_sfz_temp.enddate = DateTime.Parse(System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim()); if (File.Exists(Application.StartupPath + "\\imgsfz\\" + System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim() + ".bmp")) { M_Q_sfz_temp.krxp = Maticsoft.Common.FileToByte.FileContent(Application.StartupPath + "\\imgsfz\\" + System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim() + ".bmp"); } bll.Add(M_Q_sfz_temp); } } else { MessageBox.Show("读卡操作失败,请拿开卡片重试."); } } else { MessageBox.Show("未放卡或卡片放置不正确,请拿开卡片重试"); } CVR_CloseComm(); } else { MessageBox.Show("初始化失败!"); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } }