public bool LogImport(long idUser, string text = "") { using (DpsConnection cnn = new DpsConnection(_config.ConnectionString)) { DataTable dt = cnn.CreateDataTable("select * from Tbl_Log_Loai where IdRow=" + Loai); if (dt == null || dt.Rows.Count == 0) { Error = "Loại đối tượng không đúng"; return(false); } string ip = _accessor.HttpContext.Connection.RemoteIpAddress.ToString(); Hashtable val = new Hashtable(); val.Add("IdLoaiLog", Loai); val.Add("IdHanhDong", 7); val.Add("IP", ip); val.Add("NoiDung", "Import danh sách " + dt.Rows[0]["LoaiLog"].ToString().ToLower() + " " + text); val.Add("CreatedBy", idUser); val.Add("CreatedDate", DateTime.Now); int kq = cnn.Insert(val, "Tbl_Log"); cnn.Disconnect(); if (kq == 1) { return(true); } else { return(false); } } }
/// <summary> /// /// </summary> /// <param name="type">1: Update, 2: Check, 3: Get</param> /// <param name="request">reqtest json khi bắn API</param> /// <param name="response">response json khi API trả về</param> /// <param name="ErrorCode">ErrorCode</param> /// <param name="ErrorMessage">ErrorMessage</param> /// <returns></returns> public bool LogJeedocs(int type, string request, string response, string ProcessCode, string ProcessMessage, int idUser, bool Success) { try { using (DpsConnection cnn = new DpsConnection(_config.ConnectionString)) { Hashtable val = new Hashtable(); //val.Add("type", Loai); val.Add("ProcessCode", ProcessCode); val.Add("ProcessMessage", ProcessMessage); val.Add("ResponseJson", response); val.Add("Request", request); val.Add("Type", type); val.Add("Success", Success); val.Add("CreatedBy", idUser); val.Add("CreatedDate", DateTime.Now); int kq = cnn.Insert(val, "Tbl_JeeDocs_Log"); cnn.Disconnect(); if (kq == 1) { return(true); } else { return(false); } } } catch (Exception ex) { return(false); } }