private void SaveData(LoadOperation<ma_diaban> lo)
        {

            if (lo.Entities.Count() > 0)
            {
                MessageBox.Show("Mã tuyến " + this.txtmanv.Text.Trim().ToUpper() + " đã tồn tại");
            }
            else
            {

                if (txtmanv.Text.Trim() != "" || txtten.Text.Trim() != "")
                {
                    ma_diaban ap = new ma_diaban
                    {
                       ma_tuyen = txtmanv.Text.Trim().ToUpper(),
                       ten_tuyen = this.txtten.Text.Trim(),
                       ma_huyen=App.ma_huyen,
                       kt=checkEdit1.IsChecked                       
                    };
                    dstb.ma_diabans.Add(ap);
                    dstb.SubmitChanges(OnSubmitCompleted, true);
                }
                else
                    MessageBox.Show("Nhập chưa đủ thông tin hoặc sai qui cách nhập mã tuyến !");
            }
        }
Example #2
0
 public frmmoso()
 {
     InitializeComponent();
     OKButton.IsEnabled = false; 
     EntityQuery<loaicatmo> Query = dstb.GetLoaiCatMoQuery();
     LoadOploai = dstb.Load(Query.OrderBy(p=>p.id), LoadOpL_Complete, null);
 }
 public frmhopdongint()
 {
     InitializeComponent();
     App.id_goicuoc = "";
     EntityQuery<tram_vt> Query = dstb.GetTram_vtQuery();
     LoadOp = dstb.Load(Query.Where(t => App.ma_huyen.Contains(t.ma_huyen)).OrderBy(p => p.ten_tram), LoadOpT_Complete, null);
     //QLThuebaoDomainContext tramvt = new QLThuebaoDomainContext();
     EntityQuery<khmai> Querykm = dstb.GetKhmaiQuery();
     LoadOpkm = dstb.Load(Querykm.Where(p=>p.hieu_luc==true).OrderByDescending(t => t.ngay_bd), LoadOpTK_Complete, null);
     EntityQuery<loaikh> Queryloai = dstb.GetLoaikhQuery();
     LoadOpkh = dstb.Load(Queryloai, LoadOpKH_Complete, null);
     EntityQuery<loai_dv> Queryloaidv = dstb.GetLoai_dvQuery();
     LoadOpdv = dstb.Load(Queryloaidv, LoadOpDV_Complete, null);
     EntityQuery<nganh_nghe> QueryN = dstb.GetNganh_ngheQuery();
     LoadOpN = dstb.Load(QueryN.OrderBy(p => p.ten_nghe), LoadOpN_Complete, null);            
     EntityQuery<KhachHangUuTien> Queryut = dstb.GetKhachHangUuTienTrimQuery();
     LoadOput = dstb.Load(Queryut.OrderBy(p => p.kh_uutien1), LoadOpUT_Complete, null);
     EntityQuery<Mdiaban> QueryNV = dstb.GetMadiabanTrimQuery();
     LoadOpCB = dstb.Load(QueryNV.Where(p => p.ma_huyen == App.ma_huyen && p.kt == false).OrderBy(p => p.ten_tuyen), LoadOpCB_Complete, null);
     EntityQuery<Mdiaban> QueryNVKT = dstb.GetMadiabanTrimQuery();
     LoadOpCBKT = dstb.Load(QueryNVKT.Where(p => p.ma_huyen == App.ma_huyen && p.kt == true).OrderBy(p => p.ten_tuyen), LoadOpCBKT_Complete, null);
     EntityQuery<Goi_th> QueryG = dstb.GetGoi_thQuery();
     LoadGoi = dstb.Load(QueryG.OrderBy(p => p.ten_goi), LoadOpG_Complete, null);
     //this.txtsdt.MaxLength = App.len_sdt;
     //frmdc = new frmdiachi();
     //frmdc.Closed += new EventHandler(frmdiachi_Closed);            
 }
        private void AllProductProvinceGroupings_Loaded(LoadOperation<ProductProvinceGrouping> result)
        {
            List<int> alreadySetProducts = new List<int>();
            if (Utils.LoadOperation_Error_Handled(result.Error, "SmartMap"))
                foreach (ProductProvinceGrouping ppg in result.Entities)
                    alreadySetProducts.Add(ppg.ProductMapID);

            List<string> productNames = new List<string>();
            foreach (ProductMap pm in DBUtils.GetAllProducts())
            {
                if (productNames.Contains(pm.CD_BrandDIName) || pm.CD_BrandDIName == null || pm.CD_BrandDIName.Trim() == "")
                    continue;
                productNames.Add(pm.CD_BrandDIName);
                SolidColorBrush foreground = new SolidColorBrush(Colors.Black);
                if (alreadySetProducts.Contains(pm.ProductMapID))
                    foreground = new SolidColorBrush(Colors.Gray);
            
                
                if (_selectedProductMapIds != null && _selectedProductMapIds.Contains(pm.ProductMapID))
                    SelectedProductsList.Items.Add(new ListBoxItem() { Content = pm.CD_BrandDIName, Tag = pm.ProductMapID, Foreground = foreground });
                else
                    ProductsList.Items.Add(new ListBoxItem() { Content = pm.CD_BrandDIName, Tag = pm.ProductMapID, Foreground = foreground });
            }
            if (ProductsLoading != null)
                ProductsLoading.Visibility = System.Windows.Visibility.Collapsed;
            else
                _hideLoading = true;
        }
 void LoadOp_Complete(LoadOperation<rp_tklydocat> lo)
 {            
     gridControl1.ItemsSource = lo.Entities;
     gridControl1.GroupBy("ten_dv");
     gridControl1.ExpandAllGroups();
     gridControl1.ShowLoadingPanel = false;
 }
 public void GetCategories(Action<ObservableCollection<Category>> getCategoriesCallback)
 {
     _getCategoriesCallback = getCategoriesCallback;
     Context.Categories.Clear();
     _categoriesLoadOperation = Context.Load<Category>(Context.GetCategoriesQuery());
     _categoriesLoadOperation.Completed += OnLoadCategoriesCompleted;
 }
Example #7
0
 void LoadOpCompleteExits(LoadOperation<BSCT> lo)
 {
     if (lo.Entities.Count() > 0)
     {
         for (int i = 0; i < lo.Entities.Count(); i++)
         {
             (this.gridControl2.ItemsSource as BSC_tinh_temp).Add(new BSCT
             {
                 ma_kpi = lo.Entities.ElementAt(i).ma_kpi.ToString().Trim(),
                 ten_kpi = lo.Entities.ElementAt(i).ten_kpi.ToString().Trim(),
                 ten_kpo = lo.Entities.ElementAt(i).ten_kpo.ToString().Trim(),
                 dvt = lo.Entities.ElementAt(i).dvt.ToString().Trim(),
                 //check = lo.Entities.ElementAt(i).check==null? false: lo.Entities.ElementAt(i).check,
                 chitieugiao = lo.Entities.ElementAt(i).chitieugiao == null ? 0 : (double)lo.Entities.ElementAt(i).chitieugiao,
                 chitieuth = lo.Entities.ElementAt(i).chitieuth == null ? 0 : (double)lo.Entities.ElementAt(i).chitieuth,
                 trongso = lo.Entities.ElementAt(i).trongso == null ? 0 : (double)lo.Entities.ElementAt(i).trongso,
                 ty_trong_thuc_hien = lo.Entities.ElementAt(i).ty_trong_thuc_hien == null ? 0 : (double)lo.Entities.ElementAt(i).ty_trong_thuc_hien
             });
         }
         gridControl2.GroupBy("ten_kpo");
         gridControl2.ExpandAllGroups();
     }
     get_data();
     gridControl2.ShowLoadingPanel = false;
 }
        private void LoadSysSetCompleted(LoadOperation<t_Sys_MainRealTimeSet> result)
        {
            if (result.HasError)
            {
                MessageBox.Show("加截设置参数出错!", "出错啦!", MessageBoxButton.OK);
                return;
            }
            if (result.Entities.Count() == 0)
            {
                MessageBox.Show("还未设置参数!", "出错啦!", MessageBoxButton.OK);
                return;
            }

            SysSetReal = result.Entities.First();
            realTime.Ylower = SysSetReal.Ylower;
            realTime.Yupper = SysSetReal.Yupper;
            realTime.YmaxValue = SysSetReal.YmaxValue;
            realTime.YminValue = SysSetReal.YminValue;
            realTime.GridHeight = SysSetReal.GridHeight;
            realTime.BackColor = Colors.Black;
            realTime.ForeColor = Colors.Red;
            //先加载一个值
            timer_Tick(null,null);
            timer.Start();
        }
Example #9
0
        private void SaveData(LoadOperation<kh_mai> lo)
        {

            if (lo.Entities.Count() > 0)
            {
                MessageBox.Show("Mã chương trình " + this.txtmakm.Text.Trim().ToUpper() + " đã tồn tại");
            }
            else
            {

                if (txtmakm.Text.Trim() != "" || txtten.Text.Trim() != "")
                {
                    kh_mai km = new kh_mai
                    {
                        ma_km = txtmakm.Text.Trim().ToUpper(),
                        ten_ct = txtten.Text.Trim(),
                        ngay_bd = dbatdau.DateTime,
                        ngay_kt=dketthuc.DateTime,
                        hieu_luc= chkhieuluc.IsChecked == true ? true : false
                    };
                    dstb.kh_mais.Add(km);
                    dstb.SubmitChanges(OnSubmitCompleted, true);
                }
                else
                    MessageBox.Show("Nhập chưa đủ thông tin");
            }
        }
        public void Operation_MarkAsHandled()
        {
            TestDataContext ctxt = new TestDataContext(new Uri(TestURIs.RootURI, "TestDomainServices-TestCatalog1.svc"));

            var query = ctxt.CreateQuery<Product>("ThrowGeneralException", null, false, true);
            LoadOperation lo = new LoadOperation<Product>(query, LoadBehavior.KeepCurrent, null, null, null);

            EventHandler action = (o, e) =>
            {
                LoadOperation loadOperation = (LoadOperation)o;
                if (loadOperation.HasError)
                {
                    loadOperation.MarkErrorAsHandled();
                }
            };
            lo.Completed += action;

            DomainOperationException ex = new DomainOperationException("Operation Failed!", OperationErrorStatus.ServerError, 42, "StackTrace");
            lo.Complete(ex);

            // verify that calling MarkAsHandled again is a noop
            lo.MarkErrorAsHandled();
            lo.MarkErrorAsHandled();

            // verify that calling MarkAsHandled on an operation not in error
            // results in an exception
            lo = new LoadOperation<Product>(query, LoadBehavior.KeepCurrent, null, null, null);
            Assert.IsFalse(lo.HasError);
            Assert.IsTrue(lo.IsErrorHandled);
            ExceptionHelper.ExpectInvalidOperationException(delegate
            {
                lo.MarkErrorAsHandled();
            }, Resource.Operation_HasErrorMustBeTrue);
        }
Example #11
0
 public void LoadData()
 {
     //todo:Login için Menüleri göster,gösterme olayı yapmaya başladım.
     //DLoginLoadOp = ds.Load(ds.GetLoginQuery(txtUserName.Text, txtPassword.Password), false);
     DLoginLoadOp = context.Load(context.LoginRoleQuery(txtUserName.Text, txtPassword.Password), true);
     DLoginLoadOp.Completed += DLoginLoadOp_Completed;
 }
Example #12
0
        private void SaveData(LoadOperation<ma_ap> lo)
        {

            if (lo.Entities.Count() > 0)
            {
                MessageBox.Show("Mã xã phường " + this.txtmaap.Text.Trim().ToUpper() + " đã tồn tại");
            }
            else
            {

                if (txtmaap.Text.Trim() != "" || txtten.Text.Trim() != "")
                {
                    ma_ap ap = new ma_ap
                    {
                       maxa = m_maxa,
                       maap = this.txtmaap.Text.Trim().ToUpper(),
                       ten_ap = txtten.Text.Trim()            
                    };
                    dstb.ma_aps.Add(ap);
                    dstb.SubmitChanges(OnSubmitCompleted, true);
                }
                else
                    MessageBox.Show("Nhập chưa đủ thông tin");
            }
        }
 public void GetBooksOfTheDay(Action<ObservableCollection<BookOfDay>> getBooksOfTheDayCallback)
 {
     _getBooksOfTheDayCallback = getBooksOfTheDayCallback;
     Context.BookOfDays.Clear();
     _booksOfTheDayLoadOperation = Context.Load<BookOfDay>(Context.GetBookOfDaysQuery());
     _booksOfTheDayLoadOperation.Completed += OnLoadBookOfTheDayCompleted;
 }
 public frmdoiaccountmytv()
 {
     InitializeComponent();
     OKButton.IsEnabled = false;
     EntityQuery<gc_mytv> Querygc = dstb.GetGc_mytvQuery();
     LoadOpgc = dstb.Load(Querygc.OrderBy(p => p.ma_goi), LoadOpGC_Complete, null);                       
 }
Example #15
0
        private void LoginUserLoaded(LoadOperation<User> result)
        {
            if (result.Error == null)
            {
                Login.LoginUser = null;
                foreach (User user in result.Entities)
                    Login.LoginUser = user;

                if (Login.LoginUser != null)
                {
                    SmartMap_DomainContext context = new SmartMap_DomainContext();
                    LoadOperation loadOp = context.Load(context.GetRolePermissionsQuery(Login.LoginUser.RoleID), PermissionsLoaded, null);
                }
                else
                {
                    if (_loadingAnm != null)
                        _loadingAnm.Visibility = Visibility.Collapsed;
                    MessageBox.Show("Incorrect Username or password.");
                }
            }
            else
            {
                if (_loadingAnm != null)
                    _loadingAnm.Visibility = Visibility.Collapsed;
                string msg = result.Error.Message;
                if (result.Error.InnerException != null)
                    msg += ("Inner: \n" + result.Error.InnerException.Message);
                MessageBox.Show("Custom Error Handler:\n"+ msg);
            }
        }
 public frmhopdongmy()
 {
     InitializeComponent();
     App.id_goicuoc = "";          
     EntityQuery<tram_vt> Query = dstb.GetTram_vtQuery();
     LoadOp = dstb.Load(Query.Where(t => App.ma_huyen.Contains(t.ma_huyen)).OrderBy(p => p.ten_tram), LoadOpT_Complete, null);
     //QLThuebaoDomainContext tramvt = new QLThuebaoDomainContext();
     EntityQuery<khmai> Querykm = dstb.GetKhmaiQuery();
     LoadOpkm = dstb.Load(Querykm.Where(p=>p.hieu_luc==true).OrderByDescending(t => t.ngay_bd), LoadOpTK_Complete, null);
     EntityQuery<loaikh> Queryloai = dstb.GetLoaikhQuery();
     LoadOpkh = dstb.Load(Queryloai, LoadOpKH_Complete, null);
     EntityQuery<nganh_nghe> QueryN = dstb.GetNganh_ngheQuery();
     LoadOpN = dstb.Load(QueryN.OrderBy(p => p.ten_nghe), LoadOpN_Complete, null);
     EntityQuery<gc_mytv> Querygc = dstb.GetGc_mytvQuery();
     LoadOpgc = dstb.Load(Querygc.OrderBy(p=>p.ma_goi), LoadOpGC_Complete, null);
     EntityQuery<Mdiaban> QueryNV = dstb.GetMadiabanTrimQuery();
     LoadOpCB = dstb.Load(QueryNV.Where(p => p.ma_huyen == App.ma_huyen && p.kt == false).OrderBy(p => p.ten_tuyen), LoadOpCB_Complete, null);
     EntityQuery<Mdiaban> QueryNVKT = dstb.GetMadiabanTrimQuery();
     LoadOpCBKT = dstb.Load(QueryNVKT.Where(p => p.ma_huyen == App.ma_huyen && p.kt == true).OrderBy(p => p.ten_tuyen), LoadOpCBKT_Complete, null);
     EntityQuery<Goi_th> QueryG = dstb.GetGoi_thQuery();
     LoadGoi = dstb.Load(QueryG.OrderBy(p => p.ten_goi), LoadOpG_Complete, null);
     //EntityQuery<chungloaicap> Querycap = dstb.GetChungloaicapsQuery();
     //LoadOpcap = dstb.Load(Querycap.Where(p => p.dv == "M").OrderBy(p => p.ten_loai), LoadOpCAP_Complete, null);
     //this.txtsdt.MaxLength = App.len_sdt;
     //frmdc = new frmdiachi();
     //frmdc.Closed += new EventHandler(frmdiachi_Closed); 
    
 }
Example #17
0
 void GetData(object sender, EventArgs e)
 {
    // gridControl1.ShowLoadingPanel = true;
     EntityQuery<Catmo> Query = dstb.GetDataCatmoQuery();
     LoadOp = dstb.Load(Query.OrderBy(p => p.ma_huyen), lo=>
         {
             if (lo.Entities.Count()>0)
             {   
                 DispatcherTimer Timer1 = new DispatcherTimer();
                 Timer1.Interval = new TimeSpan(0, 0, 0, 1);
                 Timer1.Tick += new EventHandler(ChangeLed);
                 Timer1.Start();
                 DispatcherTimer Timer2 = new DispatcherTimer();
                 Timer2.Interval = new TimeSpan(0, 0, 0, 2);
                 Timer2.Tick += new EventHandler(ClearF);
                 Timer2.Start();
                 if (m_speaker)
                 {
                     media.Play();
                     media.Position = System.TimeSpan.FromSeconds(0);
                 }
                 else
                     media.Stop();
             }
         }, null);         
 }
        public void dien_dl()
        {
            gridControl1.ShowLoadingPanel = true;
            
            EntityQuery<Mdiaban> Queryt = dstb.GetMadiabanTrimQuery();
            LoadOptuyen = dstb.Load(Queryt.Where(p => p.ma_huyen == m_huyen && p.kt == false).OrderBy(p => p.ten_tuyen), LoadOpTT_Complete, null);
            EntityQuery<Mdiaban> Query = dstb.GetMadiabanTrimQuery();
            LoadOptuyenkt = dstb.Load(Query.Where(p => p.ma_huyen == m_huyen && p.kt == true).OrderBy(p => p.ten_tuyen), LoadOpTTKT_Complete, null);
            EntityQuery<ds_codinh> QueryC = dstb.GetDs_codinhQuery();
            LoadOp = dstb.Load(QueryC.Where(p=>(p.ma_nvcs==null || p.ma_nvkt==null) && p.ma_huyen==m_huyen),null,null );


            EntityQuery<Gphone> QueryG = dstb.GetGphonesQuery();
            LoadOpG = dstb.Load(QueryG.Where(p => (p.ma_nvcs == null || p.ma_nvkt == null) && p.ma_huyen == m_huyen), null, null);
            EntityQuery<internet> QueryI = dstb.GetInternetsQuery();
            LoadOpI = dstb.Load(QueryI.Where(p => (p.ma_nvcs == null || p.ma_nvkt == null) && p.ma_huyen == m_huyen), null, null);
            EntityQuery<mytv> QueryM = dstb.GetMytvsQuery();
            LoadOpM = dstb.Load(QueryM.Where(p => (p.ma_nvcs == null || p.ma_nvkt == null) && p.ma_huyen == m_huyen), null, null);

            QLThuebaoDomainContext db = new QLThuebaoDomainContext();
            InvokeOperation<System.Nullable<int>> pr = db.Excute_DsGanDiaban(m_kt, m_nv, m_huyen, m_emp);
            pr.Completed += new EventHandler(GetData);

            if (App.kythuat)
                ma_nvcs.ReadOnly = true;
            else
                ma_nvkt.ReadOnly = true;
        }
Example #19
0
 public frmeditint(string usr)
 {
     InitializeComponent();
     EntityQuery<tram_vt> Query = dstb.GetTram_vtQuery();
     LoadOp = dstb.Load(Query.Where(t => App.ma_huyen.Contains(t.ma_huyen)).OrderBy(p => p.ten_tram), LoadOpT_Complete, null);
     //QLThuebaoDomainContext tramvt = new QLThuebaoDomainContext();
     EntityQuery<khmai> Querykm = dstb.GetKhmaiQuery();
     LoadOpkm = dstb.Load(Querykm.OrderByDescending(t => t.ngay_bd), LoadOpTK_Complete, null);
     EntityQuery<loaikh> Queryloai = dstb.GetLoaikhQuery();
     LoadOpkh = dstb.Load(Queryloai, LoadOpKH_Complete, null);
     EntityQuery<nganh_nghe> QueryN = dstb.GetNganh_ngheQuery();
     LoadOpN = dstb.Load(QueryN.OrderBy(p => p.ten_nghe), LoadOpN_Complete, null);
     EntityQuery<loai_dv> Queryloaidv = dstb.GetLoai_dvQuery();
     LoadOpdv = dstb.Load(Queryloaidv, LoadOpDV_Complete, null);
     EntityQuery<KhachHangUuTien> Queryut = dstb.GetKhachHangUuTienTrimQuery();
     LoadOput = dstb.Load(Queryut.OrderBy(p => p.kh_uutien1), LoadOpUT_Complete, null);
     EntityQuery<nv_thuethu> Queryt = dstb.GetNv_thuethuQuery();
     LoadOptuyen = dstb.Load(Queryt.Where(p => p.ma_huyen == App.ma_huyen).OrderBy(p => p.ten), LoadOpTT_Complete, null);
     EntityQuery<Mdiaban> QueryNV = dstb.GetMadiabanTrimQuery();
     LoadOpCB = dstb.Load(QueryNV.Where(p => p.ma_huyen == App.ma_huyen && p.kt == false).OrderBy(p => p.ten_tuyen), LoadOpCB_Complete, null);
     EntityQuery<Mdiaban> QueryNVKT = dstb.GetMadiabanTrimQuery();
     LoadOpCBKT = dstb.Load(QueryNVKT.Where(p => p.ma_huyen == App.ma_huyen && p.kt == true).OrderBy(p => p.ten_tuyen), LoadOpCBKT_Complete, null);
     EntityQuery<chungloaicap> Querycap = dstb.GetChungloaicapsQuery();
     LoadOpcap = dstb.Load(Querycap.Where(p => p.dv == "I").OrderBy(p => p.ten_loai), LoadOpCAP_Complete, null);
     EntityQuery<thiet_bi> Querytb = dstb.GetThiet_bisQuery();
     LoadOptb = dstb.Load(Querytb.OrderBy(p => p.ten_tb), LoadOpTB_Complete, null);
     EntityQuery<Goi_th> QueryG = dstb.GetGoi_thQuery();
     LoadGoi = dstb.Load(QueryG.OrderBy(p => p.ten_goi), LoadOpG_Complete, null);
     //this.txtsdt.MaxLength = App.len_sdt;
     m_usr = usr;
     Loaded += new RoutedEventHandler(frmeditmy_Loaded);  
     //frmdc = new frmdiachi();
     //frmdc.Closed += new EventHandler(frmdiachi_Closed); 
    
 }
Example #20
0
        private void SaveData(LoadOperation<nv_thuethu> lo)
        {

            if (lo.Entities.Count() > 0)
            {
                MessageBox.Show("Tuyến thu " + this.txttuyen.Text.Trim().ToUpper() + " đã tồn tại");
            }
            else
            {               

                if (txttuyen.Text.Trim() != "" || txtten.Text.Trim() != "")
                {
                    nv_thuethu nv = new nv_thuethu
                    {
                        ten = txttuyen.Text.Trim().ToUpper(),
                        ten_nv = txtten.Text.Trim(),
                        ghi_chu=txtghichu.Text.Trim(),
                        ma_huyen=App.ma_huyen
                    };
                    dstb.nv_thuethus.Add(nv);
                    dstb.SubmitChanges(OnSubmitCompleted, true);                             
                }
                else
                    MessageBox.Show("Nhập chưa đủ thông tin");
            }
        }
Example #21
0
 void dien_dl()
 {
     gridControl1.ShowLoadingPanel = true;
     EntityQuery<ma_duong> Query = dstb.GetMa_duongQuery();
    // LoadOp = dstb.Load(Query.Where(p => p.ma_huyen == App.ma_huyen).OrderBy(p => p.ten_duong), LoadOp_Complete, null);
     LoadOp = dstb.Load(Query.OrderBy(p => p.ten_duong), LoadOp_Complete, null);
 }
