Beispiel #1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public string CheckToUpdate(Maticsoft.Model.Product model, List <Model.ProductPriceColorShip> delList, List <Model.ProductPriceColorShip> insert, List <Model.ProductPriceColorShip> updateList, string picFile, string id)
 {
     if (dal.GetDS(id).Tables[0].Rows[0]["Name"].ToString() != model.Name)
     {
         if (dal.exists(" where Name='" + model.Name + "'"))
         {
             return("名称已存在,更新失败!");
         }
         else
         {
             if (dal.Update(model, delList, insert, updateList, picFile, id) > 0)
             {
                 return("success");
             }
             else
             {
                 return("更新失败!");
             }
         }
     }
     else
     {
         if (dal.Update(model, delList, insert, updateList, picFile, id) > 0)
         {
             return("success");
         }
         else
         {
             return("更新失败!");
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Maticsoft.Model.Product> DataTableToList(DataTable dt)
        {
            List <Maticsoft.Model.Product> modelList = new List <Maticsoft.Model.Product>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Maticsoft.Model.Product model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Maticsoft.Model.Product();
                    if (dt.Rows[n]["ProID"].ToString() != "")
                    {
                        model.ProID = int.Parse(dt.Rows[n]["ProID"].ToString());
                    }
                    model.ProName = dt.Rows[n]["ProName"].ToString();
                    if (dt.Rows[n]["ProTypeID"].ToString() != "")
                    {
                        model.ProTypeID = int.Parse(dt.Rows[n]["ProTypeID"].ToString());
                    }
                    model.ImageURL = dt.Rows[n]["ImageURL"].ToString();
                    if (dt.Rows[n]["ProXingID"].ToString() != "")
                    {
                        model.ProXingID = int.Parse(dt.Rows[n]["ProXingID"].ToString());
                    }
                    if (dt.Rows[n]["Prochutime"].ToString() != "")
                    {
                        model.Prochutime = DateTime.Parse(dt.Rows[n]["Prochutime"].ToString());
                    }
                    if (dt.Rows[n]["Fatime"].ToString() != "")
                    {
                        model.Fatime = DateTime.Parse(dt.Rows[n]["Fatime"].ToString());
                    }
                    if (dt.Rows[n]["Toujian"].ToString() != "")
                    {
                        model.Toujian = int.Parse(dt.Rows[n]["Toujian"].ToString());
                    }
                    if (dt.Rows[n]["HitNum"].ToString() != "")
                    {
                        model.HitNum = int.Parse(dt.Rows[n]["HitNum"].ToString());
                    }
                    model.Procontent = dt.Rows[n]["Procontent"].ToString();
                    model.ProMonery  = dt.Rows[n]["ProMonery"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #3
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  BasicMethod
        #region  ExtensionMethod
        public long CheckToAdd(Maticsoft.Model.Product model, List <Model.ProductPriceColorShip> insertList, string picFile)
        {
            if (dal.exists(" where Name='" + model.Name + "'"))
            {
                return(-2);
            }
            long returnID = dal.Add(model, insertList, picFile);

            if (returnID > 0)
            {
                return(returnID);
            }
            else
            {
                return(-3);
            }
        }
Beispiel #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Maticsoft.Model.Product model)
 {
     dal.Update(model);
 }
Beispiel #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Maticsoft.Model.Product model)
 {
     dal.Add(model);
 }
Beispiel #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.Product model)
 {
     return(dal.Update(model));
 }
Beispiel #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Maticsoft.Model.Product model)
 {
     return(dal.Add(model));
 }