public async Task LoadForms_should_support_no_forms() { var text = "<Forms/>"; var loader = new FormLoader(); Assert.Empty(await loader.LoadForms(new StringReader(text))); }
private void LoadMenucategory() { listMenuCategory = new BllMenuCategory().GetAll(); FormLoader.LoadDataSource <MenuCategory>(CmbCategory, listMenuCategory, "MenuCategoryName", "MenuCategoryId"); }
public SmartPlugin() { _ChildNodes.Add("门禁管理", (sender, e) => { FormLoader.LoadContentFrm(_mainform); }); }
private void BtnRbnBtnClick(Object sender, EventArgs e) { var btn = (KryptonRibbonGroupButton)sender; string context = String.Format("{0} {1}", btn.TextLine1, btn.TextLine2); FormLoader.LoadChildForm(context.Replace(" ", ""), context); }
public SmartParkingPlugin() { _ChildNodes.Add("停车场监控", (sender, e) => { FormLoader.LoadContentFrm(_mainform); }); }
public async Task LoadForms_should_throw_meaningful_exception_if_cannot_parse_forms_element() { var text = "<Something/>"; var loader = new FormLoader(); var ex = await Assert.ThrowsAsync <InvalidOperationException>(() => loader.LoadForms(new StringReader(text))); ex.Message.ShouldBe("Expected 'Forms' element, but got 'Something'"); }
protected override void Save() { base.Save(); var obj = FormLoader.GetControlValue <Service.DTO.MenuItem>(ControlList); obj.MenuItemId = _id; new Service.BLL.BllMenuItem().InsertOrUpdate(obj); }
public async Task LoadForm_should_throw_meaningful_exception_if_cannot_parse_the_element() { var text = "<Form><unknown /></Form>"; var loader = new FormLoader(); var ex = await Assert.ThrowsAsync <InvalidOperationException>(() => loader.LoadForm(new StringReader(text))); ex.Message.ShouldBe("Unable to parse element 'unknown' - no corresponding type were registered"); }
protected override void OnLoad(System.EventArgs e) { base.OnLoad(e); if (_id > 0) { var MenuCategory = new Service.BLL.BllMenuCategory().GetById(_id); FormLoader.SetControlValue(ControlList, MenuCategory); } }
private void BtAdd_Click(object sender, System.EventArgs e) { try { FormLoader.LoadImage(PbImage); } catch (Exception) { throw; } }
// Получение данных обо всех балансах public static DataTable getListCustomerBalance(MySqlConnection connection) { string queryText = getQueryText(); connection.Open(); var dataTable = FormLoader.ExecuteQuery(queryText, connection); connection.Close(); return(dataTable); }
// Получение данных обо всех заказах public static System.Data.DataTable getListOrders(MySqlConnection connection) { string queryText = getQueryText(); connection.Open(); var dataTable = FormLoader.ExecuteQuery(queryText, connection); connection.Close(); return(dataTable); }
private void InitializeMainForm() { // Display the splash screen Refresh(); intializeProgressBar(100); BarTimer.Enabled = true; BarTimer.Start(); Refresh(); updateSplash("Checking for versions", 0); mainForm = new FormLoader(this); }
protected override void OnLoad(System.EventArgs e) { base.OnLoad(e); LoadMenucategory(); if (_id > 0) { var MenuItem = new Service.BLL.BllMenuItem().GetById(_id); FormLoader.SetControlValue(ControlList, MenuItem); CmbCategory.SelectedValue = MenuItem.MenuCategoryId; } }
// Получение данных обо всех изделиях заказа public static DataTable getListOrderProducts(int orderId, MySqlConnection connection) { string queryText = getQueryText(); connection.Open(); var parameters = new Dictionary <string, string>(); parameters.Add("orderId", orderId.ToString()); var dataTable = FormLoader.ExecuteQuery(queryText, connection, parameters); connection.Close(); return(dataTable); }
// Печать выделенных заказов, у которых указан перечень изделий public static void PrintOrders(string idToPrint, MySqlConnection connection) { string queryText = getQueryForPrint(idToPrint); connection.Open(); var dataTable = FormLoader.ExecuteQuery(queryText, connection); connection.Close(); if (dataTable.Rows.Count == 0) { MessageBox.Show("У выделенных заказов не заполнена таблица изделий", "Печать заказов", MessageBoxButton.OK, MessageBoxImage.Information); } else { MakeExcel(dataTable); } }
public FormView( object obj) { if (obj == null) { throw new ArgumentNullException("obj"); } var type = obj.GetType(); var builder = FormLoader.Get(type); if (builder == null) { var message = string.Format("Unable to find form builder for type: {0}", type.FullName); throw new InvalidOperationException(message); } Actions = GetActions(builder); Groups = GetGroups(obj, builder); }
private void FillComboBoxes() { var outgoingData = new List <(string field, string table, string comboBox)>(); var comboboxStatusData = (field : "name_of_status", table : "customer_statuses", comboBox : "comboBoxStatus"); var comboboxChannelData = (field : "name_of_channel", table : "order_channels", comboBox : "comboBoxChannel"); var comboboxEmployeeData = (field : "Login", table : "employees", comboBox : "comboBoxEmployee"); outgoingData.Add(comboboxChannelData); outgoingData.Add(comboboxEmployeeData); outgoingData.Add(comboboxStatusData); var receivedData = FormLoader.FillComboBoxes(outgoingData, connection); foreach (var data in receivedData) { var combobox = (ComboBox)FindName(data.Key); combobox.ItemsSource = data.Value; } }
public MaterialRecordWindow(WaysToOpenForm.WaysToOpen waysToOpen, string vendorCode = "") { material = new Material(); InitializeComponent(); way = waysToOpen; connection = new MySqlConnection(connectionString); vendorCodeRecord = vendorCode; // Заполнение шапки, полей Title = FormLoader.setNewTitle(way, Title); FillComboBoxes(); if (vendorCodeRecord != "") { material = new Material(vendorCodeRecord, connection); Border.Visibility = (material.photo != null) ? Visibility.Hidden : Visibility.Visible; FillFields(); } }
public CustomersRecordWindow(WaysToOpenForm.WaysToOpen waysToOpen, int id = -1) { customer = new Customer(); InitializeComponent(); way = waysToOpen; connection = new MySqlConnection(connectionString); idRecord = id; // Заполнение шапки, полей даты Title = FormLoader.setNewTitle(way, Title); datePickerBirthday.Text = DateTime.Now.ToLongDateString(); FillComboBoxes(); if (idRecord != -1) { customer = new Customer(idRecord, connection); Border.Visibility = (customer.photo != null) ? Visibility.Hidden : Visibility.Visible; FillFields(); } }
private void FillCombo() { listMenuItem = new BllMenuItem().GetAll(); FormLoader.LoadDataSource <Service.DTO.MenuItem>(cmbMenuItem, listMenuItem, "MenuItemName", "MenuItemId"); cmbMenuItem.Text = ""; txtPrice.Text = ""; List <Service.DTO.TableDetails> listTable = new BllTableDetails().GetAll(); FormLoader.LoadDataSource <Service.DTO.TableDetails>(cmbTableNo, listTable, "TableCode", "TableId"); if (_billId == 0) { cmbTableNo.Text = ""; } List <Service.DTO.ServiceType> listService = new BllServiceType().GetAll(); FormLoader.LoadDataSource <Service.DTO.ServiceType>(cmbServiceType, listService, "ServiceTypeName", "ServiceTypeId"); List <Service.DTO.Waiters> listWaiters = new BllWaiters().GetAll(); FormLoader.LoadDataSource <Service.DTO.Waiters>(cmbWaiter, listWaiters, "WaiterCode", "WaiterId"); List <Service.DTO.PaymentType> listPaymentType = new BllPaymentType().GetAll(); FormLoader.LoadDataSource <Service.DTO.PaymentType>(cmbPaymentType, listPaymentType, "PaymentTypeName", "PaymentTypeId"); //cmbPaymentType.Text = ""; txtSubTotal.Text = "0"; listChargeConfiguration = new BllChargeConfiguration().GetAll(); setChargeValues(); }
public static (DataTable dataTable, FindDescription findDescription) GetDataWithFind(FindDescription currentFindDescription, MySqlConnection connection, List <FieldParameters> listOfField, string query, string notNullQuery = "", string nullQuery = "", string groupBy = "", string nullQueryAlex = "") { (string editedQuery, FindDescription findDescription)result = MakeFindQuery(currentFindDescription, listOfField, query, notNullQuery, nullQuery, groupBy, nullQueryAlex); if (result.editedQuery == "") { return(dataTable : null, findDescription : new FindDescription()); } connection.Open(); var dataTable = FormLoader.ExecuteQuery(result.editedQuery, connection); connection.Close(); if (dataTable.Rows.Count == 0) { MessageBox.Show("По отобранному значению ничего не найдено", "Нет строк", MessageBoxButton.OK, MessageBoxImage.Information); } return(dataTable : dataTable, findDescription : result.findDescription); }
private void FillComboBoxes() { var outgoingData = new List <(string field, string table, string comboBox)>(); var comboboxUnitData = (field : "Name_Of_Unit", table : "units", comboBox : "comboBoxUnit"); var comboboxGroupData = (field : "Name_Of_Group", table : "groups_of_material", comboBox : "comboBoxGroup"); var comboboxTypeData = (field : "Name_Of_Type", table : "types_of_material", comboBox : "comboBoxType"); var comboboxCountryData = (field : "Name_Of_Country", table : "countries", comboBox : "comboBoxCountry"); outgoingData.Add(comboboxUnitData); outgoingData.Add(comboboxGroupData); outgoingData.Add(comboboxTypeData); outgoingData.Add(comboboxCountryData); var receivedData = FormLoader.FillComboBoxes(outgoingData, connection); foreach (var data in receivedData) { var combobox = (System.Windows.Controls.ComboBox)FindName(data.Key); combobox.ItemsSource = data.Value; } connection.Close(); }
private void FillComboBoxes() { var outgoingData = new List <(string field, string table, string comboBox)>(); var comboboxTypeData = (field : "name_of_type", table : "types_of_order", comboBox : "comboBoxTypeOfOrder"); var comboboxStatusData = (field : "name_of_status", table : "statuses_of_order", comboBox : "comboBoxStatusOfOrder"); var comboboxCustomerData = (field : "nickname", table : "customers", comboBox : "comboBoxCustomer"); // Сделал плохо, надо без второго запроса var comboboxExecutorData = (field : "login", table : "employees", comboBox : "comboBoxExecutor"); var comboboxResponsibleData = (field : "login", table : "employees", comboBox : "comboBoxResponsible"); outgoingData.Add(comboboxTypeData); outgoingData.Add(comboboxStatusData); outgoingData.Add(comboboxCustomerData); outgoingData.Add(comboboxExecutorData); outgoingData.Add(comboboxResponsibleData); var receivedData = FormLoader.FillComboBoxes(outgoingData, connection); foreach (var data in receivedData) { var combobox = (ComboBox)FindName(data.Key); combobox.ItemsSource = data.Value; } }
public OrderRecordWindow(WaysToOpenForm.WaysToOpen waysToOpen, int id = -1) { order = new Order(); InitializeComponent(); way = waysToOpen; connection = new MySqlConnection(connectionString); idRecord = id; // При создании они не могут накинуть сразу и список изделий в заказ buttonListProducts.Visibility = (way == WaysToOpenForm.WaysToOpen.create) ? Visibility.Hidden : Visibility.Visible; // Заполнение шапки, полей даты Title = FormLoader.setNewTitle(way, Title); datePickerDateOfDelievery.Text = DateTime.Now.ToLongDateString(); datePickerDateOfOrder.Text = DateTime.Now.ToLongDateString(); FillComboBoxes(); if (idRecord != -1) { order = new Order(idRecord, connection); FillFields(); } }
protected override void EditItem() { int id = _list[RowIndex].BillId; FormLoader.LoadChildForm("NewBill", "New Bill", new object[] { id }); }
public override void OnClick(TreeView treeView) { FormLoader.LoadBoneEditor(this); }
protected override void EditItem() { int id = _list[RowIndex].MenuItemId; FormLoader.LoadChildForm("AddEditMenuItem", "Add/Edit Menu Item", new object[] { id }); }
protected override void NewItem() { FormLoader.LoadChildForm("AddEditMenuItem", "Add/Edit Menu Item"); }
public override void OnClick(TreeView treeView) { FormLoader.LoadEditor(this, Text); }