示例#1
0
 public bool Delete(SubCategory obj)
 {
     try
      {
          DAL DB = new DAL(ConnectionString);
          string sqlstring = "DELETE FROM SUBCATEGORY WHERE SUBCATEGORYID = " + obj.SubCategoryID.ToString();
          int ROWCOUNT = DB.ExecuteCommandNoQuery(sqlstring);
          if (ROWCOUNT > 0)
              return true;
          else
              return false;
      }
      catch (Exception ex)
      {
          throw ex;
      }
 }
示例#2
0
        public bool Add(SubCategory objCat)
        {
            try
             {

                 DAL DB = new DAL(ConnectionString);
                 string sqlstring = "INSERT INTO SUBCATEGORY(CATEGORYID,SUBCATEGORYNAME) VALUES (" + objCat.CategoryID.ToString() + ",'" + objCat.SubCategoryName + "')";
                 int ROWCOUNT = DB.ExecuteCommandNoQuery(sqlstring);
                 if (ROWCOUNT > 0)
                     return true;
                 else
                     return false;
             }
             catch (Exception ex)
             {
                 throw ex;
             }
        }
示例#3
0
 public Receipy()
 {
     SubCategory = new SubCategory();
 }
示例#4
0
 public bool Edit(SubCategory obj)
 {
     try
      {
          DAL DB = new DAL(ConnectionString);
          string sqlstring = "UPDATE SUBCATEGORY SET SUBCATEGORYNAME = '" + obj.SubCategoryName + "',CATEGORYID = " + obj.CategoryID.ToString() + " WHERE SUBCATEGORYID = " + obj.SubCategoryID.ToString();
          int ROWCOUNT = DB.ExecuteCommandNoQuery(sqlstring);
          if (ROWCOUNT > 0)
              return true;
          else
              return false;
      }
      catch (Exception ex)
      {
          throw ex;
      }
 }
示例#5
0
 public SubCategory GetObjectFromDR(DataRow DR)
 {
     try
       {
           SubCategory obj = new SubCategory();
           obj.SubCategoryID = int.Parse(DR["SUBCATEGORYID"].ToString());
           obj.SubCategoryName = DR["SUBCATEGORYNAME"].ToString();
           obj.CategoryID = int.Parse(DR["CATEGORYID"].ToString());
           obj.Category.CategoryID = obj.CategoryID;
           obj.Category.CategoryName = DR["CATEGORYNAME"].ToString();
           return obj;
       }
     catch(Exception ex)
       {
           throw ex;
       }
 }