Beispiel #1
0
        public JsonResult SaveChanges(int id, string newValue, PriceListFieldName priceListFieldName)
        {
            var jsonSuccessResult = new JsonSuccessResult();

            try
            {
                string oldValue = String.Empty;

                // Update Row
                PriceListProducts.SaveChanges(id, newValue, priceListFieldName, out oldValue);

                // Insert Log
                #region Log

                PriceListLog log = new PriceListLog
                {
                    OldValue           = oldValue,
                    NewValue           = newValue,
                    PriceListFieldName = priceListFieldName,
                    PriceListProductID = id,
                    LastUpdate         = DateTime.Now
                };

                PriceListLogs.Inset(log);

                #endregion Log

                jsonSuccessResult.Success = true;
            }
            catch (Exception ex)
            {
                jsonSuccessResult.Errors  = new string[] { ex.Message };
                jsonSuccessResult.Success = false;
            }

            return(new JsonResult()
            {
                Data = jsonSuccessResult
            });
        }
Beispiel #2
0
        public JsonResult GetLogs(string fromDate, string toDate)
        {
            var jsonSuccessResult = new JsonSuccessResult();

            try
            {
                DateTime?fDate = null,
                        tDate  = null;

                if (!String.IsNullOrWhiteSpace(fromDate))
                {
                    fDate = Utilities.ToEnglishDate(fromDate);
                }
                if (!String.IsNullOrWhiteSpace(toDate))
                {
                    tDate = Utilities.ToEnglishDate(toDate);
                }

                var list = PriceListLogs.Get(fDate, tDate);

                renderValue(ref list);

                jsonSuccessResult.Data    = list;
                jsonSuccessResult.Success = true;
            }
            catch (Exception ex)
            {
                jsonSuccessResult.Errors  = new string[] { ex.Message };
                jsonSuccessResult.Success = false;
            }

            return(new JsonResult()
            {
                Data = jsonSuccessResult
            });
        }