Beispiel #1
0
        protected void AddSmallCategory(object sender, EventArgs e)
        {
            categoryinfo data = new categoryinfo();
            data.smallcategory = smallcategory.Value.Trim();
            data.bigcategoryid = TypeParse.DbObjToInt(bcID.SelectedValue, 0);

            bool result = category.addsmallcategory(data);
            if (result)
            {
                Response.Write("<script>alert('添加产品小类成功!');location.href='/Manager/SmallCategory.aspx';</script>");
                return;
            }
            else
            {
                Response.Write("<script>alert('添加产品小类失败!');location.href='/Manager/SmallCategory.aspx';</script>");
                return;
            }
        }
Beispiel #2
0
 protected void EditBigcategory(object sender, EventArgs e)
 {
     string uploadName = imgfile.Value;//获取待上传图片的完整路径,包括文件名
     //string uploadName = InputFile.PostedFile.FileName;
     string pictureName = oimgname.Value.Trim();//上传后的图片名,以当前时间为文件名,确保文件名没有重复
     if (imgfile.Value != "")
     {
         int idx = uploadName.LastIndexOf(".");
         string suffix = uploadName.Substring(idx);//获得上传的图片的后缀名
         if (suffix.ToLower() != ".bmp" && suffix.ToLower() != ".jpg" && suffix.ToLower() != ".jpeg" && suffix.ToLower() != ".png" && suffix.ToLower() != ".gif")
         {
             imgnote.InnerHtml = "<span style=\"color:red\">上传文件必须是图片格式!</span>";
             return;
         }
         pictureName = DateTime.Now.Ticks.ToString() + suffix;
     }
     try
     {
         if (uploadName != "")
         {
             string path = Server.MapPath("/Files/WebImages/");
             imgfile.PostedFile.SaveAs(path + pictureName);
         }
         categoryinfo data = new categoryinfo();
         data.bigcategoryimg = pictureName;
         data.bigcategory = bigcategoryname.Value.Trim();
         data.bigcategoryid =TypeParse.DbObjToInt(bigcategoryid.Value,0);
         bool result = category.editbigcategory(data);
         if (result)
         {
             Response.Write("<script>alert('修改大目录成功!');location.href='/Manager/BigCategory.aspx';</script>");
             return;
         }
         else
         {
             Response.Write("<script>alert('修改大目录失败!');location.href='/Manager/BigCategory.aspx';</script>");
             return;
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #3
0
 //添加配送地址I
 public static bool adddeliveryI(categoryinfo data)
 {
     SqlParameter[] parms = new SqlParameter[2];
     parms[0] = new SqlParameter("@deliveryI", SqlDbType.NVarChar, 20);
     parms[0].Value = data.deliveryI;
     string sql = "insert into deliveryI (deliveryI) values(@deliveryI)";
     int result = 0;
     try
     {
         result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
     }
     return result > 0;
 }
Beispiel #4
0
        //添加大类别
        public static bool addbigcategory(categoryinfo data)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0] = new SqlParameter("@bigcategory", SqlDbType.VarChar, 20);
            parms[0].Value = data.bigcategory;
            parms[1] = new SqlParameter("@bigcategoryimg", SqlDbType.VarChar,50);
            parms[1].Value = data.bigcategoryimg;

            string sql = "insert into bigcategory (bigcategory,bigcategoryimg) values(@bigcategory,@bigcategoryimg)";
            int result = 0;
            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return result > 0;
        }
Beispiel #5
0
 //根据推荐类型ID得到推荐类型信息
 public static categoryinfo gettjtypeinfo(int id)
 {
     SqlParameter[] parms = new SqlParameter[2];
     parms[0] = new SqlParameter("@id", SqlDbType.Int);
     parms[0].Value = id;
     string sql = "select tjtypeid,tjtype from tjtype where tjtypeid=@id";
     categoryinfo item = new categoryinfo();
     SqlDataReader dr = null;
     try
     {
         dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
         if (dr.Read())
         {
             item.tjtypeid = TypeParse.DbObjToInt(dr["tjtypeid"].ToString(), 0);
             item.tjtype = TypeParse.DbObjToString(dr["tjtype"].ToString(), "");
             dr.Close();
             dr.Dispose();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
     }
     return item;
 }
Beispiel #6
0
 //得到推荐类型列表
 public static List<categoryinfo> gettjtype()
 {
     string sql = "select tjtypeid,tjtype from tjtype";
     List<categoryinfo> itlist = new List<categoryinfo>();
     try
     {
         DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql);
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             categoryinfo item = new categoryinfo();
             item.tjtypeid = TypeParse.DbObjToInt(dr["tjtypeid"].ToString(), 0);
             item.tjtype = TypeParse.DbObjToString(dr["tjtype"].ToString(), "");
             itlist.Add(item);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
     }
     return itlist;
 }
Beispiel #7
0
        //根据产品小类别ID得到类别信息
        public static categoryinfo getsmallcategoryinfo(int smallcategoryid)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0] = new SqlParameter("@smallcategoryid",SqlDbType.Int);
            parms[0].Value = smallcategoryid;

            string sql = "select a.smallcategoryid,a.smallcategory,a.bigcategoryid,b.bigcategory from smallcategory a,bigcategory b where a.bigcategoryid=b.bigcategoryid and a.smallcategoryid=@smallcategoryid";
            categoryinfo item = new categoryinfo();
            SqlDataReader dr = null;
            try
            {
                dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.smallcategoryid = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0);
                    item.smallcategory = TypeParse.DbObjToString(dr["smallcategory"].ToString(), "");
                    item.bigcategoryid = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                    item.bigcategory = TypeParse.DbObjToString(dr["bigcategory"].ToString(), "");
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return item;
        }
Beispiel #8
0
        //通过大分类得到产品小类别
        public static List<categoryinfo> getsmallcategorybyid(int bigcategoryid)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0] = new SqlParameter("@bigcategoryid",SqlDbType.Int);
            parms[0].Value = bigcategoryid;

            string sql = "select a.smallcategoryid,a.smallcategory,a.bigcategoryid,b.bigcategory from smallcategory a,bigcategory b where a.bigcategoryid=b.bigcategoryid and b.bigcategoryid=@bigcategoryid";
            List<categoryinfo> itlist = new List<categoryinfo>();
            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    categoryinfo item = new categoryinfo();
                    item.smallcategoryid = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0);
                    item.smallcategory = TypeParse.DbObjToString(dr["smallcategory"].ToString(), "");
                    item.bigcategoryid = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                    item.bigcategory = TypeParse.DbObjToString(dr["bigcategory"].ToString(), "");
                    itlist.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return itlist;
        }
Beispiel #9
0
 //得到配送地址II类型列表通过Iid
 public static List<categoryinfo> getdeliveryIIbyID(int id)
 {
     SqlParameter[] parms = new SqlParameter[1];
     parms[0] = new SqlParameter("@id", SqlDbType.Int);
     parms[0].Value = id;
     string sql = "select a.deliveryIIid,a.deliveryII,b.deliveryI,b.deliveryIid from deliveryII a,deliveryI b where a.deliveryIid=b.deliveryIid and a.deliveryIid=@id";
     List<categoryinfo> itlist = new List<categoryinfo>();
     try
     {
         DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql,parms);
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             categoryinfo item = new categoryinfo();
             item.deliveryIIid = TypeParse.DbObjToInt(dr["deliveryIIid"].ToString(), 0);
             item.deliveryII = TypeParse.DbObjToString(dr["deliveryII"].ToString(), "");
             item.deliveryIid = TypeParse.DbObjToInt(dr["deliveryIid"].ToString(), 0);
             item.deliveryI = TypeParse.DbObjToString(dr["deliveryI"].ToString(), "");
             itlist.Add(item);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
     }
     return itlist;
 }
Beispiel #10
0
 //得到配送地址II类型列表
 public static List<categoryinfo> getdeliveryII()
 {
     string sql = "select a.deliveryIIid,a.deliveryII,b.deliveryI,b.deliveryIid from deliveryII a,deliveryI b where a.deliveryIid=b.deliveryIid";
     List<categoryinfo> itlist = new List<categoryinfo>();
     try
     {
         DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql);
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             categoryinfo item = new categoryinfo();
             item.deliveryIIid = TypeParse.DbObjToInt(dr["deliveryIIid"].ToString(), 0);
             item.deliveryII = TypeParse.DbObjToString(dr["deliveryII"].ToString(), "");
             item.deliveryIid = TypeParse.DbObjToInt(dr["deliveryIid"].ToString(), 0);
             item.deliveryI = TypeParse.DbObjToString(dr["deliveryI"].ToString(), "");
             itlist.Add(item);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
     }
     return itlist;
 }
Beispiel #11
0
        //编辑推荐类型
        public static bool edittjtype(categoryinfo data)
        {
            SqlParameter[] parms = new SqlParameter[3];
            parms[0] = new SqlParameter("@tjtype", SqlDbType.NVarChar, 20);
            parms[0].Value = data.tjtype;
            parms[1] = new SqlParameter("@tjtypeid", SqlDbType.Int);
            parms[1].Value = data.tjtypeid;

            string sql = "update tjtype set tjtype=@tjtype where tjtypeid=@tjtypeid";
            int result = 0;
            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
            }
            return result > 0;
        }
Beispiel #12
0
        //编辑产品小类别
        public static bool editsmallcategory(categoryinfo data)
        {
            SqlParameter[] parms = new SqlParameter[3];
            parms[0] = new SqlParameter("@smallcategory", SqlDbType.VarChar, 20);
            parms[0].Value = data.smallcategory;
            parms[1] = new SqlParameter("@bigcategoryid",SqlDbType.Int);
            parms[1].Value = data.bigcategoryid;
            parms[2] = new SqlParameter("@smallcategoryid",SqlDbType.Int);
            parms[2].Value = data.smallcategoryid;

            string sql = "update smallcategory set smallcategory=@smallcategory,bigcategoryid=@bigcategoryid where smallcategoryid=@smallcategoryid";
            int result = 0;
            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
            }
            return result > 0;
        }