Пример #1
0
        /// <summary>
        /// Contact Upd
        /// </summary>
        public static async Task <ContactEntity> ContactUpd(ContactEntity item, string userGuid, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryFirstOrDefaultAsync <ContactEntity>(
                    "pm_contact_upd", new
                {
                    contact_guid_in       = item.contact_guid,
                    service_group_guid_in = serviceGroupGuid,
                    user_guid_in          = userGuid,
                    contact_type_guid_in  = item.contact_type_guid,
                    contact_info_in       = item.contact_info
                },
                    commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");

                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// Attachment Upd
        /// </summary>
        public static async Task <AttachmentEntity> AttachmentUpd(AttachmentEntity item)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryFirstOrDefaultAsync <AttachmentEntity>(
                    "pm_attachment_upd", new
                {
                    service_group_guid_in = item.service_group_guid,
                    user_guid_in          = item.user_guid,
                    container_in          = item.container,
                    object_guid_in        = item.object_guid,
                    name_in = item.name,
                    uri_in  = item.uri
                },
                    commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");

                return(null);
            }
        }
Пример #3
0
        /// <summary>
        /// Nomenclature Material Upd
        /// </summary>
        public static async Task <NomenclatureOperationEntity> NomenclatureOperationUpd(NomenclatureOperationEntity item,
                                                                                        string userGuid, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryFirstOrDefaultAsync <NomenclatureOperationEntity>(
                    "pm_nomenclature_operation_upd", new
                {
                    nomenclature_operation_guid_in = item.nomenclature_operation_guid,
                    nomenclature_guid_in           = item.nomenclature_guid,
                    service_group_guid_in          = serviceGroupGuid,
                    user_guid_in                 = userGuid,
                    operation_guid_in            = item.operation_guid,
                    operation_count_in           = item.operation_count,
                    operation_price_in           = item.operation_price,
                    operation_price_total_in     = item.operation_price_total,
                    operation_price_total_src_in = item.operation_price_total_src,
                    operation_attribute_in       = item.operation_attribute
                },
                    commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");

                return(null);
            }
        }
Пример #4
0
        public async Task <bool> Send(ISmsMessage smsItem)
        {
            if (smsItem.Retries > MaximumRetries)
            {
                return(false);
            }
            if (smsItem.IsNew)
            {
                await Database.Save(smsItem);
            }
            try
            {
                await Dispatcher.Dispatch(smsItem);

                await Database.Update(smsItem, o => o.DateSent = LocalTime.Now);

                return(true);
            }
            catch (Exception ex)
            {
                await SendError.Raise(new SmsSendingEventArgs(smsItem) { Error = ex });

                Log.Error(ex, "Can not send the SMS queue item.");
                await RecordFailedAttempt(smsItem);

                return(false);
            }
        }
Пример #5
0
        /// <summary>
        /// EquipmentColorfulnessEditionPrice Get
        /// </summary>
        public static async Task <IEnumerable <EquipmentColorfulnessEditionPrice> > EquipmentColorfulnessEditionPriceGet(
            string equipmentGuid, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryAsync <EquipmentColorfulnessEditionPrice>(
                    "pm_equipment_colorfulness_edition_price_get", new
                {
                    equipment_guid_in     = equipmentGuid,
                    service_group_guid_in = serviceGroupGuid
                },
                    commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");

                return(null);
            }
        }
Пример #6
0
        /// <summary>
        /// Nomenclature Operation Get
        /// </summary>
        public static async Task <IEnumerable <NomenclatureOperationEntity> > NomenclatureOperationGet(
            string nomenclatureOperationGuid, string nomenclatureGuid, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryAsync <NomenclatureOperationEntity>(
                    "pm_nomenclature_operation_get", new
                {
                    nomenclature_operation_guid_in = nomenclatureOperationGuid,
                    nomenclature_guid_in           = nomenclatureGuid,
                    service_group_guid_in          = serviceGroupGuid
                },
                    commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");

                return(null);
            }
        }
Пример #7
0
        /// <summary>
        /// Attachment Get
        /// </summary>
        public static async Task <IEnumerable <AttachmentEntity> > AttachmentGet(string container, string objectGuid,
                                                                                 string attachmentGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryAsync <AttachmentEntity>("pm_attachment_get",
                                                                                   new
                {
                    container_in       = container,
                    object_guid_in     = objectGuid,
                    attachment_guid_in = attachmentGuid
                },
                                                                                   commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");

                return(null);
            }
        }
 private void OnSendError(SocketException socketException)
 {
     if (SendError != null)
     {
         SendError.BeginInvoke(this, new SocketExceptionEventArgs(socketException), null, null);
     }
 }
Пример #9
0
        /// <summary>
        /// TypeOfOwnership Upd
        /// </summary>
        public static async Task <IEnumerable <UniversalCatalogEntity> > CatalogObjectUpd(string objectGuid, string objectTypeGuid,
                                                                                          string serviceGroupGuid, string userGuid, string objectInfo)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryAsync <UniversalCatalogEntity>(
                    "catalog_object_upd", new
                {
                    object_guid_in        = objectGuid,
                    object_type_guid_in   = objectTypeGuid,
                    service_group_guid_in = serviceGroupGuid,
                    user_guid_in          = userGuid,
                    object_info_in        = objectInfo
                },
                    commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");

                return(null);
            }
        }
Пример #10
0
        public void SendConsole(string message)
        {
            Console.WriteLine($"Sending console {message}");

            Sent?.Invoke();

            SendError?.Invoke(this, new SendErrorEventArgs("brak polaczenia"));
        }
Пример #11
0
        private void OnReceiveMsg(object sender, _DKHOpenAPIEvents_OnReceiveMsgEvent e)
        {
            if (!e.sMsg.Contains("신규주문") && !e.sMsg.Contains("지연"))
            {
                Box.Show(e.sMsg.Substring(8), "Caution", 895);

                string[] arr = e.sRQName.Split(';');

                OnReceiveOrder(new Elements(Number.GetScreen(), arr[2], arr[3], arr[0], arr[1]));
            }
            SendError?.Invoke(this, new Error(e.sTrCode, e.sRQName, e.sScrNo, e.sMsg));
        }
Пример #12
0
        public void OnReceiveOrder(Elements e)
        {
            rq = new Task(() =>
            {
                Error_code = axAPI.SendOrderFO(e.sRQName, e.screen, Account, Code, 1, e.classification, "3", Math.Abs(e.quantity), "", "");
            });
            request.RequestTrData(rq);

            if (Error_code != 0)
            {
                SendError?.Invoke(this, new Error(Error_code));
            }
        }
Пример #13
0
        public async Task <bool> Send(IEmailMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (message.SendableDate > LocalTime.Now)
            {
                Log.Info($"Skipping Send() command for IEmailMessage ({message.GetId()}). SendableDate is in the future.");
                if (message.IsNew)
                {
                    await Database.Save(message);
                }

                return(false);
            }

            using (var mail = await MessageCreator.Create(message))
            {
                if (mail.To.None() && mail.CC.None() && mail.Bcc.None())
                {
                    Log.Info($"Mail message {message.GetId()} will not be sent as there is no effective recipient.");
                    return(false);
                }

                try
                {
                    await Sending.Raise(new EmailSendingEventArgs(message, mail));

                    await Dispatcher.Dispatch(mail, message);

                    if (!message.IsNew)
                    {
                        await Database.Delete(message);
                    }
                    await Sent.Raise(new EmailSendingEventArgs(message, mail));

                    return(true);
                }
                catch (Exception ex)
                {
                    await SendError.Raise(new EmailSendingEventArgs(message, mail) { Error = ex });
                    await RecordRetry(message);

                    Log.Error(ex, $"Error in sending an email for this EmailQueueItem of '{message.GetId()}' because : " + Environment.NewLine + ex.ToFullMessage());
                    return(false);
                }
            }
        }
Пример #14
0
        private void InputValueRqData(TR param)
        {
            string[] count = param.ID.Split(';'), value = param.Value.Split(';');
            int      i, l = count.Length;

            for (i = 0; i < l; i++)
            {
                axAPI.SetInputValue(count[i], value[i]);
            }

            Error_code = axAPI.CommRqData(param.RQName, param.TrCode, param.PrevNext, param.ScreenNo);

            if (Error_code != 0)
            {
                SendError?.Invoke(this, new Error(Error_code));
            }
        }
Пример #15
0
        /// <summary>
        /// Attachment Del
        /// </summary>
        public static async Task AttachmentUpdDel(string attachmentGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                await pixMakeRepository.ExecuteAsync("pm_attachment_del", new
                {
                    attachment_guid_in = attachmentGuid
                },
                                                     commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");
            }
        }
Пример #16
0
        /// <summary>
        /// User Identity Info
        /// </summary>
        public static async Task <string> GetUserServiceGroup(string userGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryFirstOrDefaultAsync <string>("auth_service_group_account_get",
                                                                                       new { user_guid_in = userGuid },
                                                                                       commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");
            }

            return(null);
        }
