コード例 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.property GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id, category_id, title, add_time  ");
            strSql.Append("  from td_property ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;


            Model.property model = new Model.property();
            DataSet        ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["category_id"].ToString() != "")
                {
                    model.category_id = int.Parse(ds.Tables[0].Rows[0]["category_id"].ToString());
                }
                model.title = ds.Tables[0].Rows[0]["title"].ToString();
                if (ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }

                List <Model.property_value> lst = new List <Model.property_value>();
                DataTable dt = new DAL.property_value().GetList("property_id=" + id).Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        Model.property_value model_value = new Model.property_value();
                        model_value.id          = Convert.ToDecimal(dr["id"]);
                        model_value.property_id = Convert.ToInt32(dr["property_id"]);
                        model_value.value       = dr["value"].ToString();
                        model_value.add_time    = Convert.ToDateTime(dr["add_time"]);

                        lst.Add(model_value);
                    }
                }
                else
                {
                    lst = null;
                }
                model.property_values = lst;
                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: edit.aspx.cs プロジェクト: wangjinfang/DTCMS
        private bool DoEdit(int _id)
        {
            bool   result          = false;
            string property_values = DTRequest.GetFormString("ck_property_value");

            BLL.property   bll   = new BLL.property();
            Model.property model = bll.GetModel(_id);
            model.title       = txt_title.Text.Trim();
            model.category_id = Convert.ToInt32(ddlCategoryId.SelectedValue);

            List <Model.property_value> lst = new List <Model.property_value>();

            string[]             property_value_arr = property_values.Split(',');
            Model.property_value model_value;
            foreach (string str in property_value_arr)
            {
                model_value          = new Model.property_value();
                model_value.id       = Convert.ToDecimal(str.Split('|')[0]);
                model_value.value    = str.Split('|')[1];
                model_value.add_time = DateTime.Now;
                lst.Add(model_value);
            }
            model.property_values = lst;

            if (bll.Update(model))
            {
                //AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改用户信息:" + model.user_name); //记录日志
                result = true;
            }
            return(result);
        }
コード例 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.property model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into td_property(");
            strSql.Append("category_id,title,add_time");
            strSql.Append(") values (");
            strSql.Append("@category_id,@title,@add_time");
            strSql.Append(") ");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@category_id", SqlDbType.Int,         4),
                new SqlParameter("@title",       SqlDbType.NVarChar,  100),
                new SqlParameter("@add_time",    SqlDbType.DateTime),
                new SqlParameter("@ReturnValue", SqlDbType.Int)
            };

            parameters[0].Value     = model.category_id;
            parameters[1].Value     = model.title;
            parameters[2].Value     = model.add_time;
            parameters[3].Direction = ParameterDirection.Output;

            List <CommandInfo> sqllist = new List <CommandInfo>();
            CommandInfo        cmd     = new CommandInfo(strSql.ToString(), parameters);

            sqllist.Add(cmd);

            StringBuilder strSql1;

            if (model.property_values != null && model.property_values.Count > 0)
            {
                foreach (Model.property_value model_value in model.property_values)
                {
                    strSql1 = new StringBuilder();
                    strSql1.Append("insert into td_property_value(property_id,value,add_time) values");
                    strSql1.Append("(@property_id,@value,@add_time)");
                    SqlParameter[] parameters1 =
                    {
                        new SqlParameter("@property_id", SqlDbType.Int,        4),
                        new SqlParameter("@value",       SqlDbType.NVarChar, 100),
                        new SqlParameter("@add_time",    SqlDbType.DateTime)
                    };
                    parameters1[0].Direction = ParameterDirection.InputOutput;
                    parameters1[1].Value     = model_value.value;
                    parameters1[2].Value     = model_value.add_time;

                    cmd = new CommandInfo(strSql1.ToString(), parameters1);
                    sqllist.Add(cmd);
                }
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return((int)parameters[3].Value);
        }
