/// <summary> /// sdsSecondaryBarcode - Selected /// </summary> protected void sdsSecondaryBarcode_Selected(object sender, SqlDataSourceStatusEventArgs e) { // Check for an exception if (e.Exception != null && e.Exception.InnerException != null) { Exception inner = e.Exception.InnerException; string errMsg = null; // Check for a previously handled exception if (inner is InternalException) { // Already Logged } else { // Error errMsg = string.Format("{0} - sdsSecondaryBarcode Selected Error - {1}", GetType().FullName, inner.Message); // Log the Error AppLogWrapper.LogError(errMsg); } // Indicate that the exception has been handled e.ExceptionHandled = true; } }
/// <summary> /// gvDirectReportCA - RowCommand /// </summary> protected void gvDirectReportCA_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Select") { int idx = Convert.ToInt32(e.CommandArgument); string statusCode = gvDirectReportCA.DataKeys[idx].Values["Status_Code"].ToString(); switch (statusCode.ToUpper()) { // Display the Modify CA screen when in the following status case "WIP": Session["Status"] = "WIP"; Response.Redirect("CreateCA.aspx"); break; case "TMLOA": Session["Status"] = "TMLOA"; Response.Redirect("CreateCA.aspx"); break; case "PNDTMDISC": Session["Status"] = "PNDTMDISC"; //(GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/CAW/CreateCA.aspx');", true); Response.Redirect("CreateCA.aspx"); break; //using response direct in a switch stmt is causing issue as it is getting redirected to a different page and then we give a break. so it is giving an exception // when using it in gridview control using openscreen it gives JS error // Merge data with template and rendition to PDF and then show dialog for opening/saving PDF case "PNDTMACK": Session["Status"] = "PNDTMACK"; AlertMessage.Show(string.Format("Show PDF"), this.Page); break; } } } catch (InternalException err) { // Display a Messagebox AlertMessage.Show(err.UserFriendlyMsg, this.Page); } catch (Exception err) { // Error string errMsg = string.Format("{0} - gvDirectReportCA RowCommand Error - {1}", GetType().FullName, err.Message); // Log the Error AppLogWrapper.LogError(errMsg); // Save a User Friendly Error Message in Session Variable errMsg = "There was a problem creating a row in the Direct report TMs CA grid. If the problem persists, please contact Technical Support."; // Display a Messagebox AlertMessage.Show(errMsg, this.Page); } }
/// <summary> /// Initializes the screen the first time /// </summary> private void InitializeScreen() { try { InitializeFields(); //tdNewProject.Visible = false; //trUploadCriteria.Visible = true; //ddlUploadCriteria.Enabled = false; //trBatchFile.Visible = false; //trBatchUpload.Visible = false; //uplControlFile.Enabled = false; //btnUploadControlFile.Enabled = false; //trSingleDoc.Visible = false; //trSingleDocUpload.Visible = false; //txtDueDate.Enabled = false; //txtEffDate.Enabled = false; //ddlPrimaryBarcode.Enabled = false; //ddlSecondaryBarcode.Enabled = false; //ddlEmailNotify.Enabled = false; //ddlEmailReminder.Enabled = false; trButtons.Visible = true; btnSave.Enabled = false; } catch (InternalException err) { // Display a Messagebox AlertMessage.Show(err.UserFriendlyMsg, this.Page); } catch (Exception err) { // Database Error string errMsg = string.Format("{0} - Create Template Initialize Screen Error - {1}", GetType().FullName, err.Message); // Log the Error AppLogWrapper.LogError(errMsg); // Display a User Friendly Error Message errMsg = "There was a problem initializing the Create Template Initialize Screen. If the problem persists, please contact Technical Support."; // Display a Messagebox AlertMessage.Show(errMsg, this.Page); } }
/// <summary> /// gvResults - OnRowDataBound /// </summary> protected void gvResults_RowDataBound(object sender, GridViewRowEventArgs e) { try { // Process DataRow if (e.Row.RowType == DataControlRowType.DataRow) { // Check if row is NOT in Edit mode if (e.Row.RowState != DataControlRowState.Edit && e.Row.RowState != (DataControlRowState.Edit | DataControlRowState.Alternate)) { // Change the Background Color of the row during Hoover GridFormatting.GridViewStyle(e); // Set OnClick event to go into Select Mode e.Row.Attributes.Add("onClick", Page.ClientScript.GetPostBackClientHyperlink(gvResults, "Select$" + e.Row.RowIndex)); } } } catch (InternalException err) { // Display a Messagebox AlertMessage.Show(err.UserFriendlyMsg, this.Page); } catch (Exception err) { // Error string errMsg = string.Format("{0} - gvResults Row Data Bound Error - {1}", GetType().FullName, err.Message); // Log the Error AppLogWrapper.LogError(errMsg); // Save a User Friendly Error Message in Session Variable errMsg = "There was a problem creating a row in the Results grid. If the problem persists, please contact Technical Support."; // Display a Messagebox AlertMessage.Show(errMsg, this.Page); } }
/// <summary> /// gvDirectReportCA - SelectedIndexChanged /// </summary> protected void gvDirectReportCA_SelectedIndexChanged(object sender, EventArgs e) { try { // Selected Row if (gvDirectReportCA.SelectedValue != null) { string tmEmplId = gvDirectReportCA.SelectedValue.ToString(); // Log the Action string logMsg = string.Format("Manager Home screen - Row Selected - EmplId: {0}", tmEmplId); _HRSCLogsDA.Insert(logMsg); } } catch (InternalException err) { // Display a Messagebox //AlertMessage.Show(err.UserFriendlyMsg, this.Page); string errMsg = err.Message; } catch (Exception err) { // Database Error string errMsg = string.Format("{0} - gvDirectReportCA Selected Index Changed Error - {1}", GetType().FullName, err.Message); // Log the Error AppLogWrapper.LogError(errMsg); // Display a User Friendly Error Message errMsg = "There was a problem selecting a record on the Manager Home screen. If the problem persists, please contact Technical Support."; // Display a Messagebox AlertMessage.Show(errMsg, this.Page); } }
/// <summary> /// Initializes all fields/controls /// </summary> private void InitializeFields() { try { txtNewTemplateName.Text = string.Empty; txtDOCXFile.Text = string.Empty; txtEffDate.Text = string.Empty; ddlTypes.SelectedIndex = -1; ddlCategories.SelectedIndex = -1; ddlSubcategories.SelectedIndex = -1; ddlExecCode.SelectedIndex = -1; ddlPrimaryBarcode.SelectedIndex = -1; ddlSecondaryBarcode.SelectedIndex = -1; //Session["Criteria"] = null; Session["EffectiveDate"] = null; } catch (InternalException err) { // Display a Messagebox AlertMessage.Show(err.UserFriendlyMsg, this.Page); } catch (Exception err) { // Database Error string errMsg = string.Format("{0} - Create Template Initialize Fields Error - {1}", GetType().FullName, err.Message); // Log the Error AppLogWrapper.LogError(errMsg); // Display a User Friendly Error Message errMsg = "There was a problem initializing the fields in the Create Template Screen. If the problem persists, please contact Technical Support."; // Display a Messagebox AlertMessage.Show(errMsg, this.Page); } }
protected string saveFile(string fileExtension, System.Web.UI.WebControls.FileUpload fileUploads) { string alertMessage = string.Empty; string[] docList = null; string emplId = string.Empty; string fileName = string.Empty; string fileType = string.Empty; string msg = string.Empty; string templateId = string.Empty; string searchCriteria = string.Empty; string uploadDirectory = string.Empty; string uploadFilePath = string.Empty; try { emplId = Session["EmplId"].ToString(); if (fileUploads.HasFile) { fileName = Path.GetFileName(fileUploads.FileName); fileType = Path.GetExtension(fileName).ToLower(); // Check for Supported file types if (fileType == string.Concat(".", fileExtension)) { //Build the full file path for the upload directory with file name uploadDirectory = string.Concat(Server.MapPath(Session["UploadDirectory"].ToString()), emplId); uploadFilePath = string.Concat(uploadDirectory, "\\", fileName); if (!Directory.Exists(uploadDirectory)) { Directory.CreateDirectory(uploadDirectory); } else // Only one file type extension should exist in the directory { searchCriteria = string.Concat("*.", fileExtension); docList = Directory.GetFiles(uploadDirectory, searchCriteria); foreach (string uploadedFile in docList) { File.Delete(uploadedFile); } } fileUploads.PostedFile.SaveAs(uploadFilePath); fileUploads.Dispose(); FileInfo fi = new FileInfo(uploadFilePath); //File attribute can't be read only, change to normal if (fi.IsReadOnly) { File.SetAttributes(uploadFilePath, FileAttributes.Normal); } fi = null; fileUploads = null; // Log the Action msg = string.Format("Create Template Screen - Save File: {0} to {1}", fileName, uploadFilePath); _HRSCLogsDA.Insert(msg); } else { //Display message msg = string.Concat("Only a ", fileExtension, " file may be Uploaded"); alertMessage = "alert('" + msg + "');"; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Information Message", alertMessage, true); } } else { //Display message msg = string.Concat("A File Upload is required to be selected. Please use the Browse button for selecting the file to be uploaded."); alertMessage = "alert('" + msg + "');"; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Information Message", alertMessage, true); } } catch (InternalException err) { // Display a Messagebox AlertMessage.Show(err.UserFriendlyMsg, this.Page); } catch (Exception err) { // Error string errMsg = string.Format("{0} - Upload {1} Click Error - {2}", GetType().FullName, fileExtension, err.Message); // Log the Error AppLogWrapper.LogError(errMsg); // Save a User Friendly Error Message in Session Variable errMsg = string.Concat("There was a problem uploading the ", fileExtension, " file. If the problem persists, please contact Technical Support."); // Display a Messagebox AlertMessage.Show(errMsg, this.Page); } return(uploadFilePath); }
/// <summary> /// gvResults - SelectedIndexChanged /// </summary> protected void gvResults_SelectedIndexChanged(object sender, EventArgs e) { try { // Process Selected Row if (gvResults.SelectedValue != null) { string tmEmplId = gvResults.SelectedValue.ToString(); // Log the Action string logMsg = string.Format("Processor Search Screen - Row Selected - EmplId: {0}", tmEmplId); _HRSCLogsDA.Insert(logMsg); if (Session["SearchType"] != null) { if (Session["SearchType"].ToString() == "NewTuitionRequest") { // Save Employee Id Session["TMEmplIdU"] = tmEmplId; // Get Team Member's Name Session["TMNameU"] = GetName(tmEmplId); // Set Tuition Request Id to New Request Session["RequestIdU"] = "0"; // Get the Team Member's Balances TMAvailableBalanceDA tmAvailableBalanceDA = new TMAvailableBalanceDA(); DataTable dtTMBal = tmAvailableBalanceDA.GetBal(tmEmplId, System.DateTime.Now); foreach (DataRow dr in dtTMBal.Rows) { if (dr["Reimbursement_Type"].ToString() == "Tuition") { // Need to save the TM Available Balance for use in the Tuition System Eligibility Checks Session["TuitionAvailBal"] = dr["AvailAmt"]; } } // Display the New Tuition Request screen ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/TuitionRequest/NewRequest.aspx');", true); } else if (Session["SearchType"].ToString() == "NewWWRequest") { // Save Employee Id Session["TMEmplIdU"] = tmEmplId; // Get Team Member's Name Session["TMNameU"] = GetName(tmEmplId); // Set Weight Watcher Request Id to New Request Session["RequestIdU"] = "0"; // Display the New Weight Watchers Request screen ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/WeightWatcherRequest/WWNewRequest.aspx');", true); } else if (Session["SearchType"].ToString() == "TuitionReassign") { // Get the Tuition Request record TuitionRequestsBO trBO = new TuitionRequestsBO(); TuitionRequestDA trDA = new TuitionRequestDA(); trBO = trDA.GetTuitionRequest(Convert.ToInt32(Session["RequestIdU"])); // Reassign the Processor trBO.Processor = tmEmplId; trBO.Modified_By = Session["EmplId"].ToString(); // Update the Tuition Request trDA.UpdateTuitionRequestStatus(trBO); Session.Remove("SearchType"); // Display the Processor Tuition Assigned screen ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/Processor/TuitionAssigned.aspx');", true); } else if (Session["SearchType"].ToString() == "WWReassign") { // Get the Weight Watchers Request record WWRequestBO wwrBO = new WWRequestBO(); WWRequestDA wwrDA = new WWRequestDA(); wwrBO = wwrDA.GetWWRequest(Convert.ToInt32(Session["RequestIdU"])); // Reassign the Processor wwrBO.Processor = tmEmplId; wwrBO.Modified_By = Session["EmplId"].ToString(); // Update the Weight Watchers Request wwrDA.UpdateWWRequestStatus(wwrBO); Session.Remove("SearchType"); // Display the Processor Weight Watchers Assigned screen ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/Processor/WWAssigned.aspx');", true); } else if (Session["SearchType"].ToString() == "CSRTuitionRequest") { // Save Employee Id Session["TMEmplId"] = tmEmplId; // Get Team Member's Name Session["TMName"] = GetName(tmEmplId); // Display the New Tuition Request screen ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/TuitionRequest/TransactionHistory.aspx');", true); } else if (Session["SearchType"].ToString() == "CSRWWRequest") { // Save Employee Id Session["TMEmplId"] = tmEmplId; // Get Team Member's Name Session["TMName"] = GetName(tmEmplId); // Display the New Tuition Request screen ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/WeightWatcherRequest/WWTransactionHistory.aspx');", true); } else if (Session["SearchType"].ToString() == "TuitionCompletedRequests") { // Save Employee Id Session["TCREmplId"] = tmEmplId; // Get Team Member's Name Session["TMName"] = GetName(tmEmplId); // Display the Tuition Completed Requests screen ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/QualityReview/TuitionCompletedRequests.aspx');", true); } else { // Save Employee Id Session["TMEmplId"] = tmEmplId; // Get Team Member's Name Session["TMName"] = GetName(tmEmplId); Session.Remove("SearchType"); // Display the Team Member Profile screen //((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openPopUp2('/Processor/TMProfile.aspx', 'TMProfile', 760, 825); window.close();", true); ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openPopUp('/Processor/TMProfile.aspx?TMEmplId=" + tmEmplId + "', 'TMProfile', 760, 825); window.close();", true); } } else { // Save Employee Id Session["TMEmplId"] = tmEmplId; // Get Team Member's Name Session["TMName"] = GetName(tmEmplId); Session.Remove("SearchType"); // Display the Team Member Profile screen //((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openPopUp2('/Processor/TMProfile.aspx', 'TMProfile', 760, 825); window.close();", true); ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openPopUp('/Processor/TMProfile.aspx?TMEmplId=" + tmEmplId + "', 'TMProfile', 760, 825); window.close();", true); } } } catch (InternalException err) { // Display a Messagebox AlertMessage.Show(err.UserFriendlyMsg, this.Page); } catch (Exception err) { // Database Error string errMsg = string.Format("{0} - gvResults Selected Index Changed Error - {1}", GetType().FullName, err.Message); // Log the Error AppLogWrapper.LogError(errMsg); // Display a User Friendly Error Message errMsg = "There was a problem selecting a record on the Search screen. If the problem persists, please contact Technical Support."; // Display a Messagebox AlertMessage.Show(errMsg, this.Page); } }
/// <summary> /// gvDirectReportCA - RowCreated /// </summary> protected void gvDirectReportCA_RowCreated(object sender, GridViewRowEventArgs e) { try { // Process Header //if (e.Row.RowType == DataControlRowType.Header) //{ // // Create a New Record button // Button btnNew = new Button(); // btnNew.ID = "btnNew"; // btnNew.Text = "Add"; // btnNew.Command += new CommandEventHandler(btnNew_Click); // btnNew.CausesValidation = false; // e.Row.Cells[0].Controls.Add(btnNew); //} // Process DataRow if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.DataItem != null) { DataRowView drv = (DataRowView)e.Row.DataItem; // Check for all the rows in the grid for (int i = 0; i <= e.Row.RowIndex; i++) { // Check for Edit Button //if (((Button)e.Row.Cells[6].Controls[0]).Text == "Edit") //{ // Hide the Edit Button //((Button)e.Row.Cells[6].Controls[0]).Style["display"] = "None"; if (Session["Status"] != null) { if (Session["Status"].ToString().ToUpper() == "WIP") { // Change the Text on the Action Button to Pending Manager TM Discussion ((Button)e.Row.Cells[6].Controls[0]).Text = "Pnd Mgr TM Disc"; } if (Session["Status"].ToString().ToUpper() == "PNDTMDISC") { // Change the Text on the Action Button to Pending TM Ack ((Button)e.Row.Cells[6].Controls[0]).Text = "Pnd TM Ack"; } if (Session["Status"].ToString().ToUpper() == "PNDTMACK") { // Hide the Button ((Button)e.Row.Cells[6].Controls[0]).Style["display"] = "None"; } if (Session["Status"].ToString().ToUpper() == "TMLOA") { // Hide the Button ((Button)e.Row.Cells[6].Controls[0]).Style["display"] = "None"; } } //} } } //// Check for Edit Button //if (((Button)e.Row.Cells[6].Controls[0]).Text == "Edit") //{ // // Hide the Edit Button // ((Button)e.Row.Cells[6].Controls[0]).Style["display"] = "None"; //} } } catch (InternalException err) { // Display a Messagebox AlertMessage.Show(err.UserFriendlyMsg, this.Page); } catch (Exception err) { // Error string errMsg = string.Format("{0} - gvDirectReportCA Row Created Error - {1}", GetType().FullName, err.Message); // Log the Error AppLogWrapper.LogError(errMsg); // Save a User Friendly Error Message in Session Variable errMsg = "There was a problem creating a row in the CA grid for Direct report TMs. If the problem persists, please contact Technical Support."; // Display a Messagebox AlertMessage.Show(errMsg, this.Page); } }
/// <summary> /// gvDirectReportCA - OnRowDataBound /// </summary> protected void gvDirectReportCA_RowDataBound(object sender, GridViewRowEventArgs e) { const string WIPText = "Work in Progress"; const string PndTMDiscText = "Pnd Mgr TM Disc"; const string PndTMAckText = "Pnd TM Ack"; //const string CancelText = "Cancel"; try { // Process DataRow if (e.Row.RowType == DataControlRowType.DataRow) { int idx = Convert.ToInt32(e.Row.RowIndex); string statusCode = gvDirectReportCA.DataKeys[idx].Values["Status_Code"].ToString(); //Button btnCancel = (Button)e.Row.Cells[6].Controls[0]; Button btnCancel = (Button)e.Row.Cells[6].FindControl("cancel"); btnCancel.Visible = false; Button btnPndTMDisc = (Button)e.Row.Cells[6].FindControl("pndTMDisc"); btnPndTMDisc.Visible = false; Button btnPndTMAck = (Button)e.Row.Cells[6].FindControl("pndTMAck"); btnPndTMAck.Visible = false; DataRowView drv = (DataRowView)e.Row.DataItem; if (statusCode.ToString().ToUpper() == "WIP") { btnPndTMDisc.Visible = true; } if (drv.Row.ItemArray[5].ToString() == WIPText) { btnPndTMDisc.Visible = true; } if (drv.Row.ItemArray[5].ToString() == PndTMDiscText) { btnPndTMDisc.Visible = true; } // Check for Pnd TM Discussion Button if (btnPndTMDisc.Text == PndTMDiscText) { btnPndTMDisc.Attributes["onclick"] = "javascript:if (! confirm('Are you sure you want to change the status. '))" + "{return false;}"; btnPndTMDisc.Visible = false; btnPndTMAck.Visible = true; } // Check for Pnd TM Ack Button if (btnPndTMAck.Text == PndTMAckText) { // Add a confirmation //btnPndTMAck.Attributes["onclick"] = "javascript:if (! confirm('Are you sure you want to change the status. '))" + // "{return false;}"; if (btnPndTMAck.Attributes["onclick"].Equals(true)) { btnPndTMAck.Visible = false; } } // Check if row is NOT in Edit mode if (e.Row.RowState != DataControlRowState.Edit && e.Row.RowState != (DataControlRowState.Edit | DataControlRowState.Alternate)) { // Change the Background Color of the row during Hover GridFormatting.GridViewStyle(e); // Set OnClick event to go into Select Mode e.Row.Attributes.Add("onClick", Page.ClientScript.GetPostBackClientHyperlink(gvDirectReportCA, "Select$" + e.Row.RowIndex)); } } } catch (InternalException err) { // Display a Messagebox AlertMessage.Show(err.UserFriendlyMsg, this.Page); } catch (Exception err) { // Error string errMsg = string.Format("{0} - gvDirectReportCA Row Data Bound Error - {1}", GetType().FullName, err.Message); // Log the Error AppLogWrapper.LogError(errMsg); // Save a User Friendly Error Message in Session Variable errMsg = "There was a problem creating a row in the CA for DirectReport TM grid. If the problem persists, please contact Technical Support."; // Display a Messagebox AlertMessage.Show(errMsg, this.Page); } }