Example #22
0
        private void SaveData(LoadOperation<ma_xa> lo)
        {

            if (lo.Entities.Count() > 0)
            {
                MessageBox.Show("Mã xã phường " + this.txtmaxa.Text.Trim().ToUpper() + " đã tồn tại");
            }
            else
            {

                if (txtmaxa.Text.Trim() != "" || txtten.Text.Trim() != "")
                {
                    ma_xa xa = new ma_xa
                    {
                        maxa = txtmaxa.Text.Trim().ToUpper(),
                        ten = txtten.Text.Trim(),
                        tientb = 20000,
                        vtci=false,
                        ma_huyen = App.ma_huyen
                    };
                    dstb.ma_xas.Add(xa);
                    dstb.SubmitChanges(OnSubmitCompleted, true);
                }
                else
                    MessageBox.Show("Nhập chưa đủ thông tin");
            }
        }
        void LoadOpTT_Complete(LoadOperation<nv_thuethu> lo)
        {
            if (lo.Entities.Count() > 0)
            {
                this.cmbtuyen.ItemsSource = lo.Entities;
                this.cmbtuyen.DisplayMember = ("ten").Trim();
                this.cmbtuyen.ValueMember = "ten";
                this.cmbtuyen1.ItemsSource = lo.Entities;
                this.cmbtuyen1.DisplayMember = ("ten").Trim();
                this.cmbtuyen1.ValueMember = "ten";
                if (m_tuyen != "")
                {
                     for (int i = 0; i < LoadOptuyen.Entities.Count(); i++)
                    {
                        if (cmbtuyen.GetKeyValue(i).ToString().Trim() == m_tuyen)
                        {
                            cmbtuyen.SelectedIndex = i;
                        }
                    }
                }
                else                
                    this.cmbtuyen.SelectedIndex = 0;
                dien_dl(cmbtuyen.Text.Trim());

            }
        }
Example #24
0
        private void OnOrdersLoaded( LoadOperation<Order> operation )
        {
            // When the data is loaded, raise the property changed event for the Orders property.
            if ( !operation.HasError ) NotifyPropertyChanged( "Orders" );

            // TODO: Check for and handle any load errors...
        }
        void LoadOp_Complete(LoadOperation<don_vi> lo)
        {
            if (lo.Entities.Count() > 0)
            {
                this.cmbhuyen.ItemsSource = lo.Entities;
                this.cmbhuyen.DisplayMember = ("ten_dv").Trim();
                this.cmbhuyen.ValueMember = "ma_dv";

                this.cmbhuyentd.ItemsSource = lo.Entities;
                this.cmbhuyentd.DisplayMember = ("ten_dv").Trim();
                this.cmbhuyentd.ValueMember = "ma_dv";
                if (m_update) // neu cap nhat thi xem coi user do duoc quyen su dung menu nao
                {                   
                    foreach (string s in m_huyen)
                    {
                        foreach (var p in lo.Entities)
                        {
                            if (p.ma_dv.Trim() == s)
                                this.cmbhuyentd.SelectedItems.Add(p);
                        }
                    }
                    for (int i = 0; i < lo.Entities.Count(); i++)
                    {
                        if (lo.Entities.ElementAt(i).ma_dv.Trim() == dv)
                            cmbhuyen.SelectedIndex = i;
                    }
                }
                rowHuyen = lo.Entities.Count(); // de biet duoc so dong trong combobox do items.count luon =0
            }
        }
Example #26
0
 public frmcatgp(string sdt,bool trove)
 {
     InitializeComponent();
     EntityQuery<tram_vt> Query = dstb.GetTram_vtQuery();
     LoadOptram = dstb.Load(Query.Where(t => App.ma_huyen.Contains(t.ma_huyen)).OrderBy(p => p.ten_tram), LoadOpT_Complete, null);
     //QLThuebaoDomainContext tramvt = new QLThuebaoDomainContext();
     EntityQuery<khmai> Querykm = dstb.GetKhmaiQuery();
     LoadOpkm = dstb.Load(Querykm.OrderByDescending(t => t.ngay_bd), LoadOpTK_Complete, null);
     EntityQuery<mlydocat> Querycat = dstb.GetLyDoCatTrimQuery();
     LoadOpcat = dstb.Load(Querycat.OrderBy(p => p.m_order), LoadOpCT_Complete, null);
     EntityQuery<loaikh> Queryloai = dstb.GetLoaikhQuery();
     LoadOpkh = dstb.Load(Queryloai, LoadOpKH_Complete, null);
     EntityQuery<nganh_nghe> QueryN = dstb.GetNganh_ngheQuery();
     LoadOpN = dstb.Load(QueryN, LoadOpN_Complete, null);
     EntityQuery<maxas> Queryxa = dstb.GetMaxasQuery();
     LoadOpxa = dstb.Load(Queryxa.Where(p=>p.ma_huyen==App.ma_huyen).OrderBy(p=>p.ten), LoadOpXA_Complete, null);
     EntityQuery<nv_thuethu> Queryt = dstb.GetNv_thuethuQuery();
     LoadOptuyen = dstb.Load(Queryt.Where(p => p.ma_huyen == App.ma_huyen).OrderBy(p => p.ten), LoadOpTT_Complete, null);
     //EntityQuery<dichvugiatang> Querydvgt = dstb.GetDichvugiatangsQuery();
     //LoadOpdvgt = dstb.Load(Querydvgt.OrderBy(p => p.ten_dv), LoadOpDV_Complete, null);
     this.txtsdt.MaxLength = App.len_sdt;           
     m_sdt = sdt;
     m_trove = trove;
     dngaycat.EditValue = App.Current_d;          
     mlydo.IsEnabled = false;
     Loaded += new RoutedEventHandler(frmeditgp_Loaded);  
     //frmdc = new frmdiachi();
     //frmdc.Closed += new EventHandler(frmdiachi_Closed);
     cmdLuu.IsEnabled = false;
    
 }
        private void SaveData(LoadOperation<tram_vt> lo)
        {

            if (lo.Entities.Count() > 0)
            {
                MessageBox.Show("Mã trạm viễn thông " + this.txtmaxa.Text.Trim().ToUpper() + " đã tồn tại");
            }
            else
            {

                if (txtmaxa.Text.Trim() != "" || txtten.Text.Trim() != "")
                {
                    tram_vt tram = new tram_vt
                    {
                        ma_tram = txtmaxa.Text.Trim().ToUpper(),
                        ten_tram = txtten.Text.Trim(),                        
                        ma_huyen = App.ma_huyen
                    };
                    dstb.tram_vts.Add(tram);
                    dstb.SubmitChanges(OnSubmitCompleted, true);
                }
                else
                    MessageBox.Show("Nhập chưa đủ thông tin");
            }
        }
Example #28
0
        void UpdateAction()
        {
            IsBusy = true;
            LoadOperation <DocumentManager.Web.Model.action> loadOperationAction
                = DocumentManagerDomainContext.Load <DocumentManager.Web.Model.action>(DocumentManagerDomainContext.GetActionQuery());

            loadOperationAction.Completed += LoadOperation_ActionCompleted;
        }
        public void LoadData()
        {
            IsBusy = true;
            LoadOperation <DocumentManager.Web.Model.standbook> loadOperationStandBookType =
                documentManagerContext.Load <DocumentManager.Web.Model.standbook>(documentManagerContext.GetStandBookQuery());

            loadOperationStandBookType.Completed += loadOperationStandBook_Completed;
        }
Example #30
0
        void loadUsersOper_Completed(object sender, EventArgs e)
        {
            Logger.info("Получен список пользователей");
            readyUsers = true;
            LoadOperation loadObjectsOper = context.Load(context.LoadOrderObjectsQuery());

            loadObjectsOper.Completed += new EventHandler(loadObjectsOper_Completed);
        }
        public void LoadData()
        {
            IsBusy = true;
            LoadOperation <DocumentManager.Web.Model.taxpayertype> loadOperationTaxPayerType =
                documentManagerContext.Load <DocumentManager.Web.Model.taxpayertype>(documentManagerContext.GetTaxpayertypeQuery());

            loadOperationTaxPayerType.Completed += loadOperationTaxPayerType_Completed;
        }
Example #32
0
        void loadObjectsOper_Completed(object sender, EventArgs e)
        {
            Logger.info("Получен список оборудования");
            readyObjects = true;
            LoadOperation loadOrdersOper = context.Load(context.LoadOrdersQuery(SessionGUID));

            loadOrdersOper.Completed += new EventHandler(loadOrdersOper_Completed);
        }
Example #33
0
        private void LoadProjectFiles()
        {
            IsBusy = true;
            LoadOperation <ProductManager.Web.Model.project_files> loadOperationProjectFiles =
                ProductDomainContext.Load <ProductManager.Web.Model.project_files>(ProductDomainContext.GetProject_filesByIDQuery(SelectProjectEntity.ManufactureNumber));

            loadOperationProjectFiles.Completed += loadOperationProjectFiles_Completed;
        }
Example #34
0
File: App1.cs Project: mikestam/t2t
        public void GetMaterialClassesCallback(LoadOperation<MaterialClass> loadOperation)
        {
            if (loadOperation.HasError)
                throw loadOperation.Error;

            //we are ready now to display the HomePage.
            ((Grid)this.RootVisual).Children.Add(new MainPage());
        }
Example #35
0
 void LoadOpTT_Complete(LoadOperation<nv_thuethu> lo)
 {
     if (lo.Entities.Count() > 0)
     {
         gridControl1.ItemsSource = lo.Entities;
         gridControl1.ShowLoadingPanel = false;
     }
 }
Example #36
0
        public void GetCheckouts(Action <ObservableCollection <Checkout> > getCheckoutsCallback)
        {
            ClearBooks();
            var query = Context.GetCheckoutsQuery();

            _getCheckoutsCallback             = getCheckoutsCallback;
            _checkoutLoadOperation            = Context.Load <Checkout>(query);
            _checkoutLoadOperation.Completed += OnLoadCheckoutsCompleted;
        }
Example #37
0
 /// <summary>
 /// Asynchronously loads data into the source collection of the collection view by invoking
 /// the load callback passed into the constructor
 /// </summary>
 /// <param name="userState">The user state will be returned in the
 /// <see cref="CollectionViewLoader.LoadCompleted"/> event args. This parameter is optional.
 /// </param>
 /// <exception cref="InvalidOperationException"> is thrown when <see cref="CanLoad"/> is false</exception>
 public override void Load(object userState)
 {
     if (!this.CanLoad)
     {
         throw new InvalidOperationException(Resources.CannotLoad);
     }
     this._currentUserState = userState;
     this.CurrentOperation  = this._load();
 }
Example #38
0
        public void LoadData()
        {
            OnLineUserList.Clear();
            systemManageDomainContext = new SystemManageDomainContext();
            LoadOperation <ProductManager.Web.Model.user> loadOnLineUser =
                systemManageDomainContext.Load <ProductManager.Web.Model.user>(systemManageDomainContext.GetLogonUserQuery());

            loadOnLineUser.Completed += loadOperationloadOnLineUser_Completed;
        }
        public void LoadData()
        {
            IsBusy = true;
            planManagerDomainContext.plans.Clear();
            LoadOperation <ProductManager.Web.Model.plan> loadOperationPlan =
                planManagerDomainContext.Load <ProductManager.Web.Model.plan>(planManagerDomainContext.GetPlanQuery());

            loadOperationPlan.Completed += loadOperationPlan_Completed;
        }
Example #40
0
        public async Task <Dictionary <string, T> > LoadAsync <T>(IEnumerable <string> ids,
                                                                  CancellationToken token = default(CancellationToken))
        {
            var loadOperation = new LoadOperation(this);

            await LoadAsyncInternal(ids.ToArray(), null, loadOperation, token).ConfigureAwait(false);

            return(loadOperation.GetDocuments <T>());
        }
        public MainPage()
        {
            InitializeComponent();
            rbPie.IsChecked   = true;
            loadOp            = this._context.Load(this._context.GetItemDetailsQuery());
            loadOp.Completed += new EventHandler(loadOp_Completed);

            //dcw = new DemoChild();
        }
Example #42
0
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            departmentIdNameDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (department department in loadOperation.Entities)
            {
                departmentIdNameDictionary.Add(department.department_id, department.department_name);
            }

            productDomainContext.project_responsibles.Clear();
            projectResponsibleSource = new EntityList <project_responsible>(productDomainContext.project_responsibles);
            projectResponsibleLoader = new DomainCollectionViewLoader <project_responsible>(
                LoadProjectResponsibleEntities,
                LoadOperationProjectResponsibleCompleted);
            projectResponsibleView = new DomainCollectionView <project_responsible>(projectResponsibleLoader, projectResponsibleSource);
            using (projectResponsibleView.DeferRefresh())
            {
                projectResponsibleView.MoveToFirstPage();
            }

            productDomainContext.questiontraces.Clear();
            questionTraceSource = new EntityList <ProductManager.Web.Model.questiontrace>(productDomainContext.questiontraces);
            questionTraceLoader = new DomainCollectionViewLoader <questiontrace>(
                LoadQuestionTraceEntities,
                LoadOperationQuestionTraceCompleted
                );
            questionTraceView = new DomainCollectionView <ProductManager.Web.Model.questiontrace>(questionTraceLoader, questionTraceSource);
            using (questionTraceView.DeferRefresh())
            {
                questionTraceView.MoveToFirstPage();
            }

            questionTraceTraceSource = new EntityList <ProductManager.Web.Model.questiontrace>(productDomainContext.questiontraces);
            questionTraceTraceLoader = new DomainCollectionViewLoader <questiontrace>(
                LoadQuestionTraceTraceEntities,
                LoadOperationQuestionTraceTraceCompleted
                );
            questionTraceTraceView = new DomainCollectionView <ProductManager.Web.Model.questiontrace>(questionTraceTraceLoader, questionTraceTraceSource);
            using (questionTraceTraceView.DeferRefresh())
            {
                questionTraceTraceView.MoveToFirstPage();
            }

            planOutlineFileSource  = new EntityList <ProductManager.Web.Model.plan_outline_files>(planManagerDomainContext.plan_outline_files);
            planOutlineFilesLoader = new DomainCollectionViewLoader <plan_outline_files>(
                LoadPlanOutLineEntities,
                LoadPlanOutLineEntitiesCompleted
                );
            planOutlineFilesView = new DomainCollectionView <ProductManager.Web.Model.plan_outline_files>(planOutlineFilesLoader, planOutlineFileSource);

            using (planOutlineFilesView.DeferRefresh())
            {
                planOutlineFilesView.MoveToFirstPage();
            }
        }
Example #43
0
        public void LoadData()
        {
            systemManageDomainContext = new SystemManageDomainContext();
            SelectDepartmentEntity    = null;
            IsBusy = true;
            LoadOperation <ProductManager.Web.Model.department> loadOperationDepartment =
                systemManageDomainContext.Load <ProductManager.Web.Model.department>(systemManageDomainContext.GetDepartmentQuery());

            loadOperationDepartment.Completed += loadOperationDepartment_Completed;
        }
Example #44
0
 protected void ProcessSingle(Action <T> completedAction, EntityQuery <T> query)
 {
     this.Service.Load <T>(query).Completed += (delegate(object sender, EventArgs e) {
         LoadOperation <T> operation = sender as LoadOperation <T>;
         if (operation != null)
         {
             completedAction(operation.Entities.FirstOrDefault <T>());
         }
     });
 }
        private void ChildWindow_Loaded_1(object sender, RoutedEventArgs e)
        {
            BusyIndicator.IsBusy = true;
            DepartmentEntityList.Clear();
            UserEntityList.Clear();
            LoadOperation <department> loadOperationDepartment =
                SystemManageDomainContext.Load <department>(SystemManageDomainContext.GetDepartmentQuery());

            loadOperationDepartment.Completed += loadOperationDepartment_Completed_Dictionary;
        }
Example #46
0
        private void OnOrdersLoaded(LoadOperation <Order> operation)
        {
            // When the data is loaded, raise the property changed event for the Orders property.
            if (!operation.HasError)
            {
                NotifyPropertyChanged("Orders");
            }

            // TODO: Check for and handle any load errors...
        }
Example #47
0
        private void LoadData()
        {
            IsBusy = true;
            ProductDomainContext      = new ProductDomainContext();
            SystemManageDomainContext = new SystemManageDomainContext();
            LoadOperation <ProductManager.Web.Model.product_part_type> loadOperationProductPartType =
                SystemManageDomainContext.Load <ProductManager.Web.Model.product_part_type>(SystemManageDomainContext.GetProduct_part_typeQuery());

            loadOperationProductPartType.Completed += loadOperationProductPartType_Completed;
        }
Example #48
0
        private void OnLoadCompleted(LoadOperation op)
        {
            this.Operation = null;

            if (!op.HasError && !op.IsCanceled)
            {
                this.Data = op.Entities;
            }
            this.RaiseLoadCompleted(op);
        }
Example #49
0
        //获取数据库表数据
        private void GetStudentList()
        {
            LoadOperation <student> loadstudent = DSRia.Load(DSRia.GetStudentQuery());

            DSRia.Load(DSRia.GetStudentQuery()).Completed += (SS, EE) => {
                this.datagrid.ItemsSource = loadstudent.Entities;
                this.tb1.Text             = "数据库表记录总数: " + DSRia.students.Count.ToString();
                this.listbox.ItemsSource  = loadstudent.Entities;
            };
        }
Example #50
0
        public void GetMaterialClassesCallback(LoadOperation <MaterialClass> loadOperation)
        {
            if (loadOperation.HasError)
            {
                throw loadOperation.Error;
            }

            //we are ready now to display the HomePage.
            ((Grid)this.RootVisual).Children.Add(new MainPage());
        }
Example #51
0
        private void LogoutComplete(LoadOperation op)
        {
            if (op.HasError)
            {
                op.MarkErrorAsHandled();
            }

            CreateDomainContext();

            ThreadPool.QueueUserWorkItem(delegate { Initialise(); });
        }
Example #52
0
        /// <summary>
        /// Register to lazily load documents and include
        /// </summary>
        public Lazy <T[]> LazyLoadInternal <T>(string[] ids, KeyValuePair <string, Type>[] includes, Action <T[]> onEval)
        {
            if (CheckIfIdAlreadyIncluded(ids, includes))
            {
                return(new Lazy <T[]>(() => ids.Select(Load <T>).ToArray()));
            }
            var loadOperation = new LoadOperation(this, DatabaseCommands.DisableAllCaching, ids, includes);
            var lazyOp        = new LazyLoadOperation <T>(loadOperation, ids, includes);

            return(AddLazyOperation(lazyOp, onEval));
        }
