Esempio n. 1
0
        public async void Saveedit(object obj)
        {
            _katmodel.KategoriHall = Katname;
            _katmodel.katNumber    = Katnumber;
            _katmodel.KategoriId   = Ids;


            if (String.IsNullOrEmpty(Katname) || String.IsNullOrEmpty(Katnumber.ToString()))
            {
                Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                Visibility = true;
                Message    = " Input wajib di isi ";
                var cs = await delayid();

                if (cs)
                {
                    Visibility = false;
                }
            }
            else
            {
                var dataadd = _services.EditSave(_katmodel);

                KategoriModels kms = Kategosris.Where(xc => xc.KategoriId == _katmodel.KategoriId).First();


                if (dataadd["df"] != "0")
                {
                    getataKat();
                    Katname    = "";
                    Katnumber  = 0;
                    Ids        = 0;
                    Coloring   = new SolidColorBrush(Color.FromRgb(46, 204, 113));
                    Visibility = true;
                    Message    = dataadd["el"];
                    var cs = await delayid();

                    if (cs)
                    {
                        Visibility = false;
                    }
                }
                else
                {
                    Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                    Visibility = true;
                    Message    = dataadd["el"];
                    var cs = await delayid();

                    if (cs)
                    {
                        Visibility = false;
                    }
                }
            }
        }
Esempio n. 2
0
        private async void AddData(object obj)
        {
            _katmodel.KategoriHall = Katname;
            _katmodel.katNumber    = Katnumber;

            if (String.IsNullOrEmpty(Katname) || String.IsNullOrEmpty(Katnumber.ToString()))
            {
                Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                Visibility = true;
                Message    = " Input wajib di isi ";
                var cs = await delayid();

                if (cs)
                {
                    Visibility = false;
                }
            }
            else
            {
                var dataadd = _services.SaveData(_katmodel);

                Kategosris = (ObservableCollection <KategoriModels>)obj;

                if (dataadd["df"] == "0")
                {
                    Kategosris.Add(new KategoriModels()
                    {
                        KategoriHall = Katname, katNumber = Katnumber
                    });
                    Coloring   = new SolidColorBrush(Color.FromRgb(46, 204, 113));
                    Visibility = true;
                    Message    = dataadd["el"];
                    var cs = await delayid();

                    getataKat();
                    if (cs)
                    {
                        Visibility = false;
                    }
                }
                else
                {
                    Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                    Visibility = true;
                    Message    = dataadd["el"];
                    var cs = await delayid();

                    if (cs)
                    {
                        Visibility = false;
                    }
                }
            }
        }