Example #1
0
 public static KiemKe RemoveRecordFromKiemKe(KiemKe kiemke, ChiTietBanKiemKe record)
 {
     foreach (ChiTietBanKiemKe item in kiemke.RECORDS)
     {
         if (item.CTBKK_THOI_GIAN == record.CTBKK_THOI_GIAN)
         {
             kiemke.RECORDS.Remove(item);
             break;
         }
     }
     return(kiemke);
 }
 public static KiemKe RemoveRecordInKiemKe(KiemKe kiemke, string maThietBi)
 {
     foreach (ChiTietBanKiemKe record in kiemke.RECORDS)
     {
         if (record.CTBKK_MA_TB == maThietBi)
         {
             kiemke.RECORDS.Remove(record);
             break;
         }
     }
     return(kiemke);
 }
 public static void UpdateRecordInKiemKeInLocalData(KiemKe kiemke)
 {
     foreach (KiemKe item in LocalData.KiemKes)
     {
         BanKiemKe banKiemKe1 = item.BKK;
         BanKiemKe banKiemKe2 = kiemke.BKK;
         if (banKiemKe1.KK_CODE == banKiemKe2.KK_CODE && banKiemKe1.KK_MADONVI == banKiemKe2.KK_MADONVI &&
             DataProvider.CheckSameDate(banKiemKe1.KK_NGAYTAO, banKiemKe2.KK_NGAYTAO))
         {
             item.RECORDS = kiemke.RECORDS;
             break;
         }
     }
 }
Example #4
0
        public static List <ChiTietBanKiemKe> CloneRecordsFromKiemKe(KiemKe kiemke)
        {
            List <ChiTietBanKiemKe> result = new List <ChiTietBanKiemKe>();

            foreach (ChiTietBanKiemKe item in kiemke.RECORDS)
            {
                ChiTietBanKiemKe ct = new ChiTietBanKiemKe()
                {
                    CTBKK_MA_TB  = item.CTBKK_MA_TB,
                    CTBKK_TEN_TB = item.CTBKK_TEN_TB,
                    CTBKK_TT_SAU = item.CTBKK_TT_SAU
                };
                result.Add(ct);
            }
            return(result);
        }
 public static void RemoveRecordInKiemKe(KiemKe kiemke, ChiTietBanKiemKe deletedRecord)
 {
     foreach (KiemKe item in LocalData.KiemKes)
     {
         if (item.BKK.KK_CODE == kiemke.BKK.KK_CODE && item.BKK.KK_MADONVI == kiemke.BKK.KK_MADONVI &&
             DataProvider.CheckSameDate(item.BKK.KK_NGAYTAO, kiemke.BKK.KK_NGAYTAO))
         {
             foreach (ChiTietBanKiemKe record in item.RECORDS)
             {
                 if (record.CTBKK_THOI_GIAN == deletedRecord.CTBKK_THOI_GIAN)
                 {
                     item.RECORDS.Remove(record);
                     break;
                 }
             }
             break;
         }
     }
 }
Example #6
0
        public async void Scan()
        {
            try
            {
                FileService.CreateFileData();
            }
            catch
            {
                await NavigationService.GetTopPage().DisplayAlert("Lỗi", "App chưa được quyền truy cập dữ liệu trong máy", "OK");

                return;
            }
            BanKiemKe banKiemKe = new BanKiemKe();

            foreach (BanKiemKe item in AppValue.banKiemKes)
            {
                if (CurrentBKK == item.KK_CODE)
                {
                    banKiemKe = item;
                    break;
                }
            }

            AppValue.banKiemKe = banKiemKe;
            if (Choose1) //online
            {
                AppValue.KKType = 1;
            }
            else //offline
            {
                AppValue.KKType = 2;
            }

            using (Acr.UserDialogs.UserDialogs.Instance.Loading("Loading.."))
            {
                if (Choose1) //KK ONLINE
                {
                }
                else //KK OFFLINE
                {
                    //LẤY RA KIEMKE TRONG LOCAL DATA
                    KiemKe kiemke = DataProvider.GetKiemKe(banKiemKe);
                    if (kiemke == null)
                    {
                        kiemke = new KiemKe
                        {
                            BKK     = banKiemKe,
                            RECORDS = new List <ChiTietBanKiemKe>()
                        };
                        LocalData.KiemKes.Add(kiemke);
                    }

                    //Lưu lại thông tin kiểm kê hiện tại
                    AppValue.kiemKe = kiemke;
                }

                //chuyển sang page quét mã
                var scanPage = ScannerView.GetInstance();
                scanPage.SetBKKInfor();
                await App.Current.MainPage.Navigation.PushAsync(scanPage);
            }
        }