Example #1
0
int
ns__search_radar_data(	soap* soap, int sessionID, char* site, char* product,
						struct DateTime* start, struct DateTime* end,
						int* result)
{
	DarxendClient* client = client_manager_get_client(sessionID);
	if (!client)
		return die_bad_client(soap);

	if (!start)
		return soap_receiver_fault(soap, "Start date must not be null", NULL);
	if (!verifyDate(start))
			return soap_receiver_fault(soap, "Invalid start date", "Value out of range");
	if (end)
	{
		if (!verifyDate(end))
			return soap_receiver_fault(soap, "Invalid end date", "Value out of range");
		if ((start->date.year > end->date.year) ||
			(start->date.year == end->date.year &&
				start->date.month > end->date.month) ||
			(start->date.year == end->date.year &&
				start->date.month == end->date.month &&
				start->date.day > end->date.day) ||
			(start->date.year == end->date.year &&
				start->date.month == end->date.month &&
				start->date.day == end->date.day &&
				start->time.hour > end->time.hour) ||
			(start->date.year == end->date.year &&
				start->date.month == end->date.month &&
				start->date.day == end->date.day &&
				start->time.hour == end->time.hour &&
				start->time.minute > end->time.minute))
			return soap_receiver_fault(soap, "Start date must be before end date.", NULL);
	}

	gchar* psite = g_ascii_strdown(site, -1);
	gchar* pproduct = g_ascii_strup(product, -1);

	*result = darxend_client_search(client, psite, pproduct, start, end);

	g_free(psite);
	g_free(pproduct);

	return SOAP_OK;
}
int countGreaterNumbers(struct transaction *Arr, int len, char *date) {
	if (!verifyDate(date))
		return NULL;
	int count = 0;
	bool compl = false;
	//--------First compare year-----------
	for (int i = 0; i < len; i++)
	{
		compl = false;
		for (int j = 6; j <= 9; j++){
			if (date[j] > Arr[i].date[j]){
				compl = true;
				break;
			}
			else if (date[j] < Arr[i].date[j]){
				count++;
				compl = true;
				break;
			}
		}
		if (compl != true){
			for (int j = 3; j <= 4; j++){
				if (date[j] > Arr[i].date[j]){
					compl = true;
					break;
				}
				else if (date[j] < Arr[i].date[j]){
					count++;
					compl = true;
					break;
				}
			}
		}
		if (compl != true){
			for (int j = 0; j <= 1; j++){
				if (date[j] > Arr[i].date[j]){
					compl = true;
					break;
				}
				else if (date[j] < Arr[i].date[j]){
					count++;
					compl = true;
					break;
				}
			}
		}
	}
	return count;
}