Intersoft Support Center

Configure OverwriteChanges Conflict Detection Support

This walkthrough shows you how to implement OverwriteChanges conflict detection in WebScheduler.

During this walkthrough, you will learn how to do the following:

  • Use ISDataSource.
  • Use SmartTag to set DataSource.
  • Use Data Source Configuration Wizard to set the Database and table.

 Prerequisites

In order to complete this walkthrough, you will need the following:

  • Access to the Intersoft SQL database.
  • Visual Studio 2005/2008/2010 Application.

 Step-By-Step Instructions

To create new web application and bind SQL database to WebScheduler

  1. Launch Visual Studio.NET 2008.
  2. Click on File menu, then select New and click Web Site.
  3. Select ASP.NET Web Site in the Template box and set Location to HTTP.
  4. Named the Web Site and click OK.
  5. Right-click on Project's name and select Add New Item.
  6. Select Intersoft AppForm in the My Templates box and named it as Walkthrough.aspx.
  7. Drag and drop WebScheduler and ISDataSource instances from toolbar to WebForm.
  8. Right click on WebScheduler control and choose WebScheduler Database Wizard.
  9. Provide Server name and create Database name. In this case, Server name is set to server1\sqlexpress and Database name is set to Intersoft. Click Create button afterwards.



  10. Open Server Explorer and choose Connect to Database. A dialog box will appear.
  11. Set Server name to server1\sqlexpress and Database name to Intersoft. Click OK to continue.



  12. In the Solution Explorer, right-click on App_Code and select Add New Item.
  13. Add a Dataset and named it Intersoft_DataSet.xsd.
  14. Drag and drop the tables from server explorer to the dataset then save the dataset.



  15. In the Solution Explorer, right-click on App_Code and select Add New Item.
  16. Add a new class and named it IntersoftDataSet.cs.
  17. Here is the IntersoftDataSet.cs content.

    C# Copy Code
    using System.Data.SqlClient;
    namespace IntersoftDataSetTableAdapters
    {   
       public partial class EventsTableAdapter : global::System.ComponentModel.Component   
       {       
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]       
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]       
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]     
          public virtual int Insert(int EventID, string CategoryID, global::System.Nullable<int> ResourceID, global::System.Nullable<int> Mode, string Subject,       
             string Description, string Location, bool AllDayEvent, global::System.Nullable<global::system.datetime> StartTime,            
             global::System.Nullable<global::system.datetime> EndTime, global::System.Nullable<int> ReminderTimeSpan)       
          {           
             this.Connection.Open();           
             try           
             {               
                this.Insert(CategoryID, ResourceID, Mode, Subject, Description, Location, AllDayEvent, StartTime, EndTime, ReminderTimeSpan);               
                OleDbCommand command = new OleDbCommand();                
                command.CommandText = "SELECT @@IDENTITY";                
                command.Connection = this.Connection;               
                return (int)command.ExecuteScalar();           
             }          
             finally           
             {                
                this.Connection.Close();           
             }       
          }   
       }
       
       public partial class RecurringEventsTableAdapter : global::System.ComponentModel.Component   
       {   
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]   
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]   
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]   
          public virtual int Insert(int EventID, global::System.Nullable<int> RecurrenceID, string CategoryID, global::System.Nullable<int> ResourceID,         
             global::System.Nullable<int> ParentID, global::System.Nullable<int> Mode, string Subject, string Description, string Location, bool AllDayEvent,         
             global::System.Nullable<global::system.datetime> StartTime, global::System.Nullable<global::system.datetime> EndTime,         
             global::System.Nullable<global::system.datetime> ExceptionDate, global::System.Nullable<int> ExceptionInfo, global::System.Nullable<int> ReminderTimeSpan)   
          {     
             this.Connection.Open();     
             try       
             {           
                this.Insert(RecurrenceID, CategoryID, ResourceID, ParentID, Mode, Subject, Description, Location, AllDayEvent, StartTime, EndTime, ExceptionDate, ExceptionInfo, ReminderTimeSpan);           
                OleDbCommand command = new OleDbCommand();            
                command.CommandText = "SELECT @@IDENTITY";            
                command.Connection = this.Connection;           
                return (int)command.ExecuteScalar();       
             }      
             finally       
             {           
                this.Connection.Close();       
             }   
          }
       }
    
       public partial class RecurrenceInfoTableAdapter : global::System.ComponentModel.Component
       {  
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]  
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]  
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]  
          public virtual int Insert(int RecurrenceID, global::System.Nullable<int> Mode, global::System.Nullable<int> RangeMode,         
             global::System.Nullable<global::system.datetime> StartDate, global::System.Nullable<global::system.datetime> EndDate,         
             global::System.Nullable<int> TotalRecurrences, global::System.Nullable<int> NDay, global::System.Nullable<int> NWeek,         
             global::System.Nullable<int> NMonth, global::System.Nullable<int> NYear, string WeekDays) 
          {     
             this.Connection.Open();     
             try       
             {         
                this.Insert(Mode, RangeMode, StartDate, EndDate, TotalRecurrences, NDay, NWeek, NMonth, NYear, WeekDays);            
                OleDbCommand command = new OleDbCommand();             
                command.CommandText = "SELECT @@IDENTITY";             
                command.Connection = this.Connection;            
                return (int)command.ExecuteScalar();       
             }    
             finally      
             {          
                this.Connection.Close();      
             }  
          }
       }
    
       public partial class CategoriesTableAdapter : global::System.ComponentModel.Component
       {
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)] 
          public virtual int Insert(int CategoryID, string CategoryName, string Description, string CategoryColor)
          {   
             this.Connection.Open();    
             try    
             {      
                this.Insert(CategoryName, Description, CategoryColor);       
                OleDbCommand command = new OleDbCommand();        
                command.CommandText = "SELECT @@IDENTITY";        
                command.Connection = this.Connection;       
                return (int)command.ExecuteScalar();    
             }   
             finally   
             {       
                this.Connection.Close();   
             } 
          }
       } 
       
       public partial class ResourcesTableAdapter : global::System.ComponentModel.Component
       {    
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]    
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]    
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]   
          public virtual int Insert(int ResourceID, string ResourceName, string Description, string Location, string ResourceColor)   
          {        
             this.Connection.Open();      
             try        
             {            
                this.Insert(ResourceName, Description, Location, ResourceColor);            
                OleDbCommand command = new OleDbCommand();             
                command.CommandText = "SELECT @@IDENTITY";             
                command.Connection = this.Connection;            
                return (int)command.ExecuteScalar();        
             }       
             finally        
             {             
                this.Connection.Close();        
             }    
          }  
       }
    }
    

  18. Build the solution.
  19. Click the SmartTag and select Configure Data Source on the upper right of the ISDataSource control.
  20. Select SchemaType to DataSet and Schema Name to IntersoftDataSet then click Next.



  21. Make sure the Select, Insert, Update and Delete tab for each table is not empty then click Finish.



  22. Select WebScheduler instance and press F4 to show the WebScheduler’s properties.
  23. Set the following properties:

    Property Value
    DataSourceID ISDataSource1
    CategoriesDataMember Categories
    RecurrenceDataMember RecurrenceInfo
    EventsDataMember Events
    RecurringEventsDataMember RecurringEvents
    ResourcesDataMember Resources



  24. Go to DataBinding and specify the field of CategoryBinding, EventsBinding, RecurrenceBinding, RecurrenceEventsBinding, and ResourcesBinding based on the database field.


     

  25. WebScheduler binding is done. Now you are able to run the project.
    The database is empty so the current WebScheduler will not show any event or resources.
Previous Next