Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(RuRo.Model.NormalLisItems model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update NormalLisItems set ");
            strSql.Append("hospnum=@hospnum,");
            strSql.Append("patname=@patname,");
            strSql.Append("sex=@sex,");
            strSql.Append("age=@age,");
            strSql.Append("age_month=@age_month,");
            strSql.Append("ext_mthd=@ext_mthd,");
            strSql.Append("location=@location,");
            strSql.Append("DOC_NAME0=@DOC_NAME0,");
            strSql.Append("test_date=@test_date,");
            strSql.Append("check_by_name=@check_by_name,");
            strSql.Append("check_date=@check_date,");
            strSql.Append("IsDel=@IsDel");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@hospnum",       SqlDbType.NVarChar,  50),
                new SqlParameter("@patname",       SqlDbType.NVarChar,  50),
                new SqlParameter("@sex",           SqlDbType.NChar,     10),
                new SqlParameter("@age",           SqlDbType.NChar,     10),
                new SqlParameter("@age_month",     SqlDbType.NChar,     10),
                new SqlParameter("@ext_mthd",      SqlDbType.NVarChar,  50),
                new SqlParameter("@location",      SqlDbType.NVarChar,  50),
                new SqlParameter("@DOC_NAME0",     SqlDbType.NVarChar,  50),
                new SqlParameter("@test_date",     SqlDbType.DateTime),
                new SqlParameter("@check_by_name", SqlDbType.NVarChar,  50),
                new SqlParameter("@check_date",    SqlDbType.DateTime),
                new SqlParameter("@IsDel",         SqlDbType.Bit,        1),
                new SqlParameter("@Id",            SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.hospnum;
            parameters[1].Value  = model.patname;
            parameters[2].Value  = model.sex;
            parameters[3].Value  = model.age;
            parameters[4].Value  = model.age_month;
            parameters[5].Value  = model.ext_mthd;
            parameters[6].Value  = model.location;
            parameters[7].Value  = model.DOC_NAME0;
            parameters[8].Value  = model.test_date;
            parameters[9].Value  = model.check_by_name;
            parameters[10].Value = model.check_date;
            parameters[11].Value = model.IsDel;
            parameters[12].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(RuRo.Model.NormalLisItems model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into NormalLisItems(");
            strSql.Append("hospnum,patname,sex,age,age_month,ext_mthd,location,DOC_NAME0,test_date,check_by_name,check_date,IsDel)");
            strSql.Append(" values (");
            strSql.Append("@hospnum,@patname,@sex,@age,@age_month,@ext_mthd,@location,@DOC_NAME0,@test_date,@check_by_name,@check_date,@IsDel)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@hospnum",       SqlDbType.NVarChar,  50),
                new SqlParameter("@patname",       SqlDbType.NVarChar,  50),
                new SqlParameter("@sex",           SqlDbType.NChar,     10),
                new SqlParameter("@age",           SqlDbType.NChar,     10),
                new SqlParameter("@age_month",     SqlDbType.NChar,     10),
                new SqlParameter("@ext_mthd",      SqlDbType.NVarChar,  50),
                new SqlParameter("@location",      SqlDbType.NVarChar,  50),
                new SqlParameter("@DOC_NAME0",     SqlDbType.NVarChar,  50),
                new SqlParameter("@test_date",     SqlDbType.DateTime),
                new SqlParameter("@check_by_name", SqlDbType.NVarChar,  50),
                new SqlParameter("@check_date",    SqlDbType.DateTime),
                new SqlParameter("@IsDel",         SqlDbType.Bit, 1)
            };
            parameters[0].Value  = model.hospnum;
            parameters[1].Value  = model.patname;
            parameters[2].Value  = model.sex;
            parameters[3].Value  = model.age;
            parameters[4].Value  = model.age_month;
            parameters[5].Value  = model.ext_mthd;
            parameters[6].Value  = model.location;
            parameters[7].Value  = model.DOC_NAME0;
            parameters[8].Value  = model.test_date;
            parameters[9].Value  = model.check_by_name;
            parameters[10].Value = model.check_date;
            parameters[11].Value = model.IsDel;

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

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

            strSql.Append("select  top 1 Id,hospnum,patname,sex,age,age_month,ext_mthd,location,DOC_NAME0,test_date,check_by_name,check_date,IsDel from NormalLisItems ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(RuRo.Model.NormalLisItems model)
 {
     return(dal.Update(model));
 }
Esempio n. 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(RuRo.Model.NormalLisItems model)
 {
     return(dal.Add(model));
 }
Esempio n. 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public RuRo.Model.NormalLisItems DataRowToModel(DataRow row)
 {
     RuRo.Model.NormalLisItems model = new RuRo.Model.NormalLisItems();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["hospnum"] != null)
         {
             model.hospnum = row["hospnum"].ToString();
         }
         if (row["patname"] != null)
         {
             model.patname = row["patname"].ToString();
         }
         if (row["sex"] != null)
         {
             model.sex = row["sex"].ToString();
         }
         if (row["age"] != null)
         {
             model.age = row["age"].ToString();
         }
         if (row["age_month"] != null)
         {
             model.age_month = row["age_month"].ToString();
         }
         if (row["ext_mthd"] != null)
         {
             model.ext_mthd = row["ext_mthd"].ToString();
         }
         if (row["location"] != null)
         {
             model.location = row["location"].ToString();
         }
         if (row["DOC_NAME0"] != null)
         {
             model.DOC_NAME0 = row["DOC_NAME0"].ToString();
         }
         if (row["test_date"] != null && row["test_date"].ToString() != "")
         {
             model.test_date = DateTime.Parse(row["test_date"].ToString());
         }
         if (row["check_by_name"] != null)
         {
             model.check_by_name = row["check_by_name"].ToString();
         }
         if (row["check_date"] != null && row["check_date"].ToString() != "")
         {
             model.check_date = DateTime.Parse(row["check_date"].ToString());
         }
         if (row["IsDel"] != null && row["IsDel"].ToString() != "")
         {
             if ((row["IsDel"].ToString() == "1") || (row["IsDel"].ToString().ToLower() == "true"))
             {
                 model.IsDel = true;
             }
             else
             {
                 model.IsDel = false;
             }
         }
     }
     return(model);
 }
Esempio n. 7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public RuRo.Model.NormalLisItems DataRowToModel(DataRow row)
 {
     RuRo.Model.NormalLisItems model = new RuRo.Model.NormalLisItems();
     if (row != null)
     {
         if(row["Id"]!=null && row["Id"].ToString()!="")
         {
             model.Id=int.Parse(row["Id"].ToString());
         }
         if(row["hospnum"]!=null)
         {
             model.hospnum=row["hospnum"].ToString();
         }
         if(row["patname"]!=null)
         {
             model.patname=row["patname"].ToString();
         }
         if(row["sex"]!=null)
         {
             model.sex=row["sex"].ToString();
         }
         if(row["age"]!=null)
         {
             model.age=row["age"].ToString();
         }
         if(row["age_month"]!=null)
         {
             model.age_month=row["age_month"].ToString();
         }
         if(row["ext_mthd"]!=null)
         {
             model.ext_mthd=row["ext_mthd"].ToString();
         }
         if(row["location"]!=null)
         {
             model.location=row["location"].ToString();
         }
         if(row["DOC_NAME0"]!=null)
         {
             model.DOC_NAME0=row["DOC_NAME0"].ToString();
         }
         if(row["test_date"]!=null && row["test_date"].ToString()!="")
         {
             model.test_date=DateTime.Parse(row["test_date"].ToString());
         }
         if(row["check_by_name"]!=null)
         {
             model.check_by_name=row["check_by_name"].ToString();
         }
         if(row["check_date"]!=null && row["check_date"].ToString()!="")
         {
             model.check_date=DateTime.Parse(row["check_date"].ToString());
         }
         if(row["IsDel"]!=null && row["IsDel"].ToString()!="")
         {
             if((row["IsDel"].ToString()=="1")||(row["IsDel"].ToString().ToLower()=="true"))
             {
                 model.IsDel=true;
             }
             else
             {
                 model.IsDel=false;
             }
         }
     }
     return model;
 }
Esempio n. 8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RuRo.Model.NormalLisItems GetModel(int Id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 Id,hospnum,patname,sex,age,age_month,ext_mthd,location,DOC_NAME0,test_date,check_by_name,check_date,IsDel from NormalLisItems ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.Int,4)
            };
            parameters[0].Value = Id;

            RuRo.Model.NormalLisItems model = new RuRo.Model.NormalLisItems();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }