コード例 #1
0
        public static AssetTicketModel[] GetAssetTickets(TicketModel ticket)
        {
            OrganizationModel organization = ticket.Organization;
            //int[] ids = IDReader.Read(TicketChild.Asset, ticket);   // $"SELECT AssetID From AssetTickets WITH (NOLOCK) WHERE TicketID = {ticket.TicketID}"
            string query = $"SELECT AssetID From AssetTickets WITH (NOLOCK) WHERE TicketID = {ticket.TicketID}";

            int[] ids = ticket.ExecuteQuery <int>(query).ToArray();
            AssetTicketModel[] models = new AssetTicketModel[ids.Length];
            for (int i = 0; i < ids.Length; ++i)
            {
                models[i] = new AssetTicketModel(new AssetModel(organization, ids[i]), ticket, false);
            }
            return(models);
        }
コード例 #2
0
        public ConnectionContext(AuthenticationModel authentication, bool useTransaction = false)
        {
            // SqlConnection
            Authentication = authentication;
            _connection    = new SqlConnection(Authentication.ConnectionString); // using
            _connection.Open();                                                  // connection must be open to begin transaction

            // DataContext
            _db = new DataContext(_connection);
            //_db.ObjectTrackingEnabled = false;  // use linq read-only
            //db.DeferredLoadingEnabled = true; // don't use DataLoadOptions
            if (useTransaction)
            {
                _transaction    = _connection.BeginTransaction();
                _db.Transaction = _transaction;
            }

            // Create Logical Model! - note that OrganizationID and UserID come from Authentication
            Organization = new OrganizationModel(this);
            User         = new UserModel(this);
        }
コード例 #3
0
 public OrganizationTicketModel(TicketModel ticket, OrganizationModel organization) : this(ticket, organization, true)
 {
 }
コード例 #4
0
 public WatercoolerMsgModel(ConnectionContext connection, int messageID) : base(connection)
 {
     Organization = connection.Organization;
     MessageID    = messageID;
     Verify();
 }
コード例 #5
0
 public WatercoolerMsgModel(OrganizationModel organization, int messageID) : base(organization)
 {
     Organization = organization;
     MessageID    = messageID;
     Verify();
 }
コード例 #6
0
 /// <summary> top down - existing ticket </summary>
 public TicketModel(OrganizationModel organization, int ticketID) : base(organization)
 {
     Organization = organization;   // user session on customer
     TicketID     = ticketID;
     Verify();
 }
コード例 #7
0
 public ProductModel(OrganizationModel organization, int productID) : base(organization)
 {
 }
コード例 #8
0
 public TagModel(OrganizationModel organization, int tagID) : base(organization)
 {
 }
コード例 #9
0
 public AssetModel(OrganizationModel organization, int assetID) : base(organization)
 {
     Organization = organization;
     AssetID      = assetID;
     Verify();
 }
コード例 #10
0
 public TaskModel(ConnectionContext connection, int taskID) : base(connection)
 {
     Organization = connection.Organization;
     TaskID       = taskID;
     Verify();
 }
コード例 #11
0
 public TaskModel(OrganizationModel organization, int taskID) : base(organization)
 {
     Organization = organization;
     TaskID       = taskID;
     Verify();
 }