/// <summary>
        /// 保存文章
        /// </summary>
        /// <param name="EventStatus">文章状态(为-1的时候取选项的值)</param>
        private Boolean SaveDataItem(Int32 EventStatus, out Playngo_ClientZone_Event Event)
        {
            Boolean SaveResult = false;

            Event = EventItem;

            Event.Title       = Common.ReplaceEscape(txtTitle.Text);
            Event.ContentText = HttpUtility.HtmlEncode(txtContentText.Text);

            Event.Address   = txtAddress.Text;
            Event.LocationX = txtLocationX.Text;
            Event.LocationY = txtLocationY.Text;


            Event.NotifyInclude = cbIncludeNotification.Checked ? 1 : 0;
            Event.NotifyStatus  = WebHelper.GetIntParam(Request, ddlNotificationStatus.UniqueID, 0);
            //Event.NotifySubscribers = cbNotifySubscribers.Checked ? 1 : 0;


            //权限
            Event.Per_AllUsers = cbPermissionsAllUsers.Checked ? 0 : 1;

            String textStr, idStr = String.Empty;

            WebHelper.GetSelected(cblPermissionsRoles, out textStr, out idStr);
            Event.Per_Roles = idStr;


            //区域
            Event.Per_AllJurisdictions = cbAllJurisdictions.Checked ? 0 : 1;
            String JurisdictionTexts, JurisdictionIDs = String.Empty;

            WebHelper.GetSelected(cblJurisdictions, out JurisdictionTexts, out JurisdictionIDs);
            Event.Per_Jurisdictions = JurisdictionIDs;

            //文章的发布状态
            if (EventStatus == -1)//如果没有指定状态就取控件的
            {
                Event.Status = WebHelper.GetIntParam(Request, ddlEventStatus.UniqueID, (Int32)EnumStatus.Published);
            }
            else
            {
                Event.Status = EventStatus;
            }

            #region "关于动态选项的代码"

            List <KeyValueEntity> list          = new List <KeyValueEntity>();
            List <SettingEntity>  ItemSettingDB = Event_ItemSettingDB;
            if (ItemSettingDB != null && ItemSettingDB.Count > 0)
            {
                ControlHelper ControlItem = new ControlHelper(ModuleId);

                foreach (SettingEntity ri in ItemSettingDB)
                {
                    KeyValueEntity item = new KeyValueEntity();
                    item.Key   = ri.Name;
                    item.Value = ControlHelper.GetWebFormValue(ri, this);
                    list.Add(item);
                }
            }


            //从动态选项中获取Roadmap启用状态
            if (list.Exists(r => r.Key == "IncludeRoadmap"))
            {
                KeyValueEntity Entity = list.Find(r => r.Key == "IncludeRoadmap");
                Event.IncludeRoadmap = Convert.ToBoolean(Entity.Value) ? 0 : 1;
            }

            //伪静态URL
            String FriendlyUrl = String.Empty;
            if (list.Exists(r => r.Key == "FriendlyUrl"))
            {
                KeyValueEntity TitleEntity = list.Find(r => r.Key == "FriendlyUrl");
                FriendlyUrl = TitleEntity.Value.ToString();

                if (String.IsNullOrEmpty(FriendlyUrl) && !String.IsNullOrEmpty(Event.Title))
                {
                    FriendlyUrl = Common.FriendlySlug(Event.Title);
                }

                Event.UrlSlug     = FriendlyUrl;
                TitleEntity.Value = FriendlyUrl;
                list[list.FindIndex(r => r.Key == "FriendlyUrl")] = TitleEntity;
            }
            Event.Options = ConvertTo.Serialize <List <KeyValueEntity> >(list);
            #endregion


            //更新项
            Event.LastIP   = WebHelper.UserHost;
            Event.LastTime = xUserTime.LocalTime();
            Event.LastUser = UserId;

            //开始状态和时间
            DateTime oTime           = xUserTime.LocalTime();
            string[] expectedFormats = { "G", "g", "f", "F" };
            string   StartDate       = WebHelper.GetStringParam(Request, txtStartDate.UniqueID, oTime.ToString("MM/dd/yyyy"));
            string   StartTime       = WebHelper.GetStringParam(Request, txtStartTime.UniqueID, oTime.ToString("HH:mm:ss"));
            if (DateTime.TryParseExact(String.Format("{0} {1}", StartDate, StartTime), "MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out oTime))
            {
                Event.StartTime = oTime;
            }


            //发布状态和时间
            DateTime oReleaseTime = xUserTime.LocalTime();
            string   ReleaseDate  = WebHelper.GetStringParam(Request, txtReleaseDate.UniqueID, oTime.ToString("MM/dd/yyyy"));
            string   ReleaseTime  = WebHelper.GetStringParam(Request, txtReleaseTime.UniqueID, oTime.ToString("HH:mm:ss"));
            if (DateTime.TryParseExact(String.Format("{0} {1}", ReleaseDate, ReleaseTime), "MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out oReleaseTime))
            {
                Event.ReleaseDate = oReleaseTime;
            }


            //结束状态和时间
            DateTime EndTime     = xUserTime.LocalTime().AddDays(1);
            string   DisableDate = WebHelper.GetStringParam(Request, txtDisableDate.UniqueID, EndTime.ToString("MM/dd/yyyy"));
            string   DisableTime = WebHelper.GetStringParam(Request, txtDisableTime.UniqueID, EndTime.ToString("HH:mm:ss"));
            if (DateTime.TryParseExact(String.Format("{0} {1}", DisableDate, DisableTime), "MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out EndTime))
            {
                Event.EndTime = EndTime;
            }


            //创建用户改为可以选择
            Event.CreateUser = WebHelper.GetIntParam(Request, hfEventAuthor.UniqueID, UserId);


            if (Event.ID > 0)
            {
                //更新
            }
            else
            {
                //新增
                Event.ModuleId   = ModuleId;
                Event.PortalId   = PortalId;
                Event.CreateTime = xUserTime.LocalTime();
            }


            int ResultEvent = 0;

            if (Event.ID > 0)
            {
                ResultEvent = Event.Update();
            }
            else
            {
                ResultEvent = Event.ID = Event.Insert();
            }

            if (ResultEvent > 0)
            {
                SaveResult = true;


                //邮件发送
                //if (Event.SendMail == 0 && cbNotifySubscribers.Checked)
                if (cbNotifySubscribers.Checked)
                {
                    //利用现成发送邮件
                    var objs = new Dictionary <object, object>();
                    objs.Add("DataItem", Event);
                    objs.Add("PortalUrl", PortalUrl);
                    ManagedThreadPool.QueueUserWorkItem(new WaitCallback(ThreadCreateSendMail), objs);


                    //更新发送状态
                    //Playngo_ClientZone_Event.Update(String.Format("SendMail={0}", 1), String.Format("ID={0}", Event.ID));
                }
            }
            else
            {
                SaveResult = false;
            }
            return(SaveResult);
        }
        /// <summary>
        /// 绑定数据项
        /// </summary>
        private void BindDataItem()
        {
            Playngo_ClientZone_Event Event = EventItem;
            TemplateFormat           xf    = new TemplateFormat(this);

            //验证文章是否存在
            if (EventID > 0 && (Event == null || EventID != Event.ID))
            {
                //需要给出提示,载入文章错误
                mTips.LoadMessage("LoadingEventError", EnumTips.Error, this, new String[] { "" });
                Response.Redirect(xUrl("Events"), false);
            }

            if (Event == null)
            {
                Event = new Playngo_ClientZone_Event();
            }



            //这里需要验证一下权限,当作者进入到别人的文章时,需要跳到列表页面
            if (Event != null && Event.ID > 0 && (!IsAdministrator && !IsAdmin) && Event.CreateUser != UserId)
            {
                //需要给出提示,你无权编辑其他作者的文章
                mTips.LoadMessage("NoPermissionEventAlert", EnumTips.Warning, this, new String[] { Event.Title });
                Response.Redirect(xUrl("Events"), false);
            }


            if (Event != null && Event.ID > 0)
            {
                liLastUpdated.Text = Event.LastTime.ToString("MM/dd/yyyy hh:mm tt", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            }

            //导出CSV链接
            hlExportCSV.NavigateUrl = xf.GoDownloadCSVToEventUrl(Event);


            txtTitle.Text       = Common.RestoreEscape(Event.Title);
            txtContentText.Text = HttpUtility.HtmlDecode(Event.ContentText);


            txtAddress.Text   = Event.Address;
            txtLocationX.Text = Event.LocationX;
            txtLocationY.Text = Event.LocationY;



            cbIncludeNotification.Checked = Event.NotifyInclude == 1;
            WebHelper.SelectedListByValue(ddlNotificationStatus, Event.NotifyStatus);
            cbNotifySubscribers.Checked = Event.NotifySubscribers == 1;


            txtStartDate.Text = Event.StartTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtStartTime.Text = Event.StartTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            txtReleaseDate.Text = Event.ReleaseDate.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtReleaseTime.Text = Event.ReleaseDate.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            txtDisableDate.Text = Event.EndTime.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            txtDisableTime.Text = Event.EndTime.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);



            //增加权限用户
            DotNetNuke.Security.Roles.RoleController rc = new DotNetNuke.Security.Roles.RoleController();
            WebHelper.BindList(cblPermissionsRoles, rc.GetPortalRoles(PortalId), "RoleName", "RoleName");
            WebHelper.SelectedListMultiByValue(cblPermissionsRoles, Event.Per_Roles);

            cbPermissionsAllUsers.Checked = Event.Per_AllUsers == 0;



            //区域
            cbAllJurisdictions.Checked = Event.Per_AllJurisdictions == 0;
            WebHelper.BindList(cblJurisdictions, Playngo_ClientZone_Jurisdiction.GetAllCheckList(ModuleId), "Name", "ID");
            WebHelper.SelectedListMultiByValue(cblJurisdictions, Event.Per_Jurisdictions);



            Event.CreateUser = Event.CreateUser == 0 ? UserId : Event.CreateUser;
            UserInfo CreateUserInfo = UserController.GetUserById(PortalId, Event.CreateUser);

            hfEventAuthor.Value     = Event.CreateUser.ToString();
            lbEventAuthor.Text      = CreateUserInfo != null && CreateUserInfo.UserID > 0 ? CreateUserInfo.DisplayName : "None";
            imgEventAuthor.ImageUrl = ViewUserPic(CreateUserInfo);


            WebHelper.SelectedListByValue(ddlEventStatus, Event.Status); //管理员看到的文章状态
        }