예제 #1
0
        public MySqlDataReader Search(TransferInItemStatus TransferInItemstatus, string SearchKey, string SortField, SortOption SortOrder)
        {
            try
            {
                if (SortField == string.Empty || SortField == null)
                {
                    SortField = "TransferInItemID";
                }

                string SQL = SQLSelect() + "WHERE (ProductCode LIKE @SearchKey or BarCode LIKE @SearchKey or Description LIKE @SearchKey " +
                             "or MatrixDescription LIKE @SearchKey or ProductGroup LIKE @SearchKey or ProductSubGroup LIKE @SearchKey " +
                             "or Remarks LIKE @SearchKey) " +
                             "ORDER BY " + SortField;

                if (SortOrder == SortOption.Ascending)
                {
                    SQL += " ASC";
                }
                else
                {
                    SQL += " DESC";
                }

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                MySqlParameter prmTransferInItemStatus = new MySqlParameter("@TransferInItemStatus", MySqlDbType.Int16);
                prmTransferInItemStatus.Value = TransferInItemstatus.ToString("d");
                cmd.Parameters.Add(prmTransferInItemStatus);

                MySqlParameter prmSearchKey = new MySqlParameter("@SearchKey", MySqlDbType.String);
                prmSearchKey.Value = "%" + SearchKey + "%";
                cmd.Parameters.Add(prmSearchKey);

                MySqlDataReader myReader = base.ExecuteReader(cmd);

                return(myReader);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
예제 #2
0
        public MySqlDataReader List(TransferInItemStatus TransferInItemstatus, string SortField, SortOption SortOrder)
        {
            try
            {
                if (SortField == string.Empty || SortField == null)
                {
                    SortField = "TransferInItemID";
                }

                string SQL = SQLSelect() + "WHERE TransferInItemStatus = @TransferInItemStatus " +
                             "ORDER BY " + SortField;

                if (SortOrder == SortOption.Ascending)
                {
                    SQL += " ASC";
                }
                else
                {
                    SQL += " DESC";
                }

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                MySqlParameter prmTransferInItemStatus = new MySqlParameter("@TransferInItemStatus", MySqlDbType.Int16);
                prmTransferInItemStatus.Value = TransferInItemstatus.ToString("d");
                cmd.Parameters.Add(prmTransferInItemStatus);

                MySqlDataReader myReader = base.ExecuteReader(cmd);

                return(myReader);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
예제 #3
0
        public MySqlDataReader Search(TransferInItemStatus TransferInItemstatus, string SearchKey, string SortField, SortOption SortOrder)
        {
            try
            {
                if (SortField == string.Empty || SortField == null) SortField = "TransferInItemID";

                string SQL = SQLSelect() + "WHERE (ProductCode LIKE @SearchKey or BarCode LIKE @SearchKey or Description LIKE @SearchKey " +
                                    "or MatrixDescription LIKE @SearchKey or ProductGroup LIKE @SearchKey or ProductSubGroup LIKE @SearchKey " +
                                    "or Remarks LIKE @SearchKey) " +
                            "ORDER BY " + SortField;

                if (SortOrder == SortOption.Ascending)
                    SQL += " ASC";
                else
                    SQL += " DESC";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                MySqlParameter prmTransferInItemStatus = new MySqlParameter("@TransferInItemStatus",MySqlDbType.Int16);
                prmTransferInItemStatus.Value = TransferInItemstatus.ToString("d");
                cmd.Parameters.Add(prmTransferInItemStatus);

                MySqlParameter prmSearchKey = new MySqlParameter("@SearchKey",MySqlDbType.String);
                prmSearchKey.Value = "%" + SearchKey + "%";
                cmd.Parameters.Add(prmSearchKey);

                MySqlDataReader myReader = base.ExecuteReader(cmd);

                return myReader;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
예제 #4
0
        public MySqlDataReader List(TransferInItemStatus TransferInItemstatus, string SortField, SortOption SortOrder)
        {
            try
            {
                if (SortField == string.Empty || SortField == null) SortField = "TransferInItemID";

                string SQL = SQLSelect() + "WHERE TransferInItemStatus = @TransferInItemStatus " +
                            "ORDER BY " + SortField;

                if (SortOrder == SortOption.Ascending)
                    SQL += " ASC";
                else
                    SQL += " DESC";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                MySqlParameter prmTransferInItemStatus = new MySqlParameter("@TransferInItemStatus",MySqlDbType.Int16);
                prmTransferInItemStatus.Value = TransferInItemstatus.ToString("d");
                cmd.Parameters.Add(prmTransferInItemStatus);

                MySqlDataReader myReader = base.ExecuteReader(cmd);

                return myReader;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }