public IActionResult CheckList(AuditDetails auditDetails)
        {
            try
            {
                var token = HttpContext.Request.Cookies["Token"]; //Get the value of Token from Cookie

                if (token == null)
                {
                    ViewBag.Message = "Session Expired !! Please Login ....";
                    return(View("Login"));
                }

                List <CheckListQuestion> questionList     = new List <CheckListQuestion>();
                CheckListService         checkListService = new CheckListService(_configuration);


                questionList = checkListService.GetQuestions(auditDetails.Type, token);

                return(View(questionList));
            }
            catch (Exception e)
            {
                return(View("Error"));
            }
        }
示例#2
0
        private void CheckList_Activated(object sender, EventArgs e)
        {
            if (veiculo != null)
            {
                if (new CheckListService().Verificar(veiculo.CodigoVeiculo))
                {
                    Dictionary <long, Object> itens = new CheckListService().Buscar(veiculo.CodigoVeiculo);
                    textBox_Veiculo.Text = veiculo.Modelo;
                    textBox_KM.Text      = veiculo.KM;
                    comboBox_Tanque.Text = veiculo.Tanque;

                    foreach (RadioButton radio in radios)
                    {
                        foreach (ItemConformidade item in ((List <ItemConformidade>)itens[2]))
                        {
                            if (radio.Name == item.Item)
                            {
                                radio.Select();
                            }
                        }
                    }

                    dateTimePicker1.Text     = ((VeiculoTemCheckList)itens[0]).DataChecagem;
                    textBox_Observacoes.Text = ((Persistencia.Modelo.CheckList)itens[1]).Observacao;
                }
                else
                {
                    textBox_Veiculo.Text = veiculo.Modelo;
                    textBox_KM.Text      = veiculo.KM;
                    comboBox_Tanque.Text = veiculo.Tanque;
                }
            }
        }
