Пример #1
0
        public Model.Type GetTypeById(int Id)
        {
            Model.Type typ = new Model.Type();
            string     sql = @"[spGetType] '{0}' ";

            sql = string.Format(sql, Id);

            try
            {
                DataSet ds = new DataSet();
                ds = _MB.CreaDS(ds, "Type", sql, _CN);
                if (ds.Tables["Type"].Rows.Count > 0)
                {
                    foreach (DataRow item in ds.Tables["Type"].Rows)
                    {
                        typ = new Model.Type()
                        {
                            Id          = int.Parse(item["Id"].ToString()),
                            Description = item["Description"].ToString(),
                            Group       = new Group()
                            {
                                Id = int.Parse(item["IdGroup"].ToString()), Description = item["DescripGroup"].ToString()
                            },
                        };
                    }
                }
                return(typ);
            }
            catch (Exception)
            {
                throw;
            }
        }
 protected void Add_Click(object sender, EventArgs e)
 {
     Model.Type type = new Model.Type();
     type.Language = 0;
     type.Name = this.tbName.Text.Trim();
     type.Order = Int32.Parse(this.tbOrder.Text);
     TypeManager.Add(type);
     this.GridView1.DataBind();
 }
Пример #3
0
 public int InsertType(Model.Type pType)
 {
     try
     {
         return(_AD.InsertType(pType));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Пример #4
0
 public bool UpdateType(Model.Type pType)
 {
     try
     {
         _AD.UpdateType(pType);
         return(true);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Пример #5
0
        /// <summary>
        /// 删除商品
        /// </summary>
        /// <param name="ty"></param>
        /// <returns></returns>
        public ActionResult DeleProductManager(Model.Type ty)
        {
            bool i = ts.Delete(ty);

            if (i)
            {
                return(Content(Ts("删除成功", "../Frontdesk/ProductManager")));
            }
            else
            {
                return(Content(Ts("删除失败", "../Frontdesk/ProductManager")));
            }
        }
Пример #6
0
        /// <summary>
        /// 修改商品类型
        /// </summary>
        /// <param name="ty"></param>
        /// <returns></returns>
        public ActionResult UpdateProductManager(Model.Type ty)
        {
            bool i = ts.Update(ty);

            if (i)
            {
                return(Content(Ts("修改成功", "../Frontdesk/ProductManager")));
            }
            else
            {
                return(Content(Ts("修改失败", "../Frontdesk/ProductManager")));
            }
        }
Пример #7
0
        /// <summary>
        /// 添加商品类型
        /// </summary>
        /// <param name="ty"></param>
        /// <returns></returns>
        public ActionResult AddProductManager(Model.Type ty)
        {
            bool i = ts.Add(ty);

            if (i)
            {
                return(Content(Ts("添加成功", "../Frontdesk/ProductManager")));
            }
            else
            {
                return(Content(Ts("添加失败", "../Frontdesk/ProductManager")));
            }
        }
Пример #8
0
        public void UpdateType(Model.Type pType)
        {
            string sql = @"[spUpdateType] '{0}', '{1}', '{2}'";

            sql = string.Format(sql, pType.Id, pType.Description, pType.Group.Id);
            try
            {
                _MB.EjecutarSQL(_CN, sql);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Пример #9
0
        public int InsertType(Model.Type pType)
        {
            string sql = @"[spInsertType] '{0}', '{1}'";

            sql = string.Format(sql, pType.Description, pType.Group.Id);
            try
            {
                return(_MB.EjecutarSQL(_CN, sql));
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Пример #10
0
 public static IList<Model.Type> GetAll(int language)
 {
     IList<Model.Type> types = new List<Model.Type>();
     string sql = "select LType" + language.ToString() + ".*,tblMenuType.OrderId from LType" + language.ToString() +
         " INNER JOIN tblMenuType ON tblMenuType.id=LType" + language.ToString() +".id";
     using (SqlDataReader sdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.Text, sql))
     {
         while (sdr.Read())
         {
             Model.Type type = new Model.Type();
             type.Id = (int)sdr["id"];
             type.Name = (string)sdr["name"];
             type.Order = (int)sdr["orderid"];
             type.Language = language;
             types.Add(type);
         }
     }
     return types;
 }
Пример #11
0
        /// <summary>
        /// 类型查询及所有商品,根据ID查询相应父类下的商品信息
        /// </summary>
        /// <returns></returns>
        public ActionResult product(Model.Type t)
        {
            List <Model.Type> lt = ts.select();

            ViewBag.Lx = lt;

            int id = t.TypeID;

            if (id == 0)
            {
                List <Goods> lg = gs.select();
                ViewData.Model = lg;
            }
            else
            {
                List <Goods> lg = gs.SelectBys(id);
                ViewData.Model = lg;
            }
            return(View());
        }
Пример #12
0
 public static Model.Type GetTypeById(int id,int language)
 {
     string sql = @"select LType" + language.ToString() + ".*,tblMenuType.OrderId from LType"
         + language.ToString() +
         " INNER JOIN tblMenuType ON tblMenuType.id=LType" + language.ToString() +
         ".id where tblMenuType.id =" + id.ToString();
     Model.Type type = new Model.Type();
     using (SqlDataReader sdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.Text, sql))
     {
         if (sdr.Read())
         {
             type.Id = id;
             type.Name = (string)sdr["name"];
             type.Order = (int)sdr["orderid"];
             type.Language = language;
         }
         else
             type = null;
     }
     return type;
 }
Пример #13
0
 public List <Computer> Computers(Model.Type type)
 {
     return(computers.Where(x => x.Type.ID == type.ID).ToList());
 }