Ejemplo n.º 1
0
        public JArray GetKWSLog(KWSLogType kWSLogType, string engNum = null, DateTime? fromDt = null, DateTime? toDt = null)
        {
            var result = KRepKWSLog.GetKWSLog(kWSLogType, engNum, fromDt, toDt);

            if (result == null)
                return null;

            var retModel = JArray.FromObject(result);

            return retModel;
        }
Ejemplo n.º 2
0
        public static List<KWSLog> GetKWSLog(KWSLogType kWSLogType, string engNum = null, DateTime? fromDt = null, DateTime? toDt = null)
        {
            var fDate = fromDt.GetValueOrDefault(DateTime.MinValue).ToUniversalTime();
            var tDate = toDt.GetValueOrDefault(DateTime.Now).GetToDate().ToUniversalTime();

            using (KDBContext db = new KDBContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    List<KWSLog> result = null;

                    if (!string.IsNullOrWhiteSpace(engNum))
                    {
                        if (kWSLogType == KWSLogType.CreateWS)
                            result = db.KWSLog.Where(x => x.EngNum == engNum
                                && (x.KWSLogType == KWSLogType.CreateWSAuto || x.KWSLogType == KWSLogType.CreateWSManual || x.KWSLogType == KWSLogType.CreateWSFail)
                                && x.InsertWhen >= fDate
                                && x.InsertWhen <= tDate
                                )
                                .OrderByDescending(x => x.InsertWhen).ToList();
                        else
                            result = db.KWSLog.Where(x => x.EngNum == engNum && x.KWSLogType == kWSLogType
                                && x.InsertWhen >= fDate
                                && x.InsertWhen <= tDate
                                ).OrderByDescending(x => x.InsertWhen).ToList();
                    }
                    else
                    {
                        if (kWSLogType == KWSLogType.CreateWS)
                            result = db.KWSLog.Where(x => (x.KWSLogType == KWSLogType.CreateWSAuto || x.KWSLogType == KWSLogType.CreateWSManual || x.KWSLogType == KWSLogType.CreateWSFail)
                                && x.InsertWhen >= fDate
                                && x.InsertWhen <= tDate
                                )

                                .OrderByDescending(x => x.InsertWhen).ToList();
                        else
                            result = db.KWSLog.Where(x => x.KWSLogType == kWSLogType
                                && x.InsertWhen >= fDate
                                && x.InsertWhen <= tDate
                                ).OrderByDescending(x => x.InsertWhen).ToList();
                    }

                    return result;
                }
            }
        }
Ejemplo n.º 3
0
        public static void KWSLogAddDeleteUser(string num, string groupName, string userId, KWSLogType kWSLogType)
        {
            KWSLogAddDeleteUser kWSLogAddDeleteUser = new KWSLogAddDeleteUser
            {
                GroupName = groupName,
                UserId = userId
            };

            KWSLog kWSLog = new KWSLog
            {
                EngNum = num,
                KWSLogType = kWSLogType,
                Info = KSerDSer.JSerialize<KWSLogAddDeleteUser>(kWSLogAddDeleteUser),

            };

            KWSLog(kWSLog);
        }
Ejemplo n.º 4
0
 public void KWSLogAddDeleteUser(string num, string groupName, string userId, KWSLogType kWSLogType)
 {
     KRepKWSLog.KWSLogAddDeleteUser(num, groupName, userId, kWSLogType);
 }