示例#1
0
 public int Remove(Ecommers.Entity.Category catE)
 {
     if (catE.SupplierID == 0 && catE.CategoryID == 0)
     {
         return(0);
     }
     else
     {
         return(DAL.Rmove(catE));
     }
 }
示例#2
0
 public int Edit(Ecommers.Entity.Category catE)
 {
     if (CheckData(catE) == 0)
     {
         return(0);
     }
     else
     {
         return(DAL.Edit(catE));
     }
 }
示例#3
0
        public int Rmove(Ecommers.Entity.Category cat)
        {
            int        result = 0;
            string     sql    = "delete from  Category where  CategoryID=@CategoryID and SupplierID=@SupplierID";
            SqlCommand cmd    = new SqlCommand(sql, DBC.conn);

            cmd.Parameters.AddWithValue("@CategoryID", cat.CategoryID);
            cmd.Parameters.AddWithValue("@SupplierID", cat.SupplierID);
            DBC.conn.Open();
            result = cmd.ExecuteNonQuery();
            DBC.conn.Close();
            return(result);
        }
示例#4
0
        public int Add(Ecommers.Entity.Category cat)
        {
            int        result = 0;
            string     sql    = "insert into Category (CategoryID , CategoryName , SupplierID ) values (@CategoryID , @CategoryName , @SupplierID )";
            SqlCommand cmd    = new SqlCommand(sql, DBC.conn);

            cmd.Parameters.AddWithValue("@CategoryID", cat.CategoryID);
            cmd.Parameters.AddWithValue("@CategoryName", cat.CategoryName);
            cmd.Parameters.AddWithValue("@SupplierID", cat.SupplierID);
            DBC.conn.Open();
            result = cmd.ExecuteNonQuery();
            DBC.conn.Close();
            return(result);
        }
示例#5
0
 private int CheckData(Ecommers.Entity.Category cat)
 {
     if (cat.CategoryID == 0)
     {
         return(0);
     }
     else if (cat.CategoryName.Length == 0)
     {
         return(0);
     }
     else if (cat.SupplierID == 0)
     {
         return(0);
     }
     else
     {
         return(1);
     }
 }