コード例 #4
0
ファイル: edit.aspx.cs プロジェクト: wangjinfang/DTCMS
 private void ShowInfo(int _id)
 {
     BLL.property   bll   = new BLL.property();
     Model.property model = bll.GetModel(_id);
     ddlCategoryId.SelectedValue = model.category_id.ToString();
     txt_title.Text = model.title;
     if (model.property_values != null)
     {
         foreach (Model.property_value model_value in model.property_values)
         {
             str_property_value += "<span onclick=\"ck_property_value(this)\">&nbsp;&nbsp;" + model_value.value
                                   + "<input type=\"checkbox\" name=\"ck_property_value\" checked=\"checked\" value=\"" + model_value.id + "|" + model_value.value
                                   + "\" style=\"display:none;\" />&nbsp;&nbsp;</span>";
         }
     }
 }
コード例 #5
0
ファイル: edit.aspx.cs プロジェクト: wangjinfang/DTCMS
        private bool DoAdd()
        {
            bool   result          = false;
            string property_values = DTRequest.GetFormString("ck_property_value");

            if (string.IsNullOrEmpty(property_values))
            {
                JscriptMsg("保存过程中发生错误!", "", "Error");
                return(false);
            }

            BLL.property   bll   = new BLL.property();
            Model.property model = new Model.property();

            model.title       = txt_title.Text.Trim();
            model.category_id = Convert.ToInt32(ddlCategoryId.SelectedValue);
            model.add_time    = DateTime.Now;

            List <Model.property_value> lst = new List <Model.property_value>();

            string[]             property_value_arr = property_values.Split(',');
            Model.property_value model_value;
            foreach (string str in property_value_arr)
            {
                if (!string.IsNullOrEmpty(str))
                {
                    model_value          = new Model.property_value();
                    model_value.value    = str.Split('|')[1];
                    model_value.add_time = DateTime.Now;
                    lst.Add(model_value);
                }
            }
            model.property_values = lst;
            if (bll.Add(model) > 0)
            {
                //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                result = true;
            }
            return(result);
        }
