protected void DdlDepartmentIndexChanged(object sender, EventArgs e) { ErrorDisplay1.ClearError(); try { ddlPortalUser.SelectedIndex = 0; txtEndDate.Text = string.Empty; txtStart.Text = string.Empty; if (int.Parse(ddlDepartment.SelectedValue) < 1) { ErrorDisplay1.ShowError("Please select a Department."); dgExpenseTransaction.DataSource = new List <StaffExpenseTransaction>(); dgExpenseTransaction.DataBind(); return; } if (!LoadTransactionsByDepartment()) { } } catch { ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); } }
protected void BtnRefreshClick(object sender, EventArgs e) { ErrorDisplay1.ClearError(); if (!LoadBeneficiaries()) { } }
protected void LnkFilterByUnApprovedClick(object sender, EventArgs e) { try { ErrorDisplay1.ClearError(); var expTransactions = ServiceProvider.Instance().GetStaffExpenseTransactionServices().GetUnApprovedctiveExpenseTransactions(); if (!expTransactions.Any()) { ErrorDisplay1.ShowError("Unapproved Expense Transaction list is empty."); dgExpenseTransaction.DataSource = new List <StaffExpenseTransaction>(); dgExpenseTransaction.DataBind(); return; } dgExpenseTransaction.DataSource = expTransactions; dgExpenseTransaction.DataBind(); Session["_expTransactions"] = expTransactions; } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); } }
protected void DgPortalRoleEditCommand(Object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { ErrorDisplay1.ClearError(); try { dgPortalRole.SelectedIndex = e.Item.ItemIndex; int id = (DataCheck.IsNumeric(dgPortalRole.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgPortalRole.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ErrorDisplay1.ShowError("Invalid Item Selection"); return; } ErrorDisplay1.ClearControls(tbUserInfo); txtRoleName.Text = ((LinkButton)dgPortalRole.SelectedItem.FindControl("lblRole")).Text; ViewState["mRoleName"] = ((LinkButton)dgPortalRole.SelectedItem.FindControl("lblRole")).Text; ViewState["mRecordID"] = id; HideTables(); btnSubmit.CommandArgument = "2"; //Update btnSubmit.Text = "Update Role"; mpeDisplayJobDetails.Show(); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError(ex.Message); } }
protected void DdlBeneficiariesIndexChanged(object sender, EventArgs e) { ErrorDisplay1.ClearError(); try { if (int.Parse(ddlBeneficiaries.SelectedValue) < 1) { ErrorDisplay1.ShowError("Please select a StaffBeneficiary"); return; } if (!LoadTransactionPayments()) { return; } // LoadExpenseTransactions(); divBeneficiary.Visible = false; divPaymentTrack.Visible = true; } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); } }
public void ResourcesDistributionList(string category) { try { ErrorDisplay1.ClearError(); //var res = _db.Resources.Where(m => m.Status == 2).ToList(); var res = _db.Resources.ToList(); //if (int.Parse(ageClass) > 0) //{ // res = res.Where(m => m.AgeId == int.Parse(ageClass)).ToList(); //} if (int.Parse(category) > 0) { res = res.Where(m => m.CategoryId == int.Parse(category)).ToList(); } if (!res.Any()) { grdReports.DataSource = new List <Resource>(); grdReports.DataBind(); ErrorDisplay1.ShowWarning("No record found"); return; } grdReports.DataSource = res; grdReports.DataBind(); } catch (Exception ex) { } }
protected void BindSitemMapItemList() { try { ErrorDisplay1.ClearError(); List <sitemap> mList = (new PortalServiceManager()).GetSiteMapList(); if (mList == null || mList.Count == 0) { dgPortalSiteMap.DataSource = new List <sitemap>(); dgPortalSiteMap.DataBind(); } if (mList != null) { mList[0].Title = "ROOT"; mList[0].Description = "ROOT"; dgPortalSiteMap.DataSource = mList; } dgPortalSiteMap.DataBind(); //HideMainDvs(); //this.listDV.Visible = true; Session["_mlist"] = mList; } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); } }
protected void BtnUpdateRecordClick(Object sender, EventArgs e) { ErrorDisplay1.ClearError(); if (txtEmail.Text == "") { ErrorDisplay1.ShowError("Email Address is required"); return; } int k = ValidateRole(); if (k < 1) { ErrorDisplay1.ShowError("User must belong to at least a role"); return; } var mUser = Membership.GetUser(txtUserName.Text.Trim()); if (mUser == null) { ErrorDisplay1.ShowError("Fatal Error occurred! Please try again soon"); return; } mUser.Email = txtEmail.Text.Trim(); mUser.IsApproved = chkActive.Checked; Membership.UpdateUser(mUser); string[] mRoles = Roles.GetRolesForUser(txtUserName.Text.Trim()); if (mRoles != null) { if (mRoles.Length > 0) { Roles.RemoveUserFromRoles(txtUserName.Text.Trim(), mRoles); } } var mNewRoles = new string[k]; int h = 0; for (int i = 0; i < chkRoles.Items.Count; i++) { if (chkRoles.Items[i].Selected) { mNewRoles[h] = chkRoles.Items[i].Value.Trim(); h += 1; } } if (mNewRoles[0].Length > 0) { Roles.AddUserToRoles(txtUserName.Text.Trim(), mNewRoles); BindUsersList(); HideTables(); listDV.Visible = true; ErrorDisplay1.ShowSuccess("User Information was updated successfully."); } else { ErrorDisplay1.ShowError("Fatal Error occurred! User information could not be updated"); } }
private void LoadFilterdAssetCategories() { ErrorDisplay1.ClearError(); try { ddlAssetCategories.DataSource = new List <AssetCategory>(); ddlAssetCategories.DataBind(); ddlAssetCategories.Items.Insert(0, new ListItem("--List is empty--", "0")); ddlAssetCategories.SelectedIndex = 0; var assetCategoryList = ServiceProvider.Instance().GetAssetCategoryServices().LoadFilterdAssetCategories(); if (!assetCategoryList.Any()) { return; } ddlAssetCategories.DataSource = assetCategoryList; ddlAssetCategories.DataValueField = "AssetCategoryId"; ddlAssetCategories.DataTextField = "Name"; ddlAssetCategories.DataBind(); ddlAssetCategories.Items.Insert(0, new ListItem("---Select an Asset Category---", "0")); ddlAssetCategories.SelectedIndex = 0; } catch { ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); } }
private bool LoadAssetType() { ErrorDisplay1.ClearError(); try { var assetTypesList = ServiceProvider.Instance().GetAssetTypeServices().GetAllAssetTypes(); if (!assetTypesList.Any()) { dgAssetTypes.DataSource = new List <AssetType>(); dgAssetTypes.DataBind(); return(false); } dgAssetTypes.DataSource = assetTypesList; dgAssetTypes.DataBind(); return(true); } catch (Exception ex) { ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); return(false); } }
protected void DgPortalUsersEditCommand(Object source, DataGridCommandEventArgs e) { if (!(Page.User.IsInRole("PortalAdmin") || Page.User.IsInRole("SiteAdmin"))) { ErrorDisplay1.ShowError("Sorry: You do not have access to this module!"); return; } ErrorDisplay1.ClearError(); dgPortalUsers.SelectedIndex = e.Item.ItemIndex; var userId = (DataCheck.IsNumeric(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (userId < 1) { ErrorDisplay1.ShowError("Invalid Selection"); return; } Session["_selectedUser"] = null; if (!BindUSer(userId)) { return; } btnSubmit.CommandArgument = "2"; // Update Item btnSubmit.Text = "Update User"; mpeDisplayJobDetails.Show(); }
protected void BindSiteMapItems() { try { ErrorDisplay1.ClearError(); List <sitemap> mList = (new PortalServiceManager()).GetSiteMapList(); if (mList == null || mList.Count == 0) { dgPortalSiteMap.DataSource = new List <sitemap>(); dgPortalSiteMap.DataBind(); } if (mList != null) { mList[0].Title = "ROOT"; ddlTabParent.DataSource = mList; } ddlTabParent.DataTextField = "Title"; ddlTabParent.DataValueField = "ID"; ddlTabParent.DataBind(); ddlTabParent.Items.Insert(0, (new ListItem("-- Please Select --", "0"))); ddlTabParent.SelectedIndex = 0; } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); } }
protected void DgPortalRoleDeleteCommand(Object source, DataGridCommandEventArgs e) { ErrorDisplay1.ClearError(); try { dgPortalRole.SelectedIndex = e.Item.ItemIndex; int id = (DataCheck.IsNumeric(dgPortalRole.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgPortalRole.DataKeys[e.Item.ItemIndex].ToString()) : 0; string roleName = ((LinkButton)dgPortalRole.SelectedItem.FindControl("lblRole")).Text; if (roleName.Length == 0) { ErrorDisplay1.ShowError("Process Error! Please try again later"); return; } //Check if the role name is PortalAdmin, then terminate the process if (roleName.ToLower() == "PortalAdmin".ToLower()) { ErrorDisplay1.ShowError("Sorry, you can not delete this role"); return; } //Check to see that the current user has right to delete role if (!Page.User.IsInRole("PortalAdmin")) { ErrorDisplay1.ShowError("Sorry, you are not authorized to delete a role"); } //If role has registered users, remove the users from the role. try { if (Roles.GetUsersInRole(roleName).Length > 0) { string[] mUsersInRole = Roles.GetUsersInRole(roleName); Roles.RemoveUsersFromRole(mUsersInRole, roleName); } } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError(ex.Message); return; } //'Now delete the role! if (Roles.DeleteRole(roleName, false)) { BindRoleItems(); ErrorDisplay1.ShowSuccess("Role Item Was Removed"); } else { ErrorDisplay1.ShowError("Role Item could not be removed"); } } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError(ex.Message); return; } }
protected void BtnAddNewAssetCategoryClick(object sender, EventArgs e) { ErrorDisplay1.ClearError(); ClearControls(); btnProcessAssetCategory.CommandArgument = "1"; btnProcessAssetCategory.Text = "Submit"; lgAssetCategoryTitle.InnerHtml = "Create a new Asset Category"; mpeProcessAssetCategory.Show(); }
protected void BtnRefreshClick(object sender, EventArgs e) { ErrorDisplay1.ClearError(); txtEndDate.Text = string.Empty; txtEndDate.Text = string.Empty; if (!LoadAllTransactions()) { } }
private bool UpdateAssetType() { ErrorDisplay1.ClearError(); try { if (Session["_assetType"] == null) { ErrorDisplay1.ShowError("Session has expired"); return(false); } var assetType = (AssetType)Session["_assetType"]; if (assetType == null) { ErrorDisplayProcessAssetType.ShowError("Session has expired"); mpeProcessAssetType.Show(); return(false); } if (assetType.AssetTypeId < 1) { ErrorDisplay1.ShowError("Invalid selection!"); return(false); } assetType.Name = txtAssetType.Text.Trim(); assetType.AssetCategoryId = int.Parse(ddlAssetCategory.SelectedValue.ToString(CultureInfo.InvariantCulture)); assetType.Status = chkAssetType.Checked ? 1 : 0; var k = ServiceProvider.Instance().GetAssetTypeServices().UpdateAssetType(assetType); if (k < 1) { if (k == -3) { ErrorDisplayProcessAssetType.ShowError("Asset Type already exists."); txtAssetType.Focus(); mpeProcessAssetType.Show(); return(false); } ErrorDisplayProcessAssetType.ShowError("The Asset Type information could not be updated. Please try again soon or contact the Admin."); mpeProcessAssetType.Show(); return(false); } return(true); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); return(false); } }
protected void btnSubmit_Click(object sender, EventArgs e) { ErrorDisplay1.ClearError(); if (!ValidateControls()) { return; } SaveData(); }
protected void BtnAddItemClick(Object sender, EventArgs e) { ErrorDisplay1.ClearError(); ErrorDisplay2.ClearError(); ErrorDisplay1.ClearControls(tbUserInfo); btnSubmit.CommandArgument = "1"; btnSubmit.Text = "Add Role"; mpeDisplayJobDetails.Show(); }
protected void BtnAddNewAssetTypeClick(object sender, EventArgs e) { ErrorDisplay1.ClearError(); ErrorDisplayProcessAssetType.ClearError(); txtAssetType.Text = string.Empty; lgAssetTypeTitle.InnerHtml = "Create a New Asset Type"; chkAssetType.Checked = false; btnSubmitAssetType.CommandArgument = "1"; btnSubmitAssetType.Text = "Submit"; mpeProcessAssetType.Show(); }
protected void BtnRefreshClick(object sender, EventArgs e) { ErrorDisplay1.ClearError(); txtEndDate.Text = string.Empty; txtStart.Text = string.Empty; if (!LoadAllTransactionPayments()) { return; } LoadTransactionPaymentFooter(); lblFilterReport.InnerHtml = "All Transaction Payments"; }
protected void DdlAssetCategoriesSelectedChanged(object sender, EventArgs e) { ErrorDisplay1.ClearError(); if (int.Parse(ddlAssetCategories.SelectedValue) < 1) { ErrorDisplay1.ShowError("Please select an Asset Category"); ddlAssetCategories.Focus(); return; } GetOrderedAssetTypeByAssetCategory(int.Parse(ddlAssetCategories.SelectedValue)); }
protected void BtnRefreshClick(object sender, EventArgs e) { ErrorDisplay1.ClearError(); ddlDepartment.SelectedIndex = 0; ddlPortalUser.SelectedIndex = 0; txtEndDate.Text = string.Empty; txtEndDate.Text = string.Empty; if (!LoadAllTransactions()) { } //lblFilterReport.InnerHtml = "All Transaction Payments"; }
protected void LnkUncompletedClick(object sender, EventArgs e) { ErrorDisplay1.ClearError(); txtEndDate.Text = string.Empty; txtStart.Text = string.Empty; btnRefresh.CommandArgument = "2"; if (!GetUncompletedPayments()) { lblFilterReport.InnerHtml = "No record found"; return; } LoadTransactionPaymentFooter(); }
protected void BtnAddItemClick(Object sender, EventArgs e) { ErrorDisplay1.ClearError(); ErrorDisplay1.ClearControls(tbUserInfo); BindSiteMapItems(); BindRoleList(); BindOrders(); //HideMainDvs(); btnSubmit.CommandArgument = "1"; // Add Item btnSubmit.Text = "Add New Tab"; mpeDisplayJobDetails.Show(); //this.tbUserInfo.Visible = true; //this.detailDiv.Visible = true; }
protected void DgAllTransactionPaymentsCommand(object source, DataGridCommandEventArgs e) { ErrorDisplay1.ClearError(); try { if (Session["_expensePaymentsList"] == null) { ErrorDisplay1.ShowError("Expense Transaction Payment list is empty or session has expired."); return; } var expenseTransactionPaymentList = Session["_expensePaymentsList"] as List <StaffExpenseTransactionPayment>; if (expenseTransactionPaymentList == null || !expenseTransactionPaymentList.Any()) { ErrorDisplay1.ShowError("Expense Transaction Payment list is empty or session has expired."); return; } dgAllTransactionPayments.SelectedIndex = e.Item.ItemIndex; long id = (DataCheck.IsNumeric(dgAllTransactionPayments.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgAllTransactionPayments.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ErrorDisplay1.ShowError("Invalid Record Selection!"); return; } var expenseTransactionPayment = expenseTransactionPaymentList.Find(m => m.StaffExpenseTransactionPaymentId == id); if (expenseTransactionPayment == null || expenseTransactionPayment.StaffExpenseTransactionId < 1) { ErrorDisplay1.ShowError("Invalid record selection."); return; } if (e.CommandName == "ViewHistory") { LoadTransactionPaymentHistory(expenseTransactionPayment.StaffExpenseTransactionId); dvTransactionPayments.Visible = false; dvTransactionPaymentHistory.Visible = true; } } catch { ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); } }
protected void BtnSearchClick(object sender, EventArgs e) { ErrorDisplay1.ClearError(); var beneficiaries = ServiceProvider.Instance().GetBeneficiaryServices().GeteBeneficiaryBySearchText(txtSearch.Text.Trim()); if (beneficiaries == null || !beneficiaries.Any()) { ErrorDisplay1.ShowError("No record found"); return; } dgBeneficiaries.DataSource = beneficiaries; dgBeneficiaries.DataBind(); }
protected void BtnprocessAssetCategoryClick(object sender, EventArgs e) { ErrorDisplay1.ClearError(); try { if (!ValidateControls()) { return; } switch (int.Parse(btnProcessAssetCategory.CommandArgument)) { case 1: if (!AddAssetCategory()) { return; } break; case 2: if (!UpdateAssetCategory()) { return; } break; default: ErrorDisplayProcessAssetCategory.ShowError("Invalid process call!"); mpeProcessAssetCategory.Show(); break; } if (!LoadAssetCategories()) { return; } ErrorDisplay1.ShowSuccess("Asset Category information was successfully processed."); } catch (Exception ex) { ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin. Please try again soon or contact the Admin."); ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); throw; } }
private void ClearControls() { ErrorDisplay1.ClearError(); ErrorDisplayCompletePayment.ClearError(); txtTitle.Text = string.Empty; txtExpenseCategory.Text = string.Empty; txtExpenseItem.Text = string.Empty; txtApprovalDateTime.Text = string.Empty; txtApprovedUnitPrice.Text = string.Empty; txtApprovalDateTime.Text = string.Empty; txtApprovedBy.Text = string.Empty; txtApprovedQuantity.Text = string.Empty; txtApprovedTotalAmount.Text = string.Empty; txtAmountPaid.Value = string.Empty; }
protected void DgPortalUsersDeleteCommand(Object source, DataGridCommandEventArgs e) { ErrorDisplay1.ClearError(); if (!Page.User.IsInRole("PortalAdmin")) { ErrorDisplay1.ShowError("Sorry: You are not authorized to delete a user"); return; } try { dgPortalUsers.SelectedIndex = e.Item.ItemIndex; var userId = (DataCheck.IsNumeric(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (userId < 1) { ErrorDisplay1.ShowError("Invalid Selection"); return; } string mName = ((LinkButton)dgPortalUsers.SelectedItem.FindControl("lblUserName")).Text; if (mName.Length < 2) { ErrorDisplay1.ShowError("No User Item Selected"); return; } if (HttpContext.Current.User.Identity.Name.ToLower() == mName.ToLower()) { ErrorDisplay1.ShowError("You cannot delete the current user!"); return; } var mUser = Membership.GetUser(mName, false); if (mUser == null) { ErrorDisplay1.ShowError("Username not found!"); return; } mUser.IsApproved = false; Membership.UpdateUser(mUser); //Membership.DeleteUser(mName); //new PortalServiceManager().DeletePortalUser(userId); BindUsersList(); ErrorDisplay1.ShowSuccess("User Record Was Deleted"); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError(ex.Message); } }
private bool ValidateTransactionPaymentControl() { ErrorDisplay1.ClearError(); ErrorDisplayCompletePayment.ClearError(); try { if (string.IsNullOrEmpty(txtAmountPaid.Value.Trim())) { ErrorDisplayCompletePayment.ShowError("Please supply the amount to be paid."); txtAmountPaid.Focus(); mpeSelectDateRangePopup.Show(); return(false); } if (txtAmountPaid.Value.Trim().Contains('-') || txtAmountPaid.Value.Trim().Contains('+') || txtAmountPaid.Value.Trim().Contains('*') || txtAmountPaid.Value.Trim().Contains('/')) { ErrorDisplayCompletePayment.ShowError("Invalid entry!"); txtAmountPaid.Focus(); mpeSelectDateRangePopup.Show(); return(false); } if (double.Parse(txtAmountPaid.Value.Trim()) > double.Parse(txtBalance.Text.Trim())) { ErrorDisplayCompletePayment.ShowError("Please enter an amount less than or equal to the Expense Transaction balance."); mpeSelectDateRangePopup.Show(); return(false); } if (!DataCheck.IsNumeric(txtAmountPaid.Value.Trim())) { ErrorDisplayCompletePayment.ShowError("Invalid entry!"); txtAmountPaid.Focus(); mpeSelectDateRangePopup.Show(); return(false); } return(true); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); return(false); } }