Beispiel #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string tagName = this.txtTagName.Text.Trim();
     if (tagName.Length == 0)
     {
         MessageBox.ShowServerBusyTip(this, "名称不能为空!");
     }
     else
     {
         Maticsoft.BLL.SNS.PhotoTags tags = new Maticsoft.BLL.SNS.PhotoTags();
         Maticsoft.Model.SNS.PhotoTags model = null;
         if (this.TagID > 0)
         {
             model = tags.GetModel(this.TagID);
             if (model != null)
             {
                 if (tags.Exists(model.TagID, tagName))
                 {
                     MessageBox.ShowServerBusyTip(this, "标签已存在!");
                 }
                 else
                 {
                     model.TagName = tagName;
                     model.IsRecommand = new int?(Globals.SafeInt(this.radlIsRecommand.SelectedValue, 0));
                     model.Status = new int?(Globals.SafeInt(this.radlStatus.SelectedValue, 0));
                     model.CreatedDate = new DateTime?(DateTime.Now);
                     if (tags.Update(model))
                     {
                         this.txtTagName.Text = "";
                         this.gridView.OnBind();
                         MessageBox.ShowSuccessTip(this, Site.TooltipUpdateOK, "PhotoTags.aspx");
                     }
                     else
                     {
                         MessageBox.ShowFailTip(this, Site.TooltipUpdateError);
                     }
                 }
             }
         }
         else if (tags.Exists(tagName))
         {
             MessageBox.ShowServerBusyTip(this, "标签已存在!");
         }
         else
         {
             model = new Maticsoft.Model.SNS.PhotoTags {
                 TagName = tagName,
                 IsRecommand = new int?(Globals.SafeInt(this.radlIsRecommand.SelectedValue, 0)),
                 Status = new int?(Globals.SafeInt(this.radlStatus.SelectedValue, 0)),
                 CreatedDate = new DateTime?(DateTime.Now)
             };
             if (tags.Add(model) > 0)
             {
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "增加图片标签成功", this);
                 this.txtTagName.Text = "";
                 MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK);
                 this.gridView.OnBind();
             }
             else
             {
                 MessageBox.ShowFailTip(this, Site.TooltipSaveError);
             }
         }
     }
 }
Beispiel #2
0
 private void ShowInfo()
 {
     Maticsoft.Model.SNS.PhotoTags model = new Maticsoft.BLL.SNS.PhotoTags().GetModel(this.TagID);
     if (model != null)
     {
         this.txtTagName.Text = model.TagName;
         this.radlIsRecommand.SelectedValue = model.IsRecommand.ToString();
         this.radlStatus.SelectedValue = model.Status.ToString();
     }
 }