Exemplo n.º 1
0
        public string ShowProductDocumation(string pName, string pType, string pDocumation)
        {
            if (pNameList.Contains(pName) && pTypeList.Contains(pType) && pDocumationList.Contains(pDocumation))
            {
                if (pDocumation == "Produkt infomation")
                {
                    ProductInfo pi = new ProductInfo(pName, pType);
                    return pi.ToString();
                }
                else if (pDocumation == "Opskirft")
                {
                    Recipe r = new Recipe(pName, pType);
                    return r.ToString();
                }
                else if (pDocumation == "Correspondance")
                {

                }
                else if (pDocumation == "QualityAssurance")
                {

                }
                //database metode til at give data tilbage i en string
            }
            return null;
        }
Exemplo n.º 2
0
 public int InsertProduct(ProductInfo product)
 {
     SqlConnection conn;
     int count = 0;
     using (conn = SqlHelper.CreateConntion())
     {
         conn.Open();
         SqlTransaction trans = conn.BeginTransaction();
         try
         {
             count = DAL.InsertProduct(product, trans);
             trans.Commit();
         }
         catch (Exception)
         {
             trans.Rollback();
         }
         conn.Close();
     }
     return count;
 }
Exemplo n.º 3
0
 public int UpdateProduct(ProductInfo product, SqlTransaction trans)
 {
     string sql = @"UPDATE [Product]
                        SET [ProductNO] = @ProductNO
                           ,[ProductName] = @ProductName
                           ,[CategoryID] = @CategoryID
                           ,[ProductSKU] = @ProductSKU
                           ,[ProductDetail] = @ProductDetail
                           ,[Price] = @Price
                           ,[SailPrice] = @SailPrice
                           ,[Place] = @Place
                           ,[SaveTime] = @SaveTime
                           ,[Define1] = @Define1
                           ,[Define2] = @Define2
                           ,[Define3] = @Define3
                           ,[UpdateDateTime] = @UpdateDateTime
                           ,[UpdateUser] = @UpdateUser
                      WHERE id=@id";
     SqlParameter[] spvalues = DBTool.GetSqlPm(product);
     return SqlHelper.ExecuteNonQuery(trans, System.Data.CommandType.Text, sql, spvalues);
 }
Exemplo n.º 4
0
 public int InsertProduct(ProductInfo product, SqlTransaction trans)
 {
     string sql = @"INSERT INTO [Product]
                            ([ProductNO]
                            ,[ProductName]
                            ,[CategoryID]
                            ,[ProductSKU]
                            ,[ProductDetail]
                            ,[Price]
                            ,[SailPrice]
                            ,[Place]
                            ,[SaveTime]
                            ,[Define1]
                            ,[Define2]
                            ,[Define3]
                            ,[InsertDateTime]
                            ,[InsertUser])
                      VALUES
                            (@ProductNO
                            ,@ProductName
                            ,@CategoryID
                            ,@ProductSKU
                            ,@ProductDetail
                            ,@Price
                            ,@SailPrice
                            ,@Place
                            ,@SaveTime
                            ,@Define1
                            ,@Define2
                            ,@Define3
                            ,@InsertDateTime
                            ,@InsertUser)";
     SqlParameter[] spvalues = DBTool.GetSqlPm(product);
     return SqlHelper.ExecuteNonQuery(trans, System.Data.CommandType.Text, sql, spvalues);
 }