Example #1
0
        private void BtnThanhToanDonHang_Click(object sender, EventArgs e)
        {
            OrderBUS orderBUS = new OrderBUS();
            Order    order    = new Order();

            order.CustomerID = customer.CustomerID;
            order.EmployeeID = Session.EmployeeSession.employee.EmployeeID;
            order.CreatedAt  = DateTime.Now;
            order.TotalPrice = int.Parse(txtTongThanhTien.Text);

            int orerID = orderBUS.Insert(order);

            OrderDetailBUS orderDetailBUS = new OrderDetailBUS();

            for (int i = 0; i < lstOrderProduct.Count; i++)
            {
                OrderDetail orderDetail = new OrderDetail();
                orderDetail.OrderID        = orerID;
                orderDetail.ProductID      = lstOrderProduct[i].ProductID;
                orderDetail.SalingPrice    = lstOrderProduct[i].Price;
                orderDetail.SalingQuantity = lstOrderQuantity[i];

                orderDetailBUS.Insert(orderDetail);
            }

            ResetForm();
        }
Example #2
0
 public FrmShop(string userName)
 {
     InitializeComponent();
     _petBUS       = new PetBUS();
     _typeBUS      = new TypeBUS();
     this.userName = userName;
     _orderBUS     = new OrderBUS();
 }
Example #3
0
        private void btnDetail_Click(object sender, EventArgs e)
        {
            frmOrderDetail _frmDetail = new frmOrderDetail(orderBindingSource.Current as Order);

            if (_frmDetail.ShowDialog() == DialogResult.Cancel)
            {
                orderTBBindingSource.DataSource = OrderBUS.getAll();
            }
        }
Example #4
0
        public MainWindow()
        {
            InitializeComponent();
            orderBUS = new OrderBUS();

            timer = new System.Windows.Threading.DispatcherTimer();

            timer.Tick    += new EventHandler(timerTick);
            timer.Interval = new TimeSpan(0, 0, 2);
        }
Example #5
0
 protected void btnDelete_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         orBUS = new OrderBUS();
         string  OrderId = ((ImageButton)sender).CommandArgument.ToString();
         ConnectionData.OpenMyConnection();
         orBUS.tblOrder_Delete(OrderId);
         pnError.Visible = false;
         pnSuccess.Visible = true;
         lblSuccess.Text = "Bạn đã xóa thành công đơn hàng có mã : " + OrderId;
         LoadOrDer();
         ConnectionData.CloseMyConnection();
     }
     catch (Exception ex)
     {
         pnError.Visible = true;
         lblError.Text = ex.Message;
     }
 }
Example #6
0
 protected void btnFilter_Click(object sender, EventArgs e)
 {
     if (txtDateFrom.Text == "" || txtDateTo.Text == "")
     {
         //Lọc theo mã đơn hàng
         if (txtOrderID.Text == "")
         {
             pnError.Visible = true;
             lblError.Text = "Bạn phải nhập thông tin tìm kiếm";
         }
         else
         {
             orBUS = new OrderBUS();
             if (orBUS.tblOrder_GetByID(txtOrderID.Text).Rows.Count > 0)
             {
                 this.dtlOrder.DataSource = orBUS.tblOrder_GetByID(txtOrderID.Text);
                 this.dtlOrder.DataBind();
             }
             else
             {
                 pnError.Visible = false;
                 pnSuccess.Visible = true;
                 lblSuccess.Text = "Không tìm thấy dữ liệu";
             }
         }
     }
         //Lọc theo ngày tháng lập đơn hàng
     else
     {
         DateTime from = convertStringToDate(txtDateFrom.Text);
         DateTime to = convertStringToDate(txtDateTo.Text);
         orBUS = new OrderBUS();
         if (orBUS.tblOrder_GetByDateCreate(from, to).Rows.Count > 0)
         {
             this.dtlOrder.DataSource = orBUS.tblOrder_GetByDateCreate(from, to);
             this.dtlOrder.DataBind();
         }
     }
 }
 public static int CreateOrd(OrderService os)
 {
     return(OrderBUS.CreateOrd(os));
 }
Example #8
0
 private void frmOrder_Load(object sender, EventArgs e)
 {
     orderTBBindingSource.DataSource = OrderBUS.getAll();
     orderBindingSource.DataSource   = new Order();
 }
Example #9
0
 private void InitBUS()
 {
     oBUS = new OrderBUS();
     odBUS = new OrderDatailBUS();
     ctBus = new CustomerBUS();
 }
Example #10
0
 public UnitTest1()
 {
     orderBUS = new OrderBUS();
     orderDAO = new OrderDAO();
 }
Example #11
0
    protected void drlStatus_SelectedIndexChanged(object sender, EventArgs e)
    {
        bool status = bool.Parse(drlStatus.SelectedValue.ToString());
        orBUS = new OrderBUS();
        this.dtlOrder.DataSource = orBUS.tblOrder_GetByStatus(status);
        this.dtlOrder.DataBind();
        if (orBUS.tblOrder_GetByStatus(status).Rows.Count > 0)
        {
            for (int i = 0; i < orBUS.tblOrder_GetByStatus(status).Rows.Count; i++)
            {
                Label lblStatus = (Label)dtlOrder.Items[i].FindControl("lblStatus");
                if (orBUS.tblOrder_GetByStatus(status).Rows[i]["Status"].ToString() == "True")
                {
                    lblStatus.Text = "Đã giao hàng";
                }
                else
                {
                    lblStatus.Text = "Chưa giao hàng";
                }
            }

        }
    }
Example #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                orBUS = new OrderBUS();
                LoadOrDer();
            }
        }
        catch (Exception)
        {

        }
    }
 public static OrderService GetOrdServiceByID(int idBook)
 {
     return(OrderBUS.GetOrdServiceByID(idBook));
 }
 public static bool UpdateTotal(int idBook)
 {
     return(OrderBUS.UpdateTotal(idBook));
 }
 private void InitBus()
 {
     cm = new Common();
     ctBUS = new CustomerBUS();
     oBUS = new OrderBUS();
     odBUS = new OrderDatailBUS();
     mgBUS = new MailGroupBUS();
     dgBUS = new DetailGroupBUS();
 }
Example #16
0
 public FrmHistory(String userName)
 {
     InitializeComponent();
     this.userName = userName;
     _orderBUS     = new OrderBUS();
 }
 public static bool UpdatePayment(int idBook, bool payment)
 {
     return(OrderBUS.UpdatePayment(idBook, payment));
 }
 public static IEnumerable <OrderDetail> GetAllOrdDetail(int idBook)
 {
     return(OrderBUS.GetAllOrdDetail(idBook));
 }
 public static void CreateOrdDetail(OrderDetail od, int idBook)
 {
     OrderBUS.CreateOrdDetail(od, idBook);
 }