We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to set only 4 no of appointments per day in Scdulecontrol in c#

Hi Viewers,
       1.    Here i am trying to set appointment per day 4 only more then 4 i need to restrict 
       2.   And i need to set Sunday's must be RED color 
       3.   Schedule must show Only  today date to foreword days only not show previews days
       4.   The days Format must be like Squired Shape like this as month's 
       5.  Calender Must be today date to next three months only 
How to set only 4 no of appointments per day in Schedule control in c#
I am very new to this Sync fusion controls please let me help 
                                                                         Thanks in Advance 


2 Replies

VS Velmurugan S Syncfusion Team July 10, 2014 01:01 PM UTC

Hi Venkaiah,

 

Thanks for using Syncfusion products.

 

We would like to inform you that, currently we are analysing your above mentioned requirements and also preparing the workaround sample that tries to meet your requirements with high priority.  Therefore, we will update you the further details in two business days on 14th July,2014. In the meantime, could you please share the following details on your requirements which will help us to provide your desired solution.

 

Query #2: And i need to set Sunday's must be RED color :

 

                  Could you please confirm us whether you are expecting the “RED color” for appointments or for the Schedule Cells on the Sundays.

 

Query #4: The days Format must be like Squired Shape like this as month's:

 

                  We regret to let you know that, we are unable to understand this scenario clearly, hence could you please share some more information on this with some screenshots.

 

Query #5: Calender Must be today date to next three months only :

 

                  Could you please confirm us whether you are expecting the above mentioned requirement in our Schedule control or with the Calendar that displays aside the schedule control.

 

Kindly share the above requested details and it will be more helpful for us to assist you further.

 

Regards,

Velmurugan



VS Velmurugan S Syncfusion Team July 14, 2014 12:57 PM UTC

Hi Venkaiah,

Thanks for your patience.

We would like to inform you that, we have prepared the sample that tries to meet your requirements (Query 1 and Query 3). Please find the following steps that will help to meet your requirements.

For Query #1: Here i am trying to set appointment per day 4 only more then 4 i need to restrict 

                We can restrict the appointments rendering per day( Ex: more then 4) by using the “OnAppointmentAdding”. Please find the following code snippet to restrict the appointment rendering.

<code>

Default.aspx page:

                <syncfusion:Schedule ID="Schedule2" runat="server" Height="500px" Width="550px"

        ViewStrip="true"

        CalendarPosition="Left" MinDate="07/14/2014" OnDataSourceControlAdding="Schedule1_DataSourceControlAdding" OnAppointmentAdding="Schedule2_AppointmentAdding"

        CalendarNavigationMode="Default" AppointmentDataSourceID="SqlDataSource1" ResourceDataSourceID="SqlDataSource2">

 

Code behind (Default.aspx.cs) page:

 

protected void Schedule1_DataSourceControlAdding(object sender, Syncfusion.Web.UI.WebControls.ScheduleControl.AppointmentDataEventArgs e)

    {

 

        myConnection = new SqlConnection(ConnectionString);

        myConnection.Open();

        SqlCommand cmdval = new SqlCommand("Select Count(StartTime)from Appointment where CONVERT(varchar(10), StartTime, 101) ='" + e.Appointment.StartTime.ToShortDateString() + "'", myConnection); // Get the count value of the startime to restric the appointment

        count = (Int32)cmdval.ExecuteScalar();

        myConnection.Close();

        myConnection.Open();

        SqlCommand cmd1 = new SqlCommand();

        cmd1.Connection = myConnection;

        if (count < 4)

        {

            cmd1.CommandText = "Insert into Appointment(Id,StartTime,Location,EndTime,Subject,Owner) values('" + e.Appointment.UniqueID + "','" + e.Appointment.StartTime.ToString() + "','" + e.Appointment.LocationValue + "','" + e.Appointment.EndTime.ToString() + "','" + e.Appointment.Subject + "','" + e.Appointment.Owner + "')"// here we checked the condition if the appointment adding date contains not more then 4 appointments means adding the appointments

            cmd1.ExecuteNonQuery();

        }

        myConnection.Close();

    }

 

    protected void Schedule2_AppointmentAdding(object sender, AppointmentEventArgs e)

    {

        if (count >= 4)

            e.Cancel = true;         // Here we cancel the appointments adding to the schedule control by enabling the e.cancel

    }

</code>

 

For Query #3: Schedule must show Only  today date to foreword days only not show previews days

                We can able to display the schedule with the today date to forward days only. This can be achieved by setting the “MinDate” value, for example if we set the MInDate as “07/14/2014” means the previous dates are not displaying in the schedule and also we couldn’t navigate to those dates. And also in the below code snippet we have set the today date(07/14/2014) as MinDate and you can dynamically change this MinDate as per your requirements. Please find the following code snippet that will help you to meet the above mentioned scenario.

<code>

                <syncfusion:Schedule ID="Schedule2" runat="server" Height="500px" Width="550px"

        ViewStrip="true"

        CalendarPosition="Left" MinDate="07/14/2014" >

</code>

And also for your reference we have prepared the with the above mentioned code snippets, which can be downloaded from the following location.

ScheduleSample

Note: Please kindly share the requested details for the other  3 requirements (query 2,query 4, query 5) you mentioned in your update and it will more helpful for us to provide you the better solution on that.

Please let us know if it helps and any further assistance on this.

Regards,

Velmurugan


Loader.
Live Chat Icon For mobile
Up arrow icon