コード例 #1
0
ファイル: frmMain.cs プロジェクト: rgonz238/Business-App-Repo
 public frmMain()
 {
     InitializeComponent();
     lblErrorSelectCust.Visible = false;
     badc = new BusinessAppDataContext();
     custDictionary = new Dictionary<int, String>();
     empDictionary = new Dictionary<int, String>();
     custIDList = new List<int>();
     empIDList = new List<int>();
 }
コード例 #2
0
        public frmAddCustItems(frmNewOrder form)
        {
            InitializeComponent();

            badc = new BusinessAppDataContext();  //initialize db context
            this.form = form;  //assign form reference
            //this.orderID = orderID;

            brandsIndexesList = new List<int>(); 
            productsIndexesList = new List<int>();
            itemsDGVIndexesList = new List<int>(); 

            productID_QuantityDict = new Dictionary<int, int>();
            productID_OrderItemsDict = new Dictionary<int, tblOrder_Item>();
            //productID_OrderItemsDictTemp = new Dictionary<int, tblOrder_Item>(); 

            cmbBxBrand.Items.Clear();  //clear brand combo box
            cmbBxBrand.Items.Add("--Choose Brand--"); //add first entry in combo box
            cmbBxBrand.SelectedIndex = 0;  //set selected index to 0

            brandsIndexesList.Add(0); //add 0 to brand indexes list

            cmbBxProducts.Enabled = false; //disable products combo box

            dgvItems.Rows.Clear();  //clear data grid view 

            //query for list of brands
            var brands = from table in badc.tblProductBrands select table;

            foreach (var element in brands) 
            {
                cmbBxBrand.Items.Add(element.Brand_Name); //add brands to combo box
                brandsIndexesList.Add(element.Brand_ID);  //add indexes to list
            }

            //query for list of all products
            var products = from table in badc.tblProductItems select table;

            foreach (var element in products)
            {
                //add product ids and quantities to list
                productID_QuantityDict.Add(element.Product_ID, element.Quantity);
            }
        }
コード例 #3
0
        private void init()
        {
            badc = new BusinessAppDataContext();

            //initialize customer name label
            var cu = from c in badc.tblCustomers
                     where c.Customer_ID == customerID
                     select c;

            lblNewOrdCustName.Text = cu.FirstOrDefault().First_Name_OR_Company + " " +
                cu.FirstOrDefault().Last_Name;
        }
コード例 #4
0
        private void insertNewCust()
        {
            BusinessAppDataContext badc = new BusinessAppDataContext();
            tblCustomer cust = new tblCustomer();

            cust.First_Name_OR_Company = txtBxNameCompany.Text;

            try {cust.Middle_Initial = Convert.ToChar(txtBxMiddleInit.Text);}
            catch (FormatException) { cust.Middle_Initial = null; }

            try {cust.Last_Name = txtBxLastName.Text;}
            catch (FormatException) { cust.Last_Name = null; }

            try {cust.Email = txtBxEmail.Text;}
            catch (FormatException) { cust.Email = null; }

            cust.Phone_Number = txtBxPhoneNum.Text;

            badc.tblCustomers.InsertOnSubmit(cust);
            badc.SubmitChanges();

            form.updateCmbBx();
        }