private void gridProducts_CellClick(object sender, DataGridViewCellEventArgs e) { try { var grid = gridProductLogs; if (grid.SelectedRows.Count > 0) { var id = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString()); if (id != 0) { //var model = Factories.CreateProducts().Get(_productID); } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception ex) { //LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
public void Edit() { try { if (gridList.SelectedRows.Count > 0) { // get id id = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (id != 0) { //show and hide controls lblAddEditTitle.Text = "Edit Record"; SetData(); mainPage.SetPage(pageDetail); bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } else { supplyClassID = int.Parse(gridList.SelectedRows[0].Cells[1].Value.ToString()); supplyTypeID = int.Parse(gridList.SelectedRows[0].Cells[2].Value.ToString()); Save(); SetData(); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } }
private void SetProductRawMaterialData() { if (gridProductRawMaterials.SelectedRows.Count > 0) { // get id productRawMaterialID = int.Parse(gridProductRawMaterials.SelectedRows[0].Cells[0].Value.ToString()); if (productRawMaterialID != 0) { //show and hide controls page.SetPage(pageUpdateProductRawMaterials); lblAddEditTitle.Text = "Edit Record"; bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); // populate data var obj = Factories.CreateProduct().GetProductRawMaterial(productRawMaterialID); cboSupplyClass.SelectedItem = LocalUtils.GetSelectedItemX(cboSupplyClass.Items, obj.SupplyClassID.ToString()); cboSupplyTypes.SelectedItem = LocalUtils.GetSelectedItemX(cboSupplyTypes.Items, obj.SupplyTypeID.ToString()); txtQuantity.Text = obj.Quantity.ToString(); } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } }
private void Edit() { try { var grid = gridChat; if (grid.SelectedRows.Count > 0) { _userID = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString()); if (_userID != 0) { var user = Factories.CreateUser().GetUser(_userID); if (user.UserName == CurrentUser.Name) { LocalUtils.ShowErrorMessage(this, "You cannot message your self!"); } else { CheckUnreadMessage(); var frmChatMessage = new frmChatMessage(user.UserName); frmChatMessage.Show(); } } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (gridList.SelectedRows.Count > 0) { id = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (id != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateSupplyInventory().Delete(id); LocalUtils.ShowDeleteSuccessMessage(this); ShowMainGrid(); id = 0; } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception) { throw; } }
async void LoadProducts() { try { await Task.Delay(1000); var products = await Task.Run(() => Factories.CreateProducts().GetProductList(txtSearch.Text)); int count = 0; gridProducts.Rows.Clear(); foreach (var item in products) { count++; gridProducts.Rows.Add(new string[] { item.ProductID.ToString(), count.ToString(), item.Description, item.Quantity.ToString() }); } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void Edit() { try { var grid = gridProducts; if (grid.SelectedRows.Count > 0) { _productID = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString()); if (_productID != 0) { page.SetPage(pageProductDetail); SetData(); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
async void Login() { try { if (txtUserName.Text == string.Empty && txtPassword.Text == string.Empty) { LocalUtils.ShowErrorMessage(this, "User Name or Password is empty"); } else { lblLoggingIn.Visible = true; await Task.Run(() => Factories.CreateUser().LoginUser(txtUserName.Text, txtPassword.Text)); //if login success set isLogin to true isLogin = true; LoginSuccess(); } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } lblLoggingIn.Visible = false; }
private void OnProjectMenuBeforeQueryStatus(object sender, EventArgs e) { var menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } if (LocalUtils.GetActiveProject().Kind != "{fc65038c-1b2f-41e1-a629-bed71d161fff}") { menuCommand.Visible = false; return; } if (LocalUtils.MyDte?.SelectedItems.Count != 1) { return; } _folderName = LocalUtils.MyDte.SelectedItems.Item(1)?.ProjectItem?.Name; var typeTuple = FolderType.FindTypeFromFolderName(_folderName); var canAdd = !string.IsNullOrEmpty(_folderName) && typeTuple != null; menuCommand.Visible = canAdd; menuCommand.Text = "Add new"; }
private async void Save() { try { if (!ValidatedFields()) { return; } var model = new AddEditUserModel(); model.UserName = txtUserName.Text; model.FirstName = txtFirstName.Text; model.MiddleName = txtMiddleName.Text; model.LastName = txtLastName.Text; model.Password = txtPassword.Text; model.RoleID = int.Parse(((ItemX)cboRoles.SelectedItem).Value); if (_userID == 0) { await Task.Run(() => Factories.CreateUser().Add(model)); page.SetPage(tabUserList); LoadUsers(); } else { await Task.Run(() => Factories.CreateUser().Edit(_userID, model)); page.SetPage(tabUserList); LoadUsers(); } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } }
public ElementType() { MetaService = LocalUtils.MetaService; Model = LocalUtils.GetModel(); Project = LocalUtils.GetActiveProjectNode(); }
public Login() { this.InitializeComponent(); mainPage = (App.Current as App).MainPage; names = LocalUtils.AllUserNames()?.ToList() ?? new List <string>(); NameBox.TextChanged += (sender, e) => { if (e.Reason == AutoSuggestionBoxTextChangeReason.UserInput) { var txt = sender.Text; sender.ItemsSource = names.Where(item => item.StartsWith(txt)).ToList(); } LoginButton.IsEnabled = !String.IsNullOrWhiteSpace(NameBox.Text) && !String.IsNullOrEmpty(PasswordBox.Password); }; NameBox.SuggestionChosen += (sender, e) => { var name = e.SelectedItem as string; User u; if (LocalUtils.TryGetUser(name, out u)) { SetUser(u); } }; PasswordBox.PasswordChanged += (sender, e) => { LoginButton.IsEnabled = !String.IsNullOrWhiteSpace(NameBox.Text) && !String.IsNullOrEmpty(PasswordBox.Password); }; }
private void AddHandlers() { var flatButtons = LocalUtils.GetAll(this, typeof(BunifuFlatButton)) .OrderBy(c => c.TabIndex); foreach (BunifuFlatButton item in flatButtons) { item.Click += flatButton_OnSetFormTitle; } var textboxes = LocalUtils.GetAll(this, typeof(BunifuTextBox)) .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex); foreach (BunifuTextBox item in textboxes) { if (item.Tag != null) { if (item.Tag.ToString().Contains("integer")) { item.TextChange += item_IntCheckTextChange; } else if (item.Tag.ToString().Contains("double")) { item.TextChange += item_DoubleCheckTextChange; } } } }
public void LoadMainGrid() { try { var criteria = txtSearch.Text; var date = dtSearchDate.Value; var models = Factories.CreateProductSale().GetAllByMonth(date, criteria); gridMain.Rows.Clear(); int count = 0; foreach (var item in models) { count++; gridMain.Rows.Add(new string[] { item.ID.ToString(), count.ToString(), item.Date.ToShortDateString(), item.CustomerName, item.ProductName, item.Quantity.ToString(), item.Total.ToString(), }); } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void SaveProduction() { if (!ValidateFields(pageUpdateProduction)) { LocalUtils.ShowValidationFailedMessage(this); } else { var model = new AddEditProductionModel(); model.Date = dtDate.Value; model.ProductID = int.Parse(((ItemX)cboProducts.SelectedItem).Value); model.Quantity = LocalUtils.ConvertToInteger(txtQuantity.Text); // get id if (productionID != 0) { Factories.CreateProduction().Edit(productionID, model); } else { Factories.CreateProduction().Add(model); productionID = model.ID; } LoadProductionGridList(); LocalUtils.ShowSaveMessage(this); } }
private void Save() { try { var model = new MemberModel(); model.Address = txtAddress.Text; model.ContactNumber = txtContactNumber.Text; model.FullName = txtFullName.Text; ValidatedFields(model); if (memberID > 0) { Factories.CreateMember().Edit(memberID, model); } else { Factories.CreateMember().Add(model); } LocalUtils.ShowSaveMessage(this); LoadList(); page.SetPage(pageList); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } }
/// <summary> /// Use to get initial data when adding new milk utilization /// </summary> private void SetInitialAddData() { try { var initialDate = dtDate.Value; var model = Factories.CreateMilkUtilize().GetRecord(date: dtDate.Value); if (model.ID == 0) { txtBeginningBalance.Text = model.BeginningVolumeBalance.ToString(); txtEndingBalance.Text = model.EndingVolumeBalance.ToString(); txtRawMilkProcess.Text = model.RawMilkProcess.ToString(); txtTotalRawMilkSold.Text = model.RawMilkSold.ToString(); txtTotalMilkDeliveredByFarmers.Text = model.TotalMilkDeliveredFromFarmers.ToString(); txtTotalMilkForUtilization.Text = model.TotalMilkForUtilization.ToString(); txtTotalRawMilkWithdrawn.Text = model.TotalRawMilkWithdrawn.ToString(); } else { dtDate.Value = initialDate; LocalUtils.ShowErrorMessage(this, "Record Already exists for this date!"); } } catch (Exception) { } }
private RevampValidationResult UIRevampRecipeSettingCheckDelegate(RevampRecipeDetailModel targetModel) { RevampValidationResult revampValidationResult = mRevampManager.IsValidRevamp(targetModel); mRevampInfoBalloon.SayMessage(LocalUtils.GenerateRevampSettingMessage(revampValidationResult, targetModel)); return(revampValidationResult); }
private void Delete() { try { var grid = gridProducts; if (grid.SelectedRows.Count > 0) { var posTransactionProductID = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString()); if (posTransactionProductID != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateProducts().Delete(posTransactionProductID); LoadProducts(); } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception ex) { //LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
public void SetData() { try { // populate data var model = Factories.CreateDailySale().Get(dailySaleID); dtDate.Value = model.Date; txtOutletSale1.Text = model.OutletSale1.ToString(); txtOutletSale2.Text = model.OutletSale2.ToString(); txtProcessingSale.Text = model.ProcessingSale.ToString(); // Total Cash Sale Dairy Product txtTotalCashSale.Text = model.TotalCashSales.ToString(); txtRawMilkSales.Text = model.RawMilkSales.ToString(); txtSalesOnAccount.Text = model.SaleOnAccount.ToString(); txtTotalSaleDairyProducts.Text = model.TotalSaleForDairyProduct.ToString(); // Total Sale Over All Sale txtTotalSale.Text = model.TotalSales.ToString(); txtDebtor.Text = model.Debtor.ToString(); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
/// <summary> /// Validates Form Fields data /// </summary> /// <returns>If Validation succed, returns True. If not, returns false.</returns> private bool ValidatedFields() { var ctrlTextBoxes2 = LocalUtils.GetAll(pageProductDetail, typeof(BunifuTextBox)) .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex); foreach (BunifuTextBox item in ctrlTextBoxes2) { if (item.Text == string.Empty) { LocalUtils.ShowValidationFailedMessage(this); return(false); } } var ctrlDropdown = LocalUtils.GetAll(pageProductDetail, typeof(Bunifu.UI.WinForms.BunifuDropdown)) .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex); foreach (Bunifu.UI.WinForms.BunifuDropdown item in ctrlDropdown) { if (item.SelectedIndex < 0) { item.Focus(); LocalUtils.ShowValidationFailedMessage(this); return(false); } } return(true); }
private void Save() { try { if (!ValidateFields()) { LocalUtils.ShowValidationFailedMessage(this); return; } var model = new UserModel(); model.Password = txtPassword.Text; model.ReTypePassword = txtRetypePassword.Text; model.UserName = txtUserName.Text; if (userID > 0) { Factories.CreateUser().Edit(userID, model); } else { Factories.CreateUser().Add(model); userID = model.ID; } ShowMainGrid(); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } }
private void btnClearance_Click(object sender, EventArgs e) { page.SetPage(pageClearance); LocalUtils.CenterControlXY(pageDashboard, pnlDashboard); LocalUtils.CenterControlXY(pageBarangayInfo, pnlBrgyInfo); LocalUtils.CenterControlXY(pageClearance, pnlClearance); }
private void Edit() { try { if (gridList.SelectedRows.Count > 0) { // get id userID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (userID != 0) { //show and hide controls mainPage.SetPage(pageDetail); bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); ResetInputs(pnlAddEdit); SetData(); } else { LocalUtils.ShowNoRecordFoundMessage(this); mainPage.SetPage(pageGridMain); bunifuTransition1.ShowSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.ToString()); } }
private void AddHandlers() { var textboxes = LocalUtils.GetAll(this, typeof(BunifuTextBox)) .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex); foreach (BunifuTextBox item in textboxes) { if (item.Tag != null) { if (item.Tag.ToString().Contains("integer") || item.Tag.ToString().Contains("double")) { item.KeyPress += textBox_keyPress; } } } //We get all textboxes with tag compute to compute textbox value // after text change event fires var computeTextBoxes = LocalUtils.GetAll(this, typeof(BunifuTextBox)) .Where(c => c.Tag.ToString().Contains("compute")).OrderBy(c => c.TabIndex); foreach (BunifuTextBox item in computeTextBoxes) { item.TextChange += item_TextChange; } }
private void Delete() { try { if (gridList.SelectedRows.Count > 0) { userID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (userID != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateUser().Delete(userID); LocalUtils.ShowDeleteSuccessMessage(this); ShowMainGrid(); userID = 0; } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception) { throw; } }
private void Save() { var model = new SupplyInventoryModel(); model.SupplyTypeID = supplyTypeID; model.SupplyClassID = supplyClassID; model.PurchaseQuantity = LocalUtils.ConvertToDouble(txtPurchaseQty.Text); // get id if (id != 0) { model.Date = dtDate.Value; if (!ValidateFields()) { LocalUtils.ShowValidationFailedMessage(this); return; } Factories.CreateSupplyInventory().Edit(id, model); LocalUtils.ShowSaveMessage(this); } else { model.Date = dtSearchDate.Value; Factories.CreateSupplyInventory().Add(model); id = model.ID; mainPage.SetPage(pageDetail); bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent); } }
private bool ValidatedFields() { var ctrlTextBoxes2 = LocalUtils.GetAll(tabSupplierDetail, typeof(BunifuTextBox)) .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex); foreach (BunifuTextBox item in ctrlTextBoxes2) { if (item.Text == string.Empty) { item.Focus(); LocalUtils.ShowValidationFailedMessage(this); return(false); } } var ctrlDropdown = LocalUtils.GetAll(tabSupplierDetail, typeof(Bunifu.UI.WinForms.BunifuDropdown)) .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex); foreach (Bunifu.UI.WinForms.BunifuDropdown item in ctrlDropdown) { if (item.SelectedIndex < 0) { item.Focus(); MetroMessageBox.Show(this, string.Format("Empty field {0 }", item.Tag), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } return(true); }
private void DeleteProductRawMaterial() { if (gridProductRawMaterials.SelectedRows.Count > 0) { productRawMaterialID = int.Parse(gridProductRawMaterials.SelectedRows[0].Cells[0].Value.ToString()); if (productRawMaterialID != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateProduct().DeleteProductRawMaterial(productRawMaterialID); LocalUtils.ShowDeleteSuccessMessage(this); LoadProductRawMaterialGridList(); productRawMaterialID = 0; } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } }
private void LoadCategories() { //转换目录信息列表至树形节点列表 List <RecursiveCategoryData> listRecursive = LocalUtils.ConvertCategoryListToRecursiveList(PortalCategoryList); RecursiveCategoryItem m_recursiveCategoryRoot; m_recursiveCategoryRoot = RecursiveHelper.ConvertListToRecursiveItem(listRecursive); RecursiveHelper.ConvertRecursiveItemToAspNetTree(ref tvCategory, m_recursiveCategoryRoot); List <CategoryInfo> list = CategoryController.ListByPortals(PortalId); for (int i = 0; i < list.Count; i++) { list[i].Name = Utils.FormatLevelName(list[i].Name, list[i].Level, ".."); } List <RecursiveCategoryData> listRecursiveData = new List <RecursiveCategoryData>(); listRecursiveData = LocalUtils.ConvertCategoryListToRecursiveList(list); RecursiveCategoryItem orderedItems = RecursiveHelper.ConvertListToRecursiveItem(listRecursiveData); ArrayList listCategory = orderedItems.GetListOrdered(); RecursiveCategoryItem a = new RecursiveCategoryItem(); a.Id = -1; a.Name = Localization.GetString("SelectCategory.Text", this.LocalResourceFile); listCategory.Add(a); ddlCategory.DataSource = listCategory; ddlCategory.DataBind(); ddlCategory.SelectedValue = "-1"; }