private void CurrentUserTextBox_MouseDoubleClick(object sender, MouseEventArgs e) { if (editMode) { MunisUser = new MunisEmployee(); } }
/// <summary> /// Queries the database for a list of results that contains the employee name result and computed Levenshtein distance to the search string. /// </summary> /// <param name="tableName"></param> /// <param name="searchEmpName"></param> /// <param name="empNameColumn"></param> /// <param name="empNumColumn"></param> /// <returns></returns> private static List <SmartEmpSearchInfo> GetEmpSearchResults(string tableName, string searchEmpName, string empNameColumn, string empNumColumn) { var tmpResults = new List <SmartEmpSearchInfo>(); var searchParams = new QueryParamCollection(); // Parameterize the input. searchParams.Add(empNameColumn, searchEmpName, false); // Query the DB for the search value. using (DataTable data = DBFactory.GetDatabase().DataTableFromParameters("SELECT * FROM " + tableName + " WHERE", searchParams.Parameters)) { foreach (DataRow row in data.Rows) { var searchValue = searchEmpName.ToUpper(); var dbValue = row[empNameColumn].ToString().ToUpper(); // Get the distance between the search value and DB value. var distance = Fastenshtein.Levenshtein.Distance(searchValue, dbValue); var employee = new MunisEmployee(row[empNameColumn].ToString(), row[empNumColumn].ToString()); // Add new entry to the list. tmpResults.Add(new SmartEmpSearchInfo(employee, searchEmpName, distance)); } } return(tmpResults); }
private void MunisSearchButton_Click(object sender, EventArgs e) { MunisUser = MunisFunctions.MunisUserSearch(this); if (!string.IsNullOrEmpty(MunisUser.Number)) { CurrentUserTextBox.Text = MunisUser.Name; CurrentUserTextBox.ReadOnly = true; } }
private void ClearAll() { RefreshCombos(); MunisUser = new MunisEmployee(); ClearFields(this); PurchaseDatePicker.Value = DateTime.Now; StatusComboBox.SetSelectedAttribute(Attributes.DeviceAttributes.StatusType["INSRV"]); TrackableCheckBox.Checked = false; NoClearCheckBox.Checked = false; controlParser.ClearErrors(); }
public void ImportFromSibi(string itemGuid) { string itemQuery = Queries.SelectSibiRequestAndItemByItemGuid(itemGuid); DateTime POPurchaseDate = default(DateTime); using (var results = DBFactory.GetDatabase().DataTableFromQueryString(itemQuery)) { controlParser.DisableFields(); controlParser.FillDBFields(results, ImportColumnRemaps()); MunisUser = LevenshteinSearch.SmartEmployeeSearch(results.Rows[0][SibiRequestItemsCols.User].ToString().ToUpper()); POPurchaseDate = MunisFunctions.GetPODate(results.Rows[0][SibiRequestCols.PO].ToString()); } CurrentUserTextBox.Text = MunisUser.Name; CheckFields(); PurchaseDatePicker.Value = POPurchaseDate; controlParser.EnableFields(); }
public static void AddNewEmp(MunisEmployee empInfo) { try { if (!IsEmployeeInDB(empInfo.Number)) { string newGuid = Guid.NewGuid().ToString(); ParamCollection insertParams = new ParamCollection(); insertParams.Add(EmployeesCols.Name, empInfo.Name); insertParams.Add(EmployeesCols.Number, empInfo.Number); insertParams.Add(EmployeesCols.Guid, newGuid); DBFactory.GetDatabase().InsertFromParameters(EmployeesCols.TableName, insertParams.Parameters); } } catch (Exception ex) { ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod()); } }
private void LoadHistoryAndFields() { using (var historicalResults = GetHistoricalTable(currentViewDevice.Guid)) { currentHash = GetHash(currentViewDevice.PopulatingTable, historicalResults); controlParser.FillDBFields(currentViewDevice.PopulatingTable); MunisUser = new MunisEmployee(currentViewDevice.CurrentUser, currentViewDevice.CurrentUserEmpNum); SetMunisEmpStatus(); DataGridHistory.SuspendLayout(); DataGridHistory.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; DataGridHistory.ColumnHeadersHeight = 38; DataGridHistory.Populate(historicalResults, HistoricalGridColumns()); DataGridHistory.FastAutoSizeColumns(); DataGridHistory.ResumeLayout(); UpdateAttachCountHandler(this, new EventArgs()); SetADInfo(); RemoteToolsControl.Device = currentViewDevice; } }
private void MunisSearchButton_Click(object sender, EventArgs e) { MunisUser = MunisFunctions.MunisUserSearch(this); }
private void CurrentUserTextBox_DoubleClick(object sender, EventArgs e) { CurrentUserTextBox.ReadOnly = false; MunisUser = new MunisEmployee(); CurrentUserTextBox.SelectAll(); }