示例#1
0
        public void DeleteLinkSpaces(LinkSpaceEntity[] oe)
        {
            SqlConnection conn = Connection.GetConnection();
            string query = "delete from LinkSpace where LinkSpaceId = @LinkSpaceId";
            SqlCommand cmd = new SqlCommand(query, conn);
            SqlParameter pLinkSpaceId = cmd.Parameters.Add("@LinkSpaceId", SqlDbType.Int);

            try
            {
                conn.Open();
                for (int i = 0; i < oe.Length; i++)
                {
                    pLinkSpaceId.Value = oe[i].linkSpaceId;
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
示例#2
0
        public LinkSpaceEntity[] getLinkSpaceArray(int pageIndex, int recNo, int projectId)
        {
            SqlDataReader dataReader = getLinkSpaceList(pageIndex, recNo, projectId);

            ArrayList al = new ArrayList();

            if ((dataReader != null) && (dataReader.HasRows))
            {
                while (dataReader.Read())
                {
                    LinkSpaceEntity eo = new LinkSpaceEntity();

                    eo.linkSpaceId  = Convert.ToInt32(dataReader["LinkSpaceId"]);
                    eo.ForumURL     = dataReader["ForumURL"].ToString();
                    eo.ForumContent = dataReader["ForumContent"].ToString();
                    eo.ActorId      = Convert.ToInt32(dataReader["ActorId"]);
                    eo.ActorName    = dataReader["ActorName"].ToString();
                    eo.UserName     = dataReader["UserName"].ToString();
                    eo.Password     = dataReader["Password"].ToString();
                    eo.ReplyContent = dataReader["ReplyContent"].ToString();
                    eo.ReplyURL     = dataReader["ReplyURL"].ToString();
                    eo.ProjectId    = Convert.ToInt32(dataReader["ProjectId"]);

                    al.Add(eo);
                }
            }

            dataReader.Close();
            LinkSpaceEntity[] arrReturn = (LinkSpaceEntity[])al.ToArray(typeof(LinkSpaceEntity));
            return(arrReturn);
        }
示例#3
0
 public void InsertLinkSpaces(LinkSpaceEntity[] oe)
 {
     try
     {
         linkSpaceDAL.InsertLinkSpaces(oe, this.ProjectId);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }
示例#4
0
 public void DeleteLinkSpaces(LinkSpaceEntity[] oe)
 {
     try
     {
         linkSpaceDAL.DeleteLinkSpaces(oe);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }
示例#5
0
        public LinkSpaceEntity[] getLinkSpaceArray(int pageIndex, int recNo, int projectId)
        {
            SqlDataReader dataReader = getLinkSpaceList(pageIndex, recNo, projectId);

            ArrayList al = new ArrayList();
            if ((dataReader != null) && (dataReader.HasRows))
            {
                while (dataReader.Read())
                {
                    LinkSpaceEntity eo = new LinkSpaceEntity();

                    eo.linkSpaceId = Convert.ToInt32(dataReader["LinkSpaceId"]);
                    eo.ForumURL = dataReader["ForumURL"].ToString();
                    eo.ForumContent = dataReader["ForumContent"].ToString();
                    eo.ActorId = Convert.ToInt32(dataReader["ActorId"]);
                    eo.ActorName = dataReader["ActorName"].ToString();
                    eo.UserName = dataReader["UserName"].ToString();
                    eo.Password = dataReader["Password"].ToString();
                    eo.ReplyContent = dataReader["ReplyContent"].ToString();
                    eo.ReplyURL = dataReader["ReplyURL"].ToString();
                    eo.ProjectId = Convert.ToInt32(dataReader["ProjectId"]);

                    al.Add(eo);
                }
            }

            dataReader.Close();
            LinkSpaceEntity[] arrReturn = (LinkSpaceEntity[])al.ToArray(typeof(LinkSpaceEntity));
            return arrReturn;
        }
示例#6
0
        public void UpdateLinkSpaces(LinkSpaceEntity[] oe, int projectId)
        {
            SqlConnection conn = Connection.GetConnection();

            string query = "update LinkSpace set ForumURL=@ForumURL, ForumContent=@ForumContent, ActorId=@ActorId,";
            query += "UserName=@UserName, Password=@Password, ReplyContent=@ReplyContent, ReplyURL=@ReplyURL,";
            query += "ProjectId=@ProjectId where LinkSpaceId = @LinkSpaceId ";

            SqlCommand cmd = new SqlCommand(query, conn);
            SqlParameter pLinkSpaceId = cmd.Parameters.Add("@LinkSpaceId", SqlDbType.Int);
            SqlParameter pForumURL = cmd.Parameters.Add("@ForumURL", SqlDbType.VarChar);
            SqlParameter pForumContent = cmd.Parameters.Add("@ForumContent", SqlDbType.VarChar);
            SqlParameter pActorId = cmd.Parameters.Add("@ActorId", SqlDbType.Int);
            SqlParameter pUserName = cmd.Parameters.Add("@UserName", SqlDbType.VarChar);
            SqlParameter pPassword = cmd.Parameters.Add("@Password", SqlDbType.VarChar);
            SqlParameter pReplyContent = cmd.Parameters.Add("@ReplyContent", SqlDbType.VarChar);
            SqlParameter pReplyURL = cmd.Parameters.Add("@ReplyURL", SqlDbType.VarChar);
            SqlParameter pProjectId = cmd.Parameters.Add("@ProjectId", SqlDbType.Int);

            try
            {
                conn.Open();
                for (int i = 0; i < oe.Length; i++)
                {
                    pLinkSpaceId.Value = oe[i].linkSpaceId;
                    pForumURL.Value = oe[i].ForumURL;
                    pForumContent.Value = oe[i].ForumContent;

                    string[] actorInfo = oe[i].ActorName.Split(',');
                    string actorId = actorInfo[actorInfo.Length - 1];

                    pActorId.Value = actorId;
                    pUserName.Value = oe[i].UserName;
                    pPassword.Value = oe[i].Password;
                    pReplyContent.Value = oe[i].ReplyContent;
                    pReplyURL.Value = oe[i].ReplyURL;
                    pProjectId.Value = projectId;
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }