private void TextBoxharga_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Enter)
            {
                if (txtnama.Text == "" || txttotalcustom.Text == "")
                {
                    e.Handled = false;
                    MessageBox.Show("the first row cannot empty", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                // your event handler here
                ShopingchartBLL shopingBLL = new ShopingchartBLL();
                OrderCustomBeli oService   = new OrderCustomBeli();
                oService.NamaCustom    = txtnama.Text;
                oService.HargaCustom   = double.Parse(txtharga.Text);
                oService.IdTransaksi   = int.Parse(txttota.Text);
                oService.JumlahCustom  = int.Parse(txttotalcustom.Text);
                oService.TotalCustom   = double.Parse(txttotal1.Text);
                oService.Checkboxaktif = true;

                if (shopingBLL.AddOrderCustombeli(oService) > 0)
                {
                    this.ClearForm3();
                    MessageBox.Show("Add Order Buy Custom successfully added !");
                    this.LoadDataSku();
                }
                else
                {
                    MessageBox.Show("Add Order Buy Custom failed to add !");
                }
                e.Handled = true;
            }
        }
Beispiel #2
0
        public OrderCustomBeli GetData()
        {
            OrderCustomBeli oData = new OrderCustomBeli();

            oData.NamaCustom  = txtnama.Text;
            oData.HargaCustom = double.Parse(txtprice.Text);
            //    oData.IdTransaksi = newreturn.receivedgoodSelected.IdTransaksi;
            //oData.DiskonProduk = double.Parse(txtdiskon1.Text);
            oData.JumlahCustom  = int.Parse(txttotal.Text);
            oData.TotalCustom   = double.Parse(txttotal1.Text);
            oData.Checkboxaktif = false;
            return(oData);
        }
        public OrderCustomBeli GetData1()
        {
            OrderCustomBeli oData = new OrderCustomBeli();

            oData.NamaCustom  = txtnamacustom.Text;
            oData.HargaCustom = double.Parse(txtpricecustom.Text);
            oData.IdTransaksi = int.Parse(txttota.Text);
            //oData.DiskonProduk = double.Parse(txtdiskon1.Text);
            oData.JumlahCustom  = int.Parse(txttotalordercustom.Text);
            oData.TotalCustom   = double.Parse(txttotal1.Text);
            oData.Checkboxaktif = true;
            return(oData);
        }
Beispiel #4
0
        public bool EditOrderCustomBeli(ListOrderBeli oData, Purchasereturn oDatas)
        {
            methodName = "EditOrderCustomBeli";
            traceID    = 1;

            using (var uow = new UnitOfWork(AppConfig.Current.ContextName))
            {
                traceID = 2;
                var oDBData = uow.ListOrderBeli.Get(oData.Id);
                if (oDBData != null)
                {
                    using (var trans = uow.BeginTransaction())
                    {
                        try
                        {
                            traceID = 3;
                            oDBData.MapFrom(oData);
                            uow.ListOrderBeli.Update(oDBData);

                            traceID = 4;
                            OrderCustomBeli oDBListorderbeli = uow.OrderCustomBeli.SingleOrDefault(m => m.IdOrderCustom == oData.IdOrderBeli);
                            if (oDBListorderbeli != null)
                            {
                                traceID = 5;
                                oDBListorderbeli.MapFrom(oData);

                                traceID = 6;
                                uow.OrderCustomBeli.Update(oDBListorderbeli);
                            }
                            else
                            {
                                traceID = 7;

                                traceID = 8;
                            }
                            traceID = 9;
                            uow.Save();
                            trans.Commit();
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            throw new AppException(500, methodName, traceID, ex);
                        }
                    }
                }
            }

            return(true);
        }
Beispiel #5
0
        public int AddOrderCustombeli(OrderCustomBeli oData)
        {
            methodName = "AddOrderCustombeli";
            traceID    = 1;

            using (var uow = new UnitOfWork(AppConfig.Current.ContextName))
            {
                using (var trans = uow.BeginTransaction())
                {
                    try
                    {
                        traceID = 2;
                        OrderCustomBeli oNewumum = new OrderCustomBeli();
                        oNewumum.MapFrom(oData);
                        oNewumum = uow.OrderCustomBeli.Add(oNewumum);
                        uow.Save();

                        if (oNewumum.IdOrderCustom > 0)
                        {
                            traceID             = 3;
                            oData.IdOrderCustom = oNewumum.IdOrderCustom;
                            ListOrderBeli oNewListOrderBeli = new ListOrderBeli();
                            oNewListOrderBeli.MapFrom(oData);

                            traceID = 4;
                            oNewListOrderBeli.IdOrderBeli = oData.IdOrderCustom;
                            oNewListOrderBeli.TotalOrder  = oData.TotalCustom;
                            oNewListOrderBeli.Jumlah      = oData.JumlahCustom;
                            oNewListOrderBeli.Sku         = oData.NamaCustom;
                            oNewListOrderBeli.HargaBeli   = oData.HargaCustom;
                            uow.ListOrderBeli.Add(oNewListOrderBeli);
                        }

                        traceID = 5;
                        uow.Save();
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        throw new AppException(500, methodName, traceID, ex);
                    }
                }
            }

            return(oData.IdOrderCustom);
        }