Beispiel #1
0
 public Maticsoft.Model.SNS.TagType DataRowToModel(DataRow row)
 {
     Maticsoft.Model.SNS.TagType type = new Maticsoft.Model.SNS.TagType();
     if (row != null)
     {
         if ((row["ID"] != null) && (row["ID"].ToString() != ""))
         {
             type.ID = int.Parse(row["ID"].ToString());
         }
         if ((row["TypeName"] != null) && (row["TypeName"].ToString() != ""))
         {
             type.TypeName = row["TypeName"].ToString();
         }
         if ((row["Remark"] != null) && (row["Remark"].ToString() != ""))
         {
             type.Remark = row["Remark"].ToString();
         }
         if ((row["Cid"] != null) && (row["Cid"].ToString() != ""))
         {
             type.Cid = new int?(int.Parse(row["Cid"].ToString()));
         }
         if ((row["Status"] != null) && (row["Status"].ToString() != ""))
         {
             type.Status = new int?(int.Parse(row["Status"].ToString()));
         }
     }
     return type;
 }
Beispiel #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string str = this.txtTypeName.Text.Trim();
     if (str.Length == 0)
     {
         MessageBox.ShowServerBusyTip(this, "类型名称不能为空!");
     }
     else if (str.Length > 50)
     {
         MessageBox.ShowServerBusyTip(this, "类型名称不能大于50个字符!");
     }
     else
     {
         string str2 = this.txtRemark.Text.Trim();
         if (str2.Length > 100)
         {
             MessageBox.ShowServerBusyTip(this, "备注不能大于100个字符!");
         }
         else
         {
             Maticsoft.Model.SNS.TagType model = new Maticsoft.Model.SNS.TagType {
                 TypeName = str,
                 Remark = str2,
                 Status = new int?(Globals.SafeInt(this.radlStatus.SelectedValue, 0)),
                 Cid = new int?(Globals.SafeInt(this.dropCid.SelectedValue, 0))
             };
             Maticsoft.BLL.SNS.TagType type2 = new Maticsoft.BLL.SNS.TagType();
             if (type2.Add(model) > 0)
             {
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加标签类型成功", this);
                 MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK, "List.aspx");
             }
             else
             {
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加标签类型失败", this);
                 MessageBox.ShowFailTip(this, Site.TooltipSaveError);
             }
         }
     }
 }
Beispiel #3
0
 public int GetTagsTypeId(string TagName)
 {
     List<Maticsoft.Model.SNS.TagType> modelList = this.GetModelList("TypeName='" + TagName + "'");
     if ((modelList != null) && (modelList.Count > 0))
     {
         return modelList[0].ID;
     }
     Maticsoft.Model.SNS.TagType model = new Maticsoft.Model.SNS.TagType {
         TypeName = TagName,
         Cid = -1
     };
     return this.Add(model);
 }