Example #1
0
        private void deleteCustomer_button_Click(object sender, EventArgs e)
        {
            AppController.DeleteCustomer(CustomerLabels, comments_richTextbox, bindingNavigator_Customer);

            AppController.syncCustomersTab(AppDAO.getBindSourceCustomer(), CustomerLabels, pictureBox_customer,
                                           deleteCustomer_button, updateCustomer_button);
        }
Example #2
0
        public static void UpdateCustomer(PictureBox pictureBox, Dictionary <String, MyTextBox> updateCustomerTextboxes, Dictionary <String, Label> customerValueLabels,
                                          PictureBox customerPictureBox, RichTextBox comments_richTextbox, DateTime birthDate, BindingNavigator bindingNavigatorCustomers, UpdateCustomer updateCustomerForm)
        {
            if (!NewCustomerController.ValidateFields(updateCustomerTextboxes, !updateCustomerTextboxes["AFM"].Text.Equals(customerValueLabels["AFM"].Text)))
            {
                return;
            }

            // Refresh the Binding Navigator if customer was updated succesfully
            try
            {
                UpdateCustomerDAO.UpdateCustomer(pictureBox, comments_richTextbox, birthDate, updateCustomerTextboxes, Int32.Parse(customerValueLabels["CUSTOMER_ID"].Text));

                int currentPage = bindingNavigatorCustomers.BindingSource.Position;
                foreach (KeyValuePair <String, Label> entry in App.GetCustomerLabels())
                {
                    entry.Value.DataBindings.Clear();
                }

                db.BindCustomerData(App.GetCustomerLabels(), App.getCommentsRichTextbox(), bindingNavigatorCustomers);
                bindingNavigatorCustomers.BindingSource.Position = currentPage;

                AppDAO.LoadCustomerPhoto(customerPictureBox, Int32.Parse(customerValueLabels["CUSTOMER_ID"].Text));

                // Updated!
                updateCustomerForm.Close();
            }
            catch (SqlException e)
            {
                ViewMessages.ExceptionOccured(e);
            }
        }
 public static void DeleteRelationship(Dictionary <string, Label> ordersProductsValueLabels, BindingNavigator bindingNavigatorOrdersProducts)
 {
     if (ViewMessages.DeleteRelationshipDialog() == DialogResult.No)
     {
         return;
     }
     AppDAO.DeleteRelationship(Int32.Parse(ordersProductsValueLabels["ORDER_ID_F"].Text));
     foreach (KeyValuePair <string, Label> entry in ordersProductsValueLabels)
     {
         entry.Value.DataBindings.Clear();
     }
     db.BindOrdersProductsData(ordersProductsValueLabels, bindingNavigatorOrdersProducts);
 }
Example #4
0
        public void initializeFields()
        {
            lastName_textbox.Text     = customerValueLabels["LAST_NAME"].Text;
            firstName_textbox.Text    = customerValueLabels["FIRST_NAME"].Text;
            afm_textbox.Text          = customerValueLabels["AFM"].Text;
            doy_textbox.Text          = customerValueLabels["DOY"].Text;
            address_textbox.Text      = customerValueLabels["ADDRESS"].Text;
            city_textbox.Text         = customerValueLabels["CITY"].Text;
            phone_textbox.Text        = customerValueLabels["PHONE_NUMBER"].Text;
            comments_richTextbox.Text = commentsRichTextBoxCustomer.Text;

            AppDAO.LoadCustomerPhoto(pictureBox1, Int32.Parse(customerValueLabels["CUSTOMER_ID"].Text));
            birthDate_picker.Text = customerValueLabels["BIRTH_DATE"].Text;
        }
        public static void DeleteCustomer(Dictionary <string, Label> customerValueLabels, RichTextBox commentsRichTextBox, BindingNavigator bindingNavigatorCustomer)
        {
            if (!customerCanBeDeleted(customerValueLabels["CUSTOMER_ID"].Text))
            {
                ViewMessages.CannotDeleteCustomer();
                return;
            }

            if (ViewMessages.DeleteCustomerDialog() == DialogResult.No)
            {
                return;
            }
            AppDAO.DeleteCustomer(Int32.Parse(customerValueLabels["CUSTOMER_ID"].Text));
            foreach (KeyValuePair <string, Label> entry in customerValueLabels)
            {
                entry.Value.DataBindings.Clear();
            }
            db.BindCustomerData(customerValueLabels, commentsRichTextBox, bindingNavigatorCustomer);
        }
        public static void DeleteOrder(Dictionary <string, Label> orderValueLabels, BindingNavigator bindingNavigatorOrder)
        {
            if (!orderCanBeDeleted(orderValueLabels["ORDER_ID"].Text))
            {
                ViewMessages.CannotDeleteOrder();
                return;
            }

            if (ViewMessages.DeleteOrderDialog() == DialogResult.No)
            {
                return;
            }
            AppDAO.DeleteOrder(Int32.Parse(orderValueLabels["ORDER_ID"].Text));
            foreach (KeyValuePair <string, Label> entry in orderValueLabels)
            {
                entry.Value.DataBindings.Clear();
            }
            db.BindOrderData(orderValueLabels, bindingNavigatorOrder);
        }
        public static void DeleteProduct(Dictionary <string, Label> productValueLabels, BindingNavigator bindingNavigatorProduct)
        {
            if (!productCanBeDeleted(productValueLabels["PRODUCT_ID"].Text))
            {
                ViewMessages.CannotDeleteProduct();
                return;
            }

            if (ViewMessages.DeleteProductDialog() == DialogResult.No)
            {
                return;
            }
            AppDAO.DeleteProduct(Int32.Parse(productValueLabels["PRODUCT_ID"].Text));
            foreach (KeyValuePair <string, Label> entry in productValueLabels)
            {
                entry.Value.DataBindings.Clear();
            }
            db.BindProductsData(productValueLabels, bindingNavigatorProduct);
        }
