public void Insert_Record(BE_LoanPosting NewBEObj)
        {
            SqlTransaction sqlTransaction = (SqlTransaction)null;

            try
            {
                SqlConnection sqlConnection = new SqlConnection(this.ConnString);
                SqlCommand    command       = new SqlCommand("InsertLoanPosting", sqlConnection);
                sqlConnection.Open();
                sqlTransaction = sqlConnection.BeginTransaction();
                //command.CommandText = "INSERT INTO Trans_InvestmentPosting\r\n                                        (InvestmentPostingID,InvestorsID, InvestmentDate, ModifiedDate, Amount, IsActive)\r\n                                        VALUES (@InvestmentPostingID,@InvestorsID, @InvestmentDate, @ModifiedDate, @Amount, @IsActive)";
                command.Transaction    = sqlTransaction;
                command.CommandType    = CommandType.StoredProcedure;
                this.InvestmentPosting = int.Parse(DataAccess.GetMaxNO("LoanPostingID", "Trans_LoanPosting").ToString());
                NewBEObj.LoanPostingID = this.InvestmentPosting;
                command.Parameters.AddWithValue("@LoanPostingID", (object)NewBEObj.LoanPostingID);
                command.Parameters.AddWithValue("@PersonID", (object)NewBEObj.PersonID);
                command.Parameters.AddWithValue("@Amount", (object)NewBEObj.Amount);
                command.Parameters.AddWithValue("@Created_At", (object)NewBEObj.Created_At);
                command.Parameters.AddWithValue("@Modify_At", (object)"1900-01-01");
                command.Parameters.AddWithValue("@IsActive", NewBEObj.IsActive);
                command.ExecuteNonQuery();
                command.Parameters.Clear();
                command.CommandText = "Insert_CashBalance";
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@CashInDate", (object)NewBEObj.Created_At);
                command.Parameters.AddWithValue("@TableID", (object)NewBEObj.LoanPostingID);
                command.Parameters.AddWithValue("@TableName", (object)"Trans_InvestmentPosting");
                command.Parameters.AddWithValue("@Dr", (object)NewBEObj.Amount);
                command.Parameters.AddWithValue("@Cr", (object)0);
                command.Parameters.AddWithValue("@IpAddress", (object)"192.168.3.67");
                command.ExecuteNonQuery();
                command.Parameters.Clear();
                sqlTransaction.Commit();
                sqlConnection.Close();
                command.Dispose();
                sqlTransaction.Dispose();
            }
            catch (Exception ex)
            {
                int num = (int)MessageBox.Show(ex.Message, DataAccess.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                sqlTransaction.Rollback();
                //( sqlTransaction.Rollback());
            }
        }
 public void Update_Record(BE_LoanPosting NewUpdateObj)
 {
     try
     {
         SqlConnection sqlConnection = new SqlConnection(this.ConnString);
         sqlConnection.Open();
         SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
         SqlCommand     command        = sqlConnection.CreateCommand();
         //SqlCommand command = new SqlCommand("UpdateLoanPosting", sqlConnection);
         command.Transaction = sqlTransaction;
         command.CommandText = " UPDATE    CashBalance\r\n                                                       SET Dr =@Dr \r\n                                                       WHERE (TableName LIKE '%Trans_LoanPosting%') AND (TableID = @TableID)";
         command.Parameters.AddWithValue("@TableID", (object)NewUpdateObj.LoanPostingID);
         command.Parameters.AddWithValue("@Dr", (object)NewUpdateObj.Amount);
         command.ExecuteNonQuery();
         command.Parameters.Clear();
         //command.CommandText = "UPDATE Trans_InvestmentPosting\r\n                                         SET InvestorsID =@InvestorsID,\r\n                                         ModifiedDate=@ModifiedDate,\r\n                                         Amount =@Amount\r\n                                         WHERE (InvestmentPostingID = @InvestmentPostingID)";
         command             = new SqlCommand("UpdateLoanPosting", sqlConnection);
         command.Transaction = sqlTransaction;
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@LoanPostingID", (object)NewUpdateObj.LoanPostingID);
         command.Parameters.AddWithValue("@PersonID", (object)NewUpdateObj.PersonID);
         command.Parameters.AddWithValue("@Amount", (object)NewUpdateObj.Amount);
         command.Parameters.AddWithValue("@Modify_At", (object)NewUpdateObj.Modify_At);
         command.Parameters.AddWithValue("@IsActive", NewUpdateObj.IsActive);
         command.ExecuteNonQuery();
         command.Parameters.Clear();
         sqlTransaction.Commit();
         sqlConnection.Close();
         command.Dispose();
         sqlTransaction.Dispose();
     }
     catch (Exception ex)
     {
         int num = (int)MessageBox.Show(ex.Message, DataAccess.ProjectName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }