473,425 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Error load meeting and time to datagridview

I have 2 table on api data: Booking{ Id, Status, Sort, CreatedDate,UpdatedAt, Title, ParticipatingLeaders, Content, UserCreatedName, UserCreatedEmail, UserCreatedPhoneNumber, DepartmentId, Start, Stop, LocationId, Request,RoomId, Date, CancelAt, SuccessAt,HostUser, LocationName, RoomName }

Room{ Id, Status, Sort, CreatedDate, CreatedAt, UpdatedAt, UpdatedBy, CodeNaame, Name, LocationId, Volumn, Items, Images }

After booking and save the meeting room, the data will be submitted to the Booking table. on form i create datagridview to view

meeting schedule and meeting room get the list of rooms in the Room api table and add new hour columns

add a new column that is the time and get the data to browse the Booking table to compare the start time and end time of the meeting

like code and picture. convert columns header is hour to compare and get the time range and load the color to know which room is meeting at which time

in the load event call the function: selectAreaColor() then got an error, but the load function does not call and book the room,

it can run and get the results as shown, but when starting to run and the load function calls, the error hope everyone can help, thanks a lot.

when adding new run debug, it browses from column header at 08:00 to the end of column and booking table data runs ok and the load event, it browses the data from the booking table to the columns on the datagridview, so it crashes


here is the code to get the display area of meeting time and meeting schedule

private void selectAreaColor()

{

string starttime ;

string stoptime ;

string selectedRoom ;

string selectedId ;

QueryRQ query = CreateQuery();

BookingIndexRS result = apiBooking.getBooking(query).Result;

foreach (BookingDetail r in result.Data)

{

string idLocal = r.Id.ToString();

selectedId = idLocal + "";

string idroom = r.RoomId.ToString();

selectedRoom = idroom + "";

string start = r.Start.ToString();

starttime = start;

string stop = r.Stop.ToString();

stoptime = stop;

string getDate =(r.Date.ToString());

// Get the start time and end time inputs and the selected meeting room

DateTime startTime = DateTime.ParseExact(starttime, "HH:mm", null);

DateTime stopTime = DateTime.ParseExact(stoptime, "HH:mm", null);

foreach (DataGridViewRow row in grdRoom.Rows)

{

if (row.Cells["Id"].Value.ToString() == selectedRoom)

{

int rowIndex = row.Index;

// Loop through the columns and compare the start and end times with the time slots

for (int i = 1; i < grdRoom.Columns.Count; i++)

{

DateTime columnTime = DateTime.ParseExact(grdRoom.Columns[i].HeaderText, "HH:mm", CultureInfo.InvariantCulture);//event load here error

string _HeaderText = grdRoom.Columns[i].Name.ToString();

if (startTime == columnTime)//|| endTime == columnTime

{

grdRoom.Rows[rowIndex].Cells[_HeaderText].Style.BackColor = Color.Blue;

if (startTime == stopTime)

return;

else

startTime = startTime.AddMinutes(30);

}

}

}

}

}

}
Mar 8 '23 #1
0 1103

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dave Smithz | last post by:
Hi, My PHP application for a client uses the publicly available "PHPMailer - PHP email class" which is very good. However, my client recently complained about the following error when sending...
4
by: Gary Davis | last post by:
Once a day or so, I receive an error on a fairly active website that calls this StrMixed.cs method constructor. 99% of the time there is no exception: System.Web.HttpUnhandledException:...
1
by: Mark | last post by:
I have .aspx code-behinds that inherit from the class below. The code runs just fine, but the form designer bombs at design time when trying to view the .aspx page in VS.NET 2003. If I comment...
1
by: Manuel Canas | last post by:
Hello there, I am using the VB.NET Standart Edition compiler and I would like to know if this is not supported on this edition. This is just a testing code from a book that I'm trying here and...
2
by: Henry J. | last post by:
When the user loads the data into a DataGridView, some error icons may be shown to indicate some errors like when uniqueness is violated. The user can go ahead modifying the data rows. Once the...
0
by: mfareezaw | last post by:
dears i need an axample how to get time and how to load numbers from file in the disk i found this in the help but it is not printing #include <stdio.h> #include <dos.h> int...
1
by: Adam Porter | last post by:
First off, I've placed my very first webservice on the web and can access the .asmx file through my browser. Now, as I'm writing my Client App, I want to call these services. I'm getting a strange...
10
by: pooja8389 | last post by:
In this program there is error in processing time of last process..plz check the error... the program is as #include<stdio.h> #include<conio.h> void main() { float avgwt,avgtt; char pname,c;...
3
by: agarwalsunitadhn | last post by:
Hi I have a problem that whenever i fetch a large amount of data from database then it shows the following error with a part of result: Fatal error: Maximum execution time of 30 seconds...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.