Exemple #1
0
        public override IDictionary <string, string> GetParameters()
        {
            var param = base.GetParameters();

            param.Add("activity_tags", ActivityTags?.ToJson());
            param.Add("cat_id", CatId?.ToString());
            param.Add("custom_parameters", CustomParameters);
            param.Add("goods_id_list", GoodsIdList?.ToJson());
            param.Add("is_brand_goods", IsBrandGoods?.ToString());
            param.Add("keyword", Keyword);
            param.Add("list_id", ListId);
            param.Add("merchant_type", MerchantType?.ToString());
            param.Add("merchant_type_list", MerchantTypeList?.ToJson());
            param.Add("opt_id", OptId?.ToString());
            param.Add("page", Page?.ToString());
            param.Add("page_size", PageSize?.ToString());
            param.Add("pid", Pid);
            param.Add("sort_type", SortType?.ToString());
            param.Add("with_coupon", WithCoupon?.ToString());
            param.Add("range_list", RangeList?.ToJson());
            return(param);
        }
Exemple #2
0
        /// <summary>
        /// Creates a xml message based on the data in the object. It is used before the message is send to the server.
        /// </summary>
        protected virtual XmlDocument CreateXmlMessage()
        {
            XmlDocument doc  = new XmlDocument();
            XmlElement  root = doc.CreateElement("NOTIFICATION");

            if (NotificationTypeSpecified)
            {
                root.Attributes.Append(doc.CreateAttribute("ver")).Value = ((int)NotificationType).ToString(CultureInfo.InvariantCulture);
            }

            root.Attributes.Append(doc.CreateAttribute("id")).Value = Id.ToString();
            if (siteId > 0)
            {
                root.Attributes.Append(doc.CreateAttribute("siteid")).Value = SiteId.ToString();
            }
            if (siteUrl.Length > 0)
            {
                root.Attributes.Append(doc.CreateAttribute("siteurl")).Value = SiteUrl;
            }

            XmlElement to = doc.CreateElement("TO");

            if (ReceiverMemberIdLow.Length > 0 && ReceiverMemberIdHigh.Length > 0)
            {
                to.Attributes.Append(doc.CreateAttribute("pid")).Value = ReceiverMemberIdLow.ToString() + ":" + ReceiverMemberIdHigh.ToString();
            }
            if (ReceiverAccount.Length > 0)
            {
                to.Attributes.Append(doc.CreateAttribute("name")).Value = ReceiverAccount;
            }
            if (ReceiverOfflineMail.Length > 0)
            {
                to.Attributes.Append(doc.CreateAttribute("email")).Value = ReceiverOfflineMail;
            }
            if (SendDevice.Length > 0)
            {
                XmlElement via = doc.CreateElement("VIA");
                via.Attributes.Append(doc.CreateAttribute("agent")).Value = SendDevice;
                to.AppendChild(via);
            }
            root.AppendChild(to);

            XmlElement from = doc.CreateElement("FROM");

            if (SenderMemberIdLow.Length > 0 && SenderMemberIdHigh.Length > 0)
            {
                from.Attributes.Append(doc.CreateAttribute("pid")).Value = SenderMemberIdLow.ToString() + ":" + SenderMemberIdHigh.ToString();
            }
            if (SenderAccount.Length > 0)
            {
                from.Attributes.Append(doc.CreateAttribute("name")).Value = SenderAccount;
            }
            root.AppendChild(from);

            XmlElement msg = doc.CreateElement("MSG");

            if (Pri.Length > 0)
            {
                msg.Attributes.Append(doc.CreateAttribute("pri")).Value = Pri.ToString();
            }

            msg.Attributes.Append(doc.CreateAttribute("id")).Value = MessageId.ToString();

            if (ActionUrl.Length > 0)
            {
                XmlElement action = doc.CreateElement("ACTION");
                action.Attributes.Append(doc.CreateAttribute("url")).Value = ActionUrl;
                msg.AppendChild(action);
            }
            if (SubcriptionUrl.Length > 0)
            {
                XmlElement subscr = doc.CreateElement("SUBSCR");
                subscr.Attributes.Append(doc.CreateAttribute("url")).Value = SubcriptionUrl;
                msg.AppendChild(subscr);
            }
            if (CatId.Length > 0)
            {
                XmlElement cat = doc.CreateElement("CAT");
                cat.Attributes.Append(doc.CreateAttribute("id")).Value = CatId.ToString();
                msg.AppendChild(cat);
            }

            XmlElement body = doc.CreateElement("BODY");

            if (Language.Length > 0)
            {
                body.Attributes.Append(doc.CreateAttribute("id")).Value = Language;
            }
            if (IconUrl.Length > 0)
            {
                body.Attributes.Append(doc.CreateAttribute("icon")).Value = IconUrl;
            }
            if (Text.Length > 0)
            {
                XmlElement textEl = doc.CreateElement("TEXT");
                textEl.AppendChild(doc.CreateTextNode(Text));
                body.AppendChild(textEl);
            }

            if (OfflineText.Length > 0)
            {
                XmlElement emailTextEl = doc.CreateElement("EMAILTEXT");
                emailTextEl.AppendChild(doc.CreateTextNode(OfflineText));
                body.AppendChild(emailTextEl);
            }
            msg.AppendChild(body);

            root.AppendChild(msg);

            doc.AppendChild(root);

            return(doc);
        }
