public IHttpActionResult PutWorkOrderParametersView(int id, WorkOrderParametersView workOrderParametersView)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != workOrderParametersView.wopID)
            {
                return(BadRequest());
            }

            db.Entry(workOrderParametersView).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WorkOrderParametersViewExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PostWorkOrderParametersView(WorkOrderParametersView workOrderParametersView)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.WorkOrderParametersViews.Add(workOrderParametersView);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (WorkOrderParametersViewExists(workOrderParametersView.wopID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = workOrderParametersView.wopID }, workOrderParametersView));
        }
        public IHttpActionResult GetWorkOrderParametersView(int id)
        {
            //WorkOrderParametersView workOrderParametersView = db.WorkOrderParametersViews.Find(id);
            WorkOrderParametersView workOrderParametersView = db.WorkOrderParametersViews.SingleOrDefault(m => m.wopID == id);

            if (workOrderParametersView == null)
            {
                return(NotFound());
            }

            return(Ok(workOrderParametersView));
        }
Exemplo n.º 4
0
        private async void popelateData(int id)
        {
            await BeBusy(true);

            wop = await rcs.getWorkOredrParametersByPrameterNoAsync(id);

            parameterNameValue.Text = wop.ParameterName;
            isDoneValue.IsToggled   = wop.isDone;
            lastUpdateValue.Text    = wop.lastUpdate.ToString();
            update.IsEnabled        = false;
            await BeBusy(false);
        }
        public IHttpActionResult DeleteWorkOrderParametersView(int id)
        {
            WorkOrderParametersView workOrderParametersView = db.WorkOrderParametersViews.Find(id);

            if (workOrderParametersView == null)
            {
                return(NotFound());
            }

            db.WorkOrderParametersViews.Remove(workOrderParametersView);
            db.SaveChanges();

            return(Ok(workOrderParametersView));
        }
        private async Task <double> OpenPercentageSliderInputAlertDialog(WorkOrderParametersView wop)
        {
            // create the TextInputView
            var inputView = new PercentageUpdateSlider(
                "How much would you rate it?", 0, 10,
                "تحديث", "الغاء", "", wop);

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <double>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                if (((PercentageUpdateSlider)sender).SliderInputResult > 0)
                {
                    //((PercentageUpdateSlider)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((SlidableInputView)sender).SliderInputResult);
                }
                else
                {
                    //((PercentageUpdateSlider)sender).IsValidationLabelVisible = true;
                }
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(0);
            };

            // Push the page to Navigation Stack
            await PopupNavigation.PushAsync(popup);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            await PopupNavigation.PopAsync();

            // return user inserted text value
            return(result);
        }
        private async Task <string> OpenKMUpdateInputAlertDialog(WorkOrderParametersView wopv)
        {
            // create the TextInputView
            var inputView = new KMUpdateTextInputCancellableView(
                "How's your day mate?", "enter here...", "تحديث", "الغاء", "Ops! Can't leave this empty!", wopv);

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <string>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                if (!string.IsNullOrEmpty(((KMUpdateTextInputCancellableView)sender).TextInputResult.ToString()))
                {
                    //((KMUpdateTextInputCancellableView)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((KMUpdateTextInputCancellableView)sender).TextInputResult);
                }
                else
                {
                    //((KMUpdateTextInputCancellableView)sender).IsValidationLabelVisible = true;
                }
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(null);
            };

            // Push the page to Navigation Stack
            await PopupNavigation.PushAsync(popup);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            await PopupNavigation.PopAsync();

            // return user inserted text value
            return(result);
        }
        private async void updateWOP(WorkOrderParametersView WOP)
        {
            await BeBusy(true);

            WorkOrdersParameters woptoUpdate = new WorkOrdersParameters();

            woptoUpdate.ID             = WOP.wopID;
            woptoUpdate.workOrder_FKID = WOP.workOrder_FKID;
            woptoUpdate.parameter_FKID = WOP.parameter_FKID;
            woptoUpdate.Lenght         = WOP.Lenght;
            woptoUpdate.Amount         = WOP.Amount;
            woptoUpdate.isDone         = WOP.isDone;
            woptoUpdate.lastUpdate     = DateTime.Now;
            woptoUpdate.DoneLength     = WOP.DoneLength;
            woptoUpdate.DoneAmount     = WOP.DoneAmount;
            woptoUpdate.weightAmount   = WOP.weightAmount;
            bool isOk = false;

            try
            {
                isOk = await rcs.PutWorkOrderParameterUpdateAsync(woptoUpdate.ID, woptoUpdate);
            }
            catch (Exception err)
            {
            }

            if (isOk)
            {
                popelateData(n);
                await BeBusy(false);
                await DisplayAlert("ok", "updated", "ok");

                //await Navigation.PopAsync();
            }
            else
            {
                await BeBusy(false);
                await DisplayAlert("Error", "Error", "ok");

                //await Navigation.PopAsync();
            }
        }
Exemplo n.º 9
0
        //public static readonly BindableProperty IsValidationLabelVisibleProperty =
        //    BindableProperty.Create(
        //        nameof(IsValidationLabelVisible),
        //        typeof(bool),
        //        typeof(KMUpdateTextInputCancellableView),
        //        false, BindingMode.OneWay, null,
        //        (bindable, value, newValue) =>
        //        {
        //            if ((bool)newValue)
        //            {
        //                ((KMUpdateTextInputCancellableView)bindable).ValidationLabel
        //                    .IsVisible = true;
        //            }
        //            else
        //            {
        //                ((KMUpdateTextInputCancellableView)bindable).ValidationLabel
        //                    .IsVisible = false;
        //            }
        //        });

        /// <summary>
        /// Gets or Sets if the ValidationLabel is visible
        /// </summary>
        //public bool IsValidationLabelVisible
        //{
        //    get
        //    {
        //        return (bool)GetValue(IsValidationLabelVisibleProperty);
        //    }
        //    set
        //    {
        //        SetValue(IsValidationLabelVisibleProperty, value);
        //    }
        //}

        public IsDoneUpdateTextInputCancellableView(string titleText, string placeHolderText,
                                                    string saveButtonText, string cancelButtonText, string validationText, WorkOrderParametersView wopv)
        {
            InitializeComponent();

            // update the Element's textual values

            SaveButton.Text   = saveButtonText;
            CancelButton.Text = cancelButtonText;
            //ValidationLabel.Text = validationText;
            //isDone.Text = wopv.isDone.ToString();

            if (wopv.isDone == true)
            {
                isDone.Text           = "تم الانجاز";
                updateValue.Text      = "true";
                isDoneSwich.IsToggled = true;
            }
            else
            {
                isDoneSwich.IsToggled = false;
                isDone.Text           = "لم يتم الانجاز";
                updateValue.Text      = "false";
            }

            pName.Text = wopv.ParameterName;
            //totalLenth.Text = wopv.Lenght.ToString();
            //doneLenth.Text = wopv.DoneLength.ToString();

            // handling events to expose to public
            SaveButton.Clicked      += SaveButton_Clicked;
            CancelButton.Clicked    += CancelButton_Clicked;
            updateValue.TextChanged += InputEntry_TextChanged;
        }
