using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Threading;
using Telerik.Web.UI;

using System.Data;
using System.Data.Linq;
using System.Data.SqlClient;
using System.Data.Odbc;
using System.IO;

using System.Security.Principal;
using System.Web.SessionState;

namespace StaticAppGlobals
{

    //[Table(Name = "dbo.ctickets_v_worklist")]
    public partial class ctickets_v_worklist
    {
        #region Private Properties

        private string _login;

        private int _id_ticket;

        private System.Nullable<int> _id_system;

        private string _ticket_type;

        private string _system_name;

        private System.Nullable<int> _system_width;

        private System.Nullable<int> _system_height;

        private System.Nullable<int> _id_status;

        private string _status_name;

        private System.Nullable<byte> _visible;

        private System.Nullable<int> _parent_id_ticket;

        private System.Nullable<int> _id_external;

        private string _ticket_status;

        private string _ticket_text;

        private string _reference;

        private string _system_status;

        private System.Nullable<byte> _system_restricted;

        private string _user_open;

        private System.Nullable<System.DateTime> _date_open;

        private string _area_name_origin;

        private System.Nullable<int> _id_company_structure_origin;

        private string _user_cancel;

        private System.Nullable<System.DateTime> _date_cancel;

        private string _user_assigned;

        private System.Nullable<System.DateTime> _date_assigned;

        private string _area_name_assigned;

        private System.Nullable<int> _id_company_structure_assigned;

        private string _area_assigned;

        private string _group_assigned;

        private string _dep_assigned;

        private string _sector_assigned;

        private string _region_assigned;

        private string _user_close;

        private System.Nullable<System.DateTime> _date_close;

        private System.Nullable<int> _id_company_structure_closed;

        private string _ncliente;

        private string _client_name;

        private string _client_type;

        private string _user_lock;

        private System.Nullable<System.DateTime> _date_lock;

        private System.Nullable<byte> _is_private;

        private System.Nullable<byte> _is_confidential;

        private System.Nullable<byte> _auto_return_transfer;

        private string _auto_return_user;

        private System.Nullable<int> _auto_return_id_company_structure;

        private string _open_comment;

        private string _current_comment;

        private string _close_comment;

        private string _certification_comment;

        private string _certification_result;

        private string _user_certification;

        private System.Nullable<System.DateTime> _date_certification;

        #endregion

        public ctickets_v_worklist()
        {
        }

        #region Public properties

        //[Column(Storage = "_login", DbType = "VarChar(20)")]
        public string login
        {
            get
            {
                return this._login;
            }
            set
            {
                if ((this._login != value))
                {
                    this._login = value;
                }
            }
        }

        //[Column(Storage = "_id_ticket", DbType = "Int NOT NULL")]
        public int id_ticket
        {
            get
            {
                return this._id_ticket;
            }
            set
            {
                if ((this._id_ticket != value))
                {
                    this._id_ticket = value;
                }
            }
        }

        //[Column(Storage = "_id_system", DbType = "Int")]
        public System.Nullable<int> id_system
        {
            get
            {
                return this._id_system;
            }
            set
            {
                if ((this._id_system != value))
                {
                    this._id_system = value;
                }
            }
        }

        //[Column(Storage = "_ticket_type", DbType = "VarChar(50)")]
        public string ticket_type
        {
            get
            {
                return this._ticket_type;
            }
            set
            {
                if ((this._ticket_type != value))
                {
                    this._ticket_type = value;
                }
            }
        }

        //[Column(Storage = "_system_name", DbType = "VarChar(50)")]
        public string system_name
        {
            get
            {
                return this._system_name;
            }
            set
            {
                if ((this._system_name != value))
                {
                    this._system_name = value;
                }
            }
        }

        //[Column(Storage = "_system_width", DbType = "Int")]
        public System.Nullable<int> system_width
        {
            get
            {
                return this._system_width;
            }
            set
            {
                if ((this._system_width != value))
                {
                    this._system_width = value;
                }
            }
        }

        //[Column(Storage = "_system_height", DbType = "Int")]
        public System.Nullable<int> system_height
        {
            get
            {
                return this._system_height;
            }
            set
            {
                if ((this._system_height != value))
                {
                    this._system_height = value;
                }
            }
        }

        //[Column(Storage = "_id_status", DbType = "Int")]
        public System.Nullable<int> id_status
        {
            get
            {
                return this._id_status;
            }
            set
            {
                if ((this._id_status != value))
                {
                    this._id_status = value;
                }
            }
        }

        //[Column(Storage = "_status_name", DbType = "VarChar(255)")]
        public string status_name
        {
            get
            {
                return this._status_name;
            }
            set
            {
                if ((this._status_name != value))
                {
                    this._status_name = value;
                }
            }
        }

        //[Column(Storage = "_visible", DbType = "TinyInt")]
        public System.Nullable<byte> visible
        {
            get
            {
                return this._visible;
            }
            set
            {
                if ((this._visible != value))
                {
                    this._visible = value;
                }
            }
        }

        //[Column(Storage = "_parent_id_ticket", DbType = "Int")]
        public System.Nullable<int> parent_id_ticket
        {
            get
            {
                return this._parent_id_ticket;
            }
            set
            {
                if ((this._parent_id_ticket != value))
                {
                    this._parent_id_ticket = value;
                }
            }
        }

        //[Column(Storage = "_id_external", DbType = "Int")]
        public System.Nullable<int> id_external
        {
            get
            {
                return this._id_external;
            }
            set
            {
                if ((this._id_external != value))
                {
                    this._id_external = value;
                }
            }
        }

        //[Column(Storage = "_ticket_status", DbType = "VarChar(255)")]
        public string ticket_status
        {
            get
            {
                return this._ticket_status;
            }
            set
            {
                if ((this._ticket_status != value))
                {
                    this._ticket_status = value;
                }
            }
        }

        //[Column(Storage = "_ticket_text", DbType = "VarChar(255)")]
        public string ticket_text
        {
            get
            {
                return this._ticket_text;
            }
            set
            {
                if ((this._ticket_text != value))
                {
                    this._ticket_text = value;
                }
            }
        }

        //[Column(Storage = "_reference", DbType = "VarChar(500)")]
        public string reference
        {
            get
            {
                return this._reference;
            }
            set
            {
                if ((this._reference != value))
                {
                    this._reference = value;
                }
            }
        }

        //[Column(Storage = "_system_status", DbType = "VarChar(255)")]
        public string system_status
        {
            get
            {
                return this._system_status;
            }
            set
            {
                if ((this._system_status != value))
                {
                    this._system_status = value;
                }
            }
        }

        //[Column(Storage = "_system_restricted", DbType = "TinyInt")]
        public System.Nullable<byte> system_restricted
        {
            get
            {
                return this._system_restricted;
            }
            set
            {
                if ((this._system_restricted != value))
                {
                    this._system_restricted = value;
                }
            }
        }

        //[Column(Storage = "_user_open", DbType = "VarChar(20)")]
        public string user_open
        {
            get
            {
                return this._user_open;
            }
            set
            {
                if ((this._user_open != value))
                {
                    this._user_open = value;
                }
            }
        }

        //[Column(Storage = "_date_open", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_open
        {
            get
            {
                return this._date_open;
            }
            set
            {
                if ((this._date_open != value))
                {
                    this._date_open = value;
                }
            }
        }

        //[Column(Storage = "_area_name_origin", DbType = "VarChar(100)")]
        public string area_name_origin
        {
            get
            {
                return this._area_name_origin;
            }
            set
            {
                if ((this._area_name_origin != value))
                {
                    this._area_name_origin = value;
                }
            }
        }

        //[Column(Storage = "_id_company_structure_origin", DbType = "Int")]
        public System.Nullable<int> id_company_structure_origin
        {
            get
            {
                return this._id_company_structure_origin;
            }
            set
            {
                if ((this._id_company_structure_origin != value))
                {
                    this._id_company_structure_origin = value;
                }
            }
        }

        //[Column(Storage = "_user_cancel", DbType = "VarChar(20)")]
        public string user_cancel
        {
            get
            {
                return this._user_cancel;
            }
            set
            {
                if ((this._user_cancel != value))
                {
                    this._user_cancel = value;
                }
            }
        }

        //[Column(Storage = "_date_cancel", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_cancel
        {
            get
            {
                return this._date_cancel;
            }
            set
            {
                if ((this._date_cancel != value))
                {
                    this._date_cancel = value;
                }
            }
        }

        //[Column(Storage = "_user_assigned", DbType = "VarChar(20)")]
        public string user_assigned
        {
            get
            {
                return this._user_assigned;
            }
            set
            {
                if ((this._user_assigned != value))
                {
                    this._user_assigned = value;
                }
            }
        }

        //[Column(Storage = "_date_assigned", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_assigned
        {
            get
            {
                return this._date_assigned;
            }
            set
            {
                if ((this._date_assigned != value))
                {
                    this._date_assigned = value;
                }
            }
        }

        //[Column(Storage = "_area_name_assigned", DbType = "VarChar(100)")]
        public string area_name_assigned
        {
            get
            {
                return this._area_name_assigned;
            }
            set
            {
                if ((this._area_name_assigned != value))
                {
                    this._area_name_assigned = value;
                }
            }
        }

        //[Column(Storage = "_id_company_structure_assigned", DbType = "Int")]
        public System.Nullable<int> id_company_structure_assigned
        {
            get
            {
                return this._id_company_structure_assigned;
            }
            set
            {
                if ((this._id_company_structure_assigned != value))
                {
                    this._id_company_structure_assigned = value;
                }
            }
        }

        //[Column(Storage = "_area_assigned", DbType = "VarChar(100)")]
        public string area_assigned
        {
            get
            {
                return this._area_assigned;
            }
            set
            {
                if ((this._area_assigned != value))
                {
                    this._area_assigned = value;
                }
            }
        }

        //[Column(Storage = "_group_assigned", DbType = "VarChar(100)")]
        public string group_assigned
        {
            get
            {
                return this._group_assigned;
            }
            set
            {
                if ((this._group_assigned != value))
                {
                    this._group_assigned = value;
                }
            }
        }

