Пример #1
0
        private void Bind()
        {
            if (!Id.Equals(Guid.Empty))
            {
                ServiceContent bll   = new ServiceContent();
                var            model = bll.GetModelByJoin(Id);
                if (model != null)
                {
                    myDataAppend.Append("<div code=\"myDataForModel\">[{\"Id\":\"" + model.Id + "\",\"ServiceItemId\":\"" + model.ServiceItemId + "\",\"ServiceItemName\":\"" + model.ServiceItemName + "\",\"Sort\":\"" + model.Sort + "\"}]</div>");

                    hServiceContentId.Value       = model.Id.ToString();
                    txtNamed_ServiceContent.Value = model.Named;

                    string pictureUrl = "";
                    if (!string.IsNullOrWhiteSpace(model.FileDirectory))
                    {
                        pictureUrl = PictureUrlHelper.GetMPicture(model.FileDirectory, model.RandomFolder, model.FileExtension);
                    }
                    imgPicture_ServiceContent.Src           = string.IsNullOrWhiteSpace(pictureUrl) ? "../../Images/nopic.gif" : pictureUrl;
                    hPictureId_ServiceContent.Value         = model.PictureId.ToString();
                    txtaDescr_ServiceContent.Value          = model.Descr;
                    txtaContent_ServiceContent.Value        = model.ContentText;
                    txtEnableStartTime_ServiceContent.Value = model.EnableStartTime == DateTime.MinValue ? "" : model.EnableStartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    txtEnableEndTime_ServiceContent.Value   = model.EnableStartTime == DateTime.MinValue ? "" : model.EnableStartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    var li = rbtnList_ServiceContent.Items.FindByValue(model.IsDisable.ToString().ToLower());
                    if (li != null)
                    {
                        li.Selected = true;
                    }
                }
            }
        }
Пример #2
0
        public string GetServiceContentById(Guid Id)
        {
            try
            {
                if (Id.Equals(Guid.Empty))
                {
                    return("");
                }

                ServiceContent scBll = new ServiceContent();
                var            model = scBll.GetModelByJoin(Id);
                if (model == null)
                {
                    return("");
                }

                Regex r = new Regex("(<img)(.*)src=\"([^\"]*?)\"(.*)/>");
                model.ContentText = r.Replace(model.ContentText, "$1$2src=\"" + WebSiteHost + "$3\" />");

                StringBuilder sb = new StringBuilder(3000);
                sb.Append("<Rsp>");

                IList <object> listArr          = new List <object>();
                Dictionary <string, string> dic = null;
                if (!string.IsNullOrWhiteSpace(model.FileDirectory) && !string.IsNullOrWhiteSpace(model.RandomFolder) && !string.IsNullOrWhiteSpace(model.FileExtension))
                {
                    EnumData.Platform platform = EnumData.Platform.Android;
                    dic = PictureUrlHelper.GetUrlByPlatform(model.FileDirectory, model.RandomFolder, model.FileExtension, platform);
                }
                listArr.Add(dic == null ? "" : WebSiteHost + dic["OriginalPicture"]);
                listArr.Add(dic == null ? "" : WebSiteHost + dic["BPicture"]);
                listArr.Add(dic == null ? "" : WebSiteHost + dic["MPicture"]);
                listArr.Add(dic == null ? "" : WebSiteHost + dic["SPicture"]);
                sb.AppendFormat("<Id>{0}</Id><Name>{1}</Name><Descr>{2}</Descr><Content><![CDATA[{3}]]></Content><LastUpdatedDate>{4}</LastUpdatedDate>", model.Id, model.Named, model.Descr, model.ContentText, model.LastUpdatedDate.ToString("yyyy-MM-dd HH:mm"));
                sb.AppendFormat("<OriginalPicture>{0}</OriginalPicture><BPicture>{1}</BPicture><MPicture>{2}</MPicture><SPicture>{3}</SPicture>", listArr.ToArray());

                sb.Append("</Rsp>");

                return(sb.ToString());
            }
            catch (Exception ex)
            {
                new CustomException(string.Format("服务-接口:string GetServiceContentById,异常:{0}", ex.Message), ex);
                return("");
            }
        }
Пример #3
0
        private void Bind()
        {
            if (!Id.Equals(Guid.Empty))
            {
                ServiceContent bll   = new ServiceContent();
                var            model = bll.GetModelByJoin(Id);
                if (model != null)
                {
                    myDataAppend.Append("<div code=\"myDataForModel\">[{\"Id\":\"" + model.Id + "\",\"ServiceItemId\":\"" + model.ServiceItemId + "\",\"ServiceItemName\":\"" + model.ServiceItemName + "\",\"Sort\":\"" + model.Sort + "\"}]</div>");

                    hServiceContentId.Value          = model.Id.ToString();
                    txtNamed_ServiceContent.Value    = model.Named;
                    imgPicture_ServiceContent.Src    = string.IsNullOrWhiteSpace(model.MPicture) ? "../../Images/nopic.gif" : model.MPicture;
                    hPictureId_ServiceContent.Value  = model.PictureId.ToString();
                    txtaDescr_ServiceContent.Value   = model.Descr;
                    txtaContent_ServiceContent.Value = model.ContentText;
                }
            }
        }