private void Bind()
 {
     if (_Id > 0)
     {
         _CurrentEntity = new GroupBLL().GetGroupElemByID(_Id);
         if (_CurrentEntity != null)
         {
             hfAppID.Value           = _CurrentEntity.ElemID.ToString();
             hfIconUrl.Value         = _CurrentEntity.RecommPicUrl;
             txtShowName.Text        = _CurrentEntity.RecommTitle;
             txtRecommWord.Text      = _CurrentEntity.RecommWord;
             txtStartTime.Text       = _CurrentEntity.StartTime.ToString("yyyy-MM-dd HH:mm");
             txtEndTime.Text         = _CurrentEntity.EndTime.ToString("yyyy-MM-dd HH:mm");
             ddlStatus.SelectedValue = _CurrentEntity.Status.ToString();
             txtPosID.Text           = _CurrentEntity.PosID.ToString();
         }
     }
     else
     {
         // 绑定最大位置id Tips
         var currentEntity = new GroupElemsEntity();
         currentEntity.GroupID = new GroupBLL().BeginnerRecommendGetGroupId(this.GroupTypeID, this.SchemeID);
         int posid = new GroupBLL().GetMaxPosID(currentEntity);
         txtStartTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
         txtEndTime.Text   = DateTime.Now.AddYears(10).ToString("yyyy-MM-dd HH:mm");
         if (posid > 0)
         {
             labelPosIDTips.Text = "目前已设置的最大位置id:" + posid.ToString();
         }
         txtPosID.Text = Tools.GetStr(posid + 1, "0");
     }
 }
Ejemplo n.º 2
0
        protected void OnSave(object sender, EventArgs e)
        {
            var currentEntity = new GroupInfoEntity();

            currentEntity.GroupID     = _Id;
            currentEntity.GroupTypeID = this.GroupTypeID;
            currentEntity.OrderType   = 0;
            currentEntity.OrderNo     = 0;
            currentEntity.GroupName   = txtGroupName.Text;
            currentEntity.GroupDesc   = txtGroupDesc.Text;
            currentEntity.GroupTips   = "";
            currentEntity.GroupPicUrl = ThumbPicUrl.Value;
            currentEntity.Remarks     = "";
            currentEntity.StartTime   = this.txtStartTime.Text.Trim().Convert <DateTime>(DateTime.Now);
            currentEntity.EndTime     = this.txtEndTime.Text.Trim().Convert <DateTime>(new DateTime(2048, 1, 1));
            currentEntity.CreateTime  = DateTime.Now;
            currentEntity.UpdateTime  = DateTime.Now;
            currentEntity.Status      = 1; // 开启
            currentEntity.UpdateTime  = DateTime.Now;
            currentEntity.Remarks     = string.Empty;
            currentEntity.SchemeID    = this.SchemeID;

            bool result = false;

            if (_Id <= 0)
            {
                //新增
                currentEntity.CreateTime = DateTime.Now;
                int newId = new GroupBLL().InsertInfoForId(currentEntity);
                if (SchemeID == 104)
                {
                    OperateRecordEntity info = new OperateRecordEntity()
                    {
                        ElemId         = newId,
                        reason         = "",
                        Status         = 1,
                        OperateFlag    = "1",
                        SourcePage     = 61,
                        OperateType    = "5",
                        OperateExplain = "新增专题",
                        OperateContent = currentEntity.GroupName,
                        UserName       = GetUserName(),
                    };
                    new OperateRecordBLL().Insert(info);
                }
                this.Alert("新增成功", "SpecialTopicEdit.aspx?id=" + newId.ToString() + "&page=" + PageType + "&SchemeID=" + SchemeID.ToString() + "&GroupTypeID=" + GroupTypeID.ToString());
            }
            else
            {
                result = new GroupBLL().SpecialTopicUpdate(currentEntity);
                if (SchemeID == 104)
                {
                    OperateRecordEntity info = new OperateRecordEntity()
                    {
                        ElemId         = _Id,
                        reason         = "",
                        Status         = 1,
                        OperateFlag    = "2",
                        SourcePage     = 61,
                        OperateType    = "5",
                        OperateExplain = "编辑专题",
                        OperateContent = currentEntity.GroupName,
                        UserName       = GetUserName(),
                    };
                    new OperateRecordBLL().Insert(info);
                }
            }
            if (result)
            {
                this.Alert("保存成功");
                Bind();
            }
            else
            {
                this.Alert("保存失败!");
            }
        }