private void FrmAddEditItem_Load(object sender, EventArgs e) { if (measurements == null) { measurements = LoadMeasurementList(); } // Fill Combo box Helpers.DataHelper helper = new Helpers.DataHelper(); var dataList = measurements.Select(x => new DropDown() { Name = x.MeasurmentName, Value = x.MeasurmentId.ToString() }).ToList(); dataList.Insert(0, new DropDown() { Name = "-- Select --", Value = (0).ToString() }); helper.FillCombo(cmbMeasurement, dataList); if (_model != null) { toggleProcess.Checked = !String.IsNullOrEmpty(_model.PFlag) && _model.PFlag.ToLower() == "p" ? true : false; txtItemName.Text = _model.ItemName; cmbMeasurement.SelectedIndex = dataList.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.MeasurmentId.ToString()).Select(x => x.index).FirstOrDefault(); toggleActive.Checked = _model.IsActive; } ConfigureStyling(); }
private void FrmAddEditAccount_Load(object sender, EventArgs e) { reciever = new ExpencesReciever(); // Fill Combo box Helpers.DataHelper helper = new Helpers.DataHelper(); _accountTypes = _accountTypes.GroupBy(x => x.Option_Name).Select(x => x.FirstOrDefault()); var dataList = _accountTypes.Select(x => new DropDown() { Name = x.Option_Type, Value = x.Option_Name.ToString() }).ToList(); dataList.Insert(0, new DropDown() { Name = "-- Select --", Value = (0).ToString() }); helper.FillCombo(cmbMainAccount, dataList); if (_model != null) { cmbMainAccount.SelectedIndex = dataList.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.Option_Name.ToString()).Select(x => x.index).FirstOrDefault(); txtAccountType.Text = _model.Expences_Name; toggleActive.Checked = _model.IsActive; } else { _model = new ExpencesModel(); } }
private void FrmAddEditRoot_Load(object sender, EventArgs e) { ConfigureStyle(); reciever = new RootReciever(); var sources = reciever.GetSources(); // Fill Combo box Helpers.DataHelper helper = new Helpers.DataHelper(); var sourceList = sources.Select(x => new DropDown() { Name = x.SourceName, Value = x.SourceId.ToString() }).ToList(); sourceList.Insert(0, new DropDown() { Name = "-- Select --", Value = (0).ToString() }); helper.FillCombo(cmbSource, sourceList); if (_model != null) { var destinationList = GetDestinationList(_model.Source.ToString()); helper.FillCombo(cmbDestination, destinationList); txtRoot.Text = string.Format("{0} To {1}", _model.DestinationName, _model.SourceName); cmbSource.SelectedIndex = sourceList.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.Source.ToString()).Select(x => x.index).FirstOrDefault(); cmbDestination.SelectedIndex = destinationList.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.DestinationId.ToString()).Select(x => x.index).FirstOrDefault(); toggleActive.Checked = _model.IsCheck; } else { _model = new RootModel(); cmbSource.SelectedIndex = 0; cmbDestination.SelectedIndex = 0; } }
private void FrmAddEditVechile_Load(object sender, EventArgs e) { ConfigureStyle(); // Fill Combo box TransportationReciever transportReciever = new TransportationReciever(); var transportations = transportReciever.GetList(); Helpers.DataHelper helper = new Helpers.DataHelper(); var dataList = transportations.Select(x => new DropDown() { Name = x.Transportation_Name, Value = x.Transportation_Id.ToString() }).ToList(); dataList.Insert(0, new DropDown() { Name = "-- Select --", Value = (0).ToString() }); helper.FillCombo(cmbTransportation, dataList); if (_model != null) { txtEmployeName.Text = _model.Employee_Name; txtMobile.Text = _model.Contact; txtVechileNo.Text = _model.Vehical_No; cmbTransportation.SelectedIndex = dataList.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.Transportation_ID.ToString()).Select(x => x.index).FirstOrDefault(); txtAdress.Text = _model.Employee_Address; txtDescription.Text = _model.Description; toggleActive.Checked = _model.Is_Active; } else { _model = new VehicleModel(); cmbTransportation.SelectedIndex = 0; } }
private void FrmAddEditSubAccount_Load(object sender, EventArgs e) { try { reciever = new SubExpencesReciever(); helper = new Helpers.DataHelper(); // Fill Main account type combo var mainAccount = _subExpencesList.GroupBy(x => x.Option_Name).Select(x => x.FirstOrDefault()); helper.FillCombo(cmbMainAccount, GetMainAccountList(mainAccount)); if (_model != null) { PopulateAccountType(_model.Expences_ID.ToString()); txtSubAccountType.Text = _model.SubExpences_Name; cmbMainAccount.SelectedIndex = GetMainAccountList(mainAccount).Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.Option_Name).Select(x => x.index).FirstOrDefault(); cmbAccountType.SelectedIndex = GetAccountTypeList(_model.Option_Name).Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.Expences_ID.ToString()).Select(x => x.index).FirstOrDefault(); toggleActive.Checked = _model.IsActive; } else { _model = new SubExpencesModel(); cmbMainAccount.SelectedIndex = 0; cmbAccountType.SelectedIndex = 0; } } catch (Exception ex) { } }
private void FrmAddEditUser_Load(object sender, EventArgs e) { reciever = new UserReciever(); // Fill Combo box Helpers.DataHelper helper = new Helpers.DataHelper(); var dataList = GetGroup().Select(x => new DropDown() { Name = x.GroupName, Value = x.GroupId.ToString() }).ToList(); dataList.Insert(0, new DropDown() { Name = "-- Select --", Value = (0).ToString() }); helper.FillCombo(cmbGroupType, dataList); if (_model != null) { cmbGroupType.SelectedIndex = dataList.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.GroupId.ToString()).Select(x => x.index).FirstOrDefault(); txtUserName.Text = _model.UserName; txtPassword.Text = _model.Password; txtConfirmPassword.Text = _model.Password; } else { _model = new UserModel(); cmbGroupType.SelectedIndex = 0; } }
private void FrmAddEditRowMaterial_Load(object sender, EventArgs e) { receiver = new RowMaterialReciever(); ConfigureStyle(); var headers = GetRowHeaders(); var measurements = GetMeasurements(); // Fill Combo Helpers.DataHelper helper = new Helpers.DataHelper(); helper.FillCombo(cmbRowHeaderName, headers); helper.FillCombo(cmbMeasurement, measurements); if (_model != null) { txtRowMaterial.Text = _model.RowMaterialName; cmbRowHeaderName.SelectedIndex = headers.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.RowHedarId.ToString()).Select(x => x.index).FirstOrDefault(); cmbMeasurement.SelectedIndex = measurements.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.MeasurmentId.ToString()).Select(x => x.index).FirstOrDefault(); toggleActive.Checked = _model.IsActive; } else { _model = new RowMaterialModel(); cmbRowHeaderName.SelectedIndex = 0; cmbMeasurement.SelectedIndex = 0; } }
private void cmbSource_SelectedIndexChanged(object sender, EventArgs e) { Helpers.DataHelper helper = new Helpers.DataHelper(); ComboBox combo = (ComboBox)sender; var selectedItem = (DropDown)combo.SelectedItem; helper.FillCombo(cmbDestination, GetDestinationList(selectedItem.Value)); cmbDestination.SelectedIndex = 0; }
private void FrmSalesTransport_Load(object sender, EventArgs e) { vehicleReciever = new VehicleReciever(); transportReciever = new TransportationReciever(); helper = new Helpers.DataHelper(); // Fill transportation list helper.FillCombo(cmbTransport, GetTransports()); FillVehicleList(); if (_model != null) { cmbTransport.SelectedIndex = GetTransports().Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.TransportationID.ToString()).Select(x => x.index).FirstOrDefault(); if (_model.TVehicleNumberID > 0) { cmbVehicleNumber.SelectedIndex = GetVehicles().Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.TVehicleNumberID.ToString()).Select(x => x.index).FirstOrDefault(); } txtDriverName.Text = _model.TEmployeeName; txtDriverMobNumber.Text = _model.TEmployeeMobNumber; } }
private void LoadSales() { Helpers.DataHelper helper = new Helpers.DataHelper(); salesReciever = new SalesInvoiceReciever(); //Fill customers if (customers == null) { Logger.Info("Retrieving customers"); customers = salesReciever.GetCustomers(); Logger.Info("Retrieving customers success."); } var customerDataList = customers.Select(x => new DropDown { Name = x.Comp_Name, Value = x.Customer_Id.ToString() }).ToList(); customerDataList.Insert(0, new DropDown { Name = "--Select--", Value = "0" }); helper.FillCombo(cmbFirmName, customerDataList); cmbFirmName.SelectedIndex = 0; Logger.Info("Customers list fill success."); //Fill Items Logger.Info("Retrieving Items"); var items = salesReciever.GetItems(); Logger.Info("Retrieving Items success."); var itemDataList = items.Select(x => new DropDown { Name = x.ItemName, Value = x.ItemId.ToString() }).ToList(); itemDataList.Insert(0, new DropDown { Name = "--Select--", Value = "0" }); helper.FillCombo(cmbAddItem, itemDataList); cmbAddItem.SelectedIndex = 0; Logger.Info("Items list fill success."); txtInvoiceNo.Text = salesReciever.GetInvoiceNumber(); Logger.Info(string.Format("Retrieved Invoice number {0}", txtInvoiceNo.Text)); }
private void LoadPurchase() { Helpers.DataHelper helper = new Helpers.DataHelper(); purchaseReciever = new PurchaseInvoiceReciever(); if (suppliers == null) { Logger.Info("Retrieving suppliers."); suppliers = purchaseReciever.GetSuppliers(); Logger.Info("Retrieving suppliers success."); } var supplierList = suppliers.Select(x => new DropDown { Name = x.Comp_Name, Value = x.Supplier_Id.ToString() }).ToList(); supplierList.Insert(0, new DropDown() { Name = "--Select--", Value = 0.ToString() }); helper.FillCombo(cmbFirmName, supplierList); cmbFirmName.SelectedIndex = 0; Logger.Info("Retrieving items."); var items = purchaseReciever.GetItems(); Logger.Info("Retrieving items success."); var itemsList = items.Select(x => new DropDown { Name = x.RowMaterialName, Value = x.RowMaterialId.ToString() }).ToList(); itemsList.Insert(0, new DropDown() { Name = "--Select--", Value = 0.ToString() }); helper.FillCombo(cmbAddItem, itemsList); cmbAddItem.SelectedIndex = 0; }