Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hotel_app.Model.Q_sfz_temp model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Q_sfz_temp(");
            strSql.Append("zjhm,krxm,krmz,krxb,krsr,krdz,department,startdate,enddate,krxp,shcl,czsj,fjbh)");
            strSql.Append(" values (");
            strSql.Append("@zjhm,@krxm,@krmz,@krxb,@krsr,@krdz,@department,@startdate,@enddate,@krxp,@shcl,@czsj,@fjbh)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@zjhm",       SqlDbType.VarChar,    50),
                new SqlParameter("@krxm",       SqlDbType.VarChar,    50),
                new SqlParameter("@krmz",       SqlDbType.VarChar,    50),
                new SqlParameter("@krxb",       SqlDbType.VarChar,    50),
                new SqlParameter("@krsr",       SqlDbType.DateTime),
                new SqlParameter("@krdz",       SqlDbType.VarChar,   200),
                new SqlParameter("@department", SqlDbType.VarChar,    50),
                new SqlParameter("@startdate",  SqlDbType.DateTime),
                new SqlParameter("@enddate",    SqlDbType.DateTime),
                new SqlParameter("@krxp",       SqlDbType.Image),
                new SqlParameter("@shcl",       SqlDbType.Bit,         1),
                new SqlParameter("@czsj",       SqlDbType.DateTime),
                new SqlParameter("@fjbh",       SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.zjhm;
            parameters[1].Value  = model.krxm;
            parameters[2].Value  = model.krmz;
            parameters[3].Value  = model.krxb;
            parameters[4].Value  = model.krsr;
            parameters[5].Value  = model.krdz;
            parameters[6].Value  = model.department;
            parameters[7].Value  = model.startdate;
            parameters[8].Value  = model.enddate;
            parameters[9].Value  = model.krxp;
            parameters[10].Value = model.shcl;
            parameters[11].Value = model.czsj;
            parameters[12].Value = model.fjbh;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hotel_app.Model.Q_sfz_temp GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,zjhm,krxm,krmz,krxb,krsr,krdz,department,startdate,enddate,krxp,shcl,czsj,fjbh from Q_sfz_temp ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Hotel_app.Model.Q_sfz_temp model = new Hotel_app.Model.Q_sfz_temp();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["zjhm"] != null && ds.Tables[0].Rows[0]["zjhm"].ToString() != "")
                {
                    model.zjhm = ds.Tables[0].Rows[0]["zjhm"].ToString();
                }
                if (ds.Tables[0].Rows[0]["krxm"] != null && ds.Tables[0].Rows[0]["krxm"].ToString() != "")
                {
                    model.krxm = ds.Tables[0].Rows[0]["krxm"].ToString();
                }
                if (ds.Tables[0].Rows[0]["krmz"] != null && ds.Tables[0].Rows[0]["krmz"].ToString() != "")
                {
                    model.krmz = ds.Tables[0].Rows[0]["krmz"].ToString();
                }
                if (ds.Tables[0].Rows[0]["krxb"] != null && ds.Tables[0].Rows[0]["krxb"].ToString() != "")
                {
                    model.krxb = ds.Tables[0].Rows[0]["krxb"].ToString();
                }
                if (ds.Tables[0].Rows[0]["krsr"] != null && ds.Tables[0].Rows[0]["krsr"].ToString() != "")
                {
                    model.krsr = DateTime.Parse(ds.Tables[0].Rows[0]["krsr"].ToString());
                }
                if (ds.Tables[0].Rows[0]["krdz"] != null && ds.Tables[0].Rows[0]["krdz"].ToString() != "")
                {
                    model.krdz = ds.Tables[0].Rows[0]["krdz"].ToString();
                }
                if (ds.Tables[0].Rows[0]["department"] != null && ds.Tables[0].Rows[0]["department"].ToString() != "")
                {
                    model.department = ds.Tables[0].Rows[0]["department"].ToString();
                }
                if (ds.Tables[0].Rows[0]["startdate"] != null && ds.Tables[0].Rows[0]["startdate"].ToString() != "")
                {
                    model.startdate = DateTime.Parse(ds.Tables[0].Rows[0]["startdate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["enddate"] != null && ds.Tables[0].Rows[0]["enddate"].ToString() != "")
                {
                    model.enddate = DateTime.Parse(ds.Tables[0].Rows[0]["enddate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["krxp"] != null && ds.Tables[0].Rows[0]["krxp"].ToString() != "")
                {
                    model.krxp = (byte[])ds.Tables[0].Rows[0]["krxp"];
                }
                if (ds.Tables[0].Rows[0]["shcl"] != null && ds.Tables[0].Rows[0]["shcl"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["shcl"].ToString() == "1") || (ds.Tables[0].Rows[0]["shcl"].ToString().ToLower() == "true"))
                    {
                        model.shcl = true;
                    }
                    else
                    {
                        model.shcl = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["czsj"] != null && ds.Tables[0].Rows[0]["czsj"].ToString() != "")
                {
                    model.czsj = DateTime.Parse(ds.Tables[0].Rows[0]["czsj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["fjbh"] != null && ds.Tables[0].Rows[0]["fjbh"].ToString() != "")
                {
                    model.fjbh = ds.Tables[0].Rows[0]["fjbh"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hotel_app.Model.Q_sfz_temp model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Q_sfz_temp set ");
            strSql.Append("zjhm=@zjhm,");
            strSql.Append("krxm=@krxm,");
            strSql.Append("krmz=@krmz,");
            strSql.Append("krxb=@krxb,");
            strSql.Append("krsr=@krsr,");
            strSql.Append("krdz=@krdz,");
            strSql.Append("department=@department,");
            strSql.Append("startdate=@startdate,");
            strSql.Append("enddate=@enddate,");
            strSql.Append("krxp=@krxp,");
            strSql.Append("shcl=@shcl,");
            strSql.Append("czsj=@czsj,");
            strSql.Append("fjbh=@fjbh");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@zjhm",       SqlDbType.VarChar,    50),
                new SqlParameter("@krxm",       SqlDbType.VarChar,    50),
                new SqlParameter("@krmz",       SqlDbType.VarChar,    50),
                new SqlParameter("@krxb",       SqlDbType.VarChar,    50),
                new SqlParameter("@krsr",       SqlDbType.DateTime),
                new SqlParameter("@krdz",       SqlDbType.VarChar,   200),
                new SqlParameter("@department", SqlDbType.VarChar,    50),
                new SqlParameter("@startdate",  SqlDbType.DateTime),
                new SqlParameter("@enddate",    SqlDbType.DateTime),
                new SqlParameter("@krxp",       SqlDbType.Image),
                new SqlParameter("@shcl",       SqlDbType.Bit,         1),
                new SqlParameter("@czsj",       SqlDbType.DateTime),
                new SqlParameter("@fjbh",       SqlDbType.VarChar,    50),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.zjhm;
            parameters[1].Value  = model.krxm;
            parameters[2].Value  = model.krmz;
            parameters[3].Value  = model.krxb;
            parameters[4].Value  = model.krsr;
            parameters[5].Value  = model.krdz;
            parameters[6].Value  = model.department;
            parameters[7].Value  = model.startdate;
            parameters[8].Value  = model.enddate;
            parameters[9].Value  = model.krxp;
            parameters[10].Value = model.shcl;
            parameters[11].Value = model.czsj;
            parameters[12].Value = model.fjbh;
            parameters[13].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
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());
                }
            }