private void initVariables() { if (getuserPrivilegeStatus() == 1) { //user is only a viewer listOption = 6; } docID = Main.currentDocument; dtDocDate.Format = DateTimePickerFormat.Custom; dtDocDate.CustomFormat = "dd-MM-yyyy"; dtDocDate.Enabled = false; FinancialYearDB.fillFYIDCombo(cmbFYID); StoreEmpMappingDB.fillLocationComboNew(cmbStoreLocation); ////dtSMRNHeaderDate.Enabled = true; pnlUI.Controls.Add(pnlAddEdit); closeAllPanels(); setButtonVisibility("init"); }
private void ListStoreEmpMapping() { try { grdList.Rows.Clear(); StoreEmpMappingDB semDB = new StoreEmpMappingDB(); List <storeempmapping> SEMs = semDB.getStockEmpMapping(); foreach (storeempmapping sem in SEMs) { grdList.Rows.Add(sem.StoreLocationID, sem.Description, sem.EmployeeID, sem.EmployeeName, ComboFIll.getStatusString(sem.Status)); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } enableBottomButtons(); pnlDocumentList.Visible = true; }
private void btnSave_Click(object sender, EventArgs e) { try { storeempmapping sem = new storeempmapping(); StoreEmpMappingDB semDB = new StoreEmpMappingDB(); try { sem.StoreLocationID = ((Structures.ComboBoxItem)cmbStoreLocation.SelectedItem).HiddenValue; sem.Description = ((Structures.ComboBoxItem)cmbStoreLocation.SelectedItem).ToString(); //sem.StoreLocationID = cmbStoreLocation.SelectedItem.ToString().Trim().Substring(0, cmbStoreLocation.SelectedItem.ToString().Trim().IndexOf('-')); //sem.Description = cmbStoreLocation.SelectedItem.ToString().Trim().Substring(cmbStoreLocation.SelectedItem.ToString().Trim().IndexOf('-') + 1); sem.EmployeeName = cmbEmployee.SelectedItem.ToString().Trim().Substring(0, cmbEmployee.SelectedItem.ToString().Trim().IndexOf('-')); sem.EmployeeID = cmbEmployee.SelectedItem.ToString().Trim().Substring(cmbEmployee.SelectedItem.ToString().Trim().IndexOf('-') + 1); } catch (Exception) { sem.StoreLocationID = ""; sem.Description = ""; sem.EmployeeName = ""; sem.EmployeeID = ""; } sem.Status = ComboFIll.getStatusCode(cmbDocumentStatus.SelectedItem.ToString()); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btn.Text; { if (btnText.Equals("Update")) { if (semDB.updateStockEmpMapping(sem)) { MessageBox.Show("StoreEmpMapping Status updated"); closeAllPanels(); ListStoreEmpMapping(); } else { MessageBox.Show("Failed to update StoreEmpMapping Status"); } } else if (btnText.Equals("Save")) { if (semDB.validateDocument(sem)) { if (semDB.insertStockEmpMapping(sem)) { MessageBox.Show("StoreEmpMapping data Added"); closeAllPanels(); ListStoreEmpMapping(); } else { MessageBox.Show("Failed to Insert StoreEmpMapping"); } } else { MessageBox.Show("StoreEmpMapping Data Validation failed"); } } } } catch (Exception) { MessageBox.Show("Failed Adding / Editing StoreEmpMapping"); } }