Exemplo n.º 1
0
        }//号牌登记

        public static string UpdateLicense(lisence l, int num)
        {
            db0.open();
            string t;

            using (db0.sqlc){
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("declare @s int");
                sb.AppendLine("select @s=[recorf]+@score from [Dinfo] where [ddrivingno]='@id'");
                sb.AppendLine("if @s>=12");
                sb.AppendLine("begin");
                sb.AppendLine("update [Dinfo] set [recorf]=12,[stat]='暂扣' where [ddrivingno]='@id'");
                sb.AppendLine();
                sb.AppendLine("end");
                sb.AppendLine("else");
                sb.AppendLine("update [Dinfo] set [recorf]=@s where [ddrivingno]='@id'");
                sb.AppendLine();
                sb.AppendFormat("select [recorf] from [Dinfo] where [ddrivingno]='@id'");
                SqlCommand     cmd = new SqlCommand(sb.ToString(), db0.sqlc);
                SqlParameter[] sp  = new SqlParameter[] {
                    new SqlParameter("id", l.Licenseno),
                    new SqlParameter("score", num)
                };
                cmd.Parameters.Add(sp);
                int t0 = Convert.ToInt32(cmd.ExecuteScalar());
                if (t0 == 12)
                {
                    t = "编号为" + l.Licenseno + "的驾照记分已满12分,执行暂扣";
                }
                else if (t0 != 0)
                {
                    t = "登记成功,编号为" + l.Licenseno + "的驾照记分为" + t0;
                }
                else
                {
                    t = "查无此照\n";
                }
                return(t);
            }
        }//驾照扣分
Exemplo n.º 2
0
        }//用户驾照查询

        public static bool RegisterLicense(lisence l)
        {
            db0.open();
            using (db0.sqlc)
            {
                string         sql  = "update [Dinfo] set [stat]='@state' where [ddrivingno]='@id'";
                SqlCommand     cmd0 = new SqlCommand(sql, db0.sqlc);
                SqlParameter[] sp   = new SqlParameter[] {
                    new SqlParameter("id", l.Licenseno),
                    new SqlParameter("state", l.State)
                };
                cmd.Parameters.Add(sp);
                if (cmd0.ExecuteNonQuery() != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }//驾照补换登记
Exemplo n.º 3
0
        public static lisence GetPersonInfo(string id)
        {
            db0.open();
            string  sql = "select * from [Dinfo] where [ddrivingno]='@id'";
            lisence l   = new lisence();

            using (db0.sqlc)
            {
                SqlCommand   cmd = new SqlCommand(sql, db0.sqlc);
                SqlParameter sp  = new SqlParameter("id", id);
                cmd.Parameters.Add(sp);
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    l.Licenseno = id;
                    l.Type      = dr["dtype"].ToString();
                    l.Date      = DateTime.Parse(dr["date"].ToString());
                    l.Record    = int.Parse(dr["recorf"].ToString());
                    l.State     = dr["stat"].ToString();
                }
            }
            return(l);
        }//用户驾照查询