Esempio n. 1
0
        /// <summary>
        /// The third parameter is added for audit - framework
        /// It will hold the entity id. If this id/user id is passed as empty no audit entry will be made
        /// </summary>
        /// <param name="cmd"></param>
        /// <param name="userId"></param>
        /// <param name="contextId"></param>
        /// <returns></returns>
        public int execInsertUpdate(String cmd, String userId)
        {
            int count = 0;

            try
            {
                //       orclCmd = new OracleCommand(cmd, orclConn);
                //     count = orclCmd.ExecuteNonQuery();
                sqlCmd = new SqlCommand(cmd, sqlConn);
                count  = sqlCmd.ExecuteNonQuery();
                AuditData.createAuditRecordForCommand(cmd,
                                                      System.Web.HttpContext.Current.Session[Connections.LOGGED_IN_USER_ID_STRING].ToString(),
                                                      System.Web.HttpContext.Current.Session[Connections.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            }
            catch (Exception e)
            {
                //throw e;
            }
            finally
            {
                //It can be logged only if there is no problem in creating the connection
                //cmd = INSERT_DB_LOG + "(" + cmd + "," + (DateTime.Now) + "," + (userId != null ? userId : "") + ")";
                //orclCmd = new OracleCommand(cmd, orclConn);
                //orclCmd.ExecuteNonQuery();
            }
            return(count);
        }