public int AddNewProduct(SqlParameter[] objDataParameter)
        {
            int affectedRows = 0;

            //using (SqlConnection)
            //{
            try
            {
                SqlCmd.CommandText = "spAddNewproduct";
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddRange(objDataParameter);
                SqlConnection.Open();
                affectedRows = (int)SqlCmd.ExecuteScalar();
            }

            catch (Exception ex)
            {
            }
            finally
            {
                SqlConnection.Close();
            }
            //}
            return(affectedRows);
        }
Beispiel #2
0
        public int AddManufacturer(SqlParameter[] objDataParameter)
        {
            using (SqlConnection)
            {
                SqlCmd.CommandText = "spAddManufactures";
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddRange(objDataParameter);
                SqlConnection.Open();
                affectedRows = (int)SqlCmd.ExecuteScalar();

                //SqlConnection.Close();
            }

            //try
            //{
            //    SqlCmd.CommandText = "spAddManufacture";
            //    SqlCmd.CommandType = CommandType.StoredProcedure;
            //    SqlCmd.Parameters.AddRange(objDataParameter);
            //    SqlConnection.Open();
            //    affectedRows = (int)SqlCmd.ExecuteScalar();
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
            //    SqlConnection.Close();
            //}
            return(affectedRows);
        }
Beispiel #3
0
 /// <summary>
 /// 执行SQL语句,返回第一行
 /// </summary>
 /// <param name="sql">SQL语句</param>
 /// <param name="parms">参数集合</param>
 /// <returns>返回 第一行</returns>
 public Object ExecuteScalar(string sql, SqlParameter[] parms = null)
 {
     try
     {
         if (SqlCon.State != ConnectionState.Open)
         {
             SqlCon.Open();
         }
         SqlCmd             = SqlTransactionFlag ? new SqlCommand(sql, SqlCon, SqlTran) : new SqlCommand(sql, SqlCon);
         SqlCmd.CommandType = CommandType.Text;
         if (parms != null)
         {
             AddParameters(parms);
         }
         return(SqlCmd.ExecuteScalar());
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         SqlCmd.Dispose();
         if (!SqlTransactionFlag)
         {
             SqlCon.Close();
             SqlCon.Dispose();
         }
     }
 }
 public int AddMainCatagory(SqlParameter[] objDataParameter)
 {
     using (SqlConnection)
     {
         SqlCmd.CommandText = "spAddMainCatagory";
         SqlCmd.CommandType = CommandType.StoredProcedure;
         SqlCmd.Parameters.AddRange(objDataParameter);
         SqlConnection.Open();
         affectedRows = (int)SqlCmd.ExecuteScalar();
     }
     return(affectedRows);
 }
        //public int SaveProductImage(string imageID, string extention, string productID)
        //{
        //    int affectedRows;
        //    using (SqlConnection)
        //    {
        //        SqlCmd.CommandText = "insert into Table_ProductImageInfo(ProductImageID, ProductImageNameExtention, ProductID) values('" + imageID + "', '" + extention + "', '" + productID + "')";
        //        SqlConnection.Open();
        //        affectedRows = (int)SqlCmd.ExecuteNonQuery();
        //    }
        //    //SqlConnection.Close();
        //    return affectedRows;
        //}

        public int SaveProductImage(SqlParameter[] objDataParameter)//Problem Here !!!
        {
            int affectedRows;

            using (SqlConnection)
            {
                SqlCmd.CommandText = "spAddImageIDandExtextion";
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddRange(objDataParameter);
                SqlConnection.Open();
                affectedRows = (int)SqlCmd.ExecuteScalar();
                //SqlConnection.Close();
            }
            //SqlConnection.Close();
            return(affectedRows);
        }
Beispiel #6
0
        public int AddSubCatagory(SqlParameter[] objDataParameter)
        {
            try
            {
                SqlCmd.CommandText = "spAddSubCatagory";
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddRange(objDataParameter);
                SqlConnection.Open();
                affectedRows = (int)SqlCmd.ExecuteScalar();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                SqlConnection.Close();
            }

            //using (SqlConnection)
            //{
            //    SqlCmd.CommandText = "spAddSubCatagory";
            //    SqlCmd.CommandType = CommandType.StoredProcedure;
            //    SqlCmd.Parameters.AddRange(objDataParameter);
            //    SqlConnection.Open();
            //    affectedRows = (int)SqlCmd.ExecuteScalar();
            //}
            return(affectedRows);


            //try
            //{
            //    SqlCmd.CommandText = "spAddSubCatagory";
            //    SqlCmd.CommandType = CommandType.StoredProcedure;
            //    SqlCmd.Parameters.AddRange(objDataParameter);
            //    SqlConnection.Open();
            //    affectedRows = (int)SqlCmd.ExecuteScalar();
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
            //    SqlConnection.Close();
            //}
            //return affectedRows;
        }
Beispiel #7
0
 public int AddUser(SqlParameter[] objDataParameter)
 {
     try
     {
         SqlCmd.CommandText = "spUserRegistration";
         SqlCmd.CommandType = CommandType.StoredProcedure;
         SqlCmd.Parameters.AddRange(objDataParameter);
         SqlConnection.Open();
         affectedRows = (int)SqlCmd.ExecuteScalar();
     }
     catch (Exception ex)
     {
     }
     finally
     {
         SqlConnection.Close();
     }
     return(affectedRows);
 }