Пример #1
0
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            var model = new StokBarangModel
            {
                barang_id     = _barangID,
                tanggal       = dateTimePickerTanggal.Value,
                stok_awal     = (int)textBoxStokAwal.IntegerValue,
                barang_masuk  = (int)textBoxBarangMasuk.IntegerValue,
                barang_keluar = (int)textBoxBarangKeluar.IntegerValue,
                stok_akhir    = (int)textBoxStokAkhir.IntegerValue
            };

            var modelArgs = new ModelEventArgs <StokBarangModel>(model);

            if (_isNewData)
            {
                if (Messages.ConfirmSave(_typeName))
                {
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
            else if (Messages.ConfirmUpdate(_typeName))
            {
                model.id        = _model.id;
                model.barang_id = _barangID;
                OnSaveData?.Invoke(this, modelArgs);
            }
        }
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            var model = new PengeluaranModel
            {
                nama       = textBoxNama.Text,
                jumlah     = uint.Parse(textBoxJumlah.Text, NumberStyles.Number),
                keterangan = textBoxKeterangan.Text
            };

            var modelArgs = new ModelEventArgs <PengeluaranModel>(model);

            if (_isNewData)
            {
                if (Messages.ConfirmSave(_typeName))
                {
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
            else if (Messages.ConfirmUpdate(_typeName))
            {
                model.id      = _model.id;
                model.tanggal = _model.tanggal;
                OnSaveData?.Invoke(this, modelArgs);
            }
        }
Пример #3
0
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            var model = new PelangganModel
            {
                nama       = textBoxNama.Text,
                alamat     = textBoxAlamat.Text,
                telpon     = textBoxTelpon.Text,
                keterangan = textBoxKeterangan.Text,
            };

            var modelArgs = new ModelEventArgs <PelangganModel>(model);

            if (_isNewData)
            {
                if (Messages.ConfirmSave(_typeName))
                {
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
            else if (Messages.ConfirmUpdate(_typeName))
            {
                model.id = _model.id;
                OnSaveData?.Invoke(this, modelArgs);
            }
        }
Пример #4
0
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            var model = new HutangOperasionalModel
            {
                tanggal       = dateTimePickerTanggal.Value.Date,
                jumlah        = decimal.Parse(textBoxDigitJumlah.Text, NumberStyles.Number),
                keterangan    = textBoxKeterangan.Text,
                status_hutang = comboBoxStatusHutang.SelectedIndex == 0 ? false : true
            };

            var modelArgs = new ModelEventArgs <HutangOperasionalModel>(model);

            if (_isNewData)
            {
                if (Messages.ConfirmSave(_typeName))
                {
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
            else if (Messages.ConfirmUpdate(_typeName))
            {
                model.id = _model.id;
                OnSaveData?.Invoke(this, modelArgs);
            }
        }
Пример #5
0
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            var model = new BarangModel
            {
                tipe_id      = comboBoxTipe.SelectedItem.id,
                sub_tipe_id  = comboBoxSubTipe.SelectedItem.id,
                supplier_id  = comboBoxSupplier.SelectedItem.id,
                kode         = textBoxKode.Text,
                nama         = textBoxNama.Text,
                hpp          = decimal.Parse(textBoxHpp.Text, NumberStyles.Number),
                harga_jual   = decimal.Parse(textBoxHargaJual.Text, NumberStyles.Number),
                harga_lama   = decimal.Parse(textBoxHargaLama.Text, NumberStyles.Number),
                stok         = int.Parse(textBoxStok.Text, NumberStyles.Number),
                minimal_stok = int.Parse(textBoxMinStok.Text, NumberStyles.Number),
                Satuan       = comboBoxSatuan.SelectedItem
            };

            var modelArgs = new ModelEventArgs <BarangModel>(model);

            if (_isNewData)
            {
                if (Messages.ConfirmSave(_typeName))
                {
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
            else if (Messages.ConfirmUpdate(_typeName))
            {
                model.id = _model.id;
                OnSaveData?.Invoke(this, modelArgs);
            }
        }
Пример #6
0
        private async static void ProcessData()
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                if (Datas.Count > 0 && Datas.TryDequeue(out string result))
                {
                    sb.Append(result);

                    if (result.Contains(SPLIT_STRING_MARK))
                    {
                        string[] dataline = sb.ToString().Split(SPLIT_STRING_MARK);

                        if (dataline.Length > 0)
                        {
                            var requestData = new DeviceData
                            {
                                Data         = dataline[0].Replace(TRIM_STRING, string.Empty).Trim(),
                                CreationTime = DateTime.Now
                            };

                            await OnSaveData?.Invoke(requestData);

                            sb = sb.Replace(dataline[0] + SPLIT_STRING_MARK, string.Empty);
                        }
                    }
                }
                else
                {
                    Thread.Sleep(5);
                }
            }
        }
Пример #7
0
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            var model = new BarangModel
            {
                tipe_id    = comboBoxTipe.SelectedItem.id,
                nama       = textBoxNama.Text,
                stok_akhir = int.Parse(textBoxStokAkhir.Text),
                keterangan = textBoxKeterangan.Text
            };

            var modelArgs = new ModelEventArgs <BarangModel>(model);

            if (_isNewData)
            {
                if (Messages.ConfirmSave(_typeName))
                {
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
            else if (Messages.ConfirmUpdate(_typeName))
            {
                model.id = _model.id;
                OnSaveData?.Invoke(this, modelArgs);
            }
        }
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            if (textBoxBarang.Tag != null)
            {
                var barangModel = textBoxBarang.Tag != null ? (BarangModel)textBoxBarang.Tag : new BarangModel();

                var model = new PenyesuaianStokModel
                {
                    tanggal     = dateTimePickerTanggal.Value,
                    Barang      = barangModel,
                    hpp         = decimal.Parse(textBoxHpp.Text, NumberStyles.Number),
                    qty         = int.Parse(textBoxQty.Text, NumberStyles.Number),
                    satuan_id   = comboBoxSatuan.SelectedItem != null ? comboBoxSatuan.SelectedItem.id : default(uint),
                    satuan_nama = comboBoxSatuan.SelectedItem.nama,
                    keterangan  = textBoxKeterangan.Text
                };

                var modelArgs = new ModelEventArgs <PenyesuaianStokModel>(model);

                if (_isNewData)
                {
                    if (Messages.ConfirmSave(_typeName))
                    {
                        OnSaveData?.Invoke(this, modelArgs);
                    }
                }
                else if (Messages.ConfirmUpdate(_typeName))
                {
                    model.id = _model.id;
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
        }
Пример #9
0
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            var model = new SupplierModel
            {
                nama           = textBoxNama.Text,
                alamat         = textBoxAlamat.Text,
                telpon         = textBoxTelpon.Text,
                fax            = textBoxFax.Text,
                email          = !string.IsNullOrWhiteSpace(textBoxEmail.Text) ? textBoxEmail.Text : null,
                website        = !string.IsNullOrWhiteSpace(textBoxWebsite.Text) ? textBoxWebsite.Text : null,
                contact_person = textBoxContactPerson.Text
            };

            var modelArgs = new ModelEventArgs <SupplierModel>(model);

            if (_isNewData)
            {
                if (Messages.ConfirmSave(_typeName))
                {
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
            else if (Messages.ConfirmUpdate(_typeName))
            {
                model.id = _model.id;
                OnSaveData?.Invoke(this, modelArgs);
            }
        }
Пример #10
0
        private void KasAwalView_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Enter:

                OnSaveData?.Invoke(sender, e);

                break;

            case Keys.Escape:

                Close();

                break;
            }
        }
Пример #11
0
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            var model = new RoleModel
            {
                kode       = textBoxKode.Text,
                nama       = textBoxNama.Text,
                keterangan = textBoxKeterangan.Text
            };

            var modelArgs = new ModelEventArgs <RoleModel>(model);

            if (_isNewData)
            {
                if (Messages.ConfirmSave(_typeName))
                {
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
            else if (Messages.ConfirmUpdate(_typeName))
            {
                model.id = _model.id;
                OnSaveData?.Invoke(this, modelArgs);
            }
        }
Пример #12
0
        private void OperationButtons_OnSaveButtonClick(object sender, EventArgs e)
        {
            var model = new UserModel
            {
                login_id = textBoxLoginID.Text,
                Role     = comboBoxRole.SelectedItem != null ? comboBoxRole.SelectedItem : new RoleModel(),
                password = textBoxPassword.ForeColor != Color.Gray ? textBoxPassword.Text : _model.password
            };

            var modelArgs = new ModelEventArgs <UserModel>(model);

            if (_isNewData)
            {
                if (Messages.ConfirmSave(_typeName))
                {
                    OnSaveData?.Invoke(this, modelArgs);
                }
            }
            else if (Messages.ConfirmUpdate(_typeName))
            {
                model.id = _model.id;
                OnSaveData?.Invoke(this, modelArgs);
            }
        }
Пример #13
0
 private void buttonSave_Click(object sender, EventArgs e)
 {
     OnSaveData?.Invoke(sender, e);
 }