コード例 #6
0
ファイル: good_show.cs プロジェクト: wangjinfang/DTCMS
        protected DataTable dt_other_goods     = new DataTable(); //其他商品表

        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            id   = DTRequest.GetQueryInt("id");
            page = DTRequest.GetQueryString("page");
            BLL.article bll = new BLL.article();

            if (id > 0) //如果ID获取到,将使用ID
            {
                if (!bll.Exists(id))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    return;
                }
                model = bll.GetModel(id);
            }
            else if (!string.IsNullOrEmpty(page)) //否则检查设置的别名
            {
                if (!bll.Exists(page))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    return;
                }
                model = bll.GetModel(page);
            }
            else
            {
                return;
            }
            //跳转URL
            if (model.link_url != null)
            {
                model.link_url = model.link_url.Trim();
            }
            if (!string.IsNullOrEmpty(model.link_url))
            {
                HttpContext.Current.Response.Redirect(model.link_url);
            }


            //销量
            DataTable dt_order_good_count = new BLL.orders().get_order_good_count(id).Tables[0];

            if (dt_order_good_count != null && dt_order_good_count.Rows.Count > 0)
            {
                order_sum = Convert.ToDecimal(dt_order_good_count.Rows[0]["quantity"]);
            }
            Model.article_category model_category = new BLL.article_category().GetModel(model.category_id);
            #region
            //规格表
            BLL.standard_price bll_standard_price = new BLL.standard_price();
            DataTable          dt_standard_price  = bll_standard_price.GetList("good_id=" + id).Tables[0];
            if (dt_standard_price != null && dt_standard_price.Rows.Count > 0)
            {
                BLL.standard bll_standard = new BLL.standard();

                if (model_category != null)
                {
                    DataTable dt_old_standard = bll_standard.GetList("'" + model_category.class_list + "' like '%,'+convert(nvarchar(10),category_id)+',%'").Tables[0];

                    dt_standard.Columns.Add("id", typeof(int));
                    dt_standard.Columns.Add("title", typeof(string));
                    dt_standard.Columns.Add("value", typeof(string));
                    dt_standard.PrimaryKey = new DataColumn[] { dt_standard.Columns["id"] };

                    foreach (DataRow dr in dt_old_standard.Rows)
                    {
                        //if(Convert.ToInt32(dr[""]))
                        DataRow new_dr = dt_standard.NewRow();
                        new_dr["id"]    = dr["id"];
                        new_dr["title"] = dr["title"];
                        DataTable dt_standard_value = new BLL.standard_value().GetList("standard_id=" + dr["id"].ToString()).Tables[0];
                        if (dt_standard_value != null || dt_standard_value.Rows.Count > 0)
                        {
                            string str_value = "";
                            foreach (DataRow dr_value in dt_standard_value.Rows)
                            {
                                str_value += dr_value["id"].ToString() + "|" + dr_value["value"].ToString() + ",";
                            }
                            new_dr["value"] = str_value.TrimEnd(',');
                            dt_standard.Rows.Add(new_dr);
                        }
                    }
                }
            }
            #endregion

            //单位表
            BLL.unit bll_unit = new BLL.unit();
            dt_unit = bll_unit.GetList("good_id=" + id).Tables[0];


            //套餐()
            BLL.meal_good bll_meal_good = new BLL.meal_good();
            BLL.meal      bll_meal      = new BLL.meal();
            dt_meal = bll_meal.GetMealByGood(id, "jiejuefangan").Tables[0];

            dt_meal.TableName = "dt_meal";
            if (dt_meal != null && dt_meal.Rows.Count > 0)
            {
                //套餐商品
                DataTable old_dt_meal_good = bll_meal_good.GetList("meal_id=" + dt_meal.Rows[0]["id"].ToString()).Tables[0];
                dt_meal_good = new DataTable();
                dt_meal_good.Columns.Add("meal_id");
                dt_meal_good.Columns.Add("good_standard_price");
                dt_meal_good.Columns.Add("title");
                dt_meal_good.Columns.Add("all_title");
                dt_meal_good.Columns.Add("img_url");
                dt_meal_good.Columns.Add("good_id");
                dt_meal_good.Columns.Add("price");
                string str_meal_good_ids = ",";
                if (old_dt_meal_good != null && old_dt_meal_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_meal_good.Rows)
                    {
                        if (str_meal_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_meal_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit           = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }


                            DataRow new_dr = dt_meal_good.NewRow();
                            new_dr["meal_id"]             = dr["meal_id"];
                            new_dr["title"]               = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"]           = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"]             = modelt.img_url;
                            new_dr["price"]               = dr["sell_price"];
                            new_dr["good_id"]             = dr["good_id"];

                            dt_meal_good.Rows.Add(new_dr);
                        }
                    }
                    dt_meal_good.TableName = "dt_meal_good";
                }
            }


            //属性表
            BLL.property_good  bll_property_good  = new BLL.property_good();
            BLL.property       bll_property       = new BLL.property();
            BLL.property_value bll_property_value = new BLL.property_value();

            DataTable dt_old_property = bll_property_good.GetList("good_id=" + id).Tables[0];
            dt_property.Columns.Add("id");
            dt_property.Columns.Add("title");
            dt_property.Columns.Add("value");
            dt_property.PrimaryKey = new DataColumn[] { dt_property.Columns["id"] };

            foreach (DataRow dr in dt_old_property.Rows)
            {
                Model.property       model_property       = bll_property.GetModel(Convert.ToInt32(dr["property_id"]));
                Model.property_value model_property_value = bll_property_value.GetModel(Convert.ToDecimal(dr["property_value_id"]));
                if (model != null && model_property_value != null)
                {
                    if (dt_property.Rows.Find(dr["property_id"]) != null)
                    {
                        dt_property.Rows.Find(dr["property_id"])["value"] = dt_property.Rows.Find(dr["property_id"])["value"].ToString() + "," + model_property_value.value;
                    }
                    else
                    {
                        DataRow new_dr = dt_property.NewRow();
                        new_dr["id"]    = dr["property_id"];
                        new_dr["title"] = model_property.title;
                        new_dr["value"] = model_property_value.value;
                        dt_property.Rows.Add(new_dr);
                    }
                }
            }


            //标签
            BLL.tag_good bll_tag_good = new BLL.tag_good();
            DataTable    dt_tag_good  = bll_tag_good.GetList("good_id=" + id).Tables[0];
            dt_tag.Columns.Add("title");
            foreach (DataRow dr in dt_tag_good.Rows)
            {
                Model.tag model_tag = new BLL.tag().GetModel(Convert.ToInt32(dr["tag_id"]));
                if (model_tag != null)
                {
                    DataRow new_dr = dt_tag.NewRow();
                    new_dr["title"] = model_tag.title;
                    dt_tag.Rows.Add(new_dr);
                }
            }


            //推荐搭配
            dt_red = bll_meal.GetMealByGood(id, "tuijiandapei").Tables[0];

            dt_red.TableName = "dt_red";
            if (dt_red != null && dt_red.Rows.Count > 0)
            {
                DataTable old_dt_red_good = bll_meal_good.GetList("meal_id=" + dt_red.Rows[0]["id"].ToString()).Tables[0];


                dt_red_good = new DataTable();
                dt_red_good.Columns.Add("meal_id");
                dt_red_good.Columns.Add("good_standard_price");
                dt_red_good.Columns.Add("title");
                dt_red_good.Columns.Add("all_title");
                dt_red_good.Columns.Add("good_id");
                dt_red_good.Columns.Add("img_url");
                dt_red_good.Columns.Add("price");
                string str_red_good_ids = ",";
                if (old_dt_red_good != null && old_dt_red_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_red_good.Rows)
                    {
                        if (str_red_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_red_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit           = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }


                            DataRow new_dr = dt_red_good.NewRow();
                            new_dr["meal_id"]             = dr["meal_id"];
                            new_dr["title"]               = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"]           = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"]             = modelt.img_url;
                            new_dr["price"]               = dr["sell_price"];
                            new_dr["good_id"]             = dr["good_id"];

                            dt_red_good.Rows.Add(new_dr);
                        }
                    }
                    dt_red_good.TableName = "dt_red_good";
                }
            }

            //类别相关
            if (model_category != null)
            {
                if (new BLL.article_category().GetModel(model_category.parent_id) != null)
                {
                    parent_category_title = new BLL.article_category().GetModel(model_category.parent_id).title;
                    dt_category           = new BLL.article_category().GetList(model_category.parent_id, "goods");
                }
                dt_other_goods = bll.get_order_buy_good(5, model_category.id).Tables[0];
            }
        }
