protected void SaveStimulition(CY.CSTS.Core.Business.StimulationCheck stimulition, int statetype)
        {
            IList<CY.CSTS.Core.Business.StimulationType> stimulationlist = new List<CY.CSTS.Core.Business.StimulationType>();
            StringBuilder res = new StringBuilder();

            for (int i = 0; i < this.CheckBoxContent.Items.Count; i++)
            {
                if (CheckBoxContent.Items[i].Selected)
                {
                    res.Append(CheckBoxContent.Items[i].Value + ",");
                    if (CheckBoxContent.Items[i].Value == "分中心与协作单位")
                    {
                        CY.CSTS.Core.Business.StimulationType unit = new CY.CSTS.Core.Business.StimulationType();
                        unit.DateCreated = DateTime.Now;
                        unit.Des = TxtUnit1.Text;
                        unit.StimulatedType = 3;
                        unit.State = statetype;
                        stimulationlist.Add(unit);

                    }
                    if (CheckBoxContent.Items[i].Value == "中心")
                    {
                        CY.CSTS.Core.Business.StimulationType center = new CY.CSTS.Core.Business.StimulationType();
                        center.DateCreated = DateTime.Now;
                        center.Des = TxtCenter1.Text;
                        center.StimulatedType = 2;
                        center.State = statetype;
                        stimulationlist.Add(center);

                    }
                    if (CheckBoxContent.Items[i].Value == "机组")
                    {
                        CY.CSTS.Core.Business.StimulationType crew = new CY.CSTS.Core.Business.StimulationType();
                        crew.DateCreated = DateTime.Now;
                        crew.Des = TxtCrew1.Text;
                        crew.StimulatedType = 1;
                        crew.State = statetype;
                        stimulationlist.Add(crew);
                    }

                }

            }
            if (res.Length > 1)
            {
                res.Remove(res.Length - 1, 1);
            }
            stimulition.Content = res.ToString();
            stimulition.Name = Txtname.Text;
            stimulition.StartDate = Convert.ToDateTime(TxtUnload.Text);
            stimulition.EndDate = Convert.ToDateTime(TxtJudge.Text);
            stimulition.AddData = DateTime.Now;
            //stimulition.AddPerson = Session[User];
            //stimulition.DateCreated=Convert.ToDateTime(TxtFirst.Text);
            stimulition.Save();
            for (int i = 0; i < stimulationlist.Count; i++)
            {
                stimulationlist.ElementAt(i).StimulationId = stimulition.Id;
                stimulationlist.ElementAt(i).Save();
            }
            bindDatas();
        }
        protected void Updatestimulition(CY.CSTS.Core.Business.StimulationCheck stimulition, int statetype)
        {
            IList<CY.CSTS.Core.Business.StimulationType> stimulationlist = CY.CSTS.Core.Business.StimulationType.SelectStimulationTypesByStimulationId(stimulition.Id);
            IList<CY.CSTS.Core.Business.StimulationType> addlist = new List<CY.CSTS.Core.Business.StimulationType>();
            StringBuilder res = new StringBuilder();

            for (int i = 0; i < this.CheckBoxContent.Items.Count; i++)
            {
                if (CheckBoxContent.Items[i].Selected)
                {
                    res.Append(CheckBoxContent.Items[i].Value + ",");
                    if (CheckBoxContent.Items[i].Value == "分中心与协作单位")
                    {
                        bool isexit = false;
                        for (int j = 0; j < stimulationlist.Count; j++)
                        {
                            if (stimulationlist.ElementAt(j).StimulatedType == 3)
                            {
                                isexit = true;
                                CY.CSTS.Core.Business.StimulationType unit = stimulationlist.ElementAt(j);
                                unit.DateCreated = DateTime.Now;
                                unit.Des = TxtUnit1.Text;
                                unit.StimulatedType = 3;
                                unit.State = statetype;
                                unit.Save();
                            }
                        }
                        if (!isexit)
                        {
                            CY.CSTS.Core.Business.StimulationType unit = new CY.CSTS.Core.Business.StimulationType();
                            unit.DateCreated = DateTime.Now;
                            unit.Des = TxtUnit1.Text;
                            unit.StimulatedType = 3;
                            unit.State = statetype;
                            addlist.Add(unit);

                        }

                    }
                    if (CheckBoxContent.Items[i].Value == "中心")
                    {
                        bool isexit = false;
                        for (int j = 0; j < stimulationlist.Count; j++)
                        {
                            if (stimulationlist.ElementAt(j).StimulatedType == 2)
                            {
                                isexit = true;
                                CY.CSTS.Core.Business.StimulationType center = stimulationlist.ElementAt(j);
                                center.DateCreated = DateTime.Now;
                                center.Des = TxtCenter1.Text;
                                center.StimulatedType = 2;
                                center.State = statetype;
                                center.Save();
                            }

                        }
                        if (!isexit)
                        {
                            CY.CSTS.Core.Business.StimulationType center = new CY.CSTS.Core.Business.StimulationType();
                            center.DateCreated = DateTime.Now;
                            center.Des = TxtCenter1.Text;
                            center.StimulatedType = 2;
                            center.State = statetype;
                            addlist.Add(center);
                        }
                    }
                    if (CheckBoxContent.Items[i].Value == "机组")
                    {
                        bool isexit = false;
                        for (int j = 0; j < stimulationlist.Count; j++)
                        {
                            if (stimulationlist.ElementAt(j).StimulatedType == 1)
                            {
                                isexit = true;
                                CY.CSTS.Core.Business.StimulationType crew = stimulationlist.ElementAt(j);
                                crew.DateCreated = DateTime.Now;
                                crew.Des = TxtCrew1.Text;
                                crew.StimulatedType = 1;
                                crew.State = statetype;
                                crew.Save();
                            }

                        }
                        if (!isexit)
                        {
                            CY.CSTS.Core.Business.StimulationType crew = new CY.CSTS.Core.Business.StimulationType();
                            crew.DateCreated = DateTime.Now;
                            crew.Des = TxtCrew1.Text;
                            crew.StimulatedType = 1;
                            crew.State = statetype;
                            addlist.Add(crew);
                        }

                    }

                }

            }
            if (res.Length > 1)
            {
                res.Remove(res.Length - 1, 1);
            }
            stimulition.Content = res.ToString();
            stimulition.Name = Txtname.Text;
            stimulition.StartDate = Convert.ToDateTime(TxtUnload.Text);
            stimulition.EndDate = Convert.ToDateTime(TxtJudge.Text);
            stimulition.AddData = DateTime.Now;
            stimulition.Save();
            for (int i = 0; i < addlist.Count; i++)
            {
                addlist.ElementAt(i).StimulationId = stimulition.Id;
                addlist.ElementAt(i).Save();
            }
            bindDatas();
        }
        /// <summary>
        /// 1获取话题(pubtopic)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetTopicInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;

            CY.UME.Core.Business.Account author;

            if (notice.InstanceId.Length < 1)
            {
                return result;
            }

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            Guid topicId = new Guid(notice.InstanceId);

            CY.UME.Core.Business.Topic topic = CY.UME.Core.Business.Topic.Load(topicId);
            if (topic == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }
            CY.UME.Core.Business.TopicExtend te = CY.UME.Core.Business.TopicExtend.Load(topicId);

            if (te == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            int groupId = 0;
            if (!int.TryParse(te.InstanceId, out groupId))
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            CY.UME.Core.Business.Group group = CY.UME.Core.Business.Group.Load(groupId);

            if (group == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("{id:'");
            sb.Append(notice.Id);
            sb.Append("', authorId:");
            sb.Append(notice.AuthorId);
            sb.Append(", accountId:");
            sb.Append(notice.AccountId);
            sb.Append(", authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Name));
            sb.Append(",content: ");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));//.Replace(currentAccount.Name, "我")
            sb.Append(",type:'");
            sb.Append(notice.Type);
            sb.Append("',topicId:'");
            sb.Append(topicId);
            sb.Append("',topicName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(CY.Utility.Common.StringUtility.CutString(topic.Title, 30, "...")));

            string strContent = topic.Content.Replace("\r\n", "");
            strContent = CY.Utility.Common.StringUtility.NoHTML(strContent);
            strContent = System.Web.HttpContext.Current.Server.HtmlDecode(strContent);
            strContent = strContent.Replace("&nbsp;", " ");
            strContent = strContent.Replace("\r\n", "");

            strContent = CY.Utility.Common.StringUtility.CutString(strContent.Trim(), 400, "...");
            strContent = strContent.Replace("&", "&amp;");

            sb.Append(",topicContent:" + CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(strContent));
            sb.Append(",topicDate:'" + CY.Utility.Common.StringUtility.getDateDifference(topic.DateCreated));
            sb.Append("',groupId:" + groupId);
            sb.Append(",groupName:" + CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(group.Name));
            sb.Append(",ReplyNum:" + topic.ReplyNum);
            sb.Append("},");

            result = sb.ToString();

            isCut = true;
            return result;
        }
        /// <summary>
        /// 7获取友情小组(relativegroup)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetRelativeGroupInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;

            StringBuilder sb = new StringBuilder();

            CY.UME.Core.Business.Account author;

            if (notice.InstanceId.Length < 1)
            {
                return result;
            }

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            Guid RelativeGroupId = new Guid();

            if (!Guid.TryParse(notice.InstanceId, out RelativeGroupId))
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            CY.UME.Core.Business.RelativeGroup re = CY.UME.Core.Business.RelativeGroup.Load(RelativeGroupId);

            if (re == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            CY.UME.Core.Business.Group MyGroup = CY.UME.Core.Business.Group.Load(re.GroupId);//作者的小组
            CY.UME.Core.Business.Group RelativeGroup = CY.UME.Core.Business.Group.Load(re.RelativeGroupId);//作者的有情小组

            if (MyGroup == null || RelativeGroup == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            sb.Append("{id:'");
            sb.Append(notice.Id);
            sb.Append("', authorId:'");
            sb.Append(notice.AuthorId);
            sb.Append("', accountId:'");
            sb.Append(notice.AccountId);
            sb.Append("', authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Name));
            sb.Append(",content:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));
            sb.Append(",type:'");
            sb.Append(notice.Type);
            //群组信息
            sb.Append("',Date:'");
            sb.Append(CY.Utility.Common.StringUtility.getDateDifference(notice.DateCreated));
            sb.Append("',myGroupId:'" + MyGroup.Id);
            sb.Append("',myGroupName:'" + MyGroup.Name);
            sb.Append("',relativeGroupId:'" + RelativeGroup.Id);
            sb.Append("',relativeGroupName:'" + CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(RelativeGroup.Name));
            sb.Append("'},");

            isCut = true;
            return sb.ToString();
        }
        /// <summary>
        /// 2获取单个图片(picture)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetPictureInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;
            StringBuilder sb = new StringBuilder();
            CY.UME.Core.Business.Account author;
            CY.UME.Core.Business.Picture pic;
            CY.UME.Core.Business.Album album;
            long picId = 0;

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            sb.Append("{id:");
            sb.Append(notice.Id);
            sb.Append(",type:'" + notice.Type);
            sb.Append("',authorId:");
            sb.Append(notice.AuthorId);
            sb.Append(",authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Name));
            sb.Append(",content:" + CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));

            string[] arrayInstanceId = notice.InstanceId.Split(',');

            if (!long.TryParse(arrayInstanceId[0], out picId))
            {
                return result;
            }
            else
            {
                if (picId < 1) { return result; }
                else
                {
                    pic = CY.UME.Core.Business.Picture.Load(picId);
                }
            }

            if (pic == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            album = CY.UME.Core.Business.Album.Load(pic.AlbumId);
            if (album == null)
            {
                return result;
            }

            sb.Append(",albumName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(album.Name));
            sb.Append(",albumId:");
            sb.Append(album.Id);

            sb.Append(",Pictures:[");
            sb.Append("{picName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(pic.Name));
            sb.Append(",pictureId:");
            sb.Append(picId);
            sb.Append(",picDate:'");
            sb.Append(CY.Utility.Common.StringUtility.getDateDifference(pic.DateCreated));
            sb.Append("',ReplyNum:" + pic.ReplyNum);
            sb.Append("}");

            for (int i = 1; i < arrayInstanceId.Length; i++)
            {
                if (!long.TryParse(arrayInstanceId[i], out picId))
                {
                    continue;
                }

                pic = CY.UME.Core.Business.Picture.Load(picId);

                if (pic == null)
                {
                    continue;
                }

                sb.Append(",{");
                sb.Append("picName:");
                sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(pic.Name));
                sb.Append(",pictureId:");
                sb.Append(picId);
                sb.Append(",picDate:'");
                sb.Append(CY.Utility.Common.StringUtility.getDateDifference(pic.DateCreated));
                sb.Append("',ReplyNum:" + pic.ReplyNum);
                sb.Append("}");
            }

            sb.Append("]");
            sb.Append("},");

            result = sb.ToString();

            isCut = true;
            return result;
        }
        /// <summary>
        /// 4获取单个(miniblog)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetMiniBlogInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;
            StringBuilder sb = new StringBuilder();
            CY.UME.Core.Business.Account author;
            CY.UME.Core.Business.MiniBlog miniBlog;

            long miniblogId = 0;

            if (!CY.Utility.Common.ParseUtility.TryParseInt64(notice.InstanceId, out miniblogId))
            {
                return result;
            }
            else
            {
                if (miniblogId < 1) { return result; }
                else
                {
                    miniBlog = CY.UME.Core.Business.MiniBlog.Load(miniblogId);
                }
            }

            if (miniBlog == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            CY.UME.Core.Business.MiniBlogExtend mbe = CY.UME.Core.Business.MiniBlogExtend.Load(miniblogId);

            bool IsPhoneSended = false;
            string picurl = String.Empty;
            string video = String.Empty;
            StringBuilder Refereds = new StringBuilder();

            Refereds.Append("{");
            if (mbe != null)
            {
                IsPhoneSended = mbe.IsPhoneSended;
                picurl = mbe.ImgPath;
                video = mbe.Video;
                if (mbe.ReferedId > 0)
                {
                    CY.UME.Core.Business.MiniBlogExtend mbeTemp = CY.UME.Core.Business.MiniBlogExtend.Load(mbe.ReferedId);
                    string name = mbe.ReferedName;
                    long id = mbe.ReferedAuthorId;
                    bool check = true;
                    long orMiniBlogId = mbe.ReferedId;
                    string orMiniBlogContent = String.Empty;
                    int orTraNum = 0;
                    int i = 0;

                    CY.UME.Core.Business.MiniBlog orMbTemp = CY.UME.Core.Business.MiniBlog.Load(mbeTemp.Id);

                    if (orMbTemp != null) orMiniBlogContent = orMbTemp.Content;//叫你们要判空,老是记不住!2010-05-11 11:17

                    Refereds.Append("TraInfo:[ ");
                    while (check)
                    {
                        if (i < 10)
                        {
                            Refereds.Append("{");
                            Refereds.Append("AccountId:" + id);
                            Refereds.Append(",Name:'" + (notice.AccountId == id ? "我" : name) + "'");
                            Refereds.Append(",MiniBlogId:" + orMiniBlogId);
                            Refereds.Append(",MiniBlogContent:" + Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(orMiniBlogContent));
                            Refereds.Append("},");
                        }

                        i++;

                        if (mbeTemp == null)
                        {
                            check = false;
                            orTraNum = CY.UME.Core.Business.MiniBlogExtend.GetMiniBlogTransferNum(orMiniBlogId);
                        }
                        else
                        {
                            if (mbeTemp.ReferedId == 0)
                            {
                                check = false;
                                orTraNum = mbeTemp.TransferedNum;
                            }
                            else
                            {
                                id = mbeTemp.ReferedAuthorId;
                                name = mbeTemp.ReferedName;
                                orMiniBlogId = mbeTemp.ReferedId;

                                CY.UME.Core.Business.MiniBlog orMiniBlog = CY.UME.Core.Business.MiniBlog.Load(orMiniBlogId);

                                orMiniBlogContent = orMiniBlog == null ? "" : orMiniBlog.Content;

                                mbeTemp = CY.UME.Core.Business.MiniBlogExtend.Load(mbeTemp.ReferedId);
                            }
                        }
                    }
                    Refereds.Remove(Refereds.Length - 1, 1);
                    Refereds.Append("]");
                    Refereds.Append(",Id:" + orMiniBlogId);
                    Refereds.Append(",TrasNum:" + orTraNum);
                }
            }
            Refereds.Append("}");

            sb.Append("{id:");
            sb.Append(notice.Id);
            sb.Append(",type:'" + notice.Type);
            sb.Append("',authorId:");
            sb.Append(notice.AuthorId);
            sb.Append(",authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Id == notice.AccountId ? "我" : author.Name));
            sb.Append(",content:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));
            sb.Append(",miniBlogId:");
            sb.Append(miniblogId);
            sb.Append(",miniBlogContent:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(miniBlog.Content));
            sb.Append(",miniBlogPubDate:'");
            sb.Append(CY.Utility.Common.StringUtility.getDateDifference(miniBlog.DatePublish));
            sb.Append("',Refereds:" + Refereds.ToString());
            sb.Append(",TrasNum:" + (mbe == null ? "0" : mbe.TransferedNum.ToString()));
            sb.Append(",ReplyNum:" + miniBlog.GetCommentCount());
            sb.Append(",IsPhoneSended:" + (IsPhoneSended ? "1" : "0"));
            sb.Append(",picUrl:'" + picurl + "'");
            sb.Append(",video:'" + video + "'");
            sb.Append("},");
            const string aabc = "<table border = 0 cellpadding=0 cellspacing=0><tr><td></td>{0}</tr></table>";
            String title = "";
            String.Format(aabc, title);
            result = sb.ToString();

            isCut = true;
            return result;
        }
        /// <summary>
        /// 3获取单个博客(blog)信息
        /// </summary>
        /// <param name="notice"></param>
        /// <returns></returns>
        private string GetBlogInfo(CY.UME.Core.Business.Notice notice, out bool isCut)
        {
            isCut = false;
            string result = String.Empty;
            StringBuilder sb = new StringBuilder();
            CY.UME.Core.Business.Account author;
            CY.UME.Core.Business.Blog blog;

            long blogId;
            if (!CY.Utility.Common.ParseUtility.TryParseInt64(notice.InstanceId, out blogId))
            {
                return result;
            }
            else
            {
                if (blogId < 1) { return result; }
                else
                {
                    blog = CY.UME.Core.Business.Blog.Load(blogId);
                }
            }

            if (blog == null)
            {
                notice.DeleteOnSave();
                notice.Save();

                return result;
            }

            author = CY.UME.Core.Business.Account.Load(notice.AuthorId);
            if (author == null)
            {
                return result;
            }

            string strContent = blog.BlogContent.Replace("\r\n", "");
            strContent = CY.Utility.Common.StringUtility.NoHTML(strContent);
            strContent = System.Web.HttpContext.Current.Server.HtmlDecode(strContent);
            strContent = strContent.Replace("&nbsp;", " ");
            strContent = CY.Utility.Common.StringUtility.CutString(strContent.Trim(), 200, "...");
            strContent = strContent.Replace("&", "&amp;");

            sb.Append("{id:");
            sb.Append(notice.Id);
            sb.Append(",type:'" + notice.Type);
            sb.Append("',authorId:");
            sb.Append(notice.AuthorId);
            sb.Append(",authorName:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(author.Name));
            sb.Append(",content:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(notice.Content));
            sb.Append(",blogId:'");
            sb.Append(blogId);
            sb.Append("',blogSubject:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(blog.Subject));
            sb.Append(",blogContent:");
            sb.Append(CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(strContent));
            sb.Append(",blogPubDate:'");
            sb.Append(CY.Utility.Common.StringUtility.getDateDifference(blog.DateCreated));
            sb.Append("',ReplyNum:" + blog.ReplyNum);
            sb.Append("},");

            result = sb.ToString();

            isCut = true;
            return result;
        }