Exemple #3
0
        private void BindEmailValues()
        {
            EMailMessageInfo mi = EMailMessageInfo.Load(EMailMessageId);

            IncidentInfo incidentInfo = EMailIncidentMappingHandler.CreateMapping(EMailMessageId);

            // Eval IncidentBox
            ddlFolder.SelectedValue = IncidentBoxRule.Evaluate(incidentInfo).IncidentBoxId.ToString();

            txtTitle.Text       = incidentInfo.Title;
            ftbDescription.Text = incidentInfo.Description;
            CommonHelper.SafeSelect(ddlPriority, incidentInfo.PriorityId.ToString());
            CommonHelper.SafeSelect(ddlSeverity, incidentInfo.SeverityId.ToString());
            CommonHelper.SafeSelect(ddlType, incidentInfo.TypeId.ToString());
            ddProject.ObjectTypeId = (int)ObjectTypes.Project;
            ddProject.ObjectId     = incidentInfo.ProjectId;

            if (incidentInfo.GeneralCategories != null)
            {
                foreach (int CatId in incidentInfo.GeneralCategories)
                {
                    CommonHelper.SafeMultipleSelect(lbCategory, CatId.ToString());
                }
            }
            if (incidentInfo.IncidentCategories != null)
            {
                foreach (int CatId in incidentInfo.IncidentCategories)
                {
                    CommonHelper.SafeMultipleSelect(lbIncidentCategory, CatId.ToString());
                }
            }

            //try from MailSenderEmail
            PrimaryKeyId contactUid = PrimaryKeyId.Empty;
            PrimaryKeyId orgUid     = PrimaryKeyId.Empty;
            Client       client     = Common.GetClient(incidentInfo.MailSenderEmail);

            if (client != null)
            {
                if (client.IsContact)
                {
                    contactUid = client.Id;

                    ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName();
                    ClientControl.ObjectId   = contactUid;
                }
                else
                {
                    orgUid = client.Id;

                    ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName();
                    ClientControl.ObjectId   = orgUid;
                }
            }


            //from incidentinfo

            if (orgUid == PrimaryKeyId.Empty && contactUid == PrimaryKeyId.Empty)
            {
                if (incidentInfo.OrgUid != PrimaryKeyId.Empty)
                {
                    ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName();
                    ClientControl.ObjectId   = incidentInfo.OrgUid;
                }
                else if (incidentInfo.ContactUid != PrimaryKeyId.Empty)
                {
                    ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName();
                    ClientControl.ObjectId   = incidentInfo.ContactUid;
                }
            }

            trHtmlAttach.Visible = false;
            trEmail.Visible      = true;

            string sBody = "";

            if (mi.HtmlBody != null)
            {
                sBody = EMailMessageInfo.CutHtmlBody(mi.HtmlBody, 256, "...");
            }

            if (sBody.Trim() != "")
            {
                lblEmail.Text = String.Format("{0}<p align=right class='text'><a href=\"javascript:OpenSizableWindow('EMailView.aspx?EMailId={2}', 750, 550)\"><b>{1}</b></a>", sBody, LocRM4.GetString("More"), EMailMessageId);
            }
            else
            {
                lblEmail.Text = sBody;
            }
        }