Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
 public FrmShop(string userName)
 {
     InitializeComponent();
     _petBUS       = new PetBUS();
     _typeBUS      = new TypeBUS();
     this.userName = userName;
     _orderBUS     = new OrderBUS();
 }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 8
0
 private void frmOrder_Load(object sender, EventArgs e)
 {
     orderTBBindingSource.DataSource = OrderBUS.getAll();
     orderBindingSource.DataSource   = new Order();
 }
Ejemplo n.º 9
0
 private void InitBUS()
 {
     oBUS = new OrderBUS();
     odBUS = new OrderDatailBUS();
     ctBus = new CustomerBUS();
 }
Ejemplo n.º 10
0
 public UnitTest1()
 {
     orderBUS = new OrderBUS();
     orderDAO = new OrderDAO();
 }
Ejemplo n.º 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";
                }
            }

        }
    }
Ejemplo n.º 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));
 }
Ejemplo n.º 15
0
 private void InitBus()
 {
     cm = new Common();
     ctBUS = new CustomerBUS();
     oBUS = new OrderBUS();
     odBUS = new OrderDatailBUS();
     mgBUS = new MailGroupBUS();
     dgBUS = new DetailGroupBUS();
 }
Ejemplo n.º 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);
 }