コード例 #7
0
ファイル: edit.aspx.cs プロジェクト: wangjinfang/DTCMS
        private bool DoAdd()
        {
            bool result = false;
            string property_values = DTRequest.GetFormString("ck_property_value");

            if (string.IsNullOrEmpty(property_values))
            {
                JscriptMsg("保存过程中发生错误!", "", "Error");
                return false;
            }

            BLL.property bll = new BLL.property();
            Model.property model = new Model.property();

            model.title = txt_title.Text.Trim();
            model.category_id = Convert.ToInt32(ddlCategoryId.SelectedValue);
            model.add_time = DateTime.Now;

            List<Model.property_value> lst = new List<Model.property_value>();
            string[] property_value_arr = property_values.Split(',');
            Model.property_value model_value;
            foreach (string str in property_value_arr)
            {
                if (!string.IsNullOrEmpty(str))
                {
                    model_value = new Model.property_value();
                    model_value.value = str.Split('|')[1];
                    model_value.add_time = DateTime.Now;
                    lst.Add(model_value);
                }
            }
            model.property_values = lst;
            if (bll.Add(model) > 0)
            {
                //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                result = true;
            }
            return result;
        }
コード例 #8
0
ファイル: td_property.cs プロジェクト: wangjinfang/DTCMS
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.property model)
 {
     return(dal.Update(model));
 }
コード例 #9
0
ファイル: td_property.cs プロジェクト: wangjinfang/DTCMS
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.property model)
 {
     return(dal.Add(model));
 }
