Esempio n. 1
0
        /// <summary>
        /// 物件資料處理 (By SQL)
        /// </summary>
        /// <param name="type">處理類型</param>
        /// <param name="data">實體資料</param>
        /// <param name="extand">擴展資訊</param>
        public T ModifyBySql(string type, T data, GenericExtand extand = null)
        {
            var context = ModifyContextFactory.CreateInstance <T>(extand);
            var output  = context.ModifyBySql(type, data).Item1;

            ModifyAfter(extand, output);
            return(output);
        }
Esempio n. 2
0
        /// <summary>
        /// 物件資料處理
        /// </summary>
        /// <param name="type">處理類型</param>
        /// <param name="data">實體資料</param>
        /// <param name="parameters">非實體屬性之參數資料</param>
        /// <param name="extand">擴展資訊</param>
        public T Modify(string type, T data, object parameters = null, GenericExtand extand = null)
        {
            var context = ModifyContextFactory.CreateInstance <T>(extand);
            var output  = context.Modify(type, data, parameters).Item1;

            ModifyAfter(extand, output);
            return(output);
        }
Esempio n. 3
0
        /// <summary>
        /// 物件集合處理
        /// </summary>
        /// <param name="type">處理類型</param>
        /// <param name="data">實體資料</param>
        /// <param name="list">實體集合</param>
        /// <param name="parameters">非實體屬性之參數資料</param>
        /// <param name="extand">擴展資訊</param>
        public IEnumerable <T> ModifyList(string type, IEnumerable <T> list, T data = null, object parameters = null, GenericExtand extand = null)
        {
            var context = ModifyContextFactory.CreateInstance <T>(extand);
            var output  = context.ModifyList(type, list, data, parameters).Item1;

            ModifyListAfter(extand, output);
            return(output);
        }
Esempio n. 4
0
        /// <summary>
        /// 物件集合處理 (By SQL)
        /// </summary>
        /// <param name="type">處理類型</param>
        /// <param name="list">實體集合</param>
        /// <param name="extand">擴展資訊</param>
        public IEnumerable <T> ModifyListBySql(string type, IEnumerable <T> list, GenericExtand extand = null)
        {
            var context = ModifyContextFactory.CreateInstance <T>(extand);
            var output  = context.ModifyListBySql(type, list).Item1;

            ModifyListAfter(extand, output);
            return(output);
        }
Esempio n. 5
0
        /// <summary>
        /// 儲存
        /// </summary>
        /// <param name="data">實體資料</param>
        /// <returns></returns>
        public Repair Save(Repair data)
        {
            var context = ModifyContextFactory.CreateInstance <Repair>();
            var output  = context.Modify("Insert", data);

            if (string.IsNullOrWhiteSpace(output.Item2["REGISTER_TIME"]))
            {
                throw new Exception($"設備 {data.DEVICE_SN } 並非異常狀態");
            }

            var result = output.Item1;

            result.REGISTER_TIME = DateTime.Parse(output.Item2["REGISTER_TIME"]);

            return(result);
        }