internal DataTable GetProducts(string ShortOrder, string ShortBy, int CurrentPage, int RecsPerPage, out int NoOfPages, out int NoOfRecords) { DataSet ds = null; SqlCommand commandObject = null; KSDB dataObject = null; SqlParameter outputParameter = null; SqlParameter outputParameter2 = null; try { commandObject = new SqlCommand(); commandObject.CommandType = CommandType.StoredProcedure; commandObject.CommandText = "ks_GetAllProducts"; commandObject.Parameters.Add("@Page", SqlDbType.Int).Value = CurrentPage; commandObject.Parameters.Add("@RecsPerPage", SqlDbType.Int).Value = RecsPerPage; commandObject.Parameters.Add("@ProductID", SqlDbType.Int).Value = ProductID; commandObject.Parameters.Add("@ShortOrder", SqlDbType.NVarChar).Value = ShortOrder; commandObject.Parameters.Add("@ShortBy", SqlDbType.NVarChar).Value = ShortBy; outputParameter = new SqlParameter(); outputParameter.ParameterName = "@NoOfPages"; outputParameter.Direction = ParameterDirection.Output; outputParameter.SqlDbType = SqlDbType.Int; commandObject.Parameters.Add(outputParameter); outputParameter2 = new SqlParameter(); outputParameter2.ParameterName = "@NoofRec"; outputParameter2.Direction = ParameterDirection.Output; outputParameter2.SqlDbType = SqlDbType.Int; commandObject.Parameters.Add(outputParameter2); dataObject = new KSDB(); ds = dataObject.GetDataSet(commandObject); NoOfPages = CleanAndFormat.CleanInteger(outputParameter.Value); NoOfRecords = CleanAndFormat.CleanInteger(outputParameter2.Value); } catch (Exception er) { NoOfPages = 0; NoOfRecords = 0; } finally { if (commandObject != null) { commandObject.Dispose(); } commandObject = null; dataObject = null; } return ds.Tables[0]; }
internal clsUsers ValidateUser() { DataSet userDetails = null; SqlCommand commandObject = null; KSDB dataObject = null; try { commandObject = new SqlCommand(); commandObject.CommandType = CommandType.StoredProcedure; commandObject.CommandText = "ks_ValidateUser"; commandObject.Parameters.Add("@UserName", SqlDbType.NVarChar).Value = UserName; commandObject.Parameters.Add("@Password", SqlDbType.NVarChar).Value = Password; dataObject = new KSDB(); userDetails = dataObject.GetDataSet(commandObject); } finally { if (commandObject != null) { commandObject.Dispose(); commandObject = null; } dataObject = null; } return GetUserProfile(userDetails, UserName, Password); }
internal DataTable GetProcutTypes(int _typeid = 0) { DataSet ds = null; SqlCommand commandObject = null; KSDB dataObject = null; try { commandObject = new SqlCommand(); commandObject.CommandType = CommandType.StoredProcedure; commandObject.CommandText = "ks_GetProductTypes"; commandObject.Parameters.Add("@ProductTypeID", SqlDbType.Int).Value = _typeid; dataObject = new KSDB(); ds = dataObject.GetDataSet(commandObject); } finally { if (commandObject != null) { commandObject.Dispose(); } commandObject = null; dataObject = null; } return ds.Tables[0]; }