Example #1
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Maticsoft.Model.Tao.SendInvite> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.Tao.SendInvite> modelList = new List<Maticsoft.Model.Tao.SendInvite>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Maticsoft.Model.Tao.SendInvite model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Maticsoft.Model.Tao.SendInvite();
             if (dt.Rows[n]["InviteID"] != null && dt.Rows[n]["InviteID"].ToString() != "")
             {
                 model.InviteID = int.Parse(dt.Rows[n]["InviteID"].ToString());
             }
             if (dt.Rows[n]["ConstitutorID"] != null && dt.Rows[n]["ConstitutorID"].ToString() != "")
             {
                 model.ConstitutorID = int.Parse(dt.Rows[n]["ConstitutorID"].ToString());
             }
             if (dt.Rows[n]["InviteeID"] != null && dt.Rows[n]["InviteeID"].ToString() != "")
             {
                 model.InviteeID = int.Parse(dt.Rows[n]["InviteeID"].ToString());
             }
             if (dt.Rows[n]["ModuleID"] != null && dt.Rows[n]["ModuleID"].ToString() != "")
             {
                 model.ModuleID = int.Parse(dt.Rows[n]["ModuleID"].ToString());
             }
             if (dt.Rows[n]["InviteStatus"] != null && dt.Rows[n]["InviteStatus"].ToString() != "")
             {
                 model.InviteStatus = int.Parse(dt.Rows[n]["InviteStatus"].ToString());
             }
             if (dt.Rows[n]["InviteDate"] != null && dt.Rows[n]["InviteDate"].ToString() != "")
             {
                 model.InviteDate = DateTime.Parse(dt.Rows[n]["InviteDate"].ToString());
             }
             if (dt.Rows[n]["DisposeDate"] != null && dt.Rows[n]["DisposeDate"].ToString() != "")
             {
                 model.DisposeDate = DateTime.Parse(dt.Rows[n]["DisposeDate"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Tao.SendInvite GetModel(int InviteID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 InviteID,ConstitutorID,InviteeID,ModuleID,InviteStatus,InviteDate,DisposeDate from Tao_SendInvite ");
            strSql.Append(" where InviteID=@InviteID");
            SqlParameter[] parameters = {
                    new SqlParameter("@InviteID", SqlDbType.Int,4)
            };
            parameters[0].Value = InviteID;

            Maticsoft.Model.Tao.SendInvite model = new Maticsoft.Model.Tao.SendInvite();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["InviteID"] != null && ds.Tables[0].Rows[0]["InviteID"].ToString() != "")
                {
                    model.InviteID = int.Parse(ds.Tables[0].Rows[0]["InviteID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ConstitutorID"] != null && ds.Tables[0].Rows[0]["ConstitutorID"].ToString() != "")
                {
                    model.ConstitutorID = int.Parse(ds.Tables[0].Rows[0]["ConstitutorID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InviteeID"] != null && ds.Tables[0].Rows[0]["InviteeID"].ToString() != "")
                {
                    model.InviteeID = int.Parse(ds.Tables[0].Rows[0]["InviteeID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ModuleID"] != null && ds.Tables[0].Rows[0]["ModuleID"].ToString() != "")
                {
                    model.ModuleID = int.Parse(ds.Tables[0].Rows[0]["ModuleID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InviteStatus"] != null && ds.Tables[0].Rows[0]["InviteStatus"].ToString() != "")
                {
                    model.InviteStatus = int.Parse(ds.Tables[0].Rows[0]["InviteStatus"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InviteDate"] != null && ds.Tables[0].Rows[0]["InviteDate"].ToString() != "")
                {
                    model.InviteDate = DateTime.Parse(ds.Tables[0].Rows[0]["InviteDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DisposeDate"] != null && ds.Tables[0].Rows[0]["DisposeDate"].ToString() != "")
                {
                    model.DisposeDate = DateTime.Parse(ds.Tables[0].Rows[0]["DisposeDate"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }