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(); }
public static void Init() { EmployeeTableAdapter.Fill(Data.Employee); MenuTableAdapter.Fill(Data.Menu); MemberTableAdapter.Fill(Data.Member); PackageTableAdapter.Fill(Data.Package); OrderTableAdapter.Fill(Data.Order); DetailMenuTableAdapter.Fill(Data.DetailMenu); DetailPackageTableAdapter.Fill(Data.DetailPackage); GenerateCommands(EmployeeBuilder); GenerateCommands(MenuBuilder); GenerateCommands(PackageCommandBuilder); GenerateCommands(MemberBuilder); GenerateCommands(OrderBuilder); GenerateCommands(DetailMenuBuilder); GenerateCommands(DetailPackageBuilder); }
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 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 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); } }
/// <summary> /// Обновить данные таблицы "Сотрудники" /// </summary> public static void UpdateTableEmpoyee() { _empoyeeTableAdapter.Fill(TestDB_WCF.Employee); }