Exemple #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            Caller NewCall = new Caller();
            NewCall.UserID = UserID;
            NewCall.UserName = UserNik;
            NewCall.Call = newtime.ToString("g");

            NewCall.Create_parametrs();
            Console.WriteLine(NewCall.ins_cols.ToString());
            db1.Create_Connection("Calls", NewCall.item);

               /// db1.LocalDataTable.Dispose();

             try
            {
                db1.Insert("Calls", NewCall.Params);
            }
            catch (Exception a)
            { MessageBox.Show(a.Message); }
            finally
            {
                MessageBox.Show(NewCall.UserName + " \n назначен на" + NewCall.Call);

            }

            db.Refresh();
            db1.connect.Close();
        }
Exemple #2
0
        private void DayTravel()
        {
            Caller travel = new Caller();

            db1.Create_Connection("Calls", travel.item);

            DataTable Respond = new DataTable();
            DataTable Result = new DataTable();
            Respond = travel.item.Clone();

            for (int i = 0; i < db1.LocalDataTable.Rows.Count; i++)
                if (db1.LocalDataTable.Rows[i].ItemArray.GetValue(2).ToString().Contains(Calldate.Value.ToShortDateString()))
                {
                    Respond.Rows.Add(db1.LocalDataTable.Rows[i].ItemArray.ToArray());
                }

            for (int j = 0; j < Respond.Rows.Count; j++)
            {

                for (int i = 0; i < 26; i++)
                {
                    String str = Time[0, i].Value.ToString().Trim();

                    if (Respond.Rows[j]["Call"].ToString().Contains(str))
                    {
                        Time[1, i].Value = Respond.Rows[j]["UserName"].ToString();
                        Day[0, i].Value = Respond.Rows[j]["UserName"].ToString();
                    }
                }
            }

            Respond.Clear();
            //travel.item.Clear();
            db1.connect.Close();
        }
Exemple #3
0
        public void WeekTravel()
        {
            int num = 0;
            DateTime temp = DateTime.Now;
            int right, left;
            List<DateTime> week = new List<DateTime>();

            for (int i = 0; i < 7; i++)
                week.Add(temp);

            DateTime now = Calendar.Value;

            switch (Calendar.Value.DayOfWeek.ToString())
            {
                case "Monday": num = 0; break;
                case "Tuesday": num = 1; break;
                case "Wednesday": num = 2; break;
                case "Thursday": num = 3; break;
                case "Friday": num = 4; break;
                case "Saturday": num = 5; break;
                case "Sunday": num = 6; break;

            }

            Console.WriteLine(num.ToString());

            week[num] = Calendar.Value;

            Console.WriteLine(week[num].Date.ToShortDateString());

            right = 6 - num;

            Console.WriteLine(right.ToString());

            for (int i = 1; i < right + 1; i++)
            {
                now = now.AddDays(1);
                week[num + i] = now;
            }

            now = Calendar.Value;

            for (int i = num-1; i > -1; i--)
            {
                now = now.AddDays(-1);
                week[i] = now;
            }

              /*  for (int i = 0; i < 7; i++)
                Console.WriteLine(week[i].Date.ToShortDateString());*/

            Caller travel = new Caller();

            DataTable Responder = new DataTable();
            db1.Create_Connection("Calls", travel.item);
            DataTable Result = new DataTable();
            Responder = travel.item.Clone();

            for (int r = 0; r < 7; r++)
            {
                Console.WriteLine(week[r].Date.ToShortDateString() + "!!!");
                for (int i = 0; i < db1.LocalDataTable.Rows.Count; i++)
                    if (db1.LocalDataTable.Rows[i].ItemArray.GetValue(2).ToString().Contains(week[r].Date.ToShortDateString()))
                    {
                        Console.WriteLine("YES");
                        Responder.Rows.Add(db1.LocalDataTable.Rows[i].ItemArray.ToArray());
                    }

                for (int j = 0; j < Responder.Rows.Count; j++)
                {
                    Console.WriteLine(Responder.Rows[j]["Call"].ToString() + "here");

                    for (int i = 0; i < 26; i++)
                    {

                        String str = Week.Rows[i].HeaderCell.Value.ToString().Trim();

                        Console.WriteLine(Responder.Rows[j]["Call"].ToString());
                        if (Responder.Rows[j]["Call"].ToString().Contains(str))
                        {

                            Week[r,i].Value = Responder.Rows[j]["UserName"].ToString();
                        }
                    }
                }

                Responder.Clear();

            }

            db1.connect.Close();
        }