Exemplo n.º 10
0
        //public static readonly BindableProperty IsValidationLabelVisibleProperty =
        //    BindableProperty.Create(
        //        nameof(IsValidationLabelVisible),
        //        typeof(bool),
        //        typeof(KMUpdateTextInputCancellableView),
        //        false, BindingMode.OneWay, null,
        //        (bindable, value, newValue) =>
        //        {
        //            if ((bool)newValue)
        //            {
        //                ((KMUpdateTextInputCancellableView)bindable).ValidationLabel
        //                    .IsVisible = true;
        //            }
        //            else
        //            {
        //                ((KMUpdateTextInputCancellableView)bindable).ValidationLabel
        //                    .IsVisible = false;
        //            }
        //        });

        /// <summary>
        /// Gets or Sets if the ValidationLabel is visible
        /// </summary>
        //public bool IsValidationLabelVisible
        //{
        //    get
        //    {
        //        return (bool)GetValue(IsValidationLabelVisibleProperty);
        //    }
        //    set
        //    {
        //        SetValue(IsValidationLabelVisibleProperty, value);
        //    }
        //}

        public EachUpdateTextInputCancellableView(string titleText, string placeHolderText,
                                                  string saveButtonText, string cancelButtonText, string validationText, WorkOrderParametersView wopv)
        {
            InitializeComponent();

            // update the Element's textual values

            SaveButton.Text   = saveButtonText;
            CancelButton.Text = cancelButtonText;
            //ValidationLabel.Text = validationText;


            pName.Text        = wopv.ParameterName;
            totalAmmount.Text = wopv.Amount.ToString();
            doneAmmount.Text  = wopv.DoneAmount.ToString();

            // handling events to expose to public
            SaveButton.Clicked      += SaveButton_Clicked;
            CancelButton.Clicked    += CancelButton_Clicked;
            updateValue.TextChanged += InputEntry_TextChanged;
        }
        //public static readonly BindableProperty IsValidationLabelVisibleProperty =
        //    BindableProperty.Create(
        //        nameof(IsValidationLabelVisible),
        //        typeof(bool),
        //        typeof(SlidableInputView),
        //        false, BindingMode.OneWay, null,
        //        (bindable, value, newValue) =>
        //        {
        //            if ((bool)newValue)
        //            {
        //                ((PercentageUpdateSlider)bindable).ValidationLabel
        //                    .IsVisible = true;
        //            }
        //            else
        //            {
        //                ((PercentageUpdateSlider)bindable).ValidationLabel
        //                    .IsVisible = false;
        //            }
        //        });

        /// <summary>
        /// Gets or Sets if the ValidationLabel is visible
        /// </summary>
        //public bool IsValidationLabelVisible
        //{
        //    get
        //    {
        //        return (bool)GetValue(IsValidationLabelVisibleProperty);
        //    }
        //    set
        //    {
        //        SetValue(IsValidationLabelVisibleProperty, value);
        //    }
        //}

        public PercentageUpdateSlider(string titleText, double minValue, double maxValue,
                                      string saveButtonText, string cancelButtonText, string validationText, WorkOrderParametersView wopv)
        {
            InitializeComponent();

            // update the Element's textual values
            //TitleLabel.Text = titleText;

            pName.Text          = wopv.ParameterName;
            totalAmmount.Text   = wopv.Amount.ToString();
            doneAmmount.Text    = wopv.DoneAmount.ToString();
            SaveButton.Text     = saveButtonText;
            InputSlider.Minimum = minValue;
            InputSlider.Maximum = maxValue;
            CancelButton.Text   = cancelButtonText;
            //ValidationLabel.Text = validationText;

            // handling events to expose to public
            SaveButton.Clicked       += SaveButton_Clicked;
            CancelButton.Clicked     += CancelButton_Clicked;
            InputSlider.ValueChanged += InputEntryOnValueChanged;
        }
        //public static readonly BindableProperty IsValidationLabelVisibleProperty =
        //    BindableProperty.Create(
        //        nameof(IsValidationLabelVisible),
        //        typeof(bool),
        //        typeof(KMUpdateTextInputCancellableView),
        //        false, BindingMode.OneWay, null,
        //        (bindable, value, newValue) =>
        //        {
        //            if ((bool)newValue)
        //            {
        //                ((KMUpdateTextInputCancellableView)bindable).ValidationLabel
        //                    .IsVisible = true;
        //            }
        //            else
        //            {
        //                ((KMUpdateTextInputCancellableView)bindable).ValidationLabel
        //                    .IsVisible = false;
        //            }
        //        });

        /// <summary>
        /// Gets or Sets if the ValidationLabel is visible
        /// </summary>
        //public bool IsValidationLabelVisible
        //{
        //    get
        //    {
        //        return (bool)GetValue(IsValidationLabelVisibleProperty);
        //    }
        //    set
        //    {
        //        SetValue(IsValidationLabelVisibleProperty, value);
        //    }
        //}

        public PercentageUpdateCancellableView(string titleText, string placeHolderText,
                                               string saveButtonText, string cancelButtonText, string validationText, WorkOrderParametersView wopv)
        {
            InitializeComponent();

            // update the Element's textual values

            SaveButton.Text   = saveButtonText;
            CancelButton.Text = cancelButtonText;
            //ValidationLabel.Text = validationText;

            pName.Text = wopv.ParameterName;
            //totalLenth.Text = wopv.Lenght.ToString();
            updateValue.Text   = wopv.DoneAmount.ToString();
            donedonAmount.Text = wopv.DoneAmount.ToString() + " %";

            InputSlider.Value = double.Parse(wopv.DoneAmount.ToString());

            // handling events to expose to public
            SaveButton.Clicked      += SaveButton_Clicked;
            CancelButton.Clicked    += CancelButton_Clicked;
            updateValue.TextChanged += InputEntry_TextChanged;
        }