        //[Column(Storage = "_dep_assigned", DbType = "VarChar(100)")]
        public string dep_assigned
        {
            get
            {
                return this._dep_assigned;
            }
            set
            {
                if ((this._dep_assigned != value))
                {
                    this._dep_assigned = value;
                }
            }
        }

        //[Column(Storage = "_sector_assigned", DbType = "VarChar(100)")]
        public string sector_assigned
        {
            get
            {
                return this._sector_assigned;
            }
            set
            {
                if ((this._sector_assigned != value))
                {
                    this._sector_assigned = value;
                }
            }
        }

        //[Column(Storage = "_region_assigned", DbType = "VarChar(100)")]
        public string region_assigned
        {
            get
            {
                return this._region_assigned;
            }
            set
            {
                if ((this._region_assigned != value))
                {
                    this._region_assigned = value;
                }
            }
        }

        //[Column(Storage = "_user_close", DbType = "VarChar(20)")]
        public string user_close
        {
            get
            {
                return this._user_close;
            }
            set
            {
                if ((this._user_close != value))
                {
                    this._user_close = value;
                }
            }
        }

        //[Column(Storage = "_date_close", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_close
        {
            get
            {
                return this._date_close;
            }
            set
            {
                if ((this._date_close != value))
                {
                    this._date_close = value;
                }
            }
        }

        //[Column(Storage = "_id_company_structure_closed", DbType = "Int")]
        public System.Nullable<int> id_company_structure_closed
        {
            get
            {
                return this._id_company_structure_closed;
            }
            set
            {
                if ((this._id_company_structure_closed != value))
                {
                    this._id_company_structure_closed = value;
                }
            }
        }

        //[Column(Storage = "_ncliente", DbType = "VarChar(8)")]
        public string ncliente
        {
            get
            {
                return this._ncliente;
            }
            set
            {
                if ((this._ncliente != value))
                {
                    this._ncliente = value;
                }
            }
        }

        //[Column(Storage = "_client_name", DbType = "VarChar(100)")]
        public string client_name
        {
            get
            {
                return this._client_name;
            }
            set
            {
                if ((this._client_name != value))
                {
                    this._client_name = value;
                }
            }
        }

        //[Column(Storage = "_client_type", DbType = "VarChar(15)")]
        public string client_type
        {
            get
            {
                return this._client_type;
            }
            set
            {
                if ((this._client_type != value))
                {
                    this._client_type = value;
                }
            }
        }

        //[Column(Storage = "_user_lock", DbType = "VarChar(20)")]
        public string user_lock
        {
            get
            {
                return this._user_lock;
            }
            set
            {
                if ((this._user_lock != value))
                {
                    this._user_lock = value;
                }
            }
        }

        //[Column(Storage = "_date_lock", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_lock
        {
            get
            {
                return this._date_lock;
            }
            set
            {
                if ((this._date_lock != value))
                {
                    this._date_lock = value;
                }
            }
        }

        //[Column(Storage = "_is_private", DbType = "TinyInt")]
        public System.Nullable<byte> is_private
        {
            get
            {
                return this._is_private;
            }
            set
            {
                if ((this._is_private != value))
                {
                    this._is_private = value;
                }
            }
        }

        //[Column(Storage = "_is_confidential", DbType = "TinyInt")]
        public System.Nullable<byte> is_confidential
        {
            get
            {
                return this._is_confidential;
            }
            set
            {
                if ((this._is_confidential != value))
                {
                    this._is_confidential = value;
                }
            }
        }

        //[Column(Storage = "_auto_return_transfer", DbType = "TinyInt")]
        public System.Nullable<byte> auto_return_transfer
        {
            get
            {
                return this._auto_return_transfer;
            }
            set
            {
                if ((this._auto_return_transfer != value))
                {
                    this._auto_return_transfer = value;
                }
            }
        }

        //[Column(Storage = "_auto_return_user", DbType = "VarChar(20)")]
        public string auto_return_user
        {
            get
            {
                return this._auto_return_user;
            }
            set
            {
                if ((this._auto_return_user != value))
                {
                    this._auto_return_user = value;
                }
            }
        }

        //[Column(Storage = "_auto_return_id_company_structure", DbType = "Int")]
        public System.Nullable<int> auto_return_id_company_structure
        {
            get
            {
                return this._auto_return_id_company_structure;
            }
            set
            {
                if ((this._auto_return_id_company_structure != value))
                {
                    this._auto_return_id_company_structure = value;
                }
            }
        }

        //[Column(Storage = "_open_comment", DbType = "VarChar(1000)")]
        public string open_comment
        {
            get
            {
                return this._open_comment;
            }
            set
            {
                if ((this._open_comment != value))
                {
                    this._open_comment = value;
                }
            }
        }

        //[Column(Storage = "_current_comment", DbType = "VarChar(1000)")]
        public string current_comment
        {
            get
            {
                return this._current_comment;
            }
            set
            {
                if ((this._current_comment != value))
                {
                    this._current_comment = value;
                }
            }
        }

        //[Column(Storage = "_close_comment", DbType = "VarChar(1000)")]
        public string close_comment
        {
            get
            {
                return this._close_comment;
            }
            set
            {
                if ((this._close_comment != value))
                {
                    this._close_comment = value;
                }
            }
        }

        //[Column(Storage = "_certification_comment", DbType = "VarChar(1000)")]
        public string certification_comment
        {
            get
            {
                return this._certification_comment;
            }
            set
            {
                if ((this._certification_comment != value))
                {
                    this._certification_comment = value;
                }
            }
        }

        //[Column(Storage = "_certification_result", DbType = "VarChar(50)")]
        public string certification_result
        {
            get
            {
                return this._certification_result;
            }
            set
            {
                if ((this._certification_result != value))
                {
                    this._certification_result = value;
                }
            }
        }

        //[Column(Storage = "_user_certification", DbType = "VarChar(20)")]
        public string user_certification
        {
            get
            {
                return this._user_certification;
            }
            set
            {
                if ((this._user_certification != value))
                {
                    this._user_certification = value;
                }
            }
        }

        //[Column(Storage = "_date_certification", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_certification
        {
            get
            {
                return this._date_certification;
            }
            set
            {
                if ((this._date_certification != value))
                {
                    this._date_certification = value;
                }
            }
        }

        #endregion
    }

    //[Table(Name="dbo.ctickets_worklist_order")]
	public partial class ctickets_worklist_order 
	{
        #region Private Properties

		private int _id_worklist_order;
		
		private string _login;
		
		private string _order_ref;
		
		private string _order_string;
		
		private string _order_fieldname;
		
        #endregion

		public ctickets_worklist_order()
		{
        }

        #region Public properties

        //[Column(Storage="_id_worklist_order", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public int id_worklist_order
		{
			get
			{
				return this._id_worklist_order;
			}
			set
			{
				if ((this._id_worklist_order != value))
				{
					this._id_worklist_order = value;
				}
			}
		}
		
        //[Column(Storage="_login", DbType="VarChar(45)")]
		public string login
		{
			get
			{
				return this._login;
			}
			set
			{
				if ((this._login != value))
				{
					this._login = value;
				}
			}
		}
		
        //[Column(Storage="_order_ref", DbType="VarChar(45)")]
		public string order_ref
		{
			get
			{
				return this._order_ref;
			}
			set
			{
				if ((this._order_ref != value))
				{
					this._order_ref = value;
				}
			}
		}
		
        //[Column(Storage="_order_string", DbType="VarChar(255)")]
		public string order_string
		{
			get
			{
				return this._order_string;
			}
			set
			{
				if ((this._order_string != value))
				{
					this._order_string = value;
				}
			}
		}
		
        //[Column(Storage="_order_fieldname", DbType="VarChar(45)")]
		public string order_fieldname
		{
			get
			{
				return this._order_fieldname;
			}
			set
			{
				if ((this._order_fieldname != value))
				{
					this._order_fieldname = value;
				}
			}
		}
		
        #endregion
	}

    //[Table(Name = "dbo.ctickets_master")]
    public partial class ctickets_master
    {
        #region Private properties

        private int _id_ticket;

        private System.Nullable<int> _parent_id_ticket;

        private System.Nullable<int> _id_system;

        private System.Nullable<int> _id_external;

        private string _ticket_status;

        private string _ticket_type;

        private string _ticket_text;

        private string _reference;

        private string _system_status;

        private System.Nullable<byte> _system_restricted;

        private string _user_open;

        private System.Nullable<System.DateTime> _date_open;

        private string _area_name_origin;

        private System.Nullable<int> _id_company_structure_origin;

        private string _user_cancel;

        private System.Nullable<System.DateTime> _date_cancel;

        private string _user_assigned;

        private System.Nullable<System.DateTime> _date_assigned;

        private string _area_name_assigned;

        private System.Nullable<int> _id_company_structure_assigned;

        private string _area_assigned;

        private string _group_assigned;

        private string _dep_assigned;

        private string _sector_assigned;

        private string _region_assigned;

        private string _user_close;

        private System.Nullable<System.DateTime> _date_close;

        private System.Nullable<int> _id_company_structure_closed;

        private string _ncliente;

        private string _client_name;

        private string _client_type;

        private string _user_lock;

        private System.Nullable<System.DateTime> _date_lock;

        private System.Nullable<byte> _is_private;

        private System.Nullable<byte> _is_confidential;

        private System.Nullable<byte> _auto_return_transfer;

        private string _auto_return_user;

        private System.Nullable<int> _auto_return_id_company_structure;

        private string _open_comment;

        private string _current_comment;

        private string _close_comment;

        private string _certification_comment;

        private string _certification_result;

        private string _user_certification;

        private System.Nullable<System.DateTime> _date_certification;

        #endregion

        public ctickets_master()
        {
        }

        #region Public properties

        //[Column(Storage = "_id_ticket", DbType = "Int NOT NULL", IsPrimaryKey = true)]
        public int id_ticket
        {
            get
            {
                return this._id_ticket;
            }
            set
            {
                if ((this._id_ticket != value))
                {
                    this._id_ticket = value;
                }
            }
        }

        //[Column(Storage = "_parent_id_ticket", DbType = "Int")]
        public System.Nullable<int> parent_id_ticket
        {
            get
            {
                return this._parent_id_ticket;
            }
            set
            {
                if ((this._parent_id_ticket != value))
                {
                    this._parent_id_ticket = value;
                }
            }
        }

