Ejemplo n.º 1
0
        public static async Task<ResponseItem> InsertUpdateLog(string url, string json_data) 
        {
            ResponseItem result = new ResponseItem();
            try
            {
                var response_data = await HttpPost(url, json_data) + "";
                if (response_data.ToLower().StartsWith("error"))
                {
                    result.IsError = true;
                    string[] tmp = response_data.Split('|');
                    result.ErrorCode = tmp[1];
                    result.ErrorMessage = tmp[2];
                }
                else
                {
                    var response_collection = JsonConvert.DeserializeObject<SYS_tblActionLogDRO>(response_data + "");

                    if (response_collection != null)
                        result = response_collection.ResponseItem;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.Message = ex.Message;
            }

            return result;
        }
Ejemplo n.º 2
0
        public async static Task<ResponseItem> InsertUpdateLog(SYS_tblActionLogDTO item)
        {
            ResponseItem result = new ResponseItem();
            try
            {
                string url = string.Format(@"{0}/InsertUpdateLog", GetBaseUrl());
                var postData = new SYS_tblActionLogDCO
                {
                    ID = item.ID,
                    ActionVN = item.ActionVN,
                    ActionEN = item.ActionEN,
                    ActionTime = item.ActionTime,
                    FunctionID = item.FunctionID,
                    FunctionNameVN = item.FunctionNameVN,
                    FunctionNameEN = item.FunctionNameEN,
                    DescriptionEN = item.DescriptionEN,
                    DescriptionVN = item.DescriptionVN,
                    FullName = item.FullName,
                    ComputerName = item.ComputerName,
                    AccountWindows = item.AccountWindows,
                    IPLAN = item.IPLAN,
                    IPWAN = item.IPWAN,
                    MacAddress = item.MacAddress,
                    Activity = item.Activity,
                    UserID = item.UserID,
                    LanguageID = item.LanguageID
                };
                var json_data = "{\"actionLog\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await SYS_tblActionLogDAO.InsertUpdateLog(url, json_data);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.Message = ex.Message;
            }

            return result;
        }