Пример #17
0
        /// <summary>
        /// Log Ins
        /// </summary>
        public static async Task LogEventIns(int eventTypeId, string eventDescripton)
        {
            try
            {
                var logRepository = await LogMySqlRepository.GetConnection();

                await logRepository.ExecuteAsync("log_event_ins", new
                {
                    event_type_id_in = eventTypeId,
                    event_desc_in    = eventDescripton
                },
                                                 commandType : CommandType.StoredProcedure);

                logRepository.Close();
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");
            }
        }
Пример #18
0
        public void StartProgress()
        {
            if (axAPI != null)
            {
                Error_code = axAPI.CommConnect();

                if (Error_code != 0)
                {
                    SendError?.Invoke(this, new Error(Error_code));

                    Box.Show("Connection Failed!!", "Caution", waiting);

                    SendExit?.Invoke(this, new ForceQuit(end));
                }
                return;
            }
            Box.Show("API Not Found!!", "Caution", waiting);

            SendExit?.Invoke(this, new ForceQuit(end));
        }
Пример #19
0
        /// <summary>
        /// CatalogObjectDel
        /// </summary>
        public static async Task CatalogObjectDel(string objectGuid, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                await pixMakeRepository.ExecuteAsync("catalog_object_del", new
                {
                    object_guid_in        = objectGuid,
                    service_group_guid_in = serviceGroupGuid
                },
                                                     commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");
            }
        }
Пример #20
0
        /// <summary>
        /// Contact Person Del
        /// </summary>
        public static async Task ContactPersonDel(string contactPersonGuid, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                await pixMakeRepository.ExecuteAsync("pm_contact_person_del", new
                {
                    contact_person_guid_in = contactPersonGuid,
                    service_group_guid_in  = serviceGroupGuid
                },
                                                     commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");
            }
        }
Пример #21
0
        /// <summary>
        /// Nomenclature Operation Del
        /// </summary>
        public static async Task NomenclatureOperationByNomenclatureDel(string nomenclatureGuid, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                await pixMakeRepository.ExecuteAsync("pm_nomenclature_operation_by_nomenclature_del", new
                {
                    nomenclature_guid_in  = nomenclatureGuid,
                    service_group_guid_in = serviceGroupGuid
                },
                                                     commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");
            }
        }
Пример #22
0
        /// <summary>
        /// Order Upd
        /// </summary>
        public static async Task OrderApprovedUpd(string orderGuid, bool approved, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                await pixMakeRepository.ExecuteAsync(
                    "pm_order_approved_updV2", new
                {
                    order_guid_in         = orderGuid,
                    approved_in           = approved,
                    service_group_guid_in = serviceGroupGuid
                },
                    commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");
            }
        }
Пример #23
0
        /// <summary>
        /// Contact Bank Account Get
        /// </summary>
        public static async Task <IEnumerable <ContactBankAccountEntity> > ContactBankAccountGet(string contactBankAccountGuid, string contactGuid, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryAsync <ContactBankAccountEntity>("pm_contact_bank_account_get", new
                {
                    contact_bank_account_guid_in = contactBankAccountGuid,
                    contact_guid_in       = contactGuid,
                    service_group_guid_in = serviceGroupGuid
                },
                                                                                           commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");

                return(null);
            }
        }
Пример #24
0
        EquipmentAdjustmentGroupEditionGet(string equipmentGuid, string serviceGroupGuid)
        {
            try
            {
                var pixMakeRepository = await PixMakeMySqlRepository.GetConnection();

                var result = await pixMakeRepository.QueryAsync <EquipmentAdjustmentGroupEdition>(
                    "pm_equipment_adjustment_group_edition_get", new
                {
                    equipment_guid_in     = equipmentGuid,
                    service_group_guid_in = serviceGroupGuid
                },
                    commandType : CommandType.StoredProcedure);

                pixMakeRepository.Close();
                return(result);
            }
            catch (Exception ex)
            {
                await SendError.SendErrorAsync(ex, customMessage : "MySql");

                return(null);
            }
        }
Пример #25
0
        private static void UIThreadException(object sender, ThreadExceptionEventArgs t)
        {
            SendError error = new SendError(t.Exception, true);

            error.ShowDialog();
        }
Пример #26
0
        private static void UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            SendError error = new SendError((Exception)e.ExceptionObject, true);

            error.ShowDialog();
        }
Пример #27
0
 static void OnSendError(IEmailQueueItem email, Exception error)
 {
     SendError?.Invoke(email, new EventArgs <Exception>(error));
 }
Пример #28
0
 void OnSendError(string errorString) => SendError.Invoke(this, errorString);