コード例 #10
0
ファイル: td_property.cs プロジェクト: wangjinfang/DTCMS
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.property GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id, category_id, title, add_time  ");
            strSql.Append("  from td_property ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            Model.property model = new Model.property();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["category_id"].ToString() != "")
                {
                    model.category_id = int.Parse(ds.Tables[0].Rows[0]["category_id"].ToString());
                }
                model.title = ds.Tables[0].Rows[0]["title"].ToString();
                if (ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }

                List<Model.property_value> lst = new List<Model.property_value>();
                DataTable dt = new DAL.property_value().GetList("property_id=" + id).Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        Model.property_value model_value = new Model.property_value();
                        model_value.id = Convert.ToDecimal(dr["id"]);
                        model_value.property_id = Convert.ToInt32(dr["property_id"]);
                        model_value.value = dr["value"].ToString();
                        model_value.add_time = Convert.ToDateTime(dr["add_time"]);

                        lst.Add(model_value);
                    }

                }
                else
                {
                    lst = null;
                }
                model.property_values = lst;
                return model;
            }
            else
            {
                return null;
            }
        }
コード例 #11
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.property model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("update td_property set ");

                        strSql.Append(" category_id = @category_id , ");
                        strSql.Append(" title = @title , ");
                        strSql.Append(" add_time = @add_time  ");
                        strSql.Append(" where id=@id ");

                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@id",          SqlDbType.Decimal,    9),
                            new SqlParameter("@category_id", SqlDbType.Int,        4),
                            new SqlParameter("@title",       SqlDbType.NVarChar, 100),
                            new SqlParameter("@add_time",    SqlDbType.DateTime)
                        };

                        parameters[0].Value = model.id;
                        parameters[1].Value = model.category_id;
                        parameters[2].Value = model.title;
                        parameters[3].Value = model.add_time;
                        DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters);

                        //删除
                        string str_del_id = "";
                        foreach (Model.property_value model_value in model.property_values)
                        {
                            if (model_value.id > 0)
                            {
                                str_del_id += model_value.id + ",";
                            }
                        }
                        if (!string.IsNullOrEmpty(str_del_id))
                        {
                            StringBuilder strSql_del = new StringBuilder();
                            strSql_del.Append("delete from td_property_value where property_id=" + model.id + " and id not in(" + str_del_id + ")");
                        }

                        if (model.property_values != null && model.property_values.Count > 0)
                        {
                            StringBuilder strSql1;
                            foreach (Model.property_value model_value in model.property_values)
                            {
                                //更新
                                if (model_value.id > 0)
                                {
                                    strSql1 = new StringBuilder();
                                    strSql1.Append("update td_property_value set ");
                                    strSql1.Append("property_id=@property_id,");
                                    strSql1.Append("value=@value,");
                                    strSql1.Append("add_time=@add_time");
                                    strSql1.Append(" where id=" + model_value.id);
                                    SqlParameter[] parameters1 =
                                    {
                                        new SqlParameter("@property_id", SqlDbType.Int,        4),
                                        new SqlParameter("@value",       SqlDbType.NVarChar, 100),
                                        new SqlParameter("@add_time",    SqlDbType.DateTime)
                                    };
                                    parameters1[0].Value = model.id;
                                    parameters1[1].Value = model_value.value;
                                    parameters1[2].Value = model_value.add_time;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql1.ToString(), parameters1);
                                }
                                else
                                {
                                    //添加
                                    strSql1 = new StringBuilder();
                                    strSql1.Append("insert into td_property_value(property_id,value,add_time) values(@property_id,@value,@add_time)");
                                    SqlParameter[] parameters1 =
                                    {
                                        new SqlParameter("@property_id", SqlDbType.Int,        4),
                                        new SqlParameter("@value",       SqlDbType.NVarChar, 100),
                                        new SqlParameter("@add_time",    SqlDbType.DateTime)
                                    };
                                    parameters1[0].Value = model.id;
                                    parameters1[1].Value = model_value.value;
                                    parameters1[2].Value = model_value.add_time;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql1.ToString(), parameters1);
                                }
                            }
                        }
                        else
                        {
                            StringBuilder strSql_del = new StringBuilder();
                            strSql_del.Append("delete from td_property_value where property_id=" + model.id);
                            DbHelperSQL.ExecuteSql(conn, trans, strSql_del.ToString());
                        }


                        trans.Commit();
                        return(true);
                    }
                    catch
                    {
                        trans.Rollback();
                        return(false);
                    }
                }
            }
        }