예제 #1
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			StockTypes clsStockTypes = new StockTypes();
			cboStockTypes.DataTextField = "StockTypeCode";
			cboStockTypes.DataValueField = "StockTypeID";
			cboStockTypes.DataSource = clsDataClass.DataReaderToDataTable(clsStockTypes.List("StockTypeCode", SortOption.Ascending)).DefaultView;
			cboStockTypes.DataBind();
			cboStockTypes.SelectedIndex = cboStockTypes.Items.Count - 1;

            Contacts clsContact = new Contacts(clsStockTypes.Connection, clsStockTypes.Transaction);
			cboSupplier.DataTextField = "ContactName";
			cboSupplier.DataValueField = "ContactID";
			cboSupplier.DataSource = clsDataClass.DataReaderToDataTable(clsContact.Suppliers(null, 0, "ContactName", SortOption.Ascending)).DefaultView;
			cboSupplier.DataBind();

            Branch clsBranch = new Branch(clsStockTypes.Connection, clsStockTypes.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            
            clsStockTypes.CommitAndDispose();

            cboStockTypes_SelectedIndexChanged(null, null);
            cboSupplier.SelectedIndex = 0;
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));

			NewTransaction();
		}