コード例 #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.DishesTyepTable DataRowToModel(DataRow row)
 {
     Maticsoft.Model.DishesTyepTable model=new Maticsoft.Model.DishesTyepTable();
     if (row != null)
     {
         if(row["DishesTypeID"]!=null)
         {
             model.DishesTypeID=row["DishesTypeID"].ToString();
         }
         if(row["DishesTypeName"]!=null)
         {
             model.DishesTypeName=row["DishesTypeName"].ToString();
         }
         if(row["OldDishesTypeID"]!=null)
         {
             model.OldDishesTypeID=row["OldDishesTypeID"].ToString();
         }
         if(row["BusinessID"]!=null)
         {
             model.BusinessID=row["BusinessID"].ToString();
         }
         if(row["SortID"]!=null && row["SortID"].ToString()!="")
         {
             model.SortID=int.Parse(row["SortID"].ToString());
         }
         if(row["CreateDate"]!=null && row["CreateDate"].ToString()!="")
         {
             model.CreateDate=DateTime.Parse(row["CreateDate"].ToString());
         }
         if(row["ChainStoreDishesTypeID"]!=null)
         {
             model.ChainStoreDishesTypeID=row["ChainStoreDishesTypeID"].ToString();
         }
         if(row["ChainStoreID"]!=null)
         {
             model.ChainStoreID=row["ChainStoreID"].ToString();
         }
         if(row["IsDeleted"]!=null && row["IsDeleted"].ToString()!="")
         {
             if((row["IsDeleted"].ToString()=="1")||(row["IsDeleted"].ToString().ToLower()=="true"))
             {
                 model.IsDeleted=true;
             }
             else
             {
                 model.IsDeleted=false;
             }
         }
         if(row["IsSetMeal"]!=null && row["IsSetMeal"].ToString()!="")
         {
             if((row["IsSetMeal"].ToString()=="1")||(row["IsSetMeal"].ToString().ToLower()=="true"))
             {
                 model.IsSetMeal=true;
             }
             else
             {
                 model.IsSetMeal=false;
             }
         }
     }
     return model;
 }
コード例 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.DishesTyepTable GetModel(string DishesTypeID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 DishesTypeID,DishesTypeName,OldDishesTypeID,BusinessID,SortID,CreateDate,ChainStoreDishesTypeID,ChainStoreID,IsDeleted,IsSetMeal from DishesTyepTable ");
            strSql.Append(" where DishesTypeID=@DishesTypeID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@DishesTypeID", SqlDbType.NVarChar,50)			};
            parameters[0].Value = DishesTypeID;

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