예제 #1
0
파일: Add.cs 프로젝트: huaminglee/myyyyshop
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string str = this.txtTagName.Text.Trim();
     if (string.IsNullOrWhiteSpace(str))
     {
         MessageBox.ShowServerBusyTip(this, "标签的名称不能为空!");
     }
     else
     {
         Maticsoft.Model.Shop.Tags.Tags model = new Maticsoft.Model.Shop.Tags.Tags();
         this.Hidden_SelectName.Value = this.txtCategoryText.Text;
         if (!string.IsNullOrWhiteSpace(this.Hidden_SelectValue.Value))
         {
             model.TagCategoryId = Globals.SafeInt(this.Hidden_SelectValue.Value, 0);
         }
         else
         {
             model.TagCategoryId = 0;
         }
         model.TagName = str;
         model.IsRecommand = bool.Parse(this.radlIsRecommand.SelectedValue);
         model.Status = Globals.SafeInt(this.radlStatus.SelectedValue, 0);
         if (this.bll.Add(model) > 0)
         {
             LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "增加商品标签成功", this);
             MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK, "List.aspx");
         }
         else
         {
             MessageBox.ShowFailTip(this, Site.TooltipSaveError);
         }
     }
 }
예제 #2
0
 public List<Maticsoft.Model.Shop.Tags.Tags> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.Shop.Tags.Tags> list = new List<Maticsoft.Model.Shop.Tags.Tags>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.Shop.Tags.Tags item = new Maticsoft.Model.Shop.Tags.Tags();
             if ((dt.Rows[i]["TagID"] != null) && (dt.Rows[i]["TagID"].ToString() != ""))
             {
                 item.TagID = int.Parse(dt.Rows[i]["TagID"].ToString());
             }
             if ((dt.Rows[i]["TagCategoryId"] != null) && (dt.Rows[i]["TagCategoryId"].ToString() != ""))
             {
                 item.TagCategoryId = int.Parse(dt.Rows[i]["TagCategoryId"].ToString());
             }
             if ((dt.Rows[i]["TagName"] != null) && (dt.Rows[i]["TagName"].ToString() != ""))
             {
                 item.TagName = dt.Rows[i]["TagName"].ToString();
             }
             if ((dt.Rows[i]["IsRecommand"] != null) && (dt.Rows[i]["IsRecommand"].ToString() != ""))
             {
                 if ((dt.Rows[i]["IsRecommand"].ToString() == "1") || (dt.Rows[i]["IsRecommand"].ToString().ToLower() == "true"))
                 {
                     item.IsRecommand = true;
                 }
                 else
                 {
                     item.IsRecommand = false;
                 }
             }
             if ((dt.Rows[i]["Status"] != null) && (dt.Rows[i]["Status"].ToString() != ""))
             {
                 item.Status = int.Parse(dt.Rows[i]["Status"].ToString());
             }
             if ((dt.Rows[i]["Meta_Title"] != null) && (dt.Rows[i]["Meta_Title"].ToString() != ""))
             {
                 item.Meta_Title = dt.Rows[i]["Meta_Title"].ToString();
             }
             if ((dt.Rows[i]["Meta_Description"] != null) && (dt.Rows[i]["Meta_Description"].ToString() != ""))
             {
                 item.Meta_Description = dt.Rows[i]["Meta_Description"].ToString();
             }
             if ((dt.Rows[i]["Meta_Keywords"] != null) && (dt.Rows[i]["Meta_Keywords"].ToString() != ""))
             {
                 item.Meta_Keywords = dt.Rows[i]["Meta_Keywords"].ToString();
             }
             list.Add(item);
         }
     }
     return list;
 }
예제 #3
0
 public Maticsoft.Model.Shop.Tags.Tags GetModel(int TagID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("SELECT  TOP 1 TagID,TagCategoryId,TagName,IsRecommand,Status,Meta_Title,Meta_Description,Meta_Keywords FROM Shop_Tags ");
     builder.Append(" WHERE TagID=@TagID");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@TagID", SqlDbType.Int, 4) };
     cmdParms[0].Value = TagID;
     Maticsoft.Model.Shop.Tags.Tags tags = new Maticsoft.Model.Shop.Tags.Tags();
     DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if ((set.Tables[0].Rows[0]["TagID"] != null) && (set.Tables[0].Rows[0]["TagID"].ToString() != ""))
     {
         tags.TagID = int.Parse(set.Tables[0].Rows[0]["TagID"].ToString());
     }
     if ((set.Tables[0].Rows[0]["TagCategoryId"] != null) && (set.Tables[0].Rows[0]["TagCategoryId"].ToString() != ""))
     {
         tags.TagCategoryId = int.Parse(set.Tables[0].Rows[0]["TagCategoryId"].ToString());
     }
     if ((set.Tables[0].Rows[0]["TagName"] != null) && (set.Tables[0].Rows[0]["TagName"].ToString() != ""))
     {
         tags.TagName = set.Tables[0].Rows[0]["TagName"].ToString();
     }
     if ((set.Tables[0].Rows[0]["IsRecommand"] != null) && (set.Tables[0].Rows[0]["IsRecommand"].ToString() != ""))
     {
         if ((set.Tables[0].Rows[0]["IsRecommand"].ToString() == "1") || (set.Tables[0].Rows[0]["IsRecommand"].ToString().ToLower() == "true"))
         {
             tags.IsRecommand = true;
         }
         else
         {
             tags.IsRecommand = false;
         }
     }
     if ((set.Tables[0].Rows[0]["Status"] != null) && (set.Tables[0].Rows[0]["Status"].ToString() != ""))
     {
         tags.Status = int.Parse(set.Tables[0].Rows[0]["Status"].ToString());
     }
     if ((set.Tables[0].Rows[0]["Meta_Title"] != null) && (set.Tables[0].Rows[0]["Meta_Title"].ToString() != ""))
     {
         tags.Meta_Title = set.Tables[0].Rows[0]["Meta_Title"].ToString();
     }
     if ((set.Tables[0].Rows[0]["Meta_Description"] != null) && (set.Tables[0].Rows[0]["Meta_Description"].ToString() != ""))
     {
         tags.Meta_Description = set.Tables[0].Rows[0]["Meta_Description"].ToString();
     }
     if ((set.Tables[0].Rows[0]["Meta_Keywords"] != null) && (set.Tables[0].Rows[0]["Meta_Keywords"].ToString() != ""))
     {
         tags.Meta_Keywords = set.Tables[0].Rows[0]["Meta_Keywords"].ToString();
     }
     return tags;
 }