Example #8
0
        private void App_Load(object sender, EventArgs e)
        {
            db.BindCustomerData(CustomerLabels, commentsRichTextBoxGlobal, bindingNavigator_Customer);
            db.BindProductsData(ProductLabels, bindingNavigator_Products);
            db.BindOrderData(OrderLabels, bindingNavigator_Orders);
            db.BindOrdersProductsData(OrdersProductsLabels, bindingNavigator_OrdersProducts);

            NewOrderController.fillCustomerIdCombobox(customerIds_combobox);

            AppController.syncCustomersTab(AppDAO.getBindSourceCustomer(), CustomerLabels, pictureBox_customer,
                                           deleteCustomer_button, updateCustomer_button);

            AppController.syncProductsTab(AppDAO.getBindSourceProducts(), ProductLabels,
                                          deleteProduct_button, updateProduct_button);

            AppController.syncOrdersTab(AppDAO.getBindSourceOrders(), OrderLabels,
                                        deleteOrder_button, updateOrder_button);

            AppController.syncOrdersProductsTab(AppDAO.getBindSourceOrdersProducts(), OrdersProductsLabels,
                                                deleteRelationship_button, updateRelationship_button);
        }
        public static void syncCustomersTab(BindingSource customerBindSource, Dictionary <String, Label> customerValueLabels,
                                            PictureBox pictureBox, Button deleteCustomerButton, Button updateCustomButton)
        {
            if (customerBindSource == null)
            {
                // Binding Source has not yet loaded - cancel
                return;
            }

            if (customerBindSource.Count == 0)
            {
                foreach (KeyValuePair <String, Label> entry in customerValueLabels)
                {
                    entry.Value.Text = "XXX";
                }
                pictureBox.Image             = null;
                deleteCustomerButton.Enabled = false;
                updateCustomButton.Enabled   = false;
                return;
            }
            deleteCustomerButton.Enabled = true;
            updateCustomButton.Enabled   = true;
            AppDAO.LoadCustomerPhoto(pictureBox, Int32.Parse(customerValueLabels["CUSTOMER_ID"].Text));
        }
Example #10
0
 private void bindingNavigatorCountItem4_TextChanged(object sender, EventArgs e)
 {
     AppController.syncCustomersTab(AppDAO.getBindSourceCustomer(), CustomerLabels, pictureBox_customer,
                                    deleteCustomer_button, updateCustomer_button);
 }
Example #11
0
 private void deleteProduct_button_Click(object sender, EventArgs e)
 {
     AppController.DeleteProduct(ProductLabels, bindingNavigator_Products);
     AppController.syncProductsTab(AppDAO.getBindSourceProducts(), ProductLabels,
                                   deleteProduct_button, updateProduct_button);
 }
Example #12
0
 private void customerId_value_label_TextChanged(object sender, EventArgs e)
 {
     AppController.syncCustomersTab(AppDAO.getBindSourceCustomer(), CustomerLabels, pictureBox_customer,
                                    deleteCustomer_button, updateCustomer_button);
 }
Example #13
0
 private void deleteRelationship_button_Click(object sender, EventArgs e)
 {
     AppController.DeleteRelationship(OrdersProductsLabels, bindingNavigator_OrdersProducts);
     AppController.syncOrdersProductsTab(AppDAO.getBindSourceOrdersProducts(), OrdersProductsLabels,
                                         deleteRelationship_button, updateRelationship_button);
 }
Example #14
0
 private void deleteOrder_button_Click(object sender, EventArgs e)
 {
     AppController.DeleteOrder(OrderLabels, bindingNavigator_Orders);
     AppController.syncOrdersTab(AppDAO.getBindSourceOrders(), OrderLabels,
                                 deleteOrder_button, updateOrder_button);
 }
Example #15
0
File: AppBLL.cs Project: radtek/crm
 /// <summary>
 /// 构造函数
 /// </summary>
 public AppBLL(BasicUserInfo pUserInfo)
 {
     this._currentDAO = new AppDAO(pUserInfo);
 }
Example #16
0
 private void toolStripLabel2_TextChanged(object sender, EventArgs e)
 {
     AppController.syncOrdersProductsTab(AppDAO.getBindSourceOrdersProducts(), OrdersProductsLabels,
                                         deleteRelationship_button, updateRelationship_button);
 }
Example #17
0
 private void bindingNavigatorCountItem5_TextChanged(object sender, EventArgs e)
 {
     AppController.syncProductsTab(AppDAO.getBindSourceProducts(), ProductLabels,
                                   deleteProduct_button, updateProduct_button);
 }
Example #18
0
 private void toolStripLabel1_TextChanged(object sender, EventArgs e)
 {
     AppController.syncOrdersTab(AppDAO.getBindSourceOrders(), OrderLabels,
                                 deleteOrder_button, updateOrder_button);
 }
Example #19
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public OrderQueryBLL(BasicUserInfo pUserInfo)
 {
     this._currentDAO = new AppDAO(pUserInfo);
 }