Exemplo n.º 1
0
        public void Update_Record(BE_Previous NewBEObj)
        {
            SqlTransaction sqlTransaction = (SqlTransaction)null;

            try
            {
                string        Qry           = @"Update Trans_PreviousData
                                set
                                Date=@Date,
                                Name=@Name,
                                Amount=@Amount,
                                Description=@Description,
                                Modify_At=@Modify_At,
                                IsActive=@IsActive
                                where RecordID=@RecordID";
                SqlConnection sqlConnection = new SqlConnection(this.ConnString);
                SqlCommand    command       = new SqlCommand(Qry, sqlConnection);
                sqlConnection.Open();
                sqlTransaction      = sqlConnection.BeginTransaction();
                command.Transaction = sqlTransaction;
                command.CommandType = CommandType.Text;
                command.CommandText = Qry;
                command.Parameters.AddWithValue("@RecordID", (object)NewBEObj.ReocordID);
                command.Parameters.AddWithValue("@Date", (object)NewBEObj.Date);
                command.Parameters.AddWithValue("@Name", (object)NewBEObj.Name);
                command.Parameters.AddWithValue("@Amount", (object)NewBEObj.Amount);
                command.Parameters.AddWithValue("@Description", (object)NewBEObj.Description);
                command.Parameters.AddWithValue("@Modify_At", (object)NewBEObj.Modify_At);
                command.Parameters.AddWithValue("@IsActive", NewBEObj.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);
                sqlTransaction.Rollback();
            }
        }
Exemplo n.º 2
0
        public void Insert_Record(BE_Previous NewBEObj)
        {
            SqlTransaction sqlTransaction = (SqlTransaction)null;

            try
            {
                string        Qry           = @"Insert into trans_PreviousData(RecordID,Date,Name,Amount,Description,Created_At,Modify_At,IsActive)
                                Values
                                (@RecordID,@Date,@Name,@Amount,@Description,@Created_At,@Modify_At,@IsActive)";
                SqlConnection sqlConnection = new SqlConnection(this.ConnString);
                SqlCommand    command       = new SqlCommand(Qry, sqlConnection);
                sqlConnection.Open();
                sqlTransaction         = sqlConnection.BeginTransaction();
                command.Transaction    = sqlTransaction;
                command.CommandType    = CommandType.Text;
                command.CommandText    = Qry;
                this.InvestmentPosting = int.Parse(DataAccess.GetMaxNO("RecordID", "Trans_PreviousData").ToString());
                NewBEObj.ReocordID     = this.InvestmentPosting;
                command.Parameters.AddWithValue("@RecordID", (object)NewBEObj.ReocordID);
                command.Parameters.AddWithValue("@Date", (object)NewBEObj.Date);
                command.Parameters.AddWithValue("@Name", (object)NewBEObj.Name);
                command.Parameters.AddWithValue("@Amount", (object)NewBEObj.Amount);
                command.Parameters.AddWithValue("@Description", (object)NewBEObj.Description);
                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();
                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();
            }
        }