Example #53
0
 public LazyLoadOperation(
     LoadOperation loadOperation,
     string[] ids,
     KeyValuePair <string, Type>[] includes,
     string transformer = null)
 {
     this.loadOperation = loadOperation;
     this.ids           = ids;
     this.includes      = includes;
     this.transformer   = transformer;
 }
Example #54
0
 protected override void OnLoad(LoadOperation op)
 {
     txtDeath.color = new Color(1, 1, 1, 0);
     txtNext.color  = new Color(1, 1, 1, 0);
     txtDeath.DOColor(Color.red, 5);
     GameClient.Instance.NextTick(() =>
     {
         _init = true;
         txtNext.DOColor(Color.red, 3);
     }, 2f);
 }
        public void GetOrderDetailsByOrderQueryCallback(LoadOperation loadOperation)
        {
            if (loadOperation.HasError)
            {
                Status = "Order Details retrieval failed"; // loadOperation.Error.Message;
                loadOperation.MarkErrorAsHandled();
                return;
            }

            RaiseEvent(OrderDetailsLoaded);
        }
Example #56
0
        public Lazy <Task <T[]> > LazyAsyncLoadInternal <T>(string[] ids, KeyValuePair <string, Type>[] includes, Action <T[]> onEval, CancellationToken token = default(CancellationToken))
        {
            if (CheckIfIdAlreadyIncluded(ids, includes))
            {
                return(new Lazy <Task <T[]> >(async() => await Task.WhenAll(ids.Select(id => LoadAsync <T>(id, token)).ToArray()).WithCancellation(token).ConfigureAwait(false)));
            }
            var loadOperation = new LoadOperation(this, AsyncDatabaseCommands.DisableAllCaching, ids, includes);
            var lazyOp        = new LazyLoadOperation <T>(loadOperation, ids, includes);

            return(AddLazyOperation(lazyOp, onEval));
        }
Example #57
0
        public void LoadData()
        {
            IsBusy = true;
            DocumentManagerDomainContext = new DocumentManager.Web.DocumentManagerDomainContext();
            DocumentManagerDomainContext.PropertyChanged -= systemManageDomainContext_PropertyChanged;
            DocumentManagerDomainContext.PropertyChanged += systemManageDomainContext_PropertyChanged;
            LoadOperation <DocumentManager.Web.Model.user> loadOperationUser =
                DocumentManagerDomainContext.Load <DocumentManager.Web.Model.user>(DocumentManagerDomainContext.GetUserQuery());

            loadOperationUser.Completed += loadOperation_Completed;
        }
        public void LoadData()
        {
            IsBusy = true;
            systemManageDomainContext = new SystemManageDomainContext();
            systemManageDomainContext.PropertyChanged -= systemManageDomainContext_PropertyChanged;
            systemManageDomainContext.PropertyChanged += systemManageDomainContext_PropertyChanged;
            LoadOperation <ProductManager.Web.Model.department> loadOperationDepartment =
                systemManageDomainContext.Load <ProductManager.Web.Model.department>(systemManageDomainContext.GetDepartmentQuery());

            loadOperationDepartment.Completed += loadOperationDepartment_Completed;
        }
Example #59
0
        public void LoadData()
        {
            IsBusy = true;
            productDomainContext      = new ProductDomainContext();
            systemManageDomainContext = new SystemManageDomainContext();

            LoadOperation <ProductManager.Web.Model.user> loadOperationUser =
                systemManageDomainContext.Load <ProductManager.Web.Model.user>(systemManageDomainContext.GetUserQuery());

            loadOperationUser.Completed += loadOperationUser_Completed;
        }
Example #60
-1
 public frmcatint(string usr)
 {
     InitializeComponent();
     EntityQuery<tram_vt> Query = dstb.GetTram_vtQuery();
     LoadOp = dstb.Load(Query.Where(t => App.ma_huyen.Contains(t.ma_huyen)).OrderBy(p => p.ten_tram), LoadOpT_Complete, null);
     //QLThuebaoDomainContext tramvt = new QLThuebaoDomainContext();
     EntityQuery<khmai> Querykm = dstb.GetKhmaiQuery();
     LoadOpkm = dstb.Load(Querykm.OrderByDescending(t => t.ngay_bd), LoadOpTK_Complete, null);
     EntityQuery<mlydocat> Querycat = dstb.GetLyDoCatTrimQuery();
     LoadOpcat = dstb.Load(Querycat.OrderBy(p => p.m_order), LoadOpCT_Complete, null);
     EntityQuery<loaikh> Queryloai = dstb.GetLoaikhQuery();
     LoadOpkh = dstb.Load(Queryloai, LoadOpKH_Complete, null);
     EntityQuery<nganh_nghe> QueryN = dstb.GetNganh_ngheQuery();
     LoadOpN = dstb.Load(QueryN, LoadOpN_Complete, null);
     EntityQuery<loai_dv> Queryloaidv = dstb.GetLoai_dvQuery();
     LoadOpdv = dstb.Load(Queryloaidv, LoadOpDV_Complete, null);            
     EntityQuery<KhachHangUuTien> Queryut = dstb.GetKhachHangUuTienTrimQuery();
     LoadOput = dstb.Load(Queryut.OrderBy(p => p.kh_uutien1), LoadOpUT_Complete, null);
     EntityQuery<nv_thuethu> Queryt = dstb.GetNv_thuethuQuery();
     LoadOptuyen = dstb.Load(Queryt.Where(p => p.ma_huyen == App.ma_huyen).OrderBy(p => p.ten), LoadOpTT_Complete, null);
     //this.txtsdt.MaxLength = App.len_sdt;
     m_usr = usr;
     dngaycat.EditValue = App.Current_d;           
     mlydo.IsEnabled = false;
     Loaded += new RoutedEventHandler(frmeditmy_Loaded);  
     //frmdc = new frmdiachi();
     //frmdc.Closed += new EventHandler(frmdiachi_Closed); 
    
 }