protected void ButtonGetStartDates_Click(object sender, EventArgs e) { BearCode bearCode = new BearCode(); String MasterMatterNumber = bearCode.AddLeadingZeros(TextBoxMasterMatter.Text, "matter"); DropDownListStartDates.Items.Clear(); TextBoxMasterMatter.Text = MasterMatterNumber; bearCode.PopulateMasterMatterStartDates(DropDownListStartDates, MasterMatterNumber, VariablesSplitManager.ERROR_LOG_FILE_NAME); LabelStartDates.Visible = true; DropDownListStartDates.Visible = true; LabelMasterMatterDescription.Text = bearCode.GetMatterDesc1(MasterMatterNumber, VariablesSplitManager.ERROR_LOG_FILE_NAME); }
protected void Page_Load(object sender, EventArgs e) { utility = new UtilityBillTracker(Page.User.Identity.Name.ToString().Substring(8)); bearCode = new BearCode(); Page.MaintainScrollPositionOnPostBack = true; int totalRows = 0; try { totalRows = dataGridView.Rows.Count; } catch (SqlException sqle) { Logger.QuickLog(errorLogFileName, sqle.Message, "Page_Load()", "int totalRows = dataGridView.Rows.Count"); } utility.SetRowChanged(totalRows); hasPagerRow.Value = "false"; //Set Tool Tips buttonSave.Attributes.Add("onmouseover", "Tip('" + VariablesBillTracker.TOOLTIP_SAVE_BUTTON + "')"); buttonSave.Attributes.Add("onmouseout", "UnTip()"); buttonChangeParameters.Attributes.Add("onmouseover", "Tip('" + VariablesBillTracker.TOOLTIP_RERUN_BUTTON + "')"); buttonChangeParameters.Attributes.Add("onmouseout", "UnTip()"); exitButton.Attributes.Add("onmouseover", "Tip('" + VariablesBillTracker.TOOLTIP_EXIT_BUTTON + "')"); exitButton.Attributes.Add("onmouseout", "UnTip()"); if (!Page.IsPostBack) { LogUserAccess(); } }
protected void Page_Load(object sender, EventArgs e) { utility = new UtilityRAT(); bearCode = new BearCode(); if (Page.IsPostBack) { int totalRows = 0; try { totalRows = GridViewSearchResults.Rows.Count; } catch (SqlException sqle) { Logger.QuickLog(VariablesRAT.ERROR_LOG_FILE_NAME, sqle.Message, "Page_Load()", "int totalRows = dataGridView.Rows.Count"); } utility.SetRowChanged(totalRows); if (GridViewSearchResults.SelectedRow != null) { if (GridViewSearchResults.SelectedRow.RowIndex != -1) { Session["rowSelected"] = GridViewSearchResults.SelectedRow.RowIndex.ToString(); } } } else { Session["rowSelected"] = "-1"; } }
protected void Page_Load(object sender, EventArgs e) { utility = new UtilityCAS(); bearCode = new BearCode(); ImageButtonRecalc.Attributes.Add("onclick", "javascript:return confirm('Recalc Status on All Records (this may take a while)?')"); if (Page.IsPostBack) { int totalRows = 0; try { totalRows = GridViewSearchResults.Rows.Count; } catch (SqlException sqle) { Logger.QuickLog(VariablesCAS.ERROR_LOG_FILE_NAME, sqle.Message, "Page_Load()", "int totalRows = dataGridView.Rows.Count"); } utility.SetRowChanged(totalRows); //rowChanged = new bool[totalRows]; if (GridViewSearchResults.SelectedRow != null) { if (GridViewSearchResults.SelectedRow.RowIndex != -1) { Session["rowSelected"] = GridViewSearchResults.SelectedRow.RowIndex.ToString(); } } } else { Session["defaultColumnWidth1"] = Hidden0.Value.ToString(); Session["defaultColumnWidth2"] = Hidden1.Value.ToString(); Session["defaultColumnWidth3"] = Hidden2.Value.ToString(); Session["defaultColumnWidth4"] = Hidden3.Value.ToString(); Session["defaultColumnWidth5"] = Hidden4.Value.ToString(); Session["defaultColumnWidth6"] = Hidden5.Value.ToString(); Session["defaultColumnWidth7"] = Hidden6.Value.ToString(); Session["defaultColumnWidth8"] = Hidden7.Value.ToString(); Session["defaultColumnWidth9"] = Hidden8.Value.ToString(); Session["defaultColumnWidth10"] = Hidden9.Value.ToString(); Session["rowSelected"] = "-1"; Session["BulkUpdate"] = "Off"; TextBoxBulkGLString.Enabled = false; TextBoxBulkGLString.Attributes.CssStyle.Add("background-color", "#AAB0B7"); PopulateVendors(DropDownListVendors); PopulateOfficeLocations(); } }
protected void PopulateOfficeLocations() { ListItem li = new ListItem("All Offices", "All"); DropDownListOffice.Items.Add(li); BearCode bearCode = new BearCode(); List <ListItem> offices = bearCode.GetLocations(VariablesCashManager.ERROR_LOG_FILE_NAME); for (int i = 0; i < offices.Count; i++) { DropDownListOffice.Items.Add(offices[i]); } }
/// <summary> /// Called before the page is rendered. This is used for the save functionality. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_PreRender(object sender, EventArgs e) { if (Page.IsPostBack) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["eliteConnectionString"].ConnectionString); BearCode bearCode = new BearCode(); if (bearCode.IsNumber(TextBoxAmountToPay.Text) || TextBoxAmountToPay.Text.Equals("")) { String amountToPay = TextBoxAmountToPay.Text; if (amountToPay.Equals("")) { amountToPay = "0"; } try { con.Open(); SqlCommand command = con.CreateCommand(); command.CommandText = "uspBMcBEARCashFlowManagerUpdateAmountToPay"; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@amountToPay", amountToPay); command.Parameters.AddWithValue("@networkId", this.userName); command.ExecuteNonQuery(); LabelMessage.Text = "Value Updated"; } catch (SqlException sqle) { Logger.QuickLog(VariablesCashManager.ERROR_LOG_FILE_NAME, sqle.Message, "adminOptions.aspx: Page_PreRender()", ""); } finally { if (con != null) { con.Close(); } } } else { LabelMessage.Text = "Please enter a valid amount"; } } }
/// <summary> /// Gets the id of the master matter from the BMcSplitManagerHeader table<br /> /// <b>Database Operation</b><br /> /// SQL:<br /> /// SELECT id from dbo.BMcSplitManagerHeader (nolock) /// WHERE MasterMatter = '" + bearCode.AddLeadingZeros(MasterMatterNumber, "matter") +"' /// AND StartDate = '" + StartDate + "' /// </summary> /// <param name="MasterMatterNumber">Master Matter Number</param> /// <param name="StartDate">Start Date of the Master Mater</param> /// <returns>Master Matter ID</returns> public String GetMasterMatterId(String MasterMatterNumber, String StartDate) { SqlConnection con = null; BearCode bearCode = new BearCode(); String sql = " SELECT id from dbo.BMcSplitManagerHeader (nolock) " + " WHERE MasterMatter = '" + bearCode.AddLeadingZeros(MasterMatterNumber, "matter") + "' " + " AND StartDate = '" + StartDate + "' "; String id = ""; try { con = new SqlConnection( ConfigurationManager.ConnectionStrings["eliteConnectionString"].ConnectionString); con.Open(); SqlCommand command = con.CreateCommand(); command.CommandType = CommandType.Text; command.CommandText = sql; SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { id = reader["id"].ToString(); } } catch (SqlException sqle) { Logger.QuickLog(VariablesSplitManager.ERROR_LOG_FILE_NAME, sqle.Message, "TextBoxMasterMatter_TextChanged()", sql); } finally { if (con != null) { con.Close(); } } return(id); }
/// <summary> /// Gets the id of the master matter from the BMcSplitManagerHeader table<br /> /// <b>Database Operation</b><br /> /// SQL:<br /> /// SELECT id from dbo.BMcSplitManagerHeader (nolock) /// WHERE MasterMatter = '" + bearCode.AddLeadingZeros(MasterMatterNumber, "matter") +"' /// AND StartDate = '" + StartDate + "' /// </summary> /// <param name="MasterMatterNumber">Master Matter Number</param> /// <param name="StartDate">Start Date of the Master Mater</param> /// <returns>Master Matter ID</returns> public String GetMasterMatterId(String MasterMatterNumber, String StartDate) { SqlConnection con = null; BearCode bearCode = new BearCode(); String sql = " SELECT id from dbo.BMcSplitManagerHeader (nolock) " + " WHERE MasterMatter = '" + bearCode.AddLeadingZeros(MasterMatterNumber, "matter") +"' " + " AND StartDate = '" + StartDate + "' "; String id = ""; try { con = new SqlConnection( ConfigurationManager.ConnectionStrings["eliteConnectionString"].ConnectionString); con.Open(); SqlCommand command = con.CreateCommand(); command.CommandType = CommandType.Text; command.CommandText = sql; SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { id = reader["id"].ToString(); } } catch (SqlException sqle) { Logger.QuickLog(VariablesSplitManager.ERROR_LOG_FILE_NAME, sqle.Message, "TextBoxMasterMatter_TextChanged()", sql); } finally { if (con != null) { con.Close(); } } return id; }
protected void PopulateOfficeLocations() { ListItem li = new ListItem("All Offices", "All"); DropDownListOffice.Items.Add(li); BearCode bearCode = new BearCode(); List<ListItem> offices = bearCode.GetLocations(VariablesCashManager.ERROR_LOG_FILE_NAME); for (int i = 0; i < offices.Count; i++) { DropDownListOffice.Items.Add(offices[i]); } }
/// <summary> /// uses Stored Procedures: uspBMcBEARSplitManagerCountHeaderRecords & uspBMcBEARSplitManagerCopySplit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonSave_Click(object sender, EventArgs e) { SqlConnection con = null; String MasterMatter = TextBoxMasterMatter.Text; BearCode bearCode = new BearCode(); String NewStartDate = TextBoxNewStartDate.Text; if (bearCode.IsDate(NewStartDate)) { try { con = new SqlConnection( ConfigurationManager.ConnectionStrings["eliteConnectionString"].ConnectionString); con.Open(); SqlCommand command = con.CreateCommand(); command.CommandText = "uspBMcBEARSplitManagerCountHeaderRecords"; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@matter", MasterMatter); command.Parameters.AddWithValue("@startDate", NewStartDate); SqlDataReader reader = command.ExecuteReader(); bool IsHeaderUnique = false; if (reader.Read()) { int countHeaderRecords = Convert.ToInt16(reader["countHeaderRecords"].ToString()); if (countHeaderRecords == 0) { IsHeaderUnique = true; } else { LabelAdminMessage.Text = "This Date Range / Master Matter<br />combination already exists"; } } reader.Close(); if (IsHeaderUnique) { try { command.CommandText = "uspBMcBEARSplitManagerCopySplit"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Clear(); command.Parameters.AddWithValue("@matter", MasterMatter); command.Parameters.AddWithValue("@startDateCopyFrom", DropDownListStartDates.SelectedValue); command.Parameters.AddWithValue("@startDateNew", NewStartDate); command.Parameters.AddWithValue("@updatedBy", utility.UserName); command.ExecuteNonQuery(); LabelAdminMessage.Text = "Record has been copied."; } catch (SqlException sqle) { Logger.QuickLog(VariablesSplitManager.ERROR_LOG_FILE_NAME, sqle.Message, "ButtonSave_Click()", "Copying Split"); LabelAdminMessage.Text = "Error in Copy<br />" + sqle.Message; } } } catch (SqlException sqle) { Logger.QuickLog(VariablesSplitManager.ERROR_LOG_FILE_NAME, sqle.Message, "ButtonSave_Click()", "Checking if HeaderRecords is Unique"); } finally { if (con != null) { con.Close(); } } } else { LabelAdminMessage.Text = "Please Enter a Valid New Start Date"; } }
protected void GridViewDataSelectedIndexChanged(object sender, EventArgs e) { BearCode bearCode = new BearCode(); bearCode.GridViewCustomizePagerRow(dataGridView, dataGridView.BottomPagerRow); }
/// <summary> /// Adds the record to the master matter /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonSaveAdd_Click(object sender, EventArgs e) { if (Session["parentId"].ToString() == null || Session["parentId"].Equals("")) { LabelMessage.Text = "Error Saving.<br />Master Matter Number has been Lost."; } else { BearCode bearCode = new BearCode(); String ParentId = Session["parentId"].ToString(); String SubMatter = bearCode.AddLeadingZeros(TextBoxSubMatterAdd.Text, "matter"); bool errorCaught = false; if (IsSubMatterUnique(ParentId, SubMatter)) { SqlConnection con = null; String ActualPercent = TextBoxActualPctAdd.Text; if (ActualPercent.Equals("")) { ActualPercent = "null"; } String Amount = TextBoxAmountAdd.Text; if (Amount.Equals("")) { Amount = "null"; } /** * " INSERT INTO dbo.BMcSplitManagerDetail " * + " (ParentId, ChildMatter, Amount, PctCalculated, PctActual) " * + " VALUES ( " * + ParentId * + " ,'" + SubMatter + "' " * + " ," + Amount * + " , null " * + " ," + ActualPercent * + " )"; */ String sqlInsert = " INSERT INTO dbo.BMcSplitManagerDetail " + " (ParentId, ChildMatter, Amount, PctCalculated, PctActual) " + " VALUES ( " + ParentId + " ,'" + SubMatter + "' " + " ," + Amount + " , null " + " ," + ActualPercent + " )"; try { con = new SqlConnection( ConfigurationManager.ConnectionStrings["eliteConnectionString"].ConnectionString); con.Open(); SqlCommand command = con.CreateCommand(); command.CommandType = CommandType.Text; command.CommandText = sqlInsert; command.ExecuteNonQuery(); } catch (SqlException sqle) { Logger.QuickLog(VariablesSplitManager.ERROR_LOG_FILE_NAME, sqle.Message, "ButtonSaveAdd_Click()", sqlInsert); LabelMessage.Text = "<u>ERROR ADDING RECORD</u><br />System Message:<br />" + sqle.Message; errorCaught = true; } finally { if (con != null) { con.Close(); } } if (!errorCaught) { LabelMessage.Text = ""; dataGridView.DataBind(); } } else { LabelMessage.Text = "Unable to Add Record. <br/> Sub-Matter: " + SubMatter + " Already Exists for this Master Matter"; } } }
protected void GridViewSearchResults_SelectedIndexChanged(object sender, EventArgs e) { BearCode bearCode = new BearCode(); LabelSelectedMessage.Text = "Selected Row ID: " + GridViewSearchResults.SelectedRow.Cells[columnID].Text + " "; LabelMatterLabel.Text = "Matter:"; LabelMatter.Text = bearCode.GetMatterDesc1( ((TextBox)GridViewSearchResults.SelectedRow.FindControl("matterTB")).Text , VariablesCAS.ERROR_LOG_FILE_NAME); LabelTimekeeperLabel.Text = "Timekeeper:"; LabelTimekeeper.Text = bearCode.GetTimekeeperInfo( ((TextBox)GridViewSearchResults.SelectedRow.FindControl("timekeepTB")).Text , "fullNameWithTkid" , VariablesCAS.ERROR_LOG_FILE_NAME); LabelCostCodeLabel.Text = "CostCode:"; LabelCostCode.Text = utility.GetCostCodeDescription( ((TextBox)GridViewSearchResults.SelectedRow.FindControl("costcodeTB")).Text.Replace("'", "''")); ImageButtonDelete.ImageUrl = "~/images/controls/trash.gif"; ImageButtonDetails.ImageUrl = "~/images/controls/magnifier.png"; ImageButtonSearchMatterPanel.ImageUrl = "~/images/controls/search.gif"; ImageButtonSearchTimekeeperPanel.ImageUrl = "~/images/controls/search.gif"; ImageButtonSelectCostCodePanel.ImageUrl = "~/images/controls/search.gif"; LinkButtonCloseSelected.Text = "X"; if (Session["BulkUpdate"] != null) { if (Session["BulkUpdate"].ToString().Equals("On")) { ImageButtonBulkUpdate.ImageUrl = "~/images/controls/bulk.gif"; ImageButtonBulkUpdate.ToolTip = "Display Bulk Update View"; blankSpan.InnerHtml = " "; } else { ImageButtonBulkUpdate.ImageUrl = "~/images/controls/smallwhitedot.gif"; ImageButtonBulkUpdate.ToolTip = ""; blankSpan.InnerHtml = ""; } } Session["MatterTBClientName"] = ((TextBox)GridViewSearchResults.SelectedRow.FindControl("matterTB")).ClientID.ToString(); Session["TimekeeperTBClientName"] = ((TextBox)GridViewSearchResults.SelectedRow.FindControl("timekeepTB")).ClientID.ToString(); Session["CostCodeTBClientName"] = ((TextBox)GridViewSearchResults.SelectedRow.FindControl("costcodeTB")).ClientID.ToString(); if (Session["rowSelected"] != null) { if (!Session["rowSelected"].ToString().Equals( GridViewSearchResults.SelectedRow.RowIndex.ToString() )) { HideAllPanels(true); } } }
/// <summary> /// Populates Office DropDownList. /// SQL is called from the BearCode class /// </summary> protected void PopulateOfficeLocations() { ListItem li = new ListItem("Select an Office", "-1"); DropDownListDetailsOffice.Items.Add(li); BearCode bearCode = new BearCode(); List<ListItem> offices = bearCode.GetLocations(VariablesCAS.ERROR_LOG_FILE_NAME); for (int i = 0; i < offices.Count; i++) { DropDownListDetailsOffice.Items.Add(offices[i]); } }