Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1080
Appointment visible property problem
posted

Hi, I want to filter appointments for subject. So I use Visible property for appointment. And it works. The only problem is when I set appointment's Visible to false, it saves changes in database, so that appointment is no more visible. How can I avoid saving Visible property for appointment ???

Parents
No Data
Reply
  • 53790
    Suggested Answer
    posted

    Hello Divac,

     

    divac said:
     How can I avoid saving Visible property for appointment ???

    There are few possible options to solve this task. By design "Visible" property doesn`t have separate Data Binding Member and the value of Visible property is include in a Byte array of  ultraCalendarInfo1.DataBindingsForAppointments.AllPropertiesMember.

    Option 1: I`m not familiar with your scenario and I don`t know the exact moment, when you stored your appointments in database, but maybe you could set Visible property to True, just before to save changes in database.

    Option 2: If it is not possible to use option 1,  you could skip the data binding of ultraCalendarInfo1.DataBindingsForAppointments.AllPropertiesMember. By this way the changes in Visible property could not be stored in database. This approach has a big disadvantage, because you will skip many of appointments settings to be stored in database

    Option 3: This approach is complicate, but I think that will solve your task. Using this approach you will be able to read your binary array from AllProperties, to modify Visible property and stored back your binary array in the database. For example:

    public void MyMethod()

            {

         SqlConnection conn = new SqlConnection("Data Source=IGBGSOFDS22;Initial Catalog=Test;Integrated Security=True");
         SqlCommand command = new SqlCommand("SELECT AllProperties FROM [dbAppointments] WHERE [AppointmentID] = '2d43b92c-9f7e-474b-88dc-87d54649fcdf'", conn);

         conn.Open();

            SqlDataReader myReader = command.ExecuteReader();
        byte[] BinaryAppData = null;

        while (myReader.Read())

            {

                   // Deserialize the Appointment from Binary data using AllProperties column

                   Appointment MyApp = Appointment.FromBytes((byte[])myReader[0]);

                   // Make changes in the Appointment

                    MyApp.Subject = "New Subject for Appointment";

                    MyApp.Visible = true;

                   //Save chages in the Appointment in Binary format;

                   BinaryAppData = MyApp.Save();

                 }

        myReader.Close();

        // Save changes in the database usign Binary data and AllProperties column

        SqlCommand command2 = new SqlCommand("UPDATE [dbAppointments] set AllProperties = @AllProperties WHERE [AppointmentID] = '2d43b92c-9f7e-474b-88dc-87d54649fcdf'", conn);

        command2.Parameters.Add("@AllProperties", SqlDbType.Binary);

        command2.Parameters["@AllProperties"].SqlValue = BinaryAppData;

        command2.ExecuteNonQuery();

        conn.Close();

       }

     Let me know if you have any questions.

    Regards

     

     

     

     

     

     

     

     

     

Children