Beispiel #1
0
        internal override void GetDataBase()
        {
            var result = OperationOrders.Select("select * from Orders");
            if(ObservableCollectionOrder != null)
                ObservableCollectionOrder.Clear();
            foreach (var item in result)
            {
                ViewModelOrdersMain viewModelOrders = new ViewModelOrdersMain();
                viewModelOrders.TheOrder = item; ObservableCollectionOrder.Add(viewModelOrders);
            }

            TableOrderObservable = ObservableCollectionOrder;
            RaisePropertyChanged("Order");     
        }
        private async Task OnCommSaveUpOrder()
        {
            if (PropID != 0)
            {
                var boreoilnumber = Propboreoilnumber;  //////////// Номер скважины
                var partynumber = Proppartynumber;      //////////// Номер бригады(партия)
                var oilfieldname = Propoilfieldname;    //////////// Месторожд.
                var typeworkname = Proptypeworkname;    //////////// Тип работ
                var dateorder = Propdateorder;          //////////// Дата ордера
                var name = PropName;                    //////////// Куст

                /////////////Save obj in BD ->
                dynamic InsertOrdersDataObj = new Orders(dateorder, oilfieldname, name, boreoilnumber, partynumber, typeworkname, PropID);
                await OperationOrder.Update(InsertOrdersDataObj);

                ViewModelOrdersMain viewModelOrders = new ViewModelOrdersMain();
                viewModelOrders.TheOrder = InsertOrdersDataObj;
                ObservableCollectionOrder.Clear(); this.Refresh();
            }
            else
            {
                var boreoilnumber = Propboreoilnumber;  //////////// Номер скважины
                var partynumber = Proppartynumber;      //////////// Номер бригады(партия)
                var oilfieldname = Propoilfieldname;    //////////// Месторожд.
                var typeworkname = Proptypeworkname;    //////////// Тип работ
                var dateorder = Propdateorder;          //////////// Дата ордера
                var name = PropName;                    //////////// Куст

                /////////////Save obj in BD ->
                dynamic InsertOrdersDataObj = new Orders(dateorder, oilfieldname, name, boreoilnumber, partynumber, typeworkname, 1);
                await OperationOrder.Insert(InsertOrdersDataObj);

                ViewModelOrdersMain viewModelOrders = new ViewModelOrdersMain();
                viewModelOrders.TheOrder = InsertOrdersDataObj;
                ObservableCollectionOrder.Add(viewModelOrders);
                TableOrderObservable = ObservableCollectionOrder;
            }
            Window theUserControl = UserControlDialog;
            theUserControl.Close();
        }