Hi Every Body
I learn lots of thing from here. Now I put my hands in ASP.Net.
I am creating a web site now I stuck at a point where I want to display the result in sorted order. Actually I have a facility to add new schedule for class I am conducting.
Class 1 Monday 04:00PM
Class 2 Tuesday 12:30 PM
Class 3 Wednesday 10:00 AM

Now if i add -
Class 4 Monday 12:30 PM and
Class 5 Thrusday 03:00 PM

then these classes should be displayed in previous list schedule but not at the end of previous list, it should looks like -
Class 4 Monday 12:30 PM and
Class 1 Monday 04:00PM
Class 2 Tuesday 12:30 PM
Class 3 Wednesday 10:00 AM
Class 5 Thrusday 03:00 PM

I hope I make myself clear to you all.

Please see the attached code file for the reference
to see my work done visit
http://www.lovepilatesleeds.com/mat-classes.aspx

int value(String day)
        {
            String com=day.ToLower();
            switch (com)

            { 
            
                case "sunday":
                    return 1;

                case "monday":
                    return 2;
                case "tuesday":

                    return 3;

                case "wednesday":
                    return 4;

                case "thursday":
                    return 5;

                case "friday":
                    return 6;

                case "saturday":
                    return 7;           
            
            }

            return 0;
        
        }




        private void button1_Click(object sender, EventArgs e)
        {

         

            if (listBox1.Items.Count == 0)
            {
                listBox1.Items.Add(textBox1.Text);
                goto x;
            }

            Array art = textBox1.Text.Trim().Split(' ');
            Array arl  ;
            int count = listBox1.Items.Count;
        
            
            
            
            for (int i = 0; i < count; i++)
            {
                char[] delimiters = new char[] { ' '};
                arl = listBox1.Items[i].ToString().Trim().Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

                if (value(art.GetValue(2).ToString()) <value(arl.GetValue(2).ToString()))
                {                 
                        listBox1.Items.Insert(i, textBox1.Text);
                        break;
                     
                }

                else if (value(art.GetValue(2).ToString()) <= value(arl.GetValue(2).ToString()))
                {
                      if (Convert.ToDateTime(art.GetValue(3)) <= Convert.ToDateTime(arl.GetValue(3)))

                         listBox1.Items.Insert(i, textBox1.Text);
                      break;
                     if (Convert.ToDateTime(art.GetValue(3)) > Convert.ToDateTime(arl.GetValue(3)))
                      listBox1.Items.Insert(i + 1, textBox1.Text);
                     break;
                }



                else  
                {

                    listBox1.Items.Add(textBox1.Text);
                    break;
                }
            }

             
        x: ;

        }

Hi
Thanx for your consideration. But what to do with this code where to embed this. Can you please give me some support on this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.