مرجع تخصصی برنامه نویسان

انجمن تخصصی برنامه نویسان فارسی زبان

کاربر سایت

night-wolf

عضویت از 1392/08/12

مشکل در منتقل کردن برنامه نوشته شده به وب سرویس جدید - سی شارپ asp.net

  • یکشنبه 10 دی 1396
  • 18:13
تشکر میکنم


برنامم یه کلاس به اسم GetNodes و یه متد داخلش به اسم GetNode داره داخل این متد هم از Node استفاده کردم که این نود از یک کلاس دیگه ای به نام Nodes ها استفاده کرده.

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Configuration;
<b> using Common_Layer;</b>
 
public class GetNodes
{
     
public ListNodes getNode(string UserTypeGuid, int status)
    { 
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrin  gs["ConStrings"].ConnectionString);
        try
        {
            using (SqlCommand command = new SqlCommand("SelectAllNodes", connection))
            {
                command.Parameters.AddWithValue("@UserTypeGuid", UserTypeGuid);
                command.Parameters.AddWithValue("@status", status);
                command.CommandType = CommandType.StoredProcedure;
 
                if (connection.State == ConnectionState.Closed)
                    connection.Open();
 
                ListNodes list = new ListNodes();
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Node temp = new Node();
                        temp.IDNode = new Guid(reader["IDNode"].ToString());
                        temp.ParentNodeID = new Guid(reader["ParentNodeID"].ToString());
                        temp.NodeName = reader["NodeName"].ToString();
                        temp.NodeCaption = reader["NodeCaption"].ToString();
                        temp.Periority = Int32.Parse(reader["Periority"].ToString());
                        temp.NavigateUrl = reader["NavigateUrl"].ToString();
                        temp.UserTypeID = reader["UserTypeID"].ToString();
                        //temp.Tni = reader["tni"].ToString();
                        //temp.Security = reader["Security"].ToString();
                        temp.Status = (int)reader["Status"];
                        list.Add(temp);
                    }
                    reader.Close();
                }
                command.Dispose();
                return list;
            }
        }
        catch (Exception exp)
        { return null; }
        finally { connection.Close(); }
    }
}

و این هم کد کلاس Nodes

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
 
namespace Common_Layer
{
    [Serializable]
    public class Node : IDisposable
    {
        #region Define Variables
        Guid _IDNode;
        string _NodeName;
        string _NodeCaption;
        string _NavigateUrl;
        Guid _ParentNodeID;
        int _NodeDepth;
        string _NodeLineage;
        string _tni;
        string _UserTypeid;
        int _Status;
        int _Periority;
 
 
        #endregion
 
        #region Define Constractors
        public Node()
        {
        }
        public Node(Node Node)
        {
            _IDNode = Node.IDNode;
            _NodeName = Node.NodeName;
            _NodeCaption = Node.NodeCaption;
            _NavigateUrl = Node.NavigateUrl;
            _ParentNodeID = Node.ParentNodeID;
            _NodeDepth = Node.NodeDepth;
            _NodeLineage = Node.NodeLineage;
            _tni = Node.Tni;
            _UserTypeid = Node.UserTypeID;
            _Status = Node.Status;
            _Periority = Node.Periority;
             
        }
        #endregion
 
        #region Define Properties
        public Guid IDNode
        {
            set { _IDNode = value; }
            get { return _IDNode; }
        }
        public string NodeName
        {
            set { _NodeName = value; }
            get { return _NodeName; }
        }
        public string NodeCaption
        {
            set { _NodeCaption = value; }
            get { return _NodeCaption; }
        }
        public string NavigateUrl
        {
            set { _NavigateUrl = value; }
            get { return _NavigateUrl; }
        }
        public Guid ParentNodeID
        {
            set { _ParentNodeID = value; }
            get { return _ParentNodeID; }
        }
        public int NodeDepth
        {
            set { _NodeDepth = value; }
            get { return _NodeDepth; }
        }
        public string NodeLineage
        {
            set { _NodeLineage = value; }
            get { return _NodeLineage; }
        }
        public string Tni
        {
            set { _tni = value; }
            get { return _tni; }
        }
        public string UserTypeID
        {
            set { _UserTypeid = value; }
            get { return _UserTypeid; }
        }
        public int Status
        {
            set { _Status = value; }
            get { return _Status; }
        }
        public int Periority
        {
            set { _Periority = value; }
            get { return _Periority; }
        }
 
         
        #endregion
         
 
        #region IDisposable Members
 
        public void Dispose()
        {
            GC.SuppressFinalize(this);
        }
 
        #endregion
    }
    [Serializable()]
<b>    public class ListNodes : List<Node></b><font color="#ff0000"><b>
    { }</b></font>
}


private ListNodes AllNodes;
AllNodes = getNode("{48401D4A-2F90-469E-849B-FBFD6F044AA1}", 0);


پاسخ های این پرسش

تعداد پاسخ ها : 0 پاسخ
در حال حاضر هیچ پاسخی ارسال نشده است
کاربرانی که از این پست تشکر کرده اند

هیچ کاربری تا کنون از این پست تشکر نکرده است

اگر نیاز به یک مشاور در زمینه طراحی سایت ، برنامه نویسی و بازاریابی الکترونیکی دارید

با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)