public void Add(string mastername, string stencilname)
        {
            var    item = new MasterRef(mastername, stencilname);
            string key  = getkey(mastername, stencilname);

            this._master_ref_dic[key] = item;
        }
Esempio n. 2
0
        public void Decode(String Id, String TKMsgIn, out uint TKResult, out String TKMsgOut)
        {
            lock (Lock)
            {
                //Cancel any pending operations
                tk.Cancel();

                TKResult = (uint)TicketingKernel.Result.GENERAL_ERROR;
                TKMsgOut = "";

                if (JobId != Id)
                {
                    return;
                }

                Console.Write(string.Format("########## TKCommand IN:\n{0}\n", TKMsgIn));
                bool ok = tk.Command(TKMsgIn, out TKMsgOut, TKCallback);
                Console.Write(string.Format("########## TKCommand OUT: {0}\n{1}\n", (ok ? "OK" : "ERROR!"), TKMsgOut));

                if (ok)
                {
                    TKResult = (uint)TicketingKernel.Result.OK;
                }

                if (MasterRef != null)
                {
                    MasterRef.JobFinished(Id);
                }
                Working = false;
            }
        }
Esempio n. 3
0
        private DbSet GetMasterRefDBSet(MasterRef mref)
        {
            DbSet returnvalue = null;

            switch (mref)
            {
            case MasterRef.config_type_ref:
            {
                returnvalue = db.Config_Types;
                break;
            }

            case MasterRef.scope_ref:
            {
                returnvalue = db.Scopes;
                break;
            }

            case MasterRef.status_ref:
            {
                returnvalue = db.Statuses;
                break;
            }
            }
            return(returnvalue);
        }
Esempio n. 4
0
        private object GetMasterRef_TableObject(MasterRef mref)
        {
            object returnvalue = null;

            switch (mref)
            {
            case MasterRef.config_type_ref:
            {
                returnvalue = new config_type_ref();
                break;
            }

            case MasterRef.scope_ref:
            {
                returnvalue = new scope_ref();
                break;
            }

            case MasterRef.status_ref:
            {
                returnvalue = new status_ref();
                break;
            }
            }
            return(returnvalue);
        }
Esempio n. 5
0
        public Array GetMasterRef(MasterRef mref)
        {
            //DbSet dbset = GetMasterRefDBSet(mref);
            var entryPoint = (from data in db.Config_Types
                              select data).ToList();

            return(entryPoint.ToArray());
        }
Esempio n. 6
0
        public void RunCommand(
            String Id,
            String TKMsgIn,
            out uint TKStatus,
            out uint TKResult,
            out String TKMsgOut,
            out IList <CTSWriteOperation> CardOperations,
            Card Card          = null,
            ExAPDU RdrCallback = null)
        {
            lock (Lock)
            {
                //Cancel any pending operations
                tk.Cancel();

                bool ok = false;
                Operations = CardOperations = new List <CTSWriteOperation>();
                TKMsgOut   = "";
                TKResult   = (uint)TicketingKernel.Result.GENERAL_ERROR;
                TKStatus   = (uint)TicketingKernel.Status.DETECTION;

                if (JobId != Id || (Card == null && RdrCallback == null))
                {
                    return;
                }
                //Call TK
                Working = true;
                if (Card != null)
                {
                    this.ActualCard = new RemoteCardData(Card);
                }
                this.RdrCallback = RdrCallback;

                Console.Write(string.Format("########## TKCommand IN:\n{0}\n", TKMsgIn));
                ok = tk.Command(TKMsgIn, out TKMsgOut, TKCallback);
                Console.Write(string.Format("########## TKCommand OUT: {0}\n{1}\n", (ok ? "OK" : "ERROR!"), TKMsgOut));

                if (!ok)
                {
                    return;
                }
                tk.Activity();
                TKMsgOut = this.TKMsgOut;
                TKResult = this.TKResult;
                TKStatus = this.TKStatus;
                if (this.TKResult != (uint)TicketingKernel.Result.OK)
                {
                    CardOperations.Clear();
                }
                this.RdrCallback = null;
                this.ActualCard  = null;
                if (MasterRef != null)
                {
                    MasterRef.JobFinished(Id);
                }
                Working = false;
            }
        }
Esempio n. 7
0
 private void WasJobDone(String Id)
 {
     lock (Lock)
     {
         if (JobId == Id && Working != true)
         {
             if (MasterRef != null)
             {
                 MasterRef.JobFinished(Id);
             }
             JobId   = null;
             Working = false;
         }
     }
 }
Esempio n. 8
0
        public object GetMasterRefUI(MasterRef mref)
        {
            object table     = GetMasterRef_TableObject(mref);
            Type   tabletype = table.GetType();

            IList <PropertyInfo> props = new List <PropertyInfo>(tabletype.GetProperties());

            // PropertyInfo[] properties = tabletype.GetProperties();
            //foreach (PropertyInfo property in properties)
            //{
            //    //property.SetValue(record, value);
            //}

            return(table);
        }
Esempio n. 9
0
        public object GetMasterRef(int id, MasterRef mref)
        {
            if (id == 0)
            {
                return(GetEmptyMasterRef(mref));         //Used to create empty structure for configuration_ref for ADD-NEW-Record
            }
            DbSet item = GetMasterRefDBSet(mref);

            item.Find(id);

            if (item == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(item);
        }
 public void Add(string mastername, string stencilname)
 {
     var item = new MasterRef(mastername,stencilname);
     string key = getkey(mastername, stencilname);
     this.master_ref_dic[key] = item;
 }
Esempio n. 11
0
 // GET api/ConfigurationAPI/0
 private object GetEmptyMasterRef(MasterRef mref)
 {
     return(GetMasterRef_TableObject(mref));
 }