        //[Column(Storage = "_id_system", DbType = "Int")]
        public System.Nullable<int> id_system
        {
            get
            {
                return this._id_system;
            }
            set
            {
                if ((this._id_system != value))
                {
                    this._id_system = value;
                }
            }
        }

        //[Column(Storage = "_id_external", DbType = "Int")]
        public System.Nullable<int> id_external
        {
            get
            {
                return this._id_external;
            }
            set
            {
                if ((this._id_external != value))
                {
                    this._id_external = value;
                }
            }
        }

        //[Column(Storage = "_ticket_status", DbType = "VarChar(255)")]
        public string ticket_status
        {
            get
            {
                return this._ticket_status;
            }
            set
            {
                if ((this._ticket_status != value))
                {
                    this._ticket_status = value;
                }
            }
        }

        //[Column(Storage = "_ticket_type", DbType = "VarChar(50)")]
        public string ticket_type
        {
            get
            {
                return this._ticket_type;
            }
            set
            {
                if ((this._ticket_type != value))
                {
                    this._ticket_type = value;
                }
            }
        }

        //[Column(Storage = "_ticket_text", DbType = "VarChar(255)")]
        public string ticket_text
        {
            get
            {
                return this._ticket_text;
            }
            set
            {
                if ((this._ticket_text != value))
                {
                    this._ticket_text = value;
                }
            }
        }

        //[Column(Storage = "_reference", DbType = "VarChar(500)")]
        public string reference
        {
            get
            {
                return this._reference;
            }
            set
            {
                if ((this._reference != value))
                {
                    this._reference = value;
                }
            }
        }

        //[Column(Storage = "_system_status", DbType = "VarChar(255)")]
        public string system_status
        {
            get
            {
                return this._system_status;
            }
            set
            {
                if ((this._system_status != value))
                {
                    this._system_status = value;
                }
            }
        }

        //[Column(Storage = "_system_restricted", DbType = "TinyInt")]
        public System.Nullable<byte> system_restricted
        {
            get
            {
                return this._system_restricted;
            }
            set
            {
                if ((this._system_restricted != value))
                {
                    this._system_restricted = value;
                }
            }
        }

        //[Column(Storage = "_user_open", DbType = "VarChar(20)")]
        public string user_open
        {
            get
            {
                return this._user_open;
            }
            set
            {
                if ((this._user_open != value))
                {
                    this._user_open = value;
                }
            }
        }

        //[Column(Storage = "_date_open", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_open
        {
            get
            {
                return this._date_open;
            }
            set
            {
                if ((this._date_open != value))
                {
                    this._date_open = value;
                }
            }
        }

        //[Column(Storage = "_area_name_origin", DbType = "VarChar(100)")]
        public string area_name_origin
        {
            get
            {
                return this._area_name_origin;
            }
            set
            {
                if ((this._area_name_origin != value))
                {
                    this._area_name_origin = value;
                }
            }
        }

        //[Column(Storage = "_id_company_structure_origin", DbType = "Int")]
        public System.Nullable<int> id_company_structure_origin
        {
            get
            {
                return this._id_company_structure_origin;
            }
            set
            {
                if ((this._id_company_structure_origin != value))
                {
                    this._id_company_structure_origin = value;
                }
            }
        }

        //[Column(Storage = "_user_cancel", DbType = "VarChar(20)")]
        public string user_cancel
        {
            get
            {
                return this._user_cancel;
            }
            set
            {
                if ((this._user_cancel != value))
                {
                    this._user_cancel = value;
                }
            }
        }

        //[Column(Storage = "_date_cancel", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_cancel
        {
            get
            {
                return this._date_cancel;
            }
            set
            {
                if ((this._date_cancel != value))
                {
                    this._date_cancel = value;
                }
            }
        }

        //[Column(Storage = "_user_assigned", DbType = "VarChar(20)")]
        public string user_assigned
        {
            get
            {
                return this._user_assigned;
            }
            set
            {
                if ((this._user_assigned != value))
                {
                    this._user_assigned = value;
                }
            }
        }

        //[Column(Storage = "_date_assigned", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_assigned
        {
            get
            {
                return this._date_assigned;
            }
            set
            {
                if ((this._date_assigned != value))
                {
                    this._date_assigned = value;
                }
            }
        }

        //[Column(Storage = "_area_name_assigned", DbType = "VarChar(100)")]
        public string area_name_assigned
        {
            get
            {
                return this._area_name_assigned;
            }
            set
            {
                if ((this._area_name_assigned != value))
                {
                    this._area_name_assigned = value;
                }
            }
        }

        //[Column(Storage = "_id_company_structure_assigned", DbType = "Int")]
        public System.Nullable<int> id_company_structure_assigned
        {
            get
            {
                return this._id_company_structure_assigned;
            }
            set
            {
                if ((this._id_company_structure_assigned != value))
                {
                    this._id_company_structure_assigned = value;
                }
            }
        }

        //[Column(Storage = "_area_assigned", DbType = "VarChar(100)")]
        public string area_assigned
        {
            get
            {
                return this._area_assigned;
            }
            set
            {
                if ((this._area_assigned != value))
                {
                    this._area_assigned = value;
                }
            }
        }

        //[Column(Storage = "_group_assigned", DbType = "VarChar(100)")]
        public string group_assigned
        {
            get
            {
                return this._group_assigned;
            }
            set
            {
                if ((this._group_assigned != value))
                {
                    this._group_assigned = value;
                }
            }
        }

        //[Column(Storage = "_dep_assigned", DbType = "VarChar(100)")]
        public string dep_assigned
        {
            get
            {
                return this._dep_assigned;
            }
            set
            {
                if ((this._dep_assigned != value))
                {
                    this._dep_assigned = value;
                }
            }
        }

        //[Column(Storage = "_sector_assigned", DbType = "VarChar(100)")]
        public string sector_assigned
        {
            get
            {
                return this._sector_assigned;
            }
            set
            {
                if ((this._sector_assigned != value))
                {
                    this._sector_assigned = value;
                }
            }
        }

        //[Column(Storage = "_region_assigned", DbType = "VarChar(100)")]
        public string region_assigned
        {
            get
            {
                return this._region_assigned;
            }
            set
            {
                if ((this._region_assigned != value))
                {
                    this._region_assigned = value;
                }
            }
        }

        //[Column(Storage = "_user_close", DbType = "VarChar(20)")]
        public string user_close
        {
            get
            {
                return this._user_close;
            }
            set
            {
                if ((this._user_close != value))
                {
                    this._user_close = value;
                }
            }
        }

        //[Column(Storage = "_date_close", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_close
        {
            get
            {
                return this._date_close;
            }
            set
            {
                if ((this._date_close != value))
                {
                    this._date_close = value;
                }
            }
        }

        //[Column(Storage = "_id_company_structure_closed", DbType = "Int")]
        public System.Nullable<int> id_company_structure_closed
        {
            get
            {
                return this._id_company_structure_closed;
            }
            set
            {
                if ((this._id_company_structure_closed != value))
                {
                    this._id_company_structure_closed = value;
                }
            }
        }

        //[Column(Storage = "_ncliente", DbType = "VarChar(8)")]
        public string ncliente
        {
            get
            {
                return this._ncliente;
            }
            set
            {
                if ((this._ncliente != value))
                {
                    this._ncliente = value;
                }
            }
        }

        //[Column(Storage = "_client_name", DbType = "VarChar(100)")]
        public string client_name
        {
            get
            {
                return this._client_name;
            }
            set
            {
                if ((this._client_name != value))
                {
                    this._client_name = value;
                }
            }
        }

        //[Column(Storage = "_client_type", DbType = "VarChar(15)")]
        public string client_type
        {
            get
            {
                return this._client_type;
            }
            set
            {
                if ((this._client_type != value))
                {
                    this._client_type = value;
                }
            }
        }

        //[Column(Storage = "_user_lock", DbType = "VarChar(20)")]
        public string user_lock
        {
            get
            {
                return this._user_lock;
            }
            set
            {
                if ((this._user_lock != value))
                {
                    this._user_lock = value;
                }
            }
        }

        //[Column(Storage = "_date_lock", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_lock
        {
            get
            {
                return this._date_lock;
            }
            set
            {
                if ((this._date_lock != value))
                {
                    this._date_lock = value;
                }
            }
        }

        //[Column(Storage = "_is_private", DbType = "TinyInt")]
        public System.Nullable<byte> is_private
        {
            get
            {
                return this._is_private;
            }
            set
            {
                if ((this._is_private != value))
                {
                    this._is_private = value;
                }
            }
        }

        //[Column(Storage = "_is_confidential", DbType = "TinyInt")]
        public System.Nullable<byte> is_confidential
        {
            get
            {
                return this._is_confidential;
            }
            set
            {
                if ((this._is_confidential != value))
                {
                    this._is_confidential = value;
                }
            }
        }

        //[Column(Storage = "_auto_return_transfer", DbType = "TinyInt")]
        public System.Nullable<byte> auto_return_transfer
        {
            get
            {
                return this._auto_return_transfer;
            }
            set
            {
                if ((this._auto_return_transfer != value))
                {
                    this._auto_return_transfer = value;
                }
            }
        }

        //[Column(Storage = "_auto_return_user", DbType = "VarChar(20)")]
        public string auto_return_user
        {
            get
            {
                return this._auto_return_user;
            }
            set
            {
                if ((this._auto_return_user != value))
                {
                    this._auto_return_user = value;
                }
            }
        }

        //[Column(Storage = "_auto_return_id_company_structure", DbType = "Int")]
        public System.Nullable<int> auto_return_id_company_structure
        {
            get
            {
                return this._auto_return_id_company_structure;
            }
            set
            {
                if ((this._auto_return_id_company_structure != value))
                {
                    this._auto_return_id_company_structure = value;
                }
            }
        }

        //[Column(Storage = "_open_comment", DbType = "VarChar(1000)")]
        public string open_comment
        {
            get
            {
                return this._open_comment;
            }
            set
            {
                if ((this._open_comment != value))
                {
                    this._open_comment = value;
                }
            }
        }

        //[Column(Storage = "_current_comment", DbType = "VarChar(1000)")]
        public string current_comment
        {
            get
            {
                return this._current_comment;
            }
            set
            {
                if ((this._current_comment != value))
                {
                    this._current_comment = value;
                }
            }
        }

