Пример #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);
        }
Пример #2
0
        protected override void OnLoad(EventArgs e)
        {
            if (Page.IsPostBack)
            {
                return;
            }

            var unity = new UnityContext();

            if (this.LoopType == LoopType.Article)
            {
                var svr = unity.GetInstance <IArticleService>();
                this.DataSource = svr.GetList(new Model.Article.Query {
                    Cate_Id = CatId, Status = 1
                }, Limit);
                this.DataBind();
            }
            else if (this.LoopType == LoopType.Advertisement)
            {
                var svr = unity.GetInstance <IAdService>();
                this.DataSource = svr.GetList(new Model.Ad.Query {
                    Position_Id = Position, Status = 1, Ad_Type = AdType, Type = this.Type
                }, Limit);
                this.DataBind();
            }
            else if (this.LoopType == LoopType.Link)
            {
                var svr = unity.GetInstance <ILinksService>();

                //int? isRecommend = null;

                //if (this.IsHot != null)
                //{
                //    isRecommend = this.Recommend.Value ? 1 : 0;
                //}

                this.DataSource = svr.GetList(new Model.Links.Query {
                    Recommend = (int?)Recommend, Status = 1
                }, Limit);
                this.DataBind();
            }
            else if (this.LoopType == LoopType.Title)
            {
                var svr = unity.GetInstance <ITitleService>();

                //int? isHots = null;

                //if (this.IsHot != null)
                //{
                //    isHots = this.IsHot.Value ? 1 : 0;
                //}

                //int? isRecommend = null;

                //if (this.IsHot != null)
                //{
                //    isRecommend = this.Recommend.Value ? 1 : 0;
                //}

                this.DataSource = svr.GetList(new Model.Title.Query {
                    Recommend = (int?)Recommend, Parent_Id = CatId, Status = 1
                }, Limit);
                this.DataBind();
            }
            else if (this.LoopType == LoopType.Category)
            {
                var svr = unity.GetInstance <ICategoryService>();

                IList <int> limits = new List <int>();

                if (Start != null && Start.HasValue)
                {
                    limits.Add(Start.Value);
                }

                if (Limit != null && Limit.HasValue)
                {
                    limits.Add(Limit.Value);
                }

                int[] newLimit = limits.ToArray <int>();

                this.DataSource = svr.GetList(new Model.Category.Query {
                    Parent_Id = CatId, Recommend = (int?)Recommend, Status = 1
                }, newLimit);
                this.DataBind();
            }
            else if (this.LoopType == LoopType.Attribute)
            {
                var svr = unity.GetInstance <IAttributeService>();
                this.DataSource = svr.GetList(new Model.Attribute.Query {
                    Recommend = (int?)Recommend, Pid = CatId, Status = 1
                }, Limit);
                this.DataBind();
            }
            else if (this.LoopType == LoopType.Question)
            {
                var svr = unity.GetInstance <IQuestionService>();
                this.DataSource = svr.GetList(new Model.Question.Query {
                    Is_Best = (int?)IsBest, Type_Id = CatId, Status = 1, User_Id = UserId
                }, Limit);
                this.DataBind();
            }
            else if (this.LoopType == LoopType.QuestionType)
            {
                var svr = unity.GetInstance <IQuestionTypeService>();
                this.DataSource = svr.GetList(new Model.QuestionType.Query {
                }, Limit);
                this.DataBind();
            }
            else if (this.LoopType == LoopType.Region)
            {
                var svr = unity.GetInstance <IRegionService>();
                this.DataSource = svr.GetList(new Model.Region.Query {
                    Parent_Id = CatId
                });
                this.DataBind();
            }
            else if (this.LoopType == LoopType.Product)
            {
                var svr = unity.GetInstance <IProductService>();
                this.DataSource = svr.GetList(new Model.Product.Query {
                    Cat_Id = CatId.TryParseToString(null), Best = (int?)IsBest, Hot = (int?)IsHot, New = IsNew, Status = 1, Sales = 0
                }, Limit);
                this.DataBind();
            }
        }
Пример #3
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);
        }
Пример #4
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;
            }
        }