//Gets the value from MasterColumn then assign it to controls such as textbox private void AssignValuesToControls() { if (VMasterDataTable.Rows.Count > 0) { foreach (JkMasterColumn column in MasterColumns) { column.Value = VMasterDataTable.Rows[0][column.Name]; if (!String.IsNullOrWhiteSpace(column.ControlName)) { IAppHandler.SetControlsValue(Controls.Find(column.ControlName, true).First(), column.Value); } } } }
//Gets the default value set from MasterColumn then assign it to controls upon creating new transaction private void AssignControlsDefaultValue() { Control control; foreach (JkMasterColumn column in MasterColumns) { column.Value = null; if (!String.IsNullOrWhiteSpace(column.ControlName)) { control = Controls.Find(column.ControlName, true).First(); if (String.IsNullOrWhiteSpace(column.DefaultValue)) { IAppHandler.ClearControlsValue(control); } else { IAppHandler.SetControlsValue(control, IAppHandler.ConvertMaskValue(column.DefaultValue)); } } } }
private void InitSeriesProviders() { if (FormState == FormStates.fsNew) { foreach (Control control in IAppHandler.FindControlByType("JkSeriesProvider", this)) { JkSeriesProvider series = (control as JkSeriesProvider); series.ConnectionString = Properties.Settings.Default.FreeAccountingSoftwareConnectionString; series.CompanyId = ISecurityHandler.CompanyId.ToString(); series.GetSeries(); foreach (JkMasterColumn column in MasterColumns) { if (column.Name == series.TransactionColumn && !String.IsNullOrWhiteSpace(column.ControlName)) { IAppHandler.SetControlsValue(Controls.Find(column.ControlName, true).First(), series.Value); } } } } }