Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KSOA.Model.Bank_OriginalGroup DataRowToModel(DataRow row)
 {
     KSOA.Model.Bank_OriginalGroup model=new KSOA.Model.Bank_OriginalGroup();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=int.Parse(row["ID"].ToString());
         }
         if(row["OpusCopyright"]!=null)
         {
             model.OpusCopyright=row["OpusCopyright"].ToString();
         }
         if(row["CreationInfo"]!=null)
         {
             model.CreationInfo=row["CreationInfo"].ToString();
         }
         if(row["OpusName"]!=null)
         {
             model.OpusName=row["OpusName"].ToString();
         }
         if(row["OpusAuthor"]!=null)
         {
             model.OpusAuthor=row["OpusAuthor"].ToString();
         }
         if(row["SalePrice"]!=null && row["SalePrice"].ToString()!="")
         {
             model.SalePrice=decimal.Parse(row["SalePrice"].ToString());
         }
         if(row["AccreditPlatform"]!=null)
         {
             model.AccreditPlatform=row["AccreditPlatform"].ToString();
         }
         if(row["AccreditCompany"]!=null)
         {
             model.AccreditCompany=row["AccreditCompany"].ToString();
         }
         if(row["AccreditTime"]!=null && row["AccreditTime"].ToString()!="")
         {
             model.AccreditTime=DateTime.Parse(row["AccreditTime"].ToString());
         }
         if(row["AccreditType"]!=null)
         {
             model.AccreditType=row["AccreditType"].ToString();
         }
         if(row["Awards"]!=null)
         {
             model.Awards=row["Awards"].ToString();
         }
         if(row["OpusMascot"]!=null)
         {
             model.OpusMascot=row["OpusMascot"].ToString();
         }
         if(row["AddTime"]!=null && row["AddTime"].ToString()!="")
         {
             model.AddTime=DateTime.Parse(row["AddTime"].ToString());
         }
         if(row["IsDelete"]!=null && row["IsDelete"].ToString()!="")
         {
             if((row["IsDelete"].ToString()=="1")||(row["IsDelete"].ToString().ToLower()=="true"))
             {
                 model.IsDelete=true;
             }
             else
             {
                 model.IsDelete=false;
             }
         }
     }
     return model;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KSOA.Model.Bank_OriginalGroup GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ID,OpusCopyright,CreationInfo,OpusName,OpusAuthor,SalePrice,AccreditPlatform,AccreditCompany,AccreditTime,AccreditType,Awards,OpusMascot,AddTime,IsDelete from Bank_OriginalGroup ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)
            };
            parameters[0].Value = ID;

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