internal void Init(DataTable TableProductCategory, FormCategories formCategories, PriceModel model) { //model.categories = new List<Category>(); //foreach (var item in TableProductCategory.AsEnumerable()) //{ // model.categories.Add(new Category // { // pc_id = Convert.ToInt32(item.ItemArray[0]), // pc_parent_id = Convert.ToInt32(item.ItemArray[1]), // pc_name = Convert.ToString(item.ItemArray[2]), // pc_description = Convert.ToString(item.ItemArray[8]) // }); //} categoryCharge = model.categoryCharge; formCategories.TreeViewCategories.Nodes.Clear(); var RootCategories = model.categories.Where(x => x.pc_parent_id == 0).ToList(); foreach (Category category in RootCategories) { // Root Nodes TreeNode node = null; //node = treeViewCategories.Nodes.Add(category.pc_id.ToString(), category.pc_name); this.categoryChargeID = category.pc_id; draw(model.categories, category, node, formCategories); } }
public void Init(ref PriceModel priceModel) { this.priceModel = priceModel; this.textBoxDatabase.Text = this.priceModel.StrDatabase; this.textBoxPassword.Text = this.priceModel.StrPassword; this.textBoxPort.Text = this.priceModel.StrPort; this.textBoxServer.Text = this.priceModel.StrServer; this.textBoxUserID.Text = this.priceModel.StrUserId; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); FormSetDatabase formSetDatabase = new FormSetDatabase(); PriceModel pm = new PriceModel(); formSetDatabase.Init(ref pm); formSetDatabase.StartPosition = FormStartPosition.CenterScreen; DialogResult dr = formSetDatabase.ShowDialog(); pm = null; if (dr == DialogResult.OK) Application.Run(new PriceUploader()); else Application.Exit(); }
public void OpenCategoriesWindow(DataTable TableProductCategory, PriceModel model) { FormCategories formCategories = new FormCategories(); formCategories.Init(TableProductCategory); //formCategories.ShowDialog(); }
public void Init() { Model = new PriceModel(); string appPath = Application.ExecutablePath; Model.InsertDataError += Model_InsertDataError; Model.OnAddRow += Model_OnAddRow; Model.OnSaveAll += Model_OnSaveAll; Model.LoadCurrency(); DateTime d1 = DateTime.Now; ReceiveData.instance.OnLoaded += new ReceiveData.OnLoadedEventHandler(instance_OnLoaded); ReceiveData.instance.BegQuery(); Model.Load_import_settings().ContinueWith(res => { SetDataTableByRows(res, TABLE_IMPORT_SETTINGS); SetDataBindings(); SetFormatComboBox(res); ReceiveData.instance.EndQuery(); }); LoadData(true); DateTime d2 = DateTime.Now; TimeSpan timeout = d2 - d1; FillComboBoxes(); comboBoxImportCurrency.SelectedIndex = 0; SetGridLayout(); //dataGrid_import_excel.Columns["isChecked"].ReadOnly = false; Debug.WriteLine("time data loaded: " + timeout.ToString()); return; }