示例#1
0
        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            try {
                // Can read this information from config file.

                NotificationDefinition message    = NotificationDef.Get(context) as NotificationDefinition;
                SmtpClient             SmtpServer = ReadSMTPConfigurationInfo(message);


                MailMessage mail = new MailMessage();

                // Sender
                mail.From = message.Sender;

                // Add attachments
                foreach (var attachment in message.Attachments)
                {
                    mail.Attachments.Add(attachment);
                }

                // To Receipients
                foreach (var toRecept in message.ToRecipients)
                {
                    mail.To.Add(toRecept);
                }

                // Cc Receipients
                if (message.CCRecipients != null)
                {
                    foreach (var ccRecept in message.CCRecipients)
                    {
                        mail.To.Add(ccRecept);
                    }
                }

                // Bcc Receipients
                if (message.BCCRecipients != null)
                {
                    foreach (var bccRecept in message.BCCRecipients)
                    {
                        mail.To.Add(bccRecept);
                    }
                }

                // Subject.
                mail.Subject = message.Subject;

                // Body.
                mail.Body = NotificationHelper.XSLTransform(XSLPath.Get(context), CustomerName.Get(context), EntityID.Get(context), CompanyName.Get(context), UserName.Get(context), BookingID.Get(context), SOID.Get(context));

                // Body Type
                mail.IsBodyHtml = message.FormatType == EnumFormatType.HTML;

                // Send email.
                SmtpServer.Send(mail);

                Result.Set(context, EntityID.Get(context));
            }
            catch (Exception ex) {
                ExceptionFormatter formater          = new ExceptionFormatter();
                string             formatedException = formater.Format("Send mail error", ex);
                Common.MessageLogger.Instance.LogMessage(ex, formatedException, Common.Priority.High, 0, System.Diagnostics.TraceEventType.Critical, "WF Email Error", "Email");
                throw ex;
            }
        }
示例#2
0
        /// <summary>
        /// Load lại danh sách bàn theo Khu vực
        /// </summary>
        private void LoadTableMapping()
        {
            if (cboArea.Value == null)
            {
                return;
            }
            Guid areaID;

            if (!Guid.TryParse(cboArea.Value.ToString(), out areaID))
            {
                return;
            }
            var tableMapping = new BLArea().GetTableMappingByAreaID(areaID, dteFromTime.DateTime);

            if (tableMapping == null || tableMapping.Rows.Count == 0)
            {
                MessageBoxCommon.ShowExclamation("Khu vực <" + ((Desktop.Entity.DictionaryDataSet.AreaRow)((System.Data.DataRowView)bsArea.Current).Row).AreaName + "> ngày <" + dteFromTime.DateTime.ToString("dd-MM-yyyy") + "> không có bàn trống nên không thể thay đổi khu vực");
                return;
            }
            else
            {
                dsBusiness.AreaTableMapping.Clear();
                dsBusiness.AreaTableMapping.Merge(tableMapping);
                bsTableMapping.DataSource = dsBusiness;
                bsTableMapping.Filter     = "TableStatus = 0 OR (TableStatus = 2 AND TableID = " + "'" + TableID.ToString() + "' AND BookingID = '" + BookingID.ToString() + "')";
                if (bsTableMapping.Find(ColumnName.TableID, TableID) == -1)
                {
                    cboTableMapping.Value = ((Desktop.Entity.BusinessDataSet.AreaTableMappingRow)dsBusiness.AreaTableMapping.Rows[0]).TableID;
                }
                else
                {
                    cboTableMapping.Value = TableID;
                }
            }
        }