Ejemplo n.º 1
0
        public static bool LogsInsert(DateTime dt, ANYID_DATA_CBS rsCBS, ANYID_DATA_ITMX rsITMX)
        {
            try
            {
                ANYID_LOGS rsLog = new ANYID_LOGS();
                if (rsCBS != null)
                {
                    rsLog.LOG_ACTION = "SEARCH";
                    rsLog.LOG_DATA   = JsonConvert.SerializeObject(rsCBS);
                }
                if (rsITMX != null)
                {
                    rsLog.LOG_ACTION = "INSERT";
                    rsLog.LOG_DATA   = JsonConvert.SerializeObject(rsITMX);
                }

                rsLog.CREATED_DATE = dt;
                rsLog.CREATED_USER = Convert.ToString(HttpContext.Current.Session["UserID"]); /* ดึงจาก Session*/
                rsLog.CREATED_SOL  = Convert.ToString(HttpContext.Current.Session["SolID"]);  /* ดึงจาก Session*/


                using (OracleContext db = new OracleContext())
                {
                    db.AddToANYID_LOGS(rsLog);
                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception e)
            {
                log.Error(CommonHelper.ErrMsg(e));
                return(false);
            }
        }