        //[Column(Storage = "_close_comment", DbType = "VarChar(1000)")]
        public string close_comment
        {
            get
            {
                return this._close_comment;
            }
            set
            {
                if ((this._close_comment != value))
                {
                    this._close_comment = value;
                }
            }
        }

        //[Column(Storage = "_certification_comment", DbType = "VarChar(1000)")]
        public string certification_comment
        {
            get
            {
                return this._certification_comment;
            }
            set
            {
                if ((this._certification_comment != value))
                {
                    this._certification_comment = value;
                }
            }
        }

        //[Column(Storage = "_certification_result", DbType = "VarChar(50)")]
        public string certification_result
        {
            get
            {
                return this._certification_result;
            }
            set
            {
                if ((this._certification_result != value))
                {
                    this._certification_result = value;
                }
            }
        }

        //[Column(Storage = "_user_certification", DbType = "VarChar(20)")]
        public string user_certification
        {
            get
            {
                return this._user_certification;
            }
            set
            {
                if ((this._user_certification != value))
                {
                    this._user_certification = value;
                }
            }
        }

        //[Column(Storage = "_date_certification", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_certification
        {
            get
            {
                return this._date_certification;
            }
            set
            {
                if ((this._date_certification != value))
                {
                    this._date_certification = value;
                }
            }
        }

        #endregion
    }

    //[Table(Name = "dbo.ctickets_systems_configuration")]
    public partial class ctickets_systems_configuration
    {

        #region Private Properties

        private int _id_system;

        private string _system_name;

        private string _system_extended_name;

        private int _system_list_type;

        private string _system_server;

        private string _system_directory;

        private string _system_insert_page;

        private System.Nullable<int> _system_insert_width;

        private System.Nullable<int> _system_insert_height;

        private string _system_view_page;

        private System.Nullable<int> _system_view_width;

        private System.Nullable<int> _system_view_height;

        private string _system_resolve_page;

        private System.Nullable<int> _system_resolve_width;

        private System.Nullable<int> _system_resolve_height;

        private string _system_config_page;

        private System.Nullable<int> _system_config_width;

        private System.Nullable<int> _system_config_height;

        private System.Nullable<int> _system_width;

        private System.Nullable<int> _system_height;

        private string _delegation_restriction;

        private string _reminder_level;

        private System.Nullable<int> _reminder_lookup_days;

        private string _reminder_mail_body;

        private string _reminder_from_display_name;

        private string _reminder_cc_mails;

        private string _reminder_bcc_mails;

        private System.Nullable<short> _reminder_active;

        private string _create_user;

        private System.Nullable<System.DateTime> _create_date;

        private string _modify_user;

        private System.Nullable<System.DateTime> _modify_date;

        private System.Nullable<byte> _active;

        #endregion

        public ctickets_systems_configuration()
        {
        }

        #region Public properties

        //[Column(Storage  = "_id_system", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int id_system
        {
            get
            {
                return this._id_system;
            }
            set
            {
                if ((this._id_system != value))
                {
                    this._id_system = value;
                }
            }
        }

        //[Column(Storage  = "_system_name", DbType = "VarChar(50)")]
        public string system_name
        {
            get
            {
                return this._system_name;
            }
            set
            {
                if ((this._system_name != value))
                {
                    this._system_name = value;
                }
            }
        }

        //[Column(Storage  = "_system_extended_name", DbType = "VarChar(255)")]
        public string system_extended_name
        {
            get
            {
                return this._system_extended_name;
            }
            set
            {
                if ((this._system_extended_name != value))
                {
                    this._system_extended_name = value;
                }
            }
        }

        //[Column(Storage  = "_system_list_type", DbType = "Int NOT NULL")]
        public int system_list_type
        {
            get
            {
                return this._system_list_type;
            }
            set
            {
                if ((this._system_list_type != value))
                {
                    this._system_list_type = value;
                }
            }
        }

        //[Column(Storage  = "_system_server", DbType = "VarChar(50)")]
        public string system_server
        {
            get
            {
                return this._system_server;
            }
            set
            {
                if ((this._system_server != value))
                {
                    this._system_server = value;
                }
            }
        }

        //[Column(Storage  = "_system_directory", DbType = "VarChar(255)")]
        public string system_directory
        {
            get
            {
                return this._system_directory;
            }
            set
            {
                if ((this._system_directory != value))
                {
                    this._system_directory = value;
                }
            }
        }

        //[Column(Storage  = "_system_insert_page", DbType = "VarChar(255)")]
        public string system_insert_page
        {
            get
            {
                return this._system_insert_page;
            }
            set
            {
                if ((this._system_insert_page != value))
                {
                    this._system_insert_page = value;
                }
            }
        }

        //[Column(Storage  = "_system_insert_width", DbType = "Int")]
        public System.Nullable<int> system_insert_width
        {
            get
            {
                return this._system_insert_width;
            }
            set
            {
                if ((this._system_insert_width != value))
                {
                    this._system_insert_width = value;
                }
            }
        }

        //[Column(Storage  = "_system_insert_height", DbType = "Int")]
        public System.Nullable<int> system_insert_height
        {
            get
            {
                return this._system_insert_height;
            }
            set
            {
                if ((this._system_insert_height != value))
                {
                    this._system_insert_height = value;
                }
            }
        }

        //[Column(Storage  = "_system_view_page", DbType = "VarChar(255)")]
        public string system_view_page
        {
            get
            {
                return this._system_view_page;
            }
            set
            {
                if ((this._system_view_page != value))
                {
                    this._system_view_page = value;
                }
            }
        }

        //[Column(Storage  = "_system_view_width", DbType = "Int")]
        public System.Nullable<int> system_view_width
        {
            get
            {
                return this._system_view_width;
            }
            set
            {
                if ((this._system_view_width != value))
                {
                    this._system_view_width = value;
                }
            }
        }

        //[Column(Storage  = "_system_view_height", DbType = "Int")]
        public System.Nullable<int> system_view_height
        {
            get
            {
                return this._system_view_height;
            }
            set
            {
                if ((this._system_view_height != value))
                {
                    this._system_view_height = value;
                }
            }
        }

        //[Column(Storage  = "_system_resolve_page", DbType = "VarChar(255)")]
        public string system_resolve_page
        {
            get
            {
                return this._system_resolve_page;
            }
            set
            {
                if ((this._system_resolve_page != value))
                {
                    this._system_resolve_page = value;
                }
            }
        }

        //[Column(Storage  = "_system_resolve_width", DbType = "Int")]
        public System.Nullable<int> system_resolve_width
        {
            get
            {
                return this._system_resolve_width;
            }
            set
            {
                if ((this._system_resolve_width != value))
                {
                    this._system_resolve_width = value;
                }
            }
        }

        //[Column(Storage  = "_system_resolve_height", DbType = "Int")]
        public System.Nullable<int> system_resolve_height
        {
            get
            {
                return this._system_resolve_height;
            }
            set
            {
                if ((this._system_resolve_height != value))
                {
                    this._system_resolve_height = value;
                }
            }
        }

        //[Column(Storage  = "_system_config_page", DbType = "VarChar(255)")]
        public string system_config_page
        {
            get
            {
                return this._system_config_page;
            }
            set
            {
                if ((this._system_config_page != value))
                {
                    this._system_config_page = value;
                }
            }
        }

        //[Column(Storage  = "_system_config_width", DbType = "Int")]
        public System.Nullable<int> system_config_width
        {
            get
            {
                return this._system_config_width;
            }
            set
            {
                if ((this._system_config_width != value))
                {
                    this._system_config_width = value;
                }
            }
        }

        //[Column(Storage  = "_system_config_height", DbType = "Int")]
        public System.Nullable<int> system_config_height
        {
            get
            {
                return this._system_config_height;
            }
            set
            {
                if ((this._system_config_height != value))
                {
                    this._system_config_height = value;
                }
            }
        }

        //[Column(Storage  = "_system_width", DbType = "Int")]
        public System.Nullable<int> system_width
        {
            get
            {
                return this._system_width;
            }
            set
            {
                if ((this._system_width != value))
                {
                    this._system_width = value;
                }
            }
        }

        //[Column(Storage  = "_system_height", DbType = "Int")]
        public System.Nullable<int> system_height
        {
            get
            {
                return this._system_height;
            }
            set
            {
                if ((this._system_height != value))
                {
                    this._system_height = value;
                }
            }
        }

        //[Column(Storage  = "_delegation_restriction", DbType = "VarChar(20)")]
        public string delegation_restriction
        {
            get
            {
                return this._delegation_restriction;
            }
            set
            {
                if ((this._delegation_restriction != value))
                {
                    this._delegation_restriction = value;
                }
            }
        }

        //[Column(Storage  = "_reminder_level", DbType = "VarChar(45)")]
        public string reminder_level
        {
            get
            {
                return this._reminder_level;
            }
            set
            {
                if ((this._reminder_level != value))
                {
                    this._reminder_level = value;
                }
            }
        }

        //[Column(Storage  = "_reminder_lookup_days", DbType = "Int")]
        public System.Nullable<int> reminder_lookup_days
        {
            get
            {
                return this._reminder_lookup_days;
            }
            set
            {
                if ((this._reminder_lookup_days != value))
                {
                    this._reminder_lookup_days = value;
                }
            }
        }

        //[Column(Storage  = "_reminder_mail_body", DbType = "VarChar(1000)")]
        public string reminder_mail_body
        {
            get
            {
                return this._reminder_mail_body;
            }
            set
            {
                if ((this._reminder_mail_body != value))
                {
                    this._reminder_mail_body = value;
                }
            }
        }

        //[Column(Storage  = "_reminder_from_display_name", DbType = "VarChar(45)")]
        public string reminder_from_display_name
        {
            get
            {
                return this._reminder_from_display_name;
            }
            set
            {
                if ((this._reminder_from_display_name != value))
                {
                    this._reminder_from_display_name = value;
                }
            }
        }

        //[Column(Storage  = "_reminder_cc_mails", DbType = "VarChar(255)")]
        public string reminder_cc_mails
        {
            get
            {
                return this._reminder_cc_mails;
            }
            set
            {
                if ((this._reminder_cc_mails != value))
                {
                    this._reminder_cc_mails = value;
                }
            }
        }

