Beispiel #1
0
        public static void SendMail_CreateWS(KMailInfo kMailInfo, CreateWSModel createWSModel)
        {
            var kMailModel = KMail.SendMail(kMailInfo);

            KWSLogCreateWS kWSLogCreateWS = new KWSLogCreateWS
            {
                KMailModel = kMailModel,
                CreateWSModel = createWSModel,
            };

            KWSLog kWSLog = new KWSLog
            {
                EngNum = createWSModel.EngNum,
                KWSLogType = createWSModel.IsAuto.GetValueOrDefault(true) ? KWSLogType.CreateWSAuto : KWSLogType.CreateWSManual,
                Info = KSerDSer.JSerialize<KWSLogCreateWS>(kWSLogCreateWS),
            };

            IMWrapWSLog.KWSLog(kWSLog);

            //Task task = new Task(() =>
            //{
            //    var kMailModel = KMail.SendMail(kMailInfo);

            //    KWSLogCreateWS kWSLogCreateWS = new KWSLogCreateWS
            //    {
            //        KMailModel = kMailModel,
            //        CreateWSModel = createWSModel,
            //    };

            //    KWSLog kWSLog = new KWSLog
            //    {
            //        EngNum = createWSModel.EngNum,
            //        KWSLogType = createWSModel.IsAuto.GetValueOrDefault(true) ? KWSLogType.CreateWSAuto : KWSLogType.CreateWSManual,
            //        Info = KSerDSer.JSerialize<KWSLogCreateWS>(kWSLogCreateWS),
            //    };

            //    IMWrapWSLog.KWSLog(kWSLog);
            //});

            //task.Start(TaskScheduler.FromCurrentSynchronizationContext());
        }
Beispiel #2
0
        private static CreateWSModel CreateWS_Private(CreateWSModel createWSModel)
        {
            CreateWS create = new CreateWS();
            try
            {
                //if (KWSUtility.IsEngFunctionAudit(createWSModel))
                //{
                createWSModel.IsAuto = createWSModel.IsAuto.GetValueOrDefault(true);
                create.Create(createWSModel);
                //}
            }
            catch (Exception ex)
            {
                KElmahUtility.LogException(ex);

                createWSModel.Success = false;
                createWSModel.FailureMsg = createWSModel.FailureMsg + " " + ex.Message;

                KWSLogCreateWS kWSLogCreateWS = new KWSLogCreateWS
                {
                    KMailModel = null,
                    CreateWSModel = createWSModel,
                };

                KWSLog kWSLog = new KWSLog
                {
                    EngNum = createWSModel.EngNum,
                    KWSLogType = KWSLogType.CreateWSFail,
                    Info = KSerDSer.JSerialize<KWSLogCreateWS>(kWSLogCreateWS),
                };

                KRepKWSLog.KWSLog(kWSLog);
            }

            if (createWSModel.Success)
                UpdateWS(createWSModel.EngNum, createWSModel.KPMGOnly);

            return createWSModel;
        }