示例#3
0
        /// <summary>
        /// 조회
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            cl_name = product_id = cl_stnd = cl_comment = cl_uadmin = cl_udate = cl_type = "";
            cl_id   = 0;

            string checkType = "";

            if (cboCheckType.SelectedIndex > 0)
            {
                checkType = cboCheckType.Text;
            }
            try
            {
                CheckListService service = new CheckListService();
                chkList = service.SearchChkList(checkType);
                if (chkList.Count == 0)
                {
                    MessageBox.Show("조회 결과가 없습니다.");
                    return;
                }
                dgvCheckList.DataSource = chkList;
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
示例#4
0
        /// <summary>
        /// DGV 바인딩
        /// </summary>
        private void DGV_Binding()
        {
            CheckListService service = new CheckListService();

            chkList = service.GetChkList();
            dgvCheckList.DataSource = chkList;
        }
示例#5
0
        private void newBtns_btnDelete_Event(object sender, EventArgs e)
        {
            if (cl_id == 0)
            {
                MessageBox.Show("선택된 항목이 없습니다");
                return;
            }

            try
            {
                CheckListService service = new CheckListService();
                bool             bResult = service.ChkDelete(cl_id);
                if (bResult)
                {
                    MessageBox.Show("선택항목이 삭제되었습니다");
                }
                else
                {
                    MessageBox.Show("삭제중 오류가 발생했습니다 다시 시도해주세요");
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
示例#6
0
 private async Task DeleteItemsAsync(IEnumerable <CheckListModel> models)
 {
     foreach (var model in models)
     {
         await CheckListService.DeleteCheckListAsync(model);
     }
 }
示例#7
0
        private void frmdefective_Load(object sender, EventArgs e)
        {
            string[]           gubun        = { "불량유형" };
            CheckListService   cService     = new CheckListService();
            List <ComboItemVO> allCheckType = cService.GetCheckTypeInfoByCodeTypes(gubun);

            CommonUtil.ComboBinding(cboDef, allCheckType, "불량유형");
        }
        public CheckListServiceTest()
        {
            var builder = new DbContextOptionsBuilder <ChecklistBotContext>();
            var b       = InMemoryDbContextOptionsExtensions.UseInMemoryDatabase(builder, "Data Source=:memory:");

            _context = new ChecklistBotContext(b.Options);
            _service = new CheckListService(_context);
        }
示例#9
0
 private async Task <IList <CheckListModel> > GetItemsAsync()
 {
     if (!ViewModelArgs.IsEmpty)
     {
         DataRequest <Data.CheckList> request = BuildDataRequest();
         return(await CheckListService.GetCheckListsAsync(request));
     }
     return(new List <CheckListModel>());
 }
示例#10
0
        /// <summary>
        /// 콤보박스바인딩 이벤트
        /// </summary>
        private void comboBinding()
        {
            string[]                gubun        = { "검사구분" };
            CheckListService        cService     = new CheckListService();
            List <ComboItemVO>      allCheckType = cService.GetCheckTypeInfoByCodeTypes(gubun);
            ProductService          pService     = new ProductService();
            List <ProdCBOBindingVO> allProItem   = pService.GetProductInfo();

            CommonUtil.ComboBinding(cboCheckType, allCheckType, "검사구분");
            CommonUtil.ProdNameBinding(cboProductName, allProItem);
        }
示例#11
0
        /// <summary>
        /// 폼로드
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmCheckList_Load(object sender, EventArgs e)
        {
            string[]           gubun        = { "검사구분" };
            CheckListService   cService     = new CheckListService();
            List <ComboItemVO> allCheckType = cService.GetCheckTypeInfoByCodeTypes(gubun);

            CommonUtil.ComboBinding(cboCheckType, allCheckType, "검사구분");

            CommonUtil.SetInitGridView(dgvCheckList);
            CommonUtil.AddGridTextColumn(dgvCheckList, "검사ID", "cl_id", 60);
            CommonUtil.AddGridTextColumn(dgvCheckList, "검사명", "cl_name", 150);
            CommonUtil.AddGridTextColumn(dgvCheckList, "품목ID", "product_id", 60);
            CommonUtil.AddGridTextColumn(dgvCheckList, "품목명", "product_name", 150);
            CommonUtil.AddGridTextColumn(dgvCheckList, "검사타입", "cl_type", 120);
            CommonUtil.AddGridTextColumn(dgvCheckList, "기준", "cl_stnd", 100);
            CommonUtil.AddGridTextColumn(dgvCheckList, "비고", "cl_comment", 150);
            CommonUtil.AddGridTextColumn(dgvCheckList, "수정자", "cl_uadmin", 100);
            CommonUtil.AddGridTextColumn(dgvCheckList, "수정일", "cl_udate", 150);

            DGV_Binding();
        }
 public CheckListItemServiceTest()
 {
     _context          = TestConfig.CreateTestContext();
     _checklistService = new CheckListService(_context);
 }
示例#13
0
        public async Task <IActionResult> GetAllCheckLists()
        {
            List <FMSDailyCheckListVM> checklist = new List <FMSDailyCheckListVM>();

            try
            {
                List <string> vehicleNumbers = (from v in dbContext.Vehicles
                                                join gv in dbContext.GBMSVehicles on v.VehicleNumber equals gv.Description
                                                select gv.Description).ToList();
                foreach (var vehicleNumber in vehicleNumbers)
                {
                    IEnumerable <DailyMorning> fMSDailyMornings = from m in dbContext.DailyMorningChecks where m.VehicleNumber == vehicleNumber && m.LastUpdated.Date == (PakistanDateTime.Today) select m;
                    if (fMSDailyMornings.Any())
                    {
                        DailyMorning dailyMorning = fMSDailyMornings.FirstOrDefault();
                        checklist.Add(CheckListService.DailyMorningCheckListToViewModel(dailyMorning));
                    }
                    else
                    {
                        Vehicle vehicle = (from f in dbContext.Vehicles
                                           join v in dbContext.GBMSVehicles on f.VehicleNumber equals v.Description
                                           where v.Description == vehicleNumber
                                           select f).SingleOrDefault();
                        Region region = (from r in dbContext.Regions
                                         where r.XDescription == vehicle.Region
                                         select r).SingleOrDefault();
                        SubRegion subRegion = (from s in dbContext.SubRegions
                                               where s.XDescription == vehicle.SubRegion
                                               select s).SingleOrDefault();
                        Station station = (from st in dbContext.Stations
                                           where st.XDescription == vehicle.Station
                                           select st).SingleOrDefault();
                        string DriverName = (from f in dbContext.Vehicles
                                             join d in dbContext.Drivers on f.VehicleNumber equals d.VehicleNumber
                                             join v in dbContext.GBMSVehicles on f.VehicleNumber equals v.Description
                                             where v.Description == vehicleNumber
                                             select d.Name).SingleOrDefault();
                        DailyMorning dailyMorning = new();
                        dailyMorning.Id            = Guid.NewGuid();
                        dailyMorning.LastUpdated   = PakistanDateTime.Now;
                        dailyMorning.VehicleNumber = vehicleNumber;
                        dailyMorning.DriverName    = DriverName;
                        dailyMorning.Region        = region.XDescription;
                        dailyMorning.Subregion     = subRegion.XDescription;
                        dailyMorning.Station       = station.XDescription;

                        await dbContext.DailyMorningChecks.AddAsync(dailyMorning);

                        await dbContext.SaveChangesAsync();

                        checklist.Add(CheckListService.DailyMorningCheckListToViewModel(dailyMorning));
                    }
                    IEnumerable <DailyEvening> fMSDailyEvenings = from e in dbContext.DailyEveningChecks where e.VehicleNumber == vehicleNumber && e.LastUpdated.Date == (PakistanDateTime.Today) select e;
                    if (fMSDailyEvenings.Any())
                    {
                        DailyEvening dailyEvening = fMSDailyEvenings.FirstOrDefault();

                        checklist.Add(CheckListService.DailyEveningEngineCheckListToViewModel(dailyEvening));
                        checklist.Add(CheckListService.DailyEveningBodyCheckListToViewModel(dailyEvening));
                        checklist.Add(CheckListService.DailyEveningInteriorCheckListToViewModel(dailyEvening));
                        checklist.Add(CheckListService.DailyEveningAcCheckListToViewModel(dailyEvening));
                        checklist.Add(CheckListService.DailyEveningGeneralCheckListToViewModel(dailyEvening));
                    }
                    else
                    {
                        Vehicle vehicle = (from f in dbContext.Vehicles
                                           join v in dbContext.GBMSVehicles on f.VehicleNumber equals v.Description
                                           where v.Description == vehicleNumber
                                           select f).SingleOrDefault();
                        Region region = (from r in dbContext.Regions
                                         where r.XDescription == vehicle.Region
                                         select r).SingleOrDefault();
                        SubRegion subRegion = (from s in dbContext.SubRegions
                                               where s.XDescription == vehicle.SubRegion
                                               select s).SingleOrDefault();
                        Station station = (from st in dbContext.Stations
                                           where st.XDescription == vehicle.Station
                                           select st).SingleOrDefault();
                        string DriverName = (from f in dbContext.Vehicles
                                             join d in dbContext.Drivers on f.VehicleNumber equals d.VehicleNumber
                                             join v in dbContext.GBMSVehicles on f.VehicleNumber equals v.Description
                                             where v.Description == vehicleNumber
                                             select d.Name).SingleOrDefault();
                        DailyEvening dailyEvening = new DailyEvening();
                        dailyEvening.Id            = Guid.NewGuid();
                        dailyEvening.LastUpdated   = PakistanDateTime.Now;
                        dailyEvening.VehicleNumber = vehicleNumber;
                        dailyEvening.DriverName    = DriverName;
                        dailyEvening.Region        = region.XDescription;
                        dailyEvening.Subregion     = subRegion.XDescription;
                        dailyEvening.Station       = station.XDescription;

                        await dbContext.DailyEveningChecks.AddAsync(dailyEvening);

                        await dbContext.SaveChangesAsync();

                        checklist.Add(CheckListService.DailyEveningEngineCheckListToViewModel(dailyEvening));
                        checklist.Add(CheckListService.DailyEveningBodyCheckListToViewModel(dailyEvening));
                        checklist.Add(CheckListService.DailyEveningInteriorCheckListToViewModel(dailyEvening));
                        checklist.Add(CheckListService.DailyEveningAcCheckListToViewModel(dailyEvening));
                        checklist.Add(CheckListService.DailyEveningGeneralCheckListToViewModel(dailyEvening));
                    }
                }
                foreach (var check in checklist)
                {
                    foreach (var point in check.Checklist)
                    {
                        IEnumerable <Complaint> complaint = from c in dbContext.Complaints
                                                            where c.VehicleNumber == check.VehicleNumber && c.PointCode == point.Code && c.IsActive
                                                            select c;
                        if (complaint.Any())
                        {
                            point.IsNotOk = true;
                            point.Value   = DailyCheckStatus.NotOk;
                        }
                    }
                }
                return(Ok(checklist));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }
示例#14
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cboProductName.SelectedIndex < 1 && cboCheckType.SelectedIndex < 1 && txtCheckListName.Text.Trim().Length < 1)
            {
                MessageBox.Show("필수항목을 채워주세요");
                return;
            }
            try
            {
                if (headName == "검사항목등록")
                {
                    CheckListVO chk = new CheckListVO
                    {
                        cl_name    = txtCheckListName.Text,
                        product_id = cboProductName.SelectedValue.ToString(),
                        cl_type    = cboCheckType.Text,
                        cl_stnd    = txtStd.Text,
                        cl_comment = txtComment.Text,
                        cl_uadmin  = txtUadmin.Text
                    };

                    CheckListService service = new CheckListService();
                    bool             bResult = service.ChkInsert(chk);
                    if (bResult)
                    {
                        MessageBox.Show("새로운 검사항목을 등록하셨습니다");
                    }
                    else
                    {
                        MessageBox.Show("등록에 실패하셨습니다");
                    }
                }
                else if (headName == "검사항목수정")
                {
                    CheckListVO chk = new CheckListVO
                    {
                        cl_id      = cl_id,
                        cl_name    = txtCheckListName.Text,
                        product_id = cboProductName.SelectedValue.ToString(),
                        cl_type    = cboCheckType.Text,
                        cl_stnd    = txtStd.Text,
                        cl_comment = txtComment.Text,
                        cl_uadmin  = txtUadmin.Text
                    };

                    CheckListService service = new CheckListService();
                    bool             bResult = service.ChkUpdate(chk);
                    if (bResult)
                    {
                        MessageBox.Show("검사항목을 수정하셨습니다");
                    }
                    else
                    {
                        MessageBox.Show("수정에 실패하셨습니다");
                    }
                }

                this.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }