Exemple #1
0
 private void detach_schedule(schedule entity)
 {
     this.SendPropertyChanging();
     entity.activities = null;
 }
Exemple #2
0
 partial void Deleteschedule(schedule instance);
Exemple #3
0
 partial void Updateschedule(schedule instance);
Exemple #4
0
 private void detach_schedule(schedule entity)
 {
     this.SendPropertyChanging();
     entity.employees = null;
 }
Exemple #5
0
 partial void Insertschedule(schedule instance);
        protected void Button3_Click(object sender, EventArgs e) //FINISH
        {
            if (StartTimeTXT.Text != "")
            {
                //--------panel
                Button2.Enabled = false; //pause locked
                Button1.Enabled = true;  //start/continue locked
                Button1.Text    = "Начать работать";

                Button1.CssClass = "panel-btn panel-btn--active";
                Button2.CssClass = "panel-btn panel-btn--blocked";

                startTime = Convert.ToDateTime(StartTimeTXT.Text);

                TimeSpan eightT = new TimeSpan(8, 0, 0);

                try
                {
                    finishTime = Convert.ToDateTime(PauseTimeTXT.Text);
                    workTime   = TimeSpan.Parse(WorkTimeTXT.Text);
                    //workTime = new TimeSpan(15, 0, 0);

                    if (TextBox1.Text == "")
                    {
                        throw new Exception("emptyField");
                    }

                    //if (workTime > eightT)
                    //{
                    //    throw new Exception("moreThanEight");
                    //}
                }
                catch (Exception eR)
                {
                    if (eR.ToString() == "emptyField")
                    {
                        finishTime       = getTime();
                        workTime        += finishTime - startTime;
                        WorkTimeTXT.Text = workTime.ToString("hh':'mm':'ss");//FINISH TIME
                        TextBox1.Text    = "Без названия";
                    }

                    //if (eR.ToString() == "moreThanEight")
                    //{
                    //    workTime = new TimeSpan(8, 0, 0);

                    //}
                }

                if (workTime > eightT)
                {
                    workTime = new TimeSpan(8, 0, 0);
                }


                //TO DATABASE
                employeesDataContextDataContext db = new employeesDataContextDataContext();
                int id_empl = Convert.ToInt32(Server.UrlDecode(Request.QueryString["id"].ToString()));

                schedule NewSchedule = new schedule();

                TimeSpan startTimetoDB  = TimeSpan.Parse(startTime.ToLongTimeString());
                TimeSpan finishTimetoDB = TimeSpan.Parse(finishTime.ToLongTimeString());
                DateTime daTEtoDB       = DateTime.Today;

                NewSchedule.employes_id          = id_empl;
                NewSchedule.data                 = daTEtoDB;
                NewSchedule.started_to_work_time = startTimetoDB;
                NewSchedule.ended_to_work_time   = finishTimetoDB;
                NewSchedule.activity_id          = Convert.ToInt32(DropDownList1.Text);
                NewSchedule.work_hours           = workTime;
                NewSchedule.name_of_theme        = TextBox1.Text;

                //Insert new record in tblmembers
                db.schedule.InsertOnSubmit(NewSchedule);
                //Update table
                db.SubmitChanges();


                //reset TXT
                StartTimeTXT.Text = "";
                PauseTimeTXT.Text = "";
                WorkTimeTXT.Text  = "";

                //-------lecture+activity
                DropDownList1.Enabled       = true;
                DropDownList1.SelectedIndex = 0;
                TextBox1.Enabled            = true;
                TextBox1.Text = "";
            }
        }