        //[Column(Storage  = "_reminder_bcc_mails", DbType = "VarChar(255)")]
        public string reminder_bcc_mails
        {
            get
            {
                return this._reminder_bcc_mails;
            }
            set
            {
                if ((this._reminder_bcc_mails != value))
                {
                    this._reminder_bcc_mails = value;
                }
            }
        }

        //[Column(Storage  = "_reminder_active", DbType = "SmallInt")]
        public System.Nullable<short> reminder_active
        {
            get
            {
                return this._reminder_active;
            }
            set
            {
                if ((this._reminder_active != value))
                {
                    this._reminder_active = value;
                }
            }
        }

        //[Column(Storage  = "_create_user", DbType = "VarChar(20)")]
        public string create_user
        {
            get
            {
                return this._create_user;
            }
            set
            {
                if ((this._create_user != value))
                {
                    this._create_user = value;
                }
            }
        }

        //[Column(Storage  = "_create_date", DbType = "DateTime")]
        public System.Nullable<System.DateTime> create_date
        {
            get
            {
                return this._create_date;
            }
            set
            {
                if ((this._create_date != value))
                {
                    this._create_date = value;
                }
            }
        }

        //[Column(Storage  = "_modify_user", DbType = "VarChar(20)")]
        public string modify_user
        {
            get
            {
                return this._modify_user;
            }
            set
            {
                if ((this._modify_user != value))
                {
                    this._modify_user = value;
                }
            }
        }

        //[Column(Storage  = "_modify_date", DbType = "DateTime")]
        public System.Nullable<System.DateTime> modify_date
        {
            get
            {
                return this._modify_date;
            }
            set
            {
                if ((this._modify_date != value))
                {
                    this._modify_date = value;
                }
            }
        }

        //[Column(Storage  = "_active", DbType = "TinyInt")]
        public System.Nullable<byte> active
        {
            get
            {
                return this._active;
            }
            set
            {
                if ((this._active != value))
                {
                    this._active = value;
                }
            }
        }

        #endregion

    }

    //[Table(Name = "dbo.ctickets_comments")]
    public partial class ctickets_comment
    {
        #region Private Properties

        private int _id_comment;

        private System.Nullable<int> _id_ticket;

        private System.Nullable<int> _id_system;

        private string _comment;

        private string _user_insert;

        private System.Nullable<System.DateTime> _date_insert;

        #endregion

        public ctickets_comment()
        {
        }

        #region Private Properties

        //[Column(Storage  = "_id_comment", DbType = "Int NOT NULL", IsPrimaryKey = true)]
        public int id_comment
        {
            get
            {
                return this._id_comment;
            }
            set
            {
                if ((this._id_comment != value))
                {
                    this._id_comment = value;
                }
            }
        }

        //[Column(Storage  = "_id_ticket", DbType = "Int")]
        public System.Nullable<int> id_ticket
        {
            get
            {
                return this._id_ticket;
            }
            set
            {
                if ((this._id_ticket != value))
                {
                    this._id_ticket = value;
                }
            }
        }

        //[Column(Storage  = "_id_system", DbType = "Int")]
        public System.Nullable<int> id_system
        {
            get
            {
                return this._id_system;
            }
            set
            {
                if ((this._id_system != value))
                {
                    this._id_system = value;
                }
            }
        }

        //[Column(Storage  = "_comment", DbType = "Text", UpdateCheck = UpdateCheck.Never)]
        public string comment
        {
            get
            {
                return this._comment;
            }
            set
            {
                if ((this._comment != value))
                {
                    this._comment = value;
                }
            }
        }

        //[Column(Storage  = "_user_insert", DbType = "VarChar(20)")]
        public string user_insert
        {
            get
            {
                return this._user_insert;
            }
            set
            {
                if ((this._user_insert != value))
                {
                    this._user_insert = value;
                }
            }
        }

        //[Column(Storage  = "_date_insert", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_insert
        {
            get
            {
                return this._date_insert;
            }
            set
            {
                if ((this._date_insert != value))
                {
                    this._date_insert = value;
                }
            }
        }

        #endregion

    }


    public partial class getCTicketsAssignedSystemsByTypeResult
    {

        private System.Nullable<int> _qty;

        private System.Nullable<int> _id_system;

        private string _system_name;

        private string _ticket_type;

        private string _system_label;

        public getCTicketsAssignedSystemsByTypeResult()
        {
        }

        //[Column(Storage  = "_qty", DbType = "Int")]
        public System.Nullable<int> qty
        {
            get
            {
                return this._qty;
            }
            set
            {
                if ((this._qty != value))
                {
                    this._qty = value;
                }
            }
        }

        //[Column(Storage  = "_id_system", DbType = "Int")]
        public System.Nullable<int> id_system
        {
            get
            {
                return this._id_system;
            }
            set
            {
                if ((this._id_system != value))
                {
                    this._id_system = value;
                }
            }
        }

        //[Column(Storage  = "_system_name", DbType = "VarChar(50)")]
        public string system_name
        {
            get
            {
                return this._system_name;
            }
            set
            {
                if ((this._system_name != value))
                {
                    this._system_name = value;
                }
            }
        }

        //[Column(Storage  = "_ticket_type", DbType = "VarChar(50)")]
        public string ticket_type
        {
            get
            {
                return this._ticket_type;
            }
            set
            {
                if ((this._ticket_type != value))
                {
                    this._ticket_type = value;
                }
            }
        }

        //[Column(Storage  = "_system_label", DbType = "VarChar(83)")]
        public string system_label
        {
            get
            {
                return this._system_label;
            }
            set
            {
                if ((this._system_label != value))
                {
                    this._system_label = value;
                }
            }
        }
    }

    public partial class getCTicketsAssignedSystemsByStatusResult
    {

        private System.Nullable<int> _qty;

        private System.Nullable<int> _id_system;

        private string _system_name;

        private string _system_status;

        private string _ticket_type;

        private string _system_label;

        public getCTicketsAssignedSystemsByStatusResult()
        {
        }

        //[Column(Storage  = "_qty", DbType = "Int")]
        public System.Nullable<int> qty
        {
            get
            {
                return this._qty;
            }
            set
            {
                if ((this._qty != value))
                {
                    this._qty = value;
                }
            }
        }

        //[Column(Storage  = "_id_system", DbType = "Int")]
        public System.Nullable<int> id_system
        {
            get
            {
                return this._id_system;
            }
            set
            {
                if ((this._id_system != value))
                {
                    this._id_system = value;
                }
            }
        }

        //[Column(Storage  = "_system_name", DbType = "VarChar(50)")]
        public string system_name
        {
            get
            {
                return this._system_name;
            }
            set
            {
                if ((this._system_name != value))
                {
                    this._system_name = value;
                }
            }
        }

        //[Column(Storage  = "_system_status", DbType = "VarChar(255)")]
        public string system_status
        {
            get
            {
                return this._system_status;
            }
            set
            {
                if ((this._system_status != value))
                {
                    this._system_status = value;
                }
            }
        }

        //[Column(Storage  = "_ticket_type", DbType = "VarChar(50)")]
        public string ticket_type
        {
            get
            {
                return this._ticket_type;
            }
            set
            {
                if ((this._ticket_type != value))
                {
                    this._ticket_type = value;
                }
            }
        }

        //[Column(Storage  = "_system_label", DbType = "VarChar(288)")]
        public string system_label
        {
            get
            {
                return this._system_label;
            }
            set
            {
                if ((this._system_label != value))
                {
                    this._system_label = value;
                }
            }
        }
    }

    public partial class ShowUsersOpenlistResult
    {

        private int _id_openlist;

        private System.Nullable<int> _id_ticket;

        private string _ticket_type;

        private string _system_name;

        private System.Nullable<int> _system_width;

        private System.Nullable<int> _system_height;

        private string _system_status;

        private System.Nullable<System.DateTime> _date_open;

        private string _dep_assigned;

        private string _user_assigned;

        private string _area_name_assigned;

        private string _dep_origin;

        private string _user_origin;

        private string _area_name_origin;

        private string _ncliente;

        private string _reference;

        private string _user_lock;

        private string _login;

        private System.Nullable<short> _is_private;

        private string _view_type;

        private System.Nullable<int> _id_status;

        private System.Nullable<int> _id_system;

        private System.Nullable<int> _id_external;

        private System.Nullable<short> _system_restricted;

        private System.Nullable<short> _view_type_order;

        private System.Nullable<byte> _visible;

        public ShowUsersOpenlistResult()
        {
        }

        //[Column(Storage  = "_id_openlist", DbType = "Int NOT NULL")]
        public int id_openlist
        {
            get
            {
                return this._id_openlist;
            }
            set
            {
                if ((this._id_openlist != value))
                {
                    this._id_openlist = value;
                }
            }
        }

        //[Column(Storage  = "_id_ticket", DbType = "Int")]
        public System.Nullable<int> id_ticket
        {
            get
            {
                return this._id_ticket;
            }
            set
            {
                if ((this._id_ticket != value))
                {
                    this._id_ticket = value;
                }
            }
        }

        //[Column(Storage  = "_ticket_type", DbType = "VarChar(100)")]
        public string ticket_type
        {
            get
            {
                return this._ticket_type;
            }
            set
            {
                if ((this._ticket_type != value))
                {
                    this._ticket_type = value;
                }
            }
        }

        //[Column(Storage  = "_system_name", DbType = "VarChar(50)")]
        public string system_name
        {
            get
            {
                return this._system_name;
            }
            set
            {
                if ((this._system_name != value))
                {
                    this._system_name = value;
                }
            }
        }

        //[Column(Storage  = "_system_width", DbType = "Int")]
        public System.Nullable<int> system_width
        {
            get
            {
                return this._system_width;
            }
            set
            {
                if ((this._system_width != value))
                {
                    this._system_width = value;
                }
            }
        }

        //[Column(Storage  = "_system_height", DbType = "Int")]
        public System.Nullable<int> system_height
        {
            get
            {
                return this._system_height;
            }
            set
            {
                if ((this._system_height != value))
                {
                    this._system_height = value;
                }
            }
        }

