示例#1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public webs_YueyxShop.Model.DepartmentBase GetModel(Guid d_ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 d_ID,cs_ID,d_BianM,d_MingCh,d_ParentId,d_CengJ,d_ZhuYDH,d_ChuanZ,d_YouX,d_CreatedBy,d_CreatedOn,d_StateCode,d_DeleteStateCode from DepartmentBase ");
            strSql.Append(" where d_ID=@d_ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@d_ID", SqlDbType.UniqueIdentifier,16)			};
            parameters[0].Value = d_ID;

            webs_YueyxShop.Model.DepartmentBase model = new webs_YueyxShop.Model.DepartmentBase();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
示例#2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public webs_YueyxShop.Model.DepartmentBase DataRowToModel(DataRow row)
 {
     webs_YueyxShop.Model.DepartmentBase model = new webs_YueyxShop.Model.DepartmentBase();
     if (row != null)
     {
         if (row["d_ID"] != null && row["d_ID"].ToString() != "")
         {
             model.d_ID = new Guid(row["d_ID"].ToString());
         }
         if (row["cs_ID"] != null && row["cs_ID"].ToString() != "")
         {
             model.cs_ID = int.Parse(row["cs_ID"].ToString());
         }
         if (row["d_BianM"] != null)
         {
             model.d_BianM = row["d_BianM"].ToString();
         }
         if (row["d_MingCh"] != null)
         {
             model.d_MingCh = row["d_MingCh"].ToString();
         }
         if (row["d_ParentId"] != null && row["d_ParentId"].ToString() != "")
         {
             model.d_ParentId = new Guid(row["d_ParentId"].ToString());
         }
         if (row["d_CengJ"] != null && row["d_CengJ"].ToString() != "")
         {
             model.d_CengJ = int.Parse(row["d_CengJ"].ToString());
         }
         if (row["d_ZhuYDH"] != null)
         {
             model.d_ZhuYDH = row["d_ZhuYDH"].ToString();
         }
         if (row["d_ChuanZ"] != null)
         {
             model.d_ChuanZ = row["d_ChuanZ"].ToString();
         }
         if (row["d_YouX"] != null)
         {
             model.d_YouX = row["d_YouX"].ToString();
         }
         if (row["d_CreatedBy"] != null && row["d_CreatedBy"].ToString() != "")
         {
             model.d_CreatedBy = new Guid(row["d_CreatedBy"].ToString());
         }
         if (row["d_CreatedOn"] != null && row["d_CreatedOn"].ToString() != "")
         {
             model.d_CreatedOn = DateTime.Parse(row["d_CreatedOn"].ToString());
         }
         if (row["d_StateCode"] != null && row["d_StateCode"].ToString() != "")
         {
             model.d_StateCode = int.Parse(row["d_StateCode"].ToString());
         }
         if (row["d_DeleteStateCode"] != null && row["d_DeleteStateCode"].ToString() != "")
         {
             model.d_DeleteStateCode = int.Parse(row["d_DeleteStateCode"].ToString());
         }
     }
     return model;
 }