Exemplo n.º 1
0
        private void button_Click(object sender, RoutedEventArgs e)//link button, we open the string listener and file listener here
        {
            string localPort   = port.Text;
            string url         = "http://localhost:" + localPort;
            string strListener = url + "/CStrRcvr";
            string FListener   = url + "/CFRcvr";

            cmd.url = url;
            try
            {
                strrcvr = new stringReceiver();
                strrcvr.CreateRecvChannel(strListener);
                rcvThrd = new Thread(new ThreadStart(this.ThreadProc));
                rcvThrd.Start();
                host = fileReceiver.CreateChannel(FListener, "../../../log/");
                host.Open();
                button5.IsEnabled = true;
                button.IsEnabled  = false;
            }
            catch (Exception ex)
            {
                Window        temp = new Window();
                StringBuilder msg  = new StringBuilder(ex.Message);
                msg.Append("\nport = ");
                msg.Append(strListener.ToString());
                temp.Content = msg.ToString();
                temp.Height  = 100;
                temp.Width   = 500;
                temp.Show();
            }
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> GetAllWarehouses(stringReceiver sR)
        {
            string id = sR.decoded();
            //without distinct to check errors
            var result = db.WAREHOUSE.Where(e => e.ID != id).Select(e => e.NAME)
                         .OrderBy(item => item).ToList();

            return(Ok(returnHelper.make(result)));
        }
Exemplo n.º 3
0
 void startStringListener(string endpoint)//start string listener
 {
     try
     {
         recvr = new stringReceiver();
         recvr.CreateRecvChannel(endpoint);
         rcvThrd = new Thread(new ThreadStart(this.strThreadProc));
         rcvThrd.Start();
         Console.WriteLine("string listener start");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> GetDetail(stringReceiver sR)
        {
            var warehouse = await db.WAREHOUSE.FindAsync(sR.decoded());

            if (warehouse == null)
            {
                return(NotFound());
            }
            db.Entry(warehouse).Reference(p => p.REGION).Load();
            var dto = new WAREHOUSEDetailDto()
            {
                name            = warehouse.NAME,
                address         = warehouse.REGION.COUNTY,
                detailedAddress = warehouse.LOCATION
            };

            return(Ok(returnHelper.make(dto)));
        }
Exemplo n.º 5
0
        public async Task <IHttpActionResult> GetEqUsingDetail(stringReceiver sR)
        {
            var id = sR.decoded();
            var eq = await db.EQ_IN_USE.Include(e => e.EQ_TYPE).FirstOrDefaultAsync(e => e.ID == id);

            var result = new detailedEqInUseDto()
            {
                name         = eq.EQ_TYPE.TYPE_NAME,
                factory_time = eq.PRODUCTION_TIME,
                install_time = eq.INSTALL_TIME,
                unit         = eq.MANAGER,
                address      = eq.ADDRESS,
                if_damage    = eq.STATUS,
                QRcode       = eq.QR_CODE,
                icon         = eq.EQ_TYPE.PICTURE
            };

            return(Ok(returnHelper.make(result)));
        }
Exemplo n.º 6
0
        public async Task <IHttpActionResult> GetStorage(stringReceiver sR)
        {
            //without distinct to check errors
            var warehouse = await db.WAREHOUSE.FindAsync(sR.decoded());

            if (warehouse == null)
            {
                return(NotFound());
            }
            var warehouseTable = new List <WAREHOUSE>();

            warehouseTable.Add(warehouse);
            var accessories = GetStoredAccessories(warehouse);
            var eqs         = GetStoredEQ(warehouse);
            var dto         = new WAREHOUSEStorageDto()
            {
                accessory = accessories,
                equipment = eqs
            };

            return(Ok(returnHelper.make(dto)));
        }
Exemplo n.º 7
0
        public async Task <IHttpActionResult> deleteStaffSheetRow(stringReceiver sR)
        {
            string id = sR.decoded();

            try
            {
                var staff = await db.STAFF.FindAsync(id);

                if (staff == null || staff.IS_SUPER != "0")
                {
                    throw new Exception();
                }
                staff.IS_SUPER = "-1";
                await db.SaveChangesAsync();

                NotificationController.NotificationCallbackMsg("开除员工" + "  编号" + staff.ID);
                return(Ok(returnHelper.make(getDtoList())));
            }
            catch (Exception)
            {
                return(Ok(returnHelper.fail()));
            }
        }
Exemplo n.º 8
0
        public async Task <IHttpActionResult> DeleteCheckSheet(stringReceiver sR)
        {
            try
            {
                string     id         = sR.decoded();
                PATROL_LOG patrol_log = await db.PATROL_LOG.FindAsync(id);

                if (patrol_log == null)
                {
                    throw new ApplicationException();
                }
                db.PATROL_LOG.Remove(patrol_log);
                await db.SaveChangesAsync();

                NotificationController.NotificationCallbackMsg("删", "巡检单" + sR.decoded());
                var checkSheets = GetCheckSheets().data.ToList();
                return(Ok(returnHelper.make(checkSheets)));
            }
            catch (Exception)
            {
                return(Ok(returnHelper.fail()));
            }
        }
Exemplo n.º 9
0
        public async Task <IHttpActionResult> deleteWorkSheet(stringReceiver sR)
        {
            string id = sR.decoded();

            try
            {
                WORK_ORDER wORK_ORDER = await db.WORK_ORDER.FindAsync(id);

                if (wORK_ORDER == null)
                {
                    throw new ApplicationException();
                }
                db.WORK_ORDER.Remove(wORK_ORDER);
                await db.SaveChangesAsync();

                var workSheets = GetWorkSheets().data.ToList();
                NotificationController.NotificationCallbackMsg("删除工单" + sR.decoded());
                return(Ok(returnHelper.make(workSheets)));
            }
            catch (Exception)
            {
                return(Ok(returnHelper.fail()));
            }
        }