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 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);
        }
Exemple #3
0
        /// <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>
        /// 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";
                }

            }


        }
        /// <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";
                }
            }
        }
        /// <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;
        }