Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.s4SuiZhen DataRowToModel(DataRow row)
 {
     Maticsoft.Model.s4SuiZhen model = new Maticsoft.Model.s4SuiZhen();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["sBianHao"] != null)
         {
             model.sBianHao = row["sBianHao"].ToString();
         }
         if (row["sSuiZhenCiShu"] != null)
         {
             model.sSuiZhenCiShu = row["sSuiZhenCiShu"].ToString();
         }
         if (row["dSuiZhenTime"] != null && row["dSuiZhenTime"].ToString() != "")
         {
             model.dSuiZhenTime = DateTime.Parse(row["dSuiZhenTime"].ToString());
         }
         if (row["sZhuYuanHao"] != null)
         {
             model.sZhuYuanHao = row["sZhuYuanHao"].ToString();
         }
         if (row["sCT"] != null)
         {
             model.sCT = row["sCT"].ToString();
         }
         if (row["sMRI"] != null)
         {
             model.sMRI = row["sMRI"].ToString();
         }
         if (row["sNeiJing"] != null)
         {
             model.sNeiJing = row["sNeiJing"].ToString();
         }
         if (row["sPET"] != null)
         {
             model.sPET = row["sPET"].ToString();
         }
         if (row["bFuFa"] != null && row["bFuFa"].ToString() != "")
         {
             if ((row["bFuFa"].ToString() == "1") || (row["bFuFa"].ToString().ToLower() == "true"))
             {
                 model.bFuFa = true;
             }
             else
             {
                 model.bFuFa = false;
             }
         }
         if (row["iUserID"] != null && row["iUserID"].ToString() != "")
         {
             model.iUserID = int.Parse(row["iUserID"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.s4SuiZhen model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update s4SuiZhen set ");
            strSql.Append("sBianHao=@sBianHao,");
            strSql.Append("sSuiZhenCiShu=@sSuiZhenCiShu,");
            strSql.Append("dSuiZhenTime=@dSuiZhenTime,");
            strSql.Append("sZhuYuanHao=@sZhuYuanHao,");
            strSql.Append("sCT=@sCT,");
            strSql.Append("sMRI=@sMRI,");
            strSql.Append("sNeiJing=@sNeiJing,");
            strSql.Append("sPET=@sPET,");
            strSql.Append("bFuFa=@bFuFa,");
            strSql.Append("iUserID=@iUserID");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@sBianHao",      OleDbType.VarChar, 255),
                new OleDbParameter("@sSuiZhenCiShu", OleDbType.VarChar, 255),
                new OleDbParameter("@dSuiZhenTime",  OleDbType.Date),
                new OleDbParameter("@sZhuYuanHao",   OleDbType.VarChar, 255),
                new OleDbParameter("@sCT",           OleDbType.VarChar, 255),
                new OleDbParameter("@sMRI",          OleDbType.VarChar, 255),
                new OleDbParameter("@sNeiJing",      OleDbType.VarChar, 255),
                new OleDbParameter("@sPET",          OleDbType.VarChar, 255),
                new OleDbParameter("@bFuFa",         OleDbType.Date),
                new OleDbParameter("@iUserID",       OleDbType.VarChar, 255),
                new OleDbParameter("@ID",            OleDbType.Integer, 4)
            };
            parameters[0].Value  = model.sBianHao;
            parameters[1].Value  = model.sSuiZhenCiShu;
            parameters[2].Value  = model.dSuiZhenTime;
            parameters[3].Value  = model.sZhuYuanHao;
            parameters[4].Value  = model.sCT;
            parameters[5].Value  = model.sMRI;
            parameters[6].Value  = model.sNeiJing;
            parameters[7].Value  = model.sPET;
            parameters[8].Value  = model.bFuFa;
            parameters[9].Value  = model.iUserID;
            parameters[10].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.s4SuiZhen model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into s4SuiZhen(");
            strSql.Append("sBianHao,sSuiZhenCiShu,dSuiZhenTime,sZhuYuanHao,sCT,sMRI,sNeiJing,sPET,bFuFa,iUserID)");
            strSql.Append(" values (");
            strSql.Append("@sBianHao,@sSuiZhenCiShu,@dSuiZhenTime,@sZhuYuanHao,@sCT,@sMRI,@sNeiJing,@sPET,@bFuFa,@iUserID)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@sBianHao",      OleDbType.VarChar, 255),
                new OleDbParameter("@sSuiZhenCiShu", OleDbType.VarChar, 255),
                new OleDbParameter("@dSuiZhenTime",  OleDbType.Date),
                new OleDbParameter("@sZhuYuanHao",   OleDbType.VarChar, 255),
                new OleDbParameter("@sCT",           OleDbType.VarChar, 255),
                new OleDbParameter("@sMRI",          OleDbType.VarChar, 255),
                new OleDbParameter("@sNeiJing",      OleDbType.VarChar, 255),
                new OleDbParameter("@sPET",          OleDbType.VarChar, 255),
                new OleDbParameter("@bFuFa",         OleDbType.Date),
                new OleDbParameter("@iUserID",       OleDbType.VarChar, 255)
            };
            parameters[0].Value = model.sBianHao;
            parameters[1].Value = model.sSuiZhenCiShu;
            parameters[2].Value = model.dSuiZhenTime;
            parameters[3].Value = model.sZhuYuanHao;
            parameters[4].Value = model.sCT;
            parameters[5].Value = model.sMRI;
            parameters[6].Value = model.sNeiJing;
            parameters[7].Value = model.sPET;
            parameters[8].Value = model.bFuFa;
            parameters[9].Value = model.iUserID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.s4SuiZhen GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,sBianHao,sSuiZhenCiShu,dSuiZhenTime,sZhuYuanHao,sCT,sMRI,sNeiJing,sPET,bFuFa,iUserID from s4SuiZhen ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@ID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

            Maticsoft.Model.s4SuiZhen model = new Maticsoft.Model.s4SuiZhen();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }