예제 #1
0
        //크루 사인인 삭제
        private void RemoveCrewOn(ToolboxsignDTO dto)
        {
            #region "RemoveCrew"
            try
            {
                //Loading(true);
                //DailybrasssignDTO item = lvCrewList.Items.Where(x => (x as DailybrasssignDTO) == dto).FirstOrDefault() as DailybrasssignDTO;
                var item = lvCrewList.Items.Where(x => (x as ToolboxsignDTO) == dto).FirstOrDefault();
                var crew = Lib.DataSource.ToolBoxTalkSelectionDataSource.ToolBoxSign.Where(AlignmentX => AlignmentX.MyPersonnelID == dto.MyPersonnelID && AlignmentX.SignTimestamp.ToString("yyyyMMdd") == dto.SignTimestamp.ToString("yyyyMMdd")).FirstOrDefault();

                if (item != null)
                {
                    dto.DTOStatus = (int)WinAppLibrary.Utilities.RowStatus.Delete;

                    Lib.DataSource.ToolBoxTalkSelectionDataSource.ToolBoxSign.Remove(crew);
                    lvCrewList.Items.Remove(item);
                }
            }
            catch (Exception e)
            {
                (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(e, "RemoveCrew");
                this.NotifyMessage("There was an error to connect to server", "Caution!");
            }
            #endregion "RemoveCrew"
        }
예제 #2
0
        private async void AssignProcedure(string tagmsg)
        {
            #region
            if (!_onHandling)
            {
                if (!string.IsNullOrEmpty(tagmsg))
                {
                    _onHandling = true;
                    int personId = 0;
                    string personname = "";

                    try
                    {
                        string[] temptagmsg = tagmsg.Split('*');
                        
                        if (temptagmsg.Length > 1)
                        {
                            personId = Convert.ToInt32(temptagmsg[0]);
                            personname = temptagmsg[1].ToString();
                            if(temptagmsg.Length > 2)
                            {
                                _pinno = temptagmsg[2].ToString();
                            }
                        }

                        //this.NotifyUser("AssignProcedure : " + personId.ToString(), NotifyType.PublishMessage);

                        var item = Lib.DataSource.ToolBoxTalkSelectionDataSource.ToolBoxSign.Where(x => (x as ToolboxsignDTO).MyPersonnelID == personId).ToList();

                        if (item.Count == 0)
                        {
                            //Save Event
                            toolboxSingIn = new ToolboxsignDTO();
                            toolboxSingIn.DailyBrassID = _brassid;
                            toolboxSingIn.MyPersonnelID = personId;
                            toolboxSingIn.SignTimestamp = DateTime.Now;
                            toolboxSingIn.NFCUID = 1;
                            toolboxSingIn.DTOStatus = (int)WinAppLibrary.Utilities.RowStatus.New;
                            toolboxSingIn.CreatedDate = DateTime.Now;
                            toolboxSingIn.CreatedBy = personname;

                            //this.NotifyUser("dtoinsert : " + personId.ToString(), NotifyType.PublishMessage);
                            ufn_PopupInputPin("OPEN", personname);
                            //this.NotifyUser("end : " + personId.ToString(), NotifyType.PublishMessage);
                        }
                        else
                        {
                            this.NotifyMessage("This crew is already assigned.", "Alert");
                        }

                        _onHandling = false;
                    }
                    catch (Exception e)
                    {
                        //Loading(false);
                        (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(e, "AssignProcedure");
                        this.NotifyMessage("We had a problem to update signing. Please contact Administrator", "Error!");
                        _onHandling = false;
                    }
                }
                else
                    this.NotifyMessage("This tag doesn't have crew information", "Alert");

            }

            #endregion
        }