        //[Column(Storage  = "_system_status", DbType = "VarChar(100)")]
        public string system_status
        {
            get
            {
                return this._system_status;
            }
            set
            {
                if ((this._system_status != value))
                {
                    this._system_status = value;
                }
            }
        }

        //[Column(Storage  = "_date_open", DbType = "DateTime")]
        public System.Nullable<System.DateTime> date_open
        {
            get
            {
                return this._date_open;
            }
            set
            {
                if ((this._date_open != value))
                {
                    this._date_open = value;
                }
            }
        }

        //[Column(Storage  = "_dep_assigned", DbType = "VarChar(500)")]
        public string dep_assigned
        {
            get
            {
                return this._dep_assigned;
            }
            set
            {
                if ((this._dep_assigned != value))
                {
                    this._dep_assigned = value;
                }
            }
        }

        //[Column(Storage  = "_user_assigned", DbType = "VarChar(255)")]
        public string user_assigned
        {
            get
            {
                return this._user_assigned;
            }
            set
            {
                if ((this._user_assigned != value))
                {
                    this._user_assigned = value;
                }
            }
        }

        //[Column(Storage  = "_area_name_assigned", DbType = "VarChar(100)")]
        public string area_name_assigned
        {
            get
            {
                return this._area_name_assigned;
            }
            set
            {
                if ((this._area_name_assigned != value))
                {
                    this._area_name_assigned = value;
                }
            }
        }

        //[Column(Storage  = "_dep_origin", DbType = "VarChar(500)")]
        public string dep_origin
        {
            get
            {
                return this._dep_origin;
            }
            set
            {
                if ((this._dep_origin != value))
                {
                    this._dep_origin = value;
                }
            }
        }

        //[Column(Storage  = "_user_origin", DbType = "VarChar(255)")]
        public string user_origin
        {
            get
            {
                return this._user_origin;
            }
            set
            {
                if ((this._user_origin != value))
                {
                    this._user_origin = value;
                }
            }
        }

        //[Column(Storage  = "_area_name_origin", DbType = "VarChar(100)")]
        public string area_name_origin
        {
            get
            {
                return this._area_name_origin;
            }
            set
            {
                if ((this._area_name_origin != value))
                {
                    this._area_name_origin = value;
                }
            }
        }

        //[Column(Storage  = "_ncliente", DbType = "VarChar(255)")]
        public string ncliente
        {
            get
            {
                return this._ncliente;
            }
            set
            {
                if ((this._ncliente != value))
                {
                    this._ncliente = value;
                }
            }
        }

        //[Column(Storage  = "_reference", DbType = "VarChar(255)")]
        public string reference
        {
            get
            {
                return this._reference;
            }
            set
            {
                if ((this._reference != value))
                {
                    this._reference = value;
                }
            }
        }

        //[Column(Storage  = "_user_lock", DbType = "VarChar(20)")]
        public string user_lock
        {
            get
            {
                return this._user_lock;
            }
            set
            {
                if ((this._user_lock != value))
                {
                    this._user_lock = value;
                }
            }
        }

        //[Column(Storage  = "_login", DbType = "VarChar(20)")]
        public string login
        {
            get
            {
                return this._login;
            }
            set
            {
                if ((this._login != value))
                {
                    this._login = value;
                }
            }
        }

        //[Column(Storage  = "_is_private", DbType = "SmallInt")]
        public System.Nullable<short> is_private
        {
            get
            {
                return this._is_private;
            }
            set
            {
                if ((this._is_private != value))
                {
                    this._is_private = value;
                }
            }
        }

        //[Column(Storage  = "_view_type", DbType = "VarChar(45)")]
        public string view_type
        {
            get
            {
                return this._view_type;
            }
            set
            {
                if ((this._view_type != value))
                {
                    this._view_type = value;
                }
            }
        }

        //[Column(Storage  = "_id_status", DbType = "Int")]
        public System.Nullable<int> id_status
        {
            get
            {
                return this._id_status;
            }
            set
            {
                if ((this._id_status != value))
                {
                    this._id_status = value;
                }
            }
        }

        //[Column(Storage  = "_id_system", DbType = "Int")]
        public System.Nullable<int> id_system
        {
            get
            {
                return this._id_system;
            }
            set
            {
                if ((this._id_system != value))
                {
                    this._id_system = value;
                }
            }
        }

        //[Column(Storage  = "_id_external", DbType = "Int")]
        public System.Nullable<int> id_external
        {
            get
            {
                return this._id_external;
            }
            set
            {
                if ((this._id_external != value))
                {
                    this._id_external = value;
                }
            }
        }

        //[Column(Storage  = "_system_restricted", DbType = "SmallInt")]
        public System.Nullable<short> system_restricted
        {
            get
            {
                return this._system_restricted;
            }
            set
            {
                if ((this._system_restricted != value))
                {
                    this._system_restricted = value;
                }
            }
        }

        //[Column(Storage  = "_view_type_order", DbType = "SmallInt")]
        public System.Nullable<short> view_type_order
        {
            get
            {
                return this._view_type_order;
            }
            set
            {
                if ((this._view_type_order != value))
                {
                    this._view_type_order = value;
                }
            }
        }

        //[Column(Storage  = "_visible", DbType = "TinyInt")]
        public System.Nullable<byte> visible
        {
            get
            {
                return this._visible;
            }
            set
            {
                if ((this._visible != value))
                {
                    this._visible = value;
                }
            }
        }
    }

    public partial class getCTicketsAssignedSystemsResult
    {

        private System.Nullable<int> _qty;

        private System.Nullable<int> _id_system;

        private string _system_name;

        private string _system_label;

        public getCTicketsAssignedSystemsResult()
        {
        }

        //[Column(Storage  = "_qty", DbType = "Int")]
        public System.Nullable<int> qty
        {
            get
            {
                return this._qty;
            }
            set
            {
                if ((this._qty != value))
                {
                    this._qty = value;
                }
            }
        }

        //[Column(Storage  = "_id_system", DbType = "Int")]
        public System.Nullable<int> id_system
        {
            get
            {
                return this._id_system;
            }
            set
            {
                if ((this._id_system != value))
                {
                    this._id_system = value;
                }
            }
        }

        //[Column(Storage  = "_system_name", DbType = "VarChar(50)")]
        public string system_name
        {
            get
            {
                return this._system_name;
            }
            set
            {
                if ((this._system_name != value))
                {
                    this._system_name = value;
                }
            }
        }

        //[Column(Storage  = "_system_label", DbType = "VarChar(83)")]
        public string system_label
        {
            get
            {
                return this._system_label;
            }
            set
            {
                if ((this._system_label != value))
                {
                    this._system_label = value;
                }
            }
        }
    }


    public partial class DataRetriever
    {
        public int lock_minutes = 15;

        public DataSet ctickets_v_worklist = new DataSet();
        public DataSet ctickets_worklist_order = new DataSet();
        public DataSet ctickets_master = new DataSet();
        public DataSet ctickets_systems_configuration = new DataSet();
        public DataSet ctickets_comments = new DataSet();
        public DataSet getCTicketsAssignedSystems = new DataSet();
        public DataSet getCTicketsAssignedSystemsByType = new DataSet();
        public DataSet getCTicketsAssignedSystemsByStatus = new DataSet();

        private static DataFileReader CSVReader = new DataFileReader();

        public static string txtCSVFolderPath
        {
            get { return CSVReader.txtCSVFolderPath; }
            set { CSVReader.txtCSVFolderPath = value; }
        }

        public DataRetriever()
        {
            FillDataSets();
        }

        public void FillDataSets()
        {
            ctickets_v_worklist = CSVReader.ConnectCSV("ctickets_v_worklist.csv");
            ctickets_worklist_order = CSVReader.ConnectCSV("ctickets_worklist_order.csv");
            ctickets_master = CSVReader.ConnectCSV("ctickets_master.csv");
            ctickets_systems_configuration = CSVReader.ConnectCSV("ctickets_systems_configuration.csv");
            ctickets_comments = CSVReader.ConnectCSV("ctickets_comments.csv");
            getCTicketsAssignedSystems = CSVReader.ConnectCSV("getCTicketsAssignedSystems.csv");
            getCTicketsAssignedSystemsByType = CSVReader.ConnectCSV("getCTicketsAssignedSystemsByType.csv");
            getCTicketsAssignedSystemsByStatus = CSVReader.ConnectCSV("getCTicketsAssignedSystemsByStatus.csv");
        }

        public ctickets_worklist_order GetWorklistOrder(string user_login)
        {
            return new ctickets_worklist_order();
        }

        public ctickets_master GetTicketDetails(int id_ticket)
        {
            var query = from ds in ctickets_master.Tables["ctickets_master.csv"].AsEnumerable()
                        where ds.Field<int>("id_ticket") == id_ticket
                        select new ctickets_master
                        {
                            id_ticket = ds.Field<int>("id_ticket"),
                            //parent_id_ticket = ds.Field<int?>("parent_id_ticket"),

                            id_external = ds.Field<int?>("id_external"),
                            id_system = ds.Field<int?>("id_system"),
                            ticket_type = ds.Field<string>("ticket_type"),
                            ticket_status = ds.Field<string>("ticket_status"),
                            ticket_text = ds.Field<string>("ticket_text"),
                            reference = ds.Field<string>("reference"),
                            system_status = ds.Field<string>("system_status"),

                            //system_restricted = ds.Field<byte?>("system_restricted"),
                            user_open = ds.Field<string>("user_open"),
                            //date_open = ds.Field<DateTime?>("date_open"),
                            //area_name_origin = ds.Field<string>("area_name_origin"),
                            //id_company_structure_origin = ds.Field<int?>("id_company_structure_origin"),

                            user_cancel = ds.Field<string>("user_cancel"),
                            date_cancel = ds.Field<DateTime?>("date_cancel"),
                            user_assigned = ds.Field<string>("user_assigned"),
                            date_assigned = ds.Field<DateTime?>("date_assigned"),
                            area_name_assigned = ds.Field<string>("area_name_assigned"),
                            id_company_structure_assigned = ds.Field<int?>("id_company_structure_assigned"),
                            area_assigned = ds.Field<string>("area_assigned"),
                            group_assigned = ds.Field<string>("group_assigned"),
                            dep_assigned = ds.Field<string>("dep_assigned"),
                            sector_assigned = ds.Field<string>("sector_assigned"),
                            region_assigned = ds.Field<string>("region_assigned"),
                            user_close = ds.Field<string>("user_close"),
                            date_close = ds.Field<DateTime?>("date_close"),

                            //id_company_structure_closed = ds.Field<int?>("id_company_structure_closed"),
                            //ncliente = ds.Field<string>("ncliente"),
                            //client_name = ds.Field<string>("client_name"),
                            //client_type = ds.Field<string>("client_type"),
                            //user_lock = ds.Field<string>("user_lock"),
                            //date_lock = ds.Field<DateTime?>("date_lock"),
                            //is_private = ds.Field<byte?>("is_private"),
                            //is_confidential = ds.Field<byte?>("is_confidential"),
                            //auto_return_transfer = ds.Field<byte?>("auto_return_transfer"),
                            //auto_return_user = ds.Field<string>("auto_return_user"),
                            //auto_return_id_company_structure = ds.Field<int?>("auto_return_id_company_structure"),
                            //open_comment = ds.Field<string>("open_comment"),
                            //current_comment = ds.Field<string>("current_comment"),
                            //close_comment = ds.Field<string>("close_comment"),
                            //certification_comment = ds.Field<string>("certification_comment"),
                            //certification_result = ds.Field<string>("certification_result"),
                            //user_certification = ds.Field<string>("user_certification"),
                            //date_certification = ds.Field<DateTime?>("date_certification")
                        } into lq
                        select lq;

            return query.FirstOrDefault();
        }

