Beispiel #1
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Maticsoft.Model.UserExp.UsersApprove> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.UserExp.UsersApprove> modelList = new List<Maticsoft.Model.UserExp.UsersApprove>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Maticsoft.Model.UserExp.UsersApprove model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Maticsoft.Model.UserExp.UsersApprove();
             if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
             {
                 model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
             }
             if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "")
             {
                 model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
             }
             if (dt.Rows[n]["ApproveType"] != null && dt.Rows[n]["ApproveType"].ToString() != "")
             {
                 model.ApproveType = int.Parse(dt.Rows[n]["ApproveType"].ToString());
             }
             if (dt.Rows[n]["ImgURL"] != null && dt.Rows[n]["ImgURL"].ToString() != "")
             {
                 model.ImgURL = dt.Rows[n]["ImgURL"].ToString();
             }
             if (dt.Rows[n]["CreatedDate"] != null && dt.Rows[n]["CreatedDate"].ToString() != "")
             {
                 model.CreatedDate = DateTime.Parse(dt.Rows[n]["CreatedDate"].ToString());
             }
             if (dt.Rows[n]["Status"] != null && dt.Rows[n]["Status"].ToString() != "")
             {
                 model.Status = int.Parse(dt.Rows[n]["Status"].ToString());
             }
             if (dt.Rows[n]["ApprovedTime"] != null && dt.Rows[n]["ApprovedTime"].ToString() != "")
             {
                 model.ApprovedTime = DateTime.Parse(dt.Rows[n]["ApprovedTime"].ToString());
             }
             if (dt.Rows[n]["ApprovedUserID"] != null && dt.Rows[n]["ApprovedUserID"].ToString() != "")
             {
                 model.ApprovedUserID = int.Parse(dt.Rows[n]["ApprovedUserID"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Beispiel #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.UserExp.UsersApprove GetModelByUidAndType(int userId, int approveType)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select top 1 ID,UserID,ApproveType,ImgURL,CreatedDate,Status,ApprovedTime,ApprovedUserID,IDCard from Accounts_UsersApprove ");
     strSql.Append(" where UserID=@UserID and ApproveType=@ApproveType");
     SqlParameter[] parameters = {
             new SqlParameter("@UserID", SqlDbType.Int,4),
             new SqlParameter("@ApproveType", SqlDbType.Int,4)
                                 };
     parameters[0].Value = userId;
     parameters[1].Value = approveType;
     Maticsoft.Model.UserExp.UsersApprove model = new Maticsoft.Model.UserExp.UsersApprove();
     DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
     if (ds.Tables[0].Rows.Count > 0)
     {
         if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
         {
             model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
         }
         if (ds.Tables[0].Rows[0]["UserID"] != null && ds.Tables[0].Rows[0]["UserID"].ToString() != "")
         {
             model.UserID = int.Parse(ds.Tables[0].Rows[0]["UserID"].ToString());
         }
         if (ds.Tables[0].Rows[0]["ApproveType"] != null && ds.Tables[0].Rows[0]["ApproveType"].ToString() != "")
         {
             model.ApproveType = int.Parse(ds.Tables[0].Rows[0]["ApproveType"].ToString());
         }
         if (ds.Tables[0].Rows[0]["ImgURL"] != null && ds.Tables[0].Rows[0]["ImgURL"].ToString() != "")
         {
             model.ImgURL = ds.Tables[0].Rows[0]["ImgURL"].ToString();
         }
         if (ds.Tables[0].Rows[0]["CreatedDate"] != null && ds.Tables[0].Rows[0]["CreatedDate"].ToString() != "")
         {
             model.CreatedDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreatedDate"].ToString());
         }
         if (ds.Tables[0].Rows[0]["Status"] != null && ds.Tables[0].Rows[0]["Status"].ToString() != "")
         {
             model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
         }
         if (ds.Tables[0].Rows[0]["ApprovedTime"] != null && ds.Tables[0].Rows[0]["ApprovedTime"].ToString() != "")
         {
             model.ApprovedTime = DateTime.Parse(ds.Tables[0].Rows[0]["ApprovedTime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["ApprovedUserID"] != null && ds.Tables[0].Rows[0]["ApprovedUserID"].ToString() != "")
         {
             model.ApprovedUserID = int.Parse(ds.Tables[0].Rows[0]["ApprovedUserID"].ToString());
         }
         if (ds.Tables[0].Rows[0]["IDCard"] != null && ds.Tables[0].Rows[0]["IDCard"].ToString() != "")
         {
             model.IDCard = ds.Tables[0].Rows[0]["IDCard"].ToString();
         }
         return model;
     }
     else
     {
         return null;
     }
 }