Exemplo n.º 1
0
        public RequestResult <BoolResult> UserManage_LoginCHK(string userid, string password)
        {
            RequestResult <UserProfileResult> profile = UserProfile(userid);

            if (!string.IsNullOrWhiteSpace(profile.ErrorMessage))
            {
                return(new RequestResult <BoolResult> {
                    ErrorMessage = profile.ErrorMessage
                });
            }
            string uri = Codehelper.Get3011ApiUrl(profile.ReturnValue.data.Country);

            if (uri.EqualsIgnoreCaseAndBlank(this.Wrapper.Client.BaseAddress.ToString()))
            {
                return(UserManage_LoginCHK(userid, password, profile.ReturnValue.data.Country));
            }
            else
            {
                using (LoginApiClient client2 = new LoginApiClient(profile.ReturnValue.data.Country))
                {
                    return(client2.UserManage_LoginCHK(userid, password, profile.ReturnValue.data.Country));
                }
            }
        }
Exemplo n.º 2
0
        public static void SendWorkFlowEmail(string sender, string[] receivers, string subject, NotificationTypes?notificationType)
        {
            LoginApiClient login = new LoginApiClient();

            using (login.Wrapper)
            {
                string   country = ConfigurationManager.AppSettings["Country"];
                string[] emails  = receivers.Select(p => login.UserEmail(p, country).ReturnValue).Where(p => p != null).ToArray();
                string   content = string.Empty;
                if (notificationType == null)
                {
                    content = $"New inbox from {sender}, Subject - {subject}";
                }
                else
                {
                    switch (notificationType)
                    {
                    case NotificationTypes.AppFinishedApproved:
                        content =
                            $"Application {subject} is Fully Approved";
                        break;

                    case NotificationTypes.AppFinishedRejected:
                        content =
                            $"Application {subject} is rejected";
                        break;

                    case NotificationTypes.AppFinishedAbort:
                        content =
                            $"Application {subject} is sent back to revise.";
                        break;

                    case NotificationTypes.CancelApp:
                        content =
                            $"{sender} cancelled the application {subject}";
                        break;

                    case NotificationTypes.ApproveApp:
                        content =
                            $"{sender} approved the application {subject}";
                        break;

                    case NotificationTypes.Comments:
                        content =
                            $"{sender} commentted the application {subject}";
                        break;

                    case NotificationTypes.RejectApp:
                        content =
                            $"{sender} reject the application {subject}";
                        break;

                    case NotificationTypes.CoverUserMessage:
                        content =
                            $"Application {subject} is finished. You are the person to cover his(her) duties.";
                        break;

                    case NotificationTypes.FinalMessage:
                        content =
                            $"Application {subject} is finished. you are the final notify person.";
                        break;

                    case NotificationTypes.SecretaryNotification:
                        content =
                            $"{sender} approved the application {subject}. You are the secretary of approver.";
                        break;
                    }
                }
                foreach (var e in emails)
                {
                    MailService.Send(e, subject, content);
                }
            }
        }