        public ctickets_systems_configuration GetTicketSystemConfiguration(int id_system)
        {
            var query = from ds in ctickets_systems_configuration.Tables["ctickets_systems_configuration.csv"].AsEnumerable()
                        where  ds.Field<int>("id_system") == id_system
                        select new ctickets_systems_configuration
                        {
                            id_system = ds.Field<int>("id_system"),
                            system_name = ds.Field<string>("system_name"),
                            system_list_type = ds.Field<int>("system_list_type")
                        } into lq
                        select lq;

            return query.FirstOrDefault();
            //return new ctickets_systems_configuration();
        }

        public ctickets_systems_configuration GetCTicketSystemConfiguration(int id_system)
        {
            var query = from ds in ctickets_systems_configuration.Tables["ctickets_systems_configuration.csv"].AsEnumerable()
                        where ds.Field<int>("id_system") == id_system
                        select new ctickets_systems_configuration
                        {
                            id_system = ds.Field<int>("id_system"),
                            system_name = ds.Field<string>("system_name"),
                            system_list_type = ds.Field<int>("system_list_type")
                        } into lq
                        select lq;

            return query.FirstOrDefault();
            //return new ctickets_systems_configuration();
        }


        public bool isTicketLocked(int id_ticket, string user_login)
        {
            return false;
        }

        public bool CreateTicketLock(int id_ticket, string user_login)
        {
            return true;
        }

        public void ReleaseTicketLock(int id_ticket)
        {
        }


        public List<ctickets_comment> GetTicketComments(int id_ticket)
        {
            return new List<ctickets_comment>();
        }

        public List<ctickets_v_worklist> GetWorkListView(string user_login, int id_system)
        {
            var query = from ds in ctickets_v_worklist.Tables["ctickets_v_worklist.csv"].AsEnumerable()
                        where ds.Field<string>("login") == user_login
                        && ds.Field<int?>("id_system") == id_system
                        select new ctickets_v_worklist
                        {
                            login = ds.Field<string>("login"),
                            id_ticket = ds.Field<int>("id_ticket"),
                            id_system = ds.Field<int?>("id_system"),
                            ticket_type = ds.Field<string>("ticket_type"),
                            system_name = ds.Field<string>("system_name"),
                            system_width = ds.Field<int?>("system_width"),
                            system_height = ds.Field<int?>("system_height"),
                            id_status = ds.Field<int?>("id_status"),
                            status_name = ds.Field<string>("status_name"),
                            //visible = ds.Field<byte?>("visible"),
                            //parent_id_ticket = ds.Field<int?>("parent_id_ticket"),
                            id_external = ds.Field<int?>("id_external"),

                            ticket_status = ds.Field<string>("ticket_status"),
                            ticket_text = ds.Field<string>("ticket_text"),
                            reference = ds.Field<string>("reference"),
                            system_status = ds.Field<string>("system_status"),

                            //system_restricted = ds.Field<byte?>("system_restricted"),
                            user_open = ds.Field<string>("user_open"),
                            //date_open = ds.Field<DateTime?>("date_open"),
                            //area_name_origin = ds.Field<string>("area_name_origin"),
                            //id_company_structure_origin = ds.Field<int?>("id_company_structure_origin"),

                            user_cancel = ds.Field<string>("user_cancel"),
                            date_cancel = ds.Field<DateTime?>("date_cancel"),
                            user_assigned = ds.Field<string>("user_assigned"),
                            date_assigned = ds.Field<DateTime?>("date_assigned"),
                            area_name_assigned = ds.Field<string>("area_name_assigned"),
                            id_company_structure_assigned = ds.Field<int?>("id_company_structure_assigned"),
                            area_assigned = ds.Field<string>("area_assigned"),
                            group_assigned = ds.Field<string>("group_assigned"),
                            dep_assigned = ds.Field<string>("dep_assigned"),
                            sector_assigned = ds.Field<string>("sector_assigned"),
                            region_assigned = ds.Field<string>("region_assigned"),
                            user_close = ds.Field<string>("user_close"),
                            date_close = ds.Field<DateTime?>("date_close"),

                            //id_company_structure_closed = ds.Field<int?>("id_company_structure_closed"),
                            //ncliente = ds.Field<string>("ncliente"),
                            //client_name = ds.Field<string>("client_name"),
                            //client_type = ds.Field<string>("client_type"),
                            //user_lock = ds.Field<string>("user_lock"),
                            //date_lock = ds.Field<DateTime?>("date_lock"),
                            //is_private = ds.Field<byte?>("is_private"),
                            //is_confidential = ds.Field<byte?>("is_confidential"),
                            //auto_return_transfer = ds.Field<byte?>("auto_return_transfer"),
                            //auto_return_user = ds.Field<string>("auto_return_user"),
                            //auto_return_id_company_structure = ds.Field<int?>("auto_return_id_company_structure"),
                            //open_comment = ds.Field<string>("open_comment"),
                            //current_comment = ds.Field<string>("current_comment"),
                            //close_comment = ds.Field<string>("close_comment"),
                            //certification_comment = ds.Field<string>("certification_comment"),
                            //certification_result = ds.Field<string>("certification_result"),
                            //user_certification = ds.Field<string>("user_certification"),
                            //date_certification = ds.Field<DateTime?>("date_certification")
                        } into lq
                        select lq;

            return query.ToList();
        }

        public List<ctickets_v_worklist> GetWorkList(string user_login, int id_system)
        {
            var query = from ds in ctickets_v_worklist.Tables["ctickets_v_worklist.csv"].AsEnumerable()
                        where ds.Field<string>("login") == user_login
                        && ds.Field<int?>("id_system") == id_system
                        select new ctickets_v_worklist
                        {
                            login = ds.Field<string>("login"),
                            id_ticket = ds.Field<int>("id_ticket"),
                            id_system = ds.Field<int?>("id_system"),
                            ticket_type = ds.Field<string>("ticket_type"),
                            system_name = ds.Field<string>("system_name"),
                            system_width = ds.Field<int?>("system_width"),
                            system_height = ds.Field<int?>("system_height"),
                            id_status = ds.Field<int?>("id_status"),
                            status_name = ds.Field<string>("status_name"),
                            visible = ds.Field<byte?>("visible"),
                            parent_id_ticket = ds.Field<int?>("parent_id_ticket"),
                            id_external = ds.Field<int?>("id_external"),
                            ticket_status = ds.Field<string>("ticket_status"),
                            ticket_text = ds.Field<string>("ticket_text"),
                            reference = ds.Field<string>("reference"),
                            system_status = ds.Field<string>("system_status"),
                            system_restricted = ds.Field<byte?>("system_restricted"),
                            user_open = ds.Field<string>("user_open"),
                            date_open = ds.Field<DateTime?>("date_open"),
                            area_name_origin = ds.Field<string>("area_name_origin"),
                            id_company_structure_origin = ds.Field<int?>("id_company_structure_origin"),
                            user_cancel = ds.Field<string>("user_cancel"),
                            date_cancel = ds.Field<DateTime?>("date_cancel"),
                            user_assigned = ds.Field<string>("user_assigned"),
                            date_assigned = ds.Field<DateTime?>("date_assigned"),
                            area_name_assigned = ds.Field<string>("area_name_assigned"),
                            id_company_structure_assigned = ds.Field<int?>("id_company_structure_assigned"),
                            area_assigned = ds.Field<string>("area_assigned"),
                            group_assigned = ds.Field<string>("group_assigned"),
                            dep_assigned = ds.Field<string>("dep_assigned"),
                            sector_assigned = ds.Field<string>("sector_assigned"),
                            region_assigned = ds.Field<string>("region_assigned"),
                            user_close = ds.Field<string>("user_close"),
                            date_close = ds.Field<DateTime?>("date_close"),
                            id_company_structure_closed = ds.Field<int?>("id_company_structure_closed"),
                            ncliente = ds.Field<string>("ncliente"),
                            client_name = ds.Field<string>("client_name"),
                            client_type = ds.Field<string>("client_type"),
                            user_lock = ds.Field<string>("user_lock"),
                            date_lock = ds.Field<DateTime?>("date_lock"),
                            is_private = ds.Field<byte?>("is_private"),
                            is_confidential = ds.Field<byte?>("is_confidential"),
                            auto_return_transfer = ds.Field<byte?>("auto_return_transfer"),
                            auto_return_user = ds.Field<string>("auto_return_user"),
                            auto_return_id_company_structure = ds.Field<int?>("auto_return_id_company_structure"),
                            open_comment = ds.Field<string>("open_comment"),
                            current_comment = ds.Field<string>("current_comment"),
                            close_comment = ds.Field<string>("close_comment"),
                            certification_comment = ds.Field<string>("certification_comment"),
                            certification_result = ds.Field<string>("certification_result"),
                            user_certification = ds.Field<string>("user_certification"),
                            date_certification = ds.Field<DateTime?>("date_certification")
                        } into lq
                        select lq;

            return query.ToList();
        }

        public List<ctickets_v_worklist> GetWorkListView(string user_login)
        {
            var query = from ds in ctickets_v_worklist.Tables["ctickets_v_worklist.csv"].AsEnumerable()
                        where ds.Field<string>("login") == user_login
                        select new ctickets_v_worklist {
                            login = ds.Field<string>("login"),
                            id_ticket = ds.Field<int>("id_ticket"),
                            id_system = ds.Field<int?>("id_system"),
                            ticket_type = ds.Field<string>("ticket_type"),
                            system_name = ds.Field<string>("system_name"),
                            system_width = ds.Field<int?>("system_width"),
                            system_height = ds.Field<int?>("system_height"),
                            id_status = ds.Field<int?>("id_status"),
                            status_name = ds.Field<string>("status_name"),
                            visible = ds.Field<byte?>("visible"),
                            parent_id_ticket = ds.Field<int?>("parent_id_ticket"),
                            id_external = ds.Field<int?>("id_external"),
                            ticket_status = ds.Field<string>("ticket_status"),
                            ticket_text = ds.Field<string>("ticket_text"),
                            reference = ds.Field<string>("reference"),
                            system_status = ds.Field<string>("system_status"),
                            system_restricted = ds.Field<byte?>("system_restricted"),
                            user_open = ds.Field<string>("user_open"),
                            date_open = ds.Field<DateTime?>("date_open"),
                            area_name_origin = ds.Field<string>("area_name_origin"),
                            id_company_structure_origin = ds.Field<int?>("id_company_structure_origin"),
                            user_cancel = ds.Field<string>("user_cancel"),
                            date_cancel = ds.Field<DateTime?>("date_cancel"),
                            user_assigned = ds.Field<string>("user_assigned"),
                            date_assigned = ds.Field<DateTime?>("date_assigned"),
                            area_name_assigned = ds.Field<string>("area_name_assigned"),
                            id_company_structure_assigned = ds.Field<int?>("id_company_structure_assigned"),
                            area_assigned = ds.Field<string>("area_assigned"),
                            group_assigned = ds.Field<string>("group_assigned"),
                            dep_assigned = ds.Field<string>("dep_assigned"),
                            sector_assigned = ds.Field<string>("sector_assigned"),
                            region_assigned = ds.Field<string>("region_assigned"),
                            user_close = ds.Field<string>("user_close"),
                            date_close = ds.Field<DateTime?>("date_close"),
                            id_company_structure_closed = ds.Field<int?>("id_company_structure_closed"),
                            ncliente = ds.Field<string>("ncliente"),
                            client_name = ds.Field<string>("client_name"),
                            client_type = ds.Field<string>("client_type"),
                            user_lock = ds.Field<string>("user_lock"),
                            date_lock = ds.Field<DateTime?>("date_lock"),
                            is_private = ds.Field<byte?>("is_private"),
                            is_confidential = ds.Field<byte?>("is_confidential"),
                            auto_return_transfer = ds.Field<byte?>("auto_return_transfer"),
                            auto_return_user = ds.Field<string>("auto_return_user"),
                            auto_return_id_company_structure = ds.Field<int?>("auto_return_id_company_structure"),
                            open_comment = ds.Field<string>("open_comment"),
                            current_comment = ds.Field<string>("current_comment"),
                            close_comment = ds.Field<string>("close_comment"),
                            certification_comment = ds.Field<string>("certification_comment"),
                            certification_result = ds.Field<string>("certification_result"),
                            user_certification = ds.Field<string>("user_certification"),
                            date_certification = ds.Field<DateTime?>("date_certification")
                        } into lq
                        select lq;

            return query.ToList();
        }

        public void UpdateWorklistOrder(string login, string refstring, string sortstring, string fieldname)
        {
        }


        public List<getCTicketsAssignedSystemsResult> GetSystemAssignedList(string user_login)
        {
            var query = from ds in getCTicketsAssignedSystems.Tables["getCTicketsAssignedSystems.csv"].AsEnumerable()
                        select new getCTicketsAssignedSystemsResult
                        {
                            qty = ds.Field<int>("qty"),
                            id_system = ds.Field<int?>("id_system"),
                            system_name = ds.Field<string>("system_name"),
                            system_label = ds.Field<string>("system_label")
                        } into lq
                        select lq;

            return query.ToList();
        }

        public List<getCTicketsAssignedSystemsByTypeResult> getCTicketsAssignedSystemsListByType(string user_login, int id_system)
        {
            var query = from ds in getCTicketsAssignedSystemsByType.Tables["getCTicketsAssignedSystemsByType.csv"].AsEnumerable()
                        where ds.Field<int?>("id_system") == id_system
                        select new getCTicketsAssignedSystemsByTypeResult
                        {
                            qty = ds.Field<int>("qty"),
                            id_system = ds.Field<int?>("id_system"),
                            system_name = ds.Field<string>("system_name"),
                            ticket_type = ds.Field<string>("ticket_type"),
                            system_label = ds.Field<string>("system_label")
                        } into lq
                        select lq;

            return query.ToList();
        }

        public List<getCTicketsAssignedSystemsByStatusResult> getCTicketsAssignedSystemsListByStatus(string user_login, int id_system)
        {
            var query = from ds in getCTicketsAssignedSystemsByStatus.Tables["getCTicketsAssignedSystemsByStatus.csv"].AsEnumerable()
                        where ds.Field<int?>("id_system") == id_system
                        select new getCTicketsAssignedSystemsByStatusResult
                        {
                            qty = ds.Field<int>("qty"),
                            //id_system = ds.Field<int?>("id_system"),
                            system_name = ds.Field<string>("system_name"),
                            system_status = ds.Field<string>("system_status"),
                            ticket_type = ds.Field<string>("ticket_type"),
                            system_label = ds.Field<string>("system_label")
                        } into lq
                        select lq;

            return query.ToList();
        }

    }

    public partial class DataFileReader
    {
        System.Data.Odbc.OdbcDataAdapter obj_oledb_da;
        public string txtCSVFolderPath = "";
        public string strCSVFile = "";

        public DataFileReader()
        { 
        }

        public DataFileReader(string txtCSVFolderPath, string strCSVFile)
        { 
            this.txtCSVFolderPath = txtCSVFolderPath;
            this.strCSVFile = strCSVFile;
        }

        # region Function For Importing Data From CSV File
        public DataSet ConnectCSV(string filetable)
        {
            DataSet ds = new DataSet();
            try
            {
                // You can get connected to driver either by using DSN or connection string

                // Create a connection string as below, if you want to use DSN less connection. The DBQ attribute sets the path of directory which contains CSV files
                //string strConnString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + txtCSVFolderPath.Trim() + ";Extensions=asc,csv,tab,txt;Persist Security Info=False";
                string strConnString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + txtCSVFolderPath.Trim().ToUpper() + ";";
                string sql_select;
                System.Data.Odbc.OdbcConnection conn;

                //Create connection to CSV file
                conn = new System.Data.Odbc.OdbcConnection(strConnString.Trim());

                // For creating a connection using DSN, use following line
                //conn	=	new System.Data.Odbc.OdbcConnection("DSN=testcsv");

                //Open the connection 
                conn.Open();
                //Fetch records from CSV
                sql_select = "select * from [" + filetable + "]";

                obj_oledb_da = new System.Data.Odbc.OdbcDataAdapter(sql_select, conn);
                //Fill dataset with the records from CSV file
                //obj_oledb_da.Fill(ds, "Stocks");
                obj_oledb_da.Fill(ds, filetable);

                //Set the datagrid properties

                //dGridCSVdata.DataSource = ds;
                //dGridCSVdata.DataMember = "Stocks";
                //Close Connection to CSV file
                conn.Close();

                //strPath = Server.MapPath(".");
                //set objConnection=Server.CreateObject("ADODB.Connection");
                //strConnectionString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" &  strPath & "\;Extensions=asc,csv,tab,txt";
                //objConnection.Open strConnectionString;
                //strSQL = "Select * From datalink.csv";
                //set objRS=Server.CreateObject("ADODB.RecordSet");
                //objRS.Open strSQL, objConnection,3,3;
                //arrRows=objRS.GetRows();
                //'let's prove that this works;
                //Response.Write("<P>Colmn Index (starts at 0): " & UBound(arrRows,1)); ' Reads left to right;
                //Response.Write("<br>Row Index (starts at 0): " & UBound(arrRows,2) & "<P>"); ' Reads up to down


                //objRS.close
                //set objRS = Nothing
                //objConnection.Close
                //set objConnection = Nothing

            }
            catch (Exception ex )
            { string exp = ex.ToString(); }

            return ds;
        }

        # endregion

        # region Create schema.ini
        /*Schema.ini File (Text File Driver)

		When the Text driver is used, the format of the text file is determined by using a
		schema information file. The schema information file, which is always named Schema.ini
		and always kept in the same directory as the text data source, provides the IISAM 
		with information about the general format of the file, the column name and data type
		information, and a number of other data characteristics
         
        example:
        [Test.csv]
        ColNameHeader=True
        Format=Delimited(;)
        MaxScanRows=25
        CharacterSet=OEM
         
        */

        private void writeSchema()
        {
            try
            {
                FileStream fsOutput = new FileStream(txtCSVFolderPath + "\\schema.ini", FileMode.Create, FileAccess.Write);
                StreamWriter srOutput = new StreamWriter(fsOutput);
                string s1, s2, s3, s4, s5;
                s1 = "[" + strCSVFile + "]";
                s2 = "ColNameHeader=True";
                s3 = "Format=Delimited(;)";
                s4 = "MaxScanRows=25";
                s5 = "CharacterSet=OEM";
                srOutput.WriteLine(s1.ToString() + '\n' + s2.ToString() + '\n' + s3.ToString() + '\n' + s4.ToString() + '\n' + s5.ToString());
                srOutput.Close();
                fsOutput.Close();
            }
            catch
            { }
            finally
            { }
        }
        #endregion
    
    }

}
