Exemple #1
0
        public async void InitialUser()
        {
            List <User> friendsList = new List <User>();

            friendsList = await DependencyService.Get <IFirebaseDatabase>().GetFriendsList();

            if (friendsList.Count == 0)
            {
                IsFriendsListEmpty = true;
                IsFriendsNotEmpty  = false;
            }
            else
            {
                IsFriendsListEmpty = false;
                IsFriendsNotEmpty  = true;
            }

            foreach (User user in friendsList)
            {
                SendTo.Add(new SelectableData <User>(user, false));
            }
            OnPropertyChanged("SendTo");
            OnPropertyChanged("IsFriendsListEmpty");
            OnPropertyChanged("IsFriendsNotEmpty");
        }
        public IActionResult Send()
        {
            SendTo sendTo = new SendTo();

            sendTo.SendKoForms(model.FormDetails, "google", "smartDisplay", "cpc");
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public IActionResult Send()
        {
            SendTo sendTo = new SendTo();

            sendTo.SendGlobalForms(model.FormDetails, "facebook", "facebookLeadAds", FilterCountry.EG);
            return(RedirectToAction("Index"));
        }
        public IActionResult Send()
        {
            SendTo sendTo = new SendTo();

            sendTo.SendKoForms(model.FormDetails, "google", "YouTube_ChannelTargeting", string.Empty);
            return(RedirectToAction("Index"));
        }
    /// <summary>
    /// Send the response from client or all clients.
    /// </summary>
    /// <param name="mSocket">TcpClient of player</param>
    /// <param name="buffer">Message stream</param>
    public static IAsyncResult TCP(TcpClient mSocket, SendTo sendTo, byte[] buffer, Player[] ToSend, object state, AsyncCallback endSend)
    {
        switch (sendTo)
        {
        case SendTo.Only:
            return(mSocket.BeginWrite(buffer, endSend, state));

        case SendTo.All:
            for (int i = 0; i < ToSend.Length; i++)
            {
                Player To = ToSend[i];
                //===============================================//
                To.tcpClient.BeginWrite(buffer, endSend, state);
            }
            break;

        case SendTo.Others:
            for (int i = 0; i < ToSend.Length; i++)
            {
                Player To = ToSend[i];

                if (To.tcpClient == mSocket)
                {
                    continue;
                }

                To.tcpClient.BeginWrite(buffer, endSend, state);
            }
            break;

        default:
            return(null);
        }
        return(null);
    }
Exemple #6
0
        public IActionResult Send()
        {
            SendTo sendTo = new SendTo();

            sendTo.SendKoForms(model.FormDetails, "google", "leadAds", string.Empty);
            return(RedirectToAction("Index"));
        }
 public void Validate()
 {
     if (SendTo.IsNullOrZero())
     {
         throw new MessageException("Email message must have send to contacts".MakeThisRedable());
     }
 }
Exemple #8
0
        private void SendNotification(Order order)
        {
            // confirm that settings are valid to send
            if (string.IsNullOrEmpty(Subject) || string.IsNullOrEmpty(SenderEmail) || string.IsNullOrEmpty(SendTo) && !SendToCustomer)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(SenderName))
            {
                SenderName = null;
            }

            // prepare data to send
            var slTo     = new System.Collections.Generic.List <string>();
            var page     = Dynamicweb.Frontend.PageView.GetPageviewByPageID(order.CheckoutPageId);
            var template = new Dynamicweb.Rendering.Template(EmailTemplate.Replace("Templates/", ""));

            if (!string.IsNullOrEmpty(SendTo))
            {
                slTo.AddRange(SendTo.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
            }
            if (SendToCustomer)
            {
                slTo.Add(order.CustomerEmail);
            }

            order.SendTo(ref page, Subject, slTo, SenderEmail, SenderName, ref template);
        }
        public IActionResult Send()
        {
            SendTo sendTo = new SendTo();

            sendTo.SendKoForms(model.FormDetails, utm_source, utm_content, utm_medium);
            return(RedirectToAction("Index"));
        }
        private async System.Threading.Tasks.Task SendEmail(EMailContent content,
                                                            Person sendToPerson)
        {
            var sendTo = new SendTo(sendToPerson.EMail, sendToPerson.Alias);

            await EMail.SendAsync(sendTo, content);
        }
Exemple #11
0
        public void TranslateExternalDeleteCommandToAkkaMessage(HTTPSourcedCommand cmdExternal)
        {
            JObject             jo        = cmdExternal.Data as JObject;
            string              id        = jo.Value <string>("Id") ?? jo.Value <string>("id");
            ClientDeleteCommand deleteCmd = new ClientDeleteCommand(id, cmdExternal.User, cmdExternal.ConnectionId);

            SendTo.Tell(deleteCmd, ReplyTo);
        }
Exemple #12
0
 public Packet()
 {
     Sender      = 0;
     DataType    = null;
     Data        = null;
     Recipients  = new List <ulong>();
     Destination = SendTo.Server;
 }
Exemple #13
0
 public EmailParam SetBody(string body)
 {
     if (string.IsNullOrEmpty(body))
     {
         throw new MessageException("Email message content cannot be null or empty".MakeThisRedable());
     }
     Body = EmailTemplate.GenarateBody(SendTo.Count.Is(1) ? SendTo.First().Name : "There", body, Regards);
     return(this);
 }
        /// <summary>
        /// Removes a Windows shortcut from the "Send to" menu.
        /// </summary>
        /// <param name="sendTo">Information about the shortcut to be removed.</param>
        public static void Remove(SendTo sendTo)
        {
            #region Sanity checks
            if (sendTo == null) throw new ArgumentNullException(nameof(sendTo));
            #endregion

            string filePath = GetSendToPath(sendTo.Name);
            if (File.Exists(filePath)) File.Delete(filePath);
        }
Exemple #15
0
        static private void SendEmail(EMailContent content, Person sendToPerson)
        {
            var sendTo = new SendTo(sendToPerson.EMail, sendToPerson.Alias);

            if (SEND_FAKE_EMAIL)
            {
                sendTo = new SendTo("*****@*****.**", sendToPerson.Alias);
            }
            EMail.Send(sendTo, content);
        }
Exemple #16
0
        public void TranslateExternalUpsertCommandToAkkaMessage(HTTPSourcedCommand cmdExternal)
        {
            ClientState cs;

            if (ExtractStateObject(cmdExternal, out cs))
            {
                ClientUpsertCommand upsertCmd = new ClientUpsertCommand(cs, cmdExternal.User, cmdExternal.ConnectionId);
                SendTo.Tell(upsertCmd, ReplyTo);
            }
        }
        /// <summary>
        /// Creates a new Windows shortcut in the "Send to" menu.
        /// </summary>
        /// <param name="sendTo">Information about the shortcut to be created.</param>
        /// <param name="target">The target the shortcut shall point to.</param>
        /// <param name="handler">A callback object used when the the user is to be informed about the progress of long-running operations such as downloads.</param>
        public static void Create(SendTo sendTo, FeedTarget target, ITaskHandler handler)
        {
            #region Sanity checks
            if (sendTo == null) throw new ArgumentNullException(nameof(sendTo));
            if (handler == null) throw new ArgumentNullException(nameof(handler));
            #endregion

            string filePath = GetSendToPath(sendTo.Name);
            Create(filePath, target, sendTo.Command, handler, machineWide: false);
        }
Exemple #18
0
        public void TranslateExternalInsertCommandToAkkaMessage(HTTPSourcedCommand cmdExternal)
        {
            UserState cs;

            if (ExtractStateObject(cmdExternal, out cs))
            {
                UserInsertCommand insertCommand = new UserInsertCommand(cs, cmdExternal.User, cmdExternal.ConnectionId);
                SendTo.Tell(insertCommand, ReplyTo);
            }
        }
Exemple #19
0
        static private void SendEmail(EMailContent content, string address)
        {
            var sendTo = new SendTo(address);

            if (SEND_FAKE_EMAIL)
            {
                sendTo = new SendTo("*****@*****.**");
            }
            EMail.Send(sendTo, content);
        }
Exemple #20
0
        public void SendNetworkMessage(Message message, SendTo sendTo, NetIncomingMessage netMessage = null, NetDeliveryMethod deliveryMethod = NetDeliveryMethod.ReliableOrdered)
        {
            if (m_isServer)
            {
                Type messageType      = message.GetType();
                NetOutgoingMessage om = m_server.CreateMessage();
                om.Write((int)MessageFunction.ClassMessage);;
                om.Write(messageType.Assembly.ToString());
                om.Write(messageType.ToString());
                om.WriteAllFields(message);

                NetConnection sender = null;
                if (netMessage != null)
                {
                    sender = netMessage.SenderConnection;
                }

                switch (sendTo)
                {
                case SendTo.All:
                    message.OnCalled(message, netMessage);
                    m_server.SendToAll(om, sender, deliveryMethod, 0);
                    break;

                case SendTo.Others:
                    m_server.SendToAll(om, sender, deliveryMethod, 0);
                    if (sender != null)      //If server diden't send the message
                    {
                        message.OnCalled(message, netMessage);
                    }
                    break;

                case SendTo.Server:
                    message.OnCalled(message, netMessage);
                    break;
                }
            }
            else
            {
                Type messageType      = message.GetType();
                NetOutgoingMessage om = m_client.CreateMessage();
                om.Write((int)MessageFunction.ClassMessage);
                om.Write((int)sendTo);
                om.Write(messageType.Assembly.ToString());
                om.Write(messageType.ToString());
                om.WriteAllFields(message);
                m_client.SendMessage(om, deliveryMethod);

                if (sendTo == SendTo.All) //Trigger for sender if you sent it to everybody
                {
                    message.OnCalled(message, netMessage);
                }
            }
        }
Exemple #21
0
 void Response(Player mSocket, Packet packetToResponse, SendTo send, object[] response)
 {
     using (NeutronWriter writer = new NeutronWriter())
     {
         writer.WritePacket(Packet.Database);
         writer.WritePacket(packetToResponse);
         writer.Write(response.Serialize());
         //========================================================================================\\
         mSocket.Send(send, writer.GetBuffer(), Broadcast.None, null, ProtocolType.Tcp, null, null);
     }
 }
        public void SendNetworkMessage(Message message, SendTo sendTo, NetIncomingMessage netMessage = null, NetDeliveryMethod deliveryMethod = NetDeliveryMethod.ReliableOrdered)
        {
            if (m_isServer)
            {
                Type messageType = message.GetType();
                NetOutgoingMessage om = m_server.CreateMessage();
                om.Write((int)MessageFunction.ClassMessage);;
                om.Write(messageType.Assembly.ToString());
                om.Write(messageType.ToString());
                om.WriteAllFields(message);

                NetConnection sender = null;
                if (netMessage != null)
                {
                    sender = netMessage.SenderConnection;
                }

                switch (sendTo)
                {
                    case SendTo.All:
                        message.OnCalled(message, netMessage);
                        m_server.SendToAll(om, sender, deliveryMethod, 0);
                        break;
                    case SendTo.Others:
                        m_server.SendToAll(om, sender, deliveryMethod, 0);
                        if (sender != null)  //If server diden't send the message
                            message.OnCalled(message, netMessage);
                        break;
                    case SendTo.Server:
                        message.OnCalled(message, netMessage);
                        break;
                }
            }
            else
            {
                Type messageType = message.GetType();
                NetOutgoingMessage om = m_client.CreateMessage();
                om.Write((int)MessageFunction.ClassMessage);
                om.Write((int) sendTo);
                om.Write(messageType.Assembly.ToString());
                om.Write(messageType.ToString());
                om.WriteAllFields(message);
                m_client.SendMessage(om, deliveryMethod);

                if (sendTo == SendTo.All) //Trigger for sender if you sent it to everybody
                {
                    message.OnCalled(message, netMessage);
                }
            }
        }
            public static string SendTestEMail()
            {
                try
                {
                    MailMessage mail = new MailMessage();

                    mail.From = new MailAddress(SendFrom);

                    mail.To.Clear();

                    string[] strMailTo = SendTo.Split(';');

                    foreach (string sMailTo in strMailTo)
                    {
                        mail.To.Add(sMailTo);
                    }

                    mail.Subject    = Subject;
                    mail.IsBodyHtml = true;
                    mail.Body       = GetTestMailBody();

                    AlternateView  av = AlternateView.CreateAlternateViewFromString(mail.Body, null, MediaTypeNames.Text.Html);
                    LinkedResource lr = new LinkedResource(LogoPath, MediaTypeNames.Image.Jpeg);
                    lr.ContentId = "imglogo";
                    av.LinkedResources.Add(lr);
                    mail.AlternateViews.Add(av);

                    SmtpServer.Port        = Convert.ToInt32(Port);
                    SmtpServer.Credentials = new System.Net.NetworkCredential(LoginId, Password);
                    SmtpServer.EnableSsl   = SSL;

                    string userState = "test message1";

                    if (Async)
                    {
                        SmtpServer.SendAsync(mail, userState);
                    }
                    else
                    {
                        SmtpServer.Send(mail);
                    }

                    return("Succeed");
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }
            }
Exemple #24
0
    void SendVoice(SendTo sendTo, byte[] buffer, IPEndPoint comparer, IPEndPoint onlyEndPoint, Player[] ToSend = null)
    {
        switch (sendTo)
        {
        case SendTo.All:
            lock (lockerUDPEndPointsVoices)
            {
                if (ToSend.Any(x => x.tcpClient.RemoteEndPoint().Equals(comparer)))
                {
                    foreach (var _ip in udpEndPointsVoices)
                    {
                        _UDPVoiceSocket.BeginSend(buffer, buffer.Length, _ip, (e) =>
                        {
                            _UDPVoiceSocket.EndSend(e);
                        }, null);
                    }
                }
            }
            break;

        case SendTo.Only:
            _UDPVoiceSocket.BeginSend(buffer, buffer.Length, onlyEndPoint, (e) =>
            {
                _UDPVoiceSocket.EndSend(e);
            }, null);
            break;

        case SendTo.Others:
            lock (lockerUDPEndPointsVoices)
            {
                if (ToSend.Any(x => x.tcpClient.RemoteEndPoint().Equals(comparer)))
                {
                    foreach (var _ip in udpEndPointsVoices)
                    {
                        if (_ip.Equals(onlyEndPoint))
                        {
                            continue;
                        }

                        _UDPVoiceSocket.BeginSend(buffer, buffer.Length, _ip, (e) =>
                        {
                            _UDPVoiceSocket.EndSend(e);
                        }, null);
                    }
                }
            }
            break;
        }
    }
Exemple #25
0
    /// <summary>
    /// Removes a Windows shortcut from the "Send to" menu.
    /// </summary>
    /// <param name="sendTo">Information about the shortcut to be removed.</param>
    public static void Remove(SendTo sendTo)
    {
        #region Sanity checks
        if (sendTo == null)
        {
            throw new ArgumentNullException(nameof(sendTo));
        }
        #endregion

        string filePath = GetSendToPath(sendTo.Name);
        if (File.Exists(filePath))
        {
            File.Delete(filePath);
        }
    }
Exemple #26
0
        private void AssociateMarketingListToSendGrid(ApiRoot root, List <List> listLists, CrmEarlyBound.Campaign campaign)
        {
            List <string> listSendGridId = new List <string>();

            foreach (List lists in listLists)
            {
                listSendGridId.Add(lists.find_SendGridId);
            }

            SendTo     sendTo     = new SendTo(listSendGridId);
            SingleSend singleSend = new SingleSend(sendTo);

            Task t = Task.Run(() => root.PathSingleSend(singleSend, campaign.find_SendGridId));

            t.Wait();
        }
Exemple #27
0
    /// <summary>
    /// Creates a new Windows shortcut in the "Send to" menu.
    /// </summary>
    /// <param name="sendTo">Information about the shortcut to be created.</param>
    /// <param name="target">The target the shortcut shall point to.</param>
    /// <param name="iconStore">Stores icon files downloaded from the web as local files.</param>
    public static void Create(SendTo sendTo, FeedTarget target, IIconStore iconStore)
    {
        #region Sanity checks
        if (sendTo == null)
        {
            throw new ArgumentNullException(nameof(sendTo));
        }
        if (iconStore == null)
        {
            throw new ArgumentNullException(nameof(iconStore));
        }
        #endregion

        string filePath = GetSendToPath(sendTo.Name);
        Create(filePath, target, sendTo.Command, iconStore);
    }
Exemple #28
0
        /// <summary>
        /// Creates a new Windows shortcut in the "Send to" menu.
        /// </summary>
        /// <param name="sendTo">Information about the shortcut to be created.</param>
        /// <param name="target">The target the shortcut shall point to.</param>
        /// <param name="handler">A callback object used when the the user is to be informed about the progress of long-running operations such as downloads.</param>
        public static void Create(SendTo sendTo, FeedTarget target, ITaskHandler handler)
        {
            #region Sanity checks
            if (sendTo == null)
            {
                throw new ArgumentNullException(nameof(sendTo));
            }
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            #endregion

            string filePath = GetSendToPath(sendTo.Name);
            Create(filePath, target, sendTo.Command, handler, machineWide: false);
        }
Exemple #29
0
        private void Modify(GameObject tar, SendTo to)
        {
            if (tar == ((uOscClient)target).gameObject)
            {
                switch (to)
                {
                case SendTo.VMT:
                    serializedObject.FindProperty("port").intValue = 39570; break;

                case SendTo.VMCProtocolToMarionette:
                    serializedObject.FindProperty("port").intValue = 39539; break;

                case SendTo.VMCProtocolToPerformer:
                    serializedObject.FindProperty("port").intValue = 39540; break;
                }
                serializedObject.ApplyModifiedProperties();
            }
        }
Exemple #30
0
        public Queue <Email> GetEmailsToSendList()
        {
            Queue <Email> EmailsToSend = new Queue <Email>();

            BuildLists();
            dt = GetSQLInfo();
            if (dt == null)
            {
                return(EmailsToSend);
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Employee emp = GetEmployee(i);
                if (emp.IsValid())
                {
                    Email email;
                    if (SendTo.Equals("Selected Employees Only - SQL Filter"))
                    {
                        email = new Email(ID, emp.GetEmpref(), emp.GetEmpEmail(), GetSubject(i), GetMessage(i));
                    }
                    else if (SendTo.Equals("Specific Email Address - SQL Filter"))
                    {
                        email = new Email(ID, emp.GetEmpref(), SpecificAddress, GetSubject(i), GetMessage(i));
                    }
                    else
                    {
                        email = new Email(ID, emp.GetEmpref(), emp.GetSupEmail(), GetSubject(i), GetMessage(i));
                    }

                    if (GetAppendEmailFooter())
                    {
                        email.AddFooter(EmailMessageFooter);
                    }
                    if (GetUseAlternateMgrEmailField())
                    {
                        email.ToAddress = emp.GetEmail("tmsemp", AlternateMgrEmailField);
                    }

                    UpdateFields(emp.GetEmpref());
                    EmailsToSend.Enqueue(email);
                }
            }
            return(EmailsToSend);
        }
Exemple #31
0
        public EmailParam AddSendTo(string email, string name = "There")
        {
            if (!email.IsValidEmail())
            {
                return(this);
            }
            email = email.TrimAndToLower();
            if (SendTo.IsNull())
            {
                SendTo = new List <EmailAddress>();
            }

            if (SendTo.Any(p => p.Email.Equals(email, System.StringComparison.InvariantCultureIgnoreCase)))
            {
                return(this);
            }
            SendTo.Add(new EmailAddress(email, name));
            return(this);
        }
    public static IAsyncResult UDP(SendTo sendTo, byte[] buffer, Player[] ToSend, IPEndPoint onlyEndPoint, object state, AsyncCallback endSend)
    {
        switch (sendTo)
        {
        case SendTo.Only:
            return(_UDPSocket.BeginSend(buffer, buffer.Length, onlyEndPoint, endSend, state));

        case SendTo.All:
            lock (lockerUDPEndPoints)
            {
                foreach (var _ip in udpEndPoints)
                {
                    if (ToSend.Any(x => x.tcpClient.RemoteEndPoint().Equals(_ip)))
                    {
                        _UDPSocket.BeginSend(buffer, buffer.Length, _ip, endSend, state);
                    }
                }
            }
            break;

        case SendTo.Others:
            lock (lockerUDPEndPoints)
            {
                foreach (var _ip in udpEndPoints)
                {
                    if (_ip.Equals(onlyEndPoint))
                    {
                        continue;
                    }

                    if (ToSend.Any(x => x.tcpClient.RemoteEndPoint().Equals(_ip)))
                    {
                        _UDPSocket.BeginSend(buffer, buffer.Length, _ip, endSend, state);
                    }
                }
            }
            break;

        default:
            return(null);
        }
        return(null);
    }
        public override void Execute()
        {
            var mailMessage = new MailMessage
            {
                IsBodyHtml = true,
                Body       = HtmlBody,
                Subject    = Subject,
            };

            if (string.IsNullOrEmpty(ReplyTo) == false)
            {
                try
                {
                    mailMessage.ReplyToList.Add(new MailAddress(ReplyTo));
                }
                catch
                {
                    // we explicitly ignore bad reply to emails
                }
            }

            // Send a notification of the comment to the post author
            if (SendTo != null)
            {
                SendTo.ForEach(x => mailMessage.To.Add(x));
            }
            if (Cc != null)
            {
                Cc.ForEach(email => mailMessage.CC.Add(email));
            }
            if (Bcc != null)
            {
                Bcc.ForEach(email => mailMessage.Bcc.Add(email));
            }

            using (var smtpClient = new SmtpClient())
            {
#if !DEBUG
                smtpClient.Send(mailMessage);
#endif
            }
        }
Exemple #34
0
        private void PreviewNext()
        {
            //通过计算

            //flinstance.hostDataSet要改写
            SendTo send = new SendTo(Role, User);
            GetNextActivity(send, CurrentAcitivity);
        }
Exemple #35
0
        private SendTo GetSendTo(IEventWaiting activity, SendTo from)
        {
            switch (activity.SendToKind)
            {
                //user
                case SendToKind.Applicate: return new SendTo(string.Empty, Instance.Creator);
                case SendToKind.User:
                    {
                        string user = string.IsNullOrEmpty(activity.SendToUser) ? string.Empty : activity.SendToUser.Split(';')[0].Trim();
                        return new SendTo(string.Empty, user);
                    }
                case SendToKind.RefUser:
                    {
                        string user = Instance._hostDataSet.Tables[0].Rows[0][activity.SendToField].ToString();
                        return new SendTo(string.Empty, user);
                    }
                case SendToKind.Role:
                    {
                        string role = string.IsNullOrEmpty(activity.SendToRole) ? string.Empty : activity.SendToRole.Split(';')[0].Trim();
                        return new SendTo(role, string.Empty);
                    }
                case SendToKind.RefRole:
                    {
                        string role = Instance._hostDataSet.Tables[0].Rows[0][activity.SendToField].ToString();
                        return new SendTo(role, string.Empty);
                    }
                case SendToKind.Manager:
                    {
                        string role = string.Empty;
                        if (activity is FLApproveBranchActivity && !string.IsNullOrEmpty(Instance.R))
                        {
                            role = Instance.R;
                        }
                        else
                        {
                            role = from.RoleID;
                        }
                        return GetManager(new SendTo(role, string.Empty));
                    }
                case SendToKind.RefManager:
                    {
                        string role = string.Empty;
                        if (activity is FLApproveBranchActivity && !string.IsNullOrEmpty(Instance.R))
                        {
                            role = Instance.R;
                        }
                        else
                        {
                            role = Instance._hostDataSet.Tables[0].Rows[0][activity.SendToField].ToString();
                        }
                        return GetManager(new SendTo(role, string.Empty));
                    }
                case SendToKind.ApplicateManager:
                    {
                        string role = string.Empty;
                        if (activity is FLApproveBranchActivity && !string.IsNullOrEmpty(Instance.R))
                        {
                            role = Instance.R;
                        }
                        else
                        {
                            role = Instance.CreateRole;
                        }
                        return GetManager(new SendTo(role, string.Empty));
                        //return GetManager(new SendTo(Instance.CreateRole, Instance.Creator));

                    }
            }
            return new SendTo(string.Empty, string.Empty);
        }
Exemple #36
0
        //递归
        private void GetNextActivity(SendTo from, string AcitivityName)
        {
            List<FLActivity> activitys = instance.GetNextFLActivities(AcitivityName, from.UserID, from.RoleID);
            foreach (FLActivity activity in activitys)
            {
                if (activity is IEventWaiting)
                {
                    SendTo send = null;
                    if (activity is ISupportFLDetailsActivity && !string.IsNullOrEmpty((activity as ISupportFLDetailsActivity).SendToId2))
                    {
                        //int index = activity.Name.LastIndexOf('_');
                        //string detailName = index > 0 ? activity.Name.Substring(0, index) : activity.Name;
                        //if (activitys.Count > 1 && !string.IsNullOrEmpty(activity.UpperParallel))
                        //{
                        //    InsertDetailStand(Document.DocumentElement, detailName, activity.Name, activity.UpperParallel, activity.UpperParallelBranch);
                        //}
                        //else
                        //{
                        //    InsertDetailStand(Document.DocumentElement, detailName, activity.Name, null, null);
                        //}
                        send = new SendTo((activity as ISupportFLDetailsActivity).SendToId2, string.Empty);
                    }
                    else
                    {
                        send = GetSendTo(activity as IEventWaiting, from);
                    }
                    AddSendTo(activity.Name, send);
                    if (activity is ISupportFLDetailsActivity && !string.IsNullOrEmpty((activity as ISupportFLDetailsActivity).SendToId2))
                    {
                        if (!activity.IsUpperParallelAnd && activitys.IndexOf(activity) > 0)
                        {
                            continue;
                        }
                    }
                    GetNextActivity(send, activity.Name);

                }
                else if (activity is IFLNotifyActivity)//通知
                {
                    SendTo send = GetSendTo(activity as IFLNotifyActivity, from);
                    AddSendTo(activity.Name, send);
                }
            }
        }
Exemple #37
0
 private SendTo GetManager(SendTo send)
 {
     string role = string.Empty;
     if (!string.IsNullOrEmpty(send.RoleID))
     {
         role = send.RoleID;
     }
     else if (!string.IsNullOrEmpty(send.UserID))
     {
         List<string> roleIds = Global.GetRoleIdsByUserId(send.UserID, ClientInfo);
         if (roleIds.Count > 0)
         {
             role = roleIds[0];
         }
     }
     if (!string.IsNullOrEmpty(role))
     {
         role = Global.GetManagerRoleId(role, OrgKind, ClientInfo);
         return new SendTo(role, string.Empty);
     }
     return new SendTo(string.Empty, string.Empty);
 }
Exemple #38
0
        private void AddSendTo(string activityName, SendTo send, AcitivityStatus status)
        {
            FLActivity activity = Instance.RootFLActivity.GetFLActivityByName(activityName);
            if (activity != null)
            {
                if (activity is IFLApproveBranchActivity)
                {
                    activityName = activityName.Replace("-", "_");
                    InsertApproveStand(Document.DocumentElement, (activity as IFLApproveBranchActivity).ParentActivity, activityName);
                }
                else if (activity is ISupportFLDetailsActivity /*&& !string.IsNullOrEmpty((activity as ISupportFLDetailsActivity).SendToId2)*/)
                {
                    if (!string.IsNullOrEmpty(activity.Location))
                    {
                        var index = activity.Name.LastIndexOf('_');
                        if (index > 0)
                        {
                            var detailName = activity.Name.Substring(0, activity.Name.LastIndexOf('_'));
                            FLActivity locationActivity = Instance.RootFLActivity.GetFLActivityByName(detailName);
                            if (locationActivity != null && locationActivity is FLDetailsActivity)
                            {
                                InsertDetailStand(Document.DocumentElement, detailName, activity.Name, activity.UpperParallel, activity.UpperParallelBranch);
                            }
                        }
                    }
                }
            }

            if (Type == PreviewType.Image)
            {
                if (status != AcitivityStatus.PlusApproved)
                {
                    string newName = "Unknown";
                    //为Activity加上待办者的名字

                    if (!string.IsNullOrEmpty(send.UserID))
                    {
                        string name = Global.GetUserName(send.UserID, ClientInfo);

                        newName = name;
                    }
                    else if (!string.IsNullOrEmpty(send.RoleID))
                    {
                        //andy: 取第一个用户的名字
                        List<string> users = Global.GetUsersIdsByRoleId(send.RoleID, ClientInfo);
                        if (users.Count > 0)
                        {
                            string name = Global.GetUserName(users[0], ClientInfo);
                            newName = name;
                        }
                        else
                        {
                            newName = "Nobody";
                        }
                    }
                    ReplaceName(Document.DocumentElement, activityName, newName, status);
                }
            }
            else
            {
                string roleID = send.RoleID;
                string userID = send.UserID;
                string userName = string.Empty;
                if (!string.IsNullOrEmpty(send.UserID))
                {
                    if (string.IsNullOrEmpty(roleID))
                    {
                        userID = send.UserID;
                        List<string> roles = Global.GetRoleIdsByUserId(userID, clientInfo);
                        if (roles.Count > 0)
                        {
                            roleID = roles[0];
                        }
                    }
                    userName = string.IsNullOrEmpty(userID) ? string.Empty : Global.GetUserName(userID, clientInfo);
                }
                else if (string.IsNullOrEmpty(userID) && !string.IsNullOrEmpty(send.RoleID))
                {
                    roleID = send.RoleID;
                    List<string> users = Global.GetUsersIdsByRoleId(send.RoleID, ClientInfo);
                    if (users.Count > 0)
                    {
                        userID = users[0];
                        foreach (string user in users)
                        {
                            if (!string.IsNullOrEmpty(userName))
                            {
                                userName += ",";
                            }
                            userName += Global.GetUserName(user, clientInfo);
                        }
                    }
                }
                string roleName = string.IsNullOrEmpty(roleID) ? string.Empty : Global.GetGroupName(roleID, clientInfo);
                if (roleName.Contains("/"))
                {
                    roleName = roleName.Split('/')[0];
                }
                //string userName = string.IsNullOrEmpty(userID) ? string.Empty : Global.GetUserName(userID, clientInfo);

                if (activity is ISupportFLDetailsActivity && !string.IsNullOrEmpty((activity as ISupportFLDetailsActivity).SendToId2))
                {
                    if (string.IsNullOrEmpty(activity.UpperParallel))
                    {
                        AddToTable(activityName, roleName, userName, status);
                    }
                    else
                    {
                        string condtion = "Or";
                        if (activity.IsUpperParallelAnd)
                        {
                            condtion = "And";
                        }
                        AddToTable(activityName, roleName, userName, status, condtion);
                    }
                }
                else
                {
                    AddToTable(activityName, roleName, userName, status);
                }
            }
        }
Exemple #39
0
 private void AddSendTo(string activityName, SendTo send)
 {
     AddSendTo(activityName, send, AcitivityStatus.Wait);
 }