private void ChooseAddress_Load(object sender, EventArgs e) { uxCBAisle.SelectedIndex = 0; uxCBShelf.SelectedIndex = 0; uxCBSubshelf.SelectedIndex = 0; try { dsPhysicalInventory = new DataSetPhysicalInventory(); cache.AddObject(CacheAddress.PhysicalInventoryData, dsPhysicalInventory); taWarehouseInventory = new WarehouseInventoryTableAdapter(); taWarehouseLocations = new WarehouseLocationsTableAdapter(); taPhysicalProgress = new PhysicalProgressTableAdapter(); taPhysicalProgressSummary = new PhysicalProgressSummaryTableAdapter(); taEmployee = new EmployeeTableAdapter(); cache.AddObject(CacheAddress.WarehouseInventoryTableAdapter, taWarehouseInventory); cache.AddObject(CacheAddress.WarehouseLocationsTableAdapter, taWarehouseLocations); cache.AddObject(CacheAddress.PhysicalProgressTableAdapter, taPhysicalProgress); cache.AddObject(CacheAddress.PhysicalProgressSummaryTableAdapter, taPhysicalProgressSummary); cache.AddObject(CacheAddress.EmployeeTableAdapter, taEmployee); cache.AddObject(CacheAddress.BeginPhysicalAisle, BeginPhysicalAisle); cache.AddObject(CacheAddress.BeginPhysicalShelf, BeginPhysicalShelf); cache.AddObject(CacheAddress.BeginPhysicalSubshelf, BeginPhysicalSubshelf); taWarehouseLocations.Fill(dsPhysicalInventory.WarehouseLocations); } catch (SqlException ex) { foreach (SqlError SQLErr in ex.Errors) { MessageBox.Show(SQLErr.Message); } } }
public void Login(string password) { try { using (var eta = new EmployeeTableAdapter()) { eta.Connection = new SqlConnection { ConnectionString = FXRFGlobals._eehConnectionString }; var edt = eta.GetEmployeeByPassword(password); switch (edt.Rows.Count) { case 1: OnRaiseSuccessfulLogin(new LogInArgs { OperatorCode = edt[0].operator_code, OperatorName = edt[0].name }); break; case 0: OnRaiseFailedLogin(new EventArgs()); throw new Exception("Invalid password."); default: OnRaiseFailedLogin(new EventArgs()); throw new Exception("Unknown error validating password."); } } } catch (Exception ex) { throw; } }
private void uxButtonContinuePhysical_Click(object sender, EventArgs e) { try { DataSetPhysicalInventory dsPhysicalInventory = (DataSetPhysicalInventory)cache.RetrieveObject(CacheAddress.PhysicalInventoryData); EmployeeTableAdapter taEmployee = (EmployeeTableAdapter)cache.RetrieveObject(CacheAddress.EmployeeTableAdapter); taEmployee.Fill(dsPhysicalInventory.Employee, uxTextBoxPassword.Text); string OperatorCode; Exception ex = null; switch (dsPhysicalInventory.Employee.Rows.Count) { case 1: OperatorCode = dsPhysicalInventory.Employee[0].OperatorCode; break; case 0: ex = new Exception("Invalid password."); uxTextBoxPassword.Focus(); throw ex; default: ex = new Exception("Unknown error validating password."); uxTextBoxPassword.Focus(); throw ex; } PhysicalProgressTableAdapter taPhysicalProgressTableAdapter = (PhysicalProgressTableAdapter)cache.RetrieveObject(CacheAddress.PhysicalProgressTableAdapter); BeginPhysicalAisle = uxCBAisle.Text; BeginPhysicalShelf = Int32.Parse(uxCBShelf.Text); BeginPhysicalSubshelf = Int32.Parse(uxCBSubshelf.Text); cache.RemoveObject(CacheAddress.BeginPhysicalAisle); cache.RemoveObject(CacheAddress.BeginPhysicalShelf); cache.RemoveObject(CacheAddress.BeginPhysicalSubshelf); cache.AddObject(CacheAddress.BeginPhysicalAisle, BeginPhysicalAisle); cache.AddObject(CacheAddress.BeginPhysicalShelf, BeginPhysicalShelf); cache.AddObject(CacheAddress.BeginPhysicalSubshelf, BeginPhysicalSubshelf); // Continue cycle count for specified address. taPhysicalProgressTableAdapter.Fill(dsPhysicalInventory.PhysicalProgress, BeginPhysicalAisle, BeginPhysicalShelf, BeginPhysicalSubshelf); cache.AddObject(CacheAddress.PhysicalInventoryData, dsPhysicalInventory); Application.Run(new frmScanToLocation()); } catch (SqlException ex) { foreach (SqlError SQLErr in ex.Errors) { MessageBox.Show(SQLErr.Message); } } catch (Exception ex) { // Getting exception when loading frmScanToLocation. //MessageBox.Show (ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { EmployeeTableAdapter employeeDataSetTableAdapters = new EmployeeTableAdapter(); EmployeeDataSet.EmployeeDataTable eds = new EmployeeDataSet.EmployeeDataTable(); employeeDataSetTableAdapters.Fill(eds); gvEmployee.DataSource = eds; gvEmployee.DataBind(); }
/// <summary> /// / /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmAddNewApp_Load(object sender, EventArgs e) { //this.cleanSDataset.EnforceConstraints = false; ViewEmpPerContract = new ViewEmpPerContractTableAdapter(); employeeTableAdapter = new EmployeeTableAdapter(); this.contractTableAdapter.Fill(this.cleanSDataset.Contract); this.customerTableAdapter.Fill(this.cleanSDataset.Customer); }
public void deleteEmployee(int accCode) { using (EmployeeTableAdapter employeeTableAdapter = new EmployeeTableAdapter()) { try { employeeTableAdapter.Delete(new int?(accCode)); } catch (Exception exception) { throw new Exception(string.Concat("unable to delete employee. ", exception.Message)); } } }
public void insertEmployee(string name, string nation, long?id, long?phone, string address, int accCode, string role, decimal balance) { using (EmployeeTableAdapter employeeTableAdapter = new EmployeeTableAdapter()) { try { employeeTableAdapter.Insert(name, nation, id, address, phone, new int?(accCode), role, new decimal?(balance)); } catch (Exception exception) { throw new Exception(string.Concat("Error inserting employee. ", exception.Message)); } } }
public void updateEmployee(string name, string nation, long?id, long?phone, string address, int accCode, int oldAcc, string role, int EmID) { using (EmployeeTableAdapter employeeTableAdapter = new EmployeeTableAdapter()) { try { employeeTableAdapter.Update(new int?(EmID), name, nation, id, address, phone, new int?(accCode), new int?(oldAcc), role); } catch (Exception exception) { throw new Exception(string.Concat("Error updating employee. ", exception.Message)); } } }
private void UxButtonContinuePhysicalClick(object sender, EventArgs e) { try { using (var taEmployee = new EmployeeTableAdapter()) { var employeeDT = taEmployee.GetOperatorCodeByPassword(uxTextBoxPassword.Text); switch (employeeDT.Rows.Count) { case 1: _operatorCode = employeeDT[0].OperatorCode; break; case 0: uxTextBoxPassword.Focus(); throw new Exception("Invalid password."); default: uxTextBoxPassword.Focus(); throw new Exception("Unknown error validating password."); } } _rack = RackSelection.Text; _shelf = ShelfSelection.Text; _position = PositionSelection.Text; var scanningView = new ScanToLocationView { Plant = _plant, OperatorCode = _operatorCode, BeginPhysicalRack = _rack, BeginPhysicalShelf = _shelf, BeginPhysicalPosition = _position }; scanningView.Show(); } catch (SqlException ex) { foreach (SqlError sqlErr in ex.Errors) { MessageBox.Show(sqlErr.Message); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public EmployeeDataTable getEmployee() { EmployeeDataTable data; using (EmployeeTableAdapter employeeTableAdapter = new EmployeeTableAdapter()) { try { data = employeeTableAdapter.GetData(); } catch (Exception exception) { throw new Exception(string.Concat("unable to get employees. ", exception.Message)); } } return(data); }
public int getNextCode() { int num1; int num2; int num3; using (EmployeeTableAdapter employeeTableAdapter = new EmployeeTableAdapter()) { try { int num4 = Convert.ToInt32(employeeTableAdapter.getLastEmployee()); if (num4 == 0) { num3 = 241; } else { if (num4 < 1000) { num1 = num4 % 10; num2 = Convert.ToInt32(num4 / 10); } else { if (num4 < 10000) { num1 = num4 % 100; num2 = Convert.ToInt32(num4 / 100); } else { num1 = num4 % 1000; num2 = Convert.ToInt32(num4 / 1000); } } num3 = Convert.ToInt32(string.Concat(int num5 = num1 + 1, num5.ToString())); throw new Exception(string.Concat("Could not get the next Code. ", exception.Message)); } } catch (Exception exception) { } } return(num3); }
protected void btnSearch_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtSearch.Text.Trim())) { EmployeeTableAdapter employeeDataSetTableAdapters = new EmployeeTableAdapter(); EmployeeDataSet.EmployeeDataTable eds = new EmployeeDataSet.EmployeeDataTable(); employeeDataSetTableAdapters.Fill(eds); gvEmployee.DataSource = from dr in eds where dr.FirstName.Contains(txtSearch.Text) || dr.LastName.Contains(txtSearch.Text) select new { dr.LastName, dr.FirstName }; gvEmployee.DataBind(); } else { EmployeeTableAdapter employeeDataSetTableAdapters = new EmployeeTableAdapter(); EmployeeDataSet.EmployeeDataTable eds = new EmployeeDataSet.EmployeeDataTable(); employeeDataSetTableAdapters.Fill(eds); gvEmployee.DataSource = eds; gvEmployee.DataBind(); } }
private void UxButtonBeginPhysicalClick(object sender, EventArgs e) { try { using (var taEmployee = new EmployeeTableAdapter()) { var employeeDT = taEmployee.GetOperatorCodeByPassword(uxTextBoxPassword.Text); switch (employeeDT.Rows.Count) { case 1: _operatorCode = employeeDT[0].OperatorCode; break; case 0: uxTextBoxPassword.Focus(); throw new Exception("Invalid password."); default: uxTextBoxPassword.Focus(); throw new Exception("Unknown error validating password."); } } using (var taPhysicalProgressTableAdapter = new PhysicalProgressTableAdapter()) { _rack = RackSelection.Text; _shelf = ShelfSelection.Text; _position = PositionSelection.Text; // Validate before continuing. string validationMessage = _operatorCode + " will initiate a cycle count on aisle " + _rack; if (string.IsNullOrEmpty(_shelf)) { validationMessage += " all shelves and"; } else { validationMessage += string.Format(" shelf {0} and", _shelf); } if (string.IsNullOrEmpty(_position)) { validationMessage += " all positions."; } else { validationMessage += string.Format(" position {0}.", _position); } if (MessageBox.Show(validationMessage, "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) { RackSelection.Focus(); throw new Exception("Operation cancelled."); } // Begin cycle count for specified address. DateTime?tranDT = null; Int32? result = null; taPhysicalProgressTableAdapter.BeginPhysical(_operatorCode, _plant, _rack, _shelf, _position, ref tranDT, ref result); } var scanningView = new ScanToLocationView { Plant = _plant, OperatorCode = _operatorCode, BeginPhysicalRack = _rack, BeginPhysicalShelf = _shelf, BeginPhysicalPosition = _position }; scanningView.Show(); } catch (SqlException ex) { foreach (SqlError sqlErr in ex.Errors) { MessageBox.Show(sqlErr.Message); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FillGrid(object value) { dataSet1.Tables[0].Clear(); dataSet1.Tables[0].AcceptChanges(); gridControl1.RefreshDataSource(); if (ViewEmpPerContract == null) { ViewEmpPerContract = new ViewEmpPerContractTableAdapter(); } if (employeeTableAdapter == null) { employeeTableAdapter = new EmployeeTableAdapter(); } ViewEmpPerContract.Fill(this.cleanSDataset.ViewEmpPerContract); employeeTableAdapter.Fill(this.cleanSDataset.Employee); if (this.cleanSDataset.ViewEmpPerContract.Count > 0) { DataView dv = new DataView(cleanSDataset.ViewEmpPerContract) { RowFilter = "IdContract=" + value }; if (dv.Count > 0) { dataSet1.Tables[0].Clear(); dataSet1.Tables[0].AcceptChanges(); foreach (DataRowView rowView in dv) { var row = dataSet1.Tables[0].NewRow(); row[0] = true; row[1] = rowView["FirstName"]; row[2] = rowView["LastName"]; row["Id"] = rowView["IdEmployee"]; dataSet1.Tables[0].Rows.Add(row); } dataSet1.Tables[0].AcceptChanges(); } foreach (var rowEmp in this.cleanSDataset.Employee) { var dataView = new DataView(dataSet1.Tables[0]) { RowFilter = "id=" + rowEmp["IdEmployee"] }; if (dataView.Count == 0) { var row = dataSet1.Tables[0].NewRow(); row[0] = false; row[1] = rowEmp["FirstName"]; row[2] = rowEmp["LastName"]; row["Id"] = rowEmp["IdEmployee"]; dataSet1.Tables[0].Rows.Add(row); dataSet1.Tables[0].AcceptChanges(); } } } }
private void frmScanToLocation_Load(object sender, EventArgs e) { try { MyRFGun = new SymbolRFGun.SymbolRFGun(); MyRFGun.RFScan += new RFScanEventHandler(MyRFGun_RFScan); } catch (SymbolRFGunException ex) { MessageBox.Show(ex.Message); this.Close(); } try { //Select Device from device list Symbol.Audio.Device MyDevice = (Symbol.Audio.Device)Symbol.StandardForms.SelectDevice.Select( Symbol.Audio.Controller.Title, Symbol.Audio.Device.AvailableDevices); if (MyDevice == null) { MessageBox.Show("No Device Selected", "SelectDevice"); //close the form this.Close(); return; } //check the device type switch (MyDevice.AudioType) { //if standard device case Symbol.Audio.AudioType.StandardAudio: MyAudioController = new Symbol.Audio.StandardAudio(MyDevice); break; //if simulated device case Symbol.Audio.AudioType.SimulatedAudio: MyAudioController = new Symbol.Audio.SimulatedAudio(MyDevice); break; default: throw new Symbol.Exceptions.InvalidDataTypeException("Unknown Device Type"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } try { Exception ex = null; dsPhysicalInventory = (DataSetPhysicalInventory)cache.RetrieveObject(CacheAddress.PhysicalInventoryData); taEmployee = (EmployeeTableAdapter)cache.RetrieveObject(CacheAddress.EmployeeTableAdapter); taPhysicalProgress = (PhysicalProgressTableAdapter)cache.RetrieveObject(CacheAddress.PhysicalProgressTableAdapter); taPhysicalProgressSummary = (PhysicalProgressSummaryTableAdapter)cache.RetrieveObject(CacheAddress.PhysicalProgressSummaryTableAdapter); taWarehouseInventory = (WarehouseInventoryTableAdapter)cache.RetrieveObject(CacheAddress.WarehouseInventoryTableAdapter); switch (dsPhysicalInventory.Employee.Rows.Count) { case 1: OperatorCode = dsPhysicalInventory.Employee[0].OperatorCode; uxLabelOperatorCode.Text = OperatorCode; break; case 0: ex = new Exception("Invalid password."); throw ex; default: ex = new Exception("Unknown error validating password."); throw ex; } PutAwayAisle = (string)cache.RetrieveObject(CacheAddress.BeginPhysicalAisle); BeginPhysicalShelf = (Int32)cache.RetrieveObject(CacheAddress.BeginPhysicalShelf); BeginPhysicalSubshelf = (Int32)cache.RetrieveObject(CacheAddress.BeginPhysicalSubshelf); uxCBAisle.Items.Add(PutAwayAisle); uxCBAisle.SelectedIndex = 0; if (BeginPhysicalShelf == 0) { uxCBShelf.Items.Add("1"); uxCBShelf.Items.Add("2"); uxCBShelf.Items.Add("3"); uxCBShelf.Items.Add("4"); PutAwayShelf = 1; } else { uxCBShelf.Items.Add(BeginPhysicalShelf.ToString()); PutAwayShelf = BeginPhysicalShelf; } uxCBShelf.SelectedIndex = 0; if (BeginPhysicalSubshelf == 0) { uxCBSubshelf.Items.Add("1"); uxCBSubshelf.Items.Add("2"); uxCBSubshelf.Items.Add("3"); uxCBSubshelf.Items.Add("4"); uxCBSubshelf.Items.Add("5"); uxCBSubshelf.Items.Add("6"); uxCBSubshelf.Items.Add("7"); uxCBSubshelf.Items.Add("8"); uxCBSubshelf.Items.Add("9"); uxCBSubshelf.Items.Add("10"); uxCBSubshelf.Items.Add("11"); uxCBSubshelf.Items.Add("12"); PutAwaySubshelf = 1; } else { uxCBSubshelf.Items.Add(BeginPhysicalSubshelf.ToString()); PutAwaySubshelf = BeginPhysicalSubshelf; } uxCBSubshelf.SelectedIndex = 0; RefreshProgress(); } catch (SqlException ex) { foreach (SqlError SQLErr in ex.Errors) { MessageBox.Show(SQLErr.Message); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void uxButtonBeginPhysical_Click(object sender, EventArgs e) { try { DataSetPhysicalInventory dsPhysicalInventory = (DataSetPhysicalInventory)cache.RetrieveObject(CacheAddress.PhysicalInventoryData); EmployeeTableAdapter taEmployee = (EmployeeTableAdapter)cache.RetrieveObject(CacheAddress.EmployeeTableAdapter); taEmployee.Fill(dsPhysicalInventory.Employee, uxTextBoxPassword.Text); string OperatorCode; Exception ex = null; switch (dsPhysicalInventory.Employee.Rows.Count) { case 1: OperatorCode = dsPhysicalInventory.Employee [0].OperatorCode; break; case 0: ex = new Exception("Invalid password."); uxTextBoxPassword.Focus(); throw ex; default: ex = new Exception("Unknown error validating password."); uxTextBoxPassword.Focus(); throw ex; } PhysicalProgressTableAdapter taPhysicalProgressTableAdapter = (PhysicalProgressTableAdapter)cache.RetrieveObject(CacheAddress.PhysicalProgressTableAdapter); BeginPhysicalAisle = uxCBAisle.Text; BeginPhysicalShelf = Int32.Parse(uxCBShelf.Text); BeginPhysicalSubshelf = Int32.Parse(uxCBSubshelf.Text); // Validate before continuing. string ValidationMessage = OperatorCode + " will initiate a cycle count on aisle " + BeginPhysicalAisle; if (BeginPhysicalShelf == 0) { ValidationMessage += " all shelves and"; } else { ValidationMessage += " shelf " + BeginPhysicalShelf.ToString() + " and"; } if (BeginPhysicalSubshelf == 0) { ValidationMessage += " all positions."; } else { ValidationMessage += " position " + BeginPhysicalSubshelf.ToString() + "."; } if (MessageBox.Show(ValidationMessage, "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) { ex = new Exception("Operation cancelled."); uxCBAisle.Focus(); throw ex; } cache.RemoveObject(CacheAddress.BeginPhysicalAisle); cache.RemoveObject(CacheAddress.BeginPhysicalShelf); cache.RemoveObject(CacheAddress.BeginPhysicalSubshelf); cache.AddObject(CacheAddress.BeginPhysicalAisle, BeginPhysicalAisle); cache.AddObject(CacheAddress.BeginPhysicalShelf, BeginPhysicalShelf); cache.AddObject(CacheAddress.BeginPhysicalSubshelf, BeginPhysicalSubshelf); // Begin cycle count for specified address. Int32 Result; taPhysicalProgressTableAdapter.BeginPhysical_ByAddress(OperatorCode, BeginPhysicalAisle, BeginPhysicalShelf, BeginPhysicalSubshelf, out Result); taPhysicalProgressTableAdapter.Fill(dsPhysicalInventory.PhysicalProgress, BeginPhysicalAisle, BeginPhysicalShelf, BeginPhysicalSubshelf); cache.AddObject(CacheAddress.PhysicalInventoryData, dsPhysicalInventory); Application.Run(new frmScanToLocation()); } catch (SqlException ex) { foreach (SqlError SQLErr in ex.Errors) { MessageBox.Show(SQLErr.Message); } } catch (Exception ex) { // Getting exception when loading frmScanToLocation. //MessageBox.Show (ex.Message); } }