protected void btnCreate_Click(object sender, EventArgs e)
        {
            DurationSystems du = new DurationSystems();
            du.StartDate = txtStartDate.Date;
            du.EndDate = txtEndDate.Date;
            var q = (from p in db.DurationSystems
                     orderby p.DurationId descending
                     select p).First();

            du.Organize = q.Organize;
            du.SelfDev = q.SelfDev;
            du.Professional = q.Professional;
            du.TeamWork = q.TeamWork;
            du.Communicate = q.Communicate;
            du.Mind = q.Mind;

            du.WorkLoad_Lv_2 = q.WorkLoad_Lv_2;
            du.WorkLoad_Lv_3 = q.WorkLoad_Lv_3;
            du.WorkLoad_Lv_4 = q.WorkLoad_Lv_4;
            du.WorkLoad_Lv_5 = q.WorkLoad_Lv_5;

            db.DurationSystems.InsertOnSubmit(du);
            db.SubmitChanges();
        }
 partial void DeleteDurationSystems(DurationSystems instance);
 partial void InsertDurationSystems(DurationSystems instance);
 partial void UpdateDurationSystems(DurationSystems instance);
Esempio n. 5
0
        private int SetDurationId()
        {
            int durationId;
            try
            {
                durationId = dm.getDurationId();
            }
            catch (Exception)
            {
                DurationDataContext dr = new DurationDataContext();
                var q = (from p in dr.DurationSystems
                         orderby p.DurationId descending
                    select p).First();

                DurationSystems newDr = new DurationSystems();
                newDr.StartDate = q.EndDate.AddDays(1);
                newDr.EndDate = newDr.StartDate.AddMonths(6);

                newDr.Organize = q.Organize;
                newDr.SelfDev = q.SelfDev;
                newDr.Professional = q.Professional;
                newDr.Communicate = q.Communicate;
                newDr.Mind = q.Mind;
                newDr.TeamWork = q.TeamWork;

                newDr.WorkLoad_Lv_2 = q.WorkLoad_Lv_2;
                newDr.WorkLoad_Lv_3 = q.WorkLoad_Lv_3;
                newDr.WorkLoad_Lv_4 = q.WorkLoad_Lv_4;
                newDr.WorkLoad_Lv_5 = q.WorkLoad_Lv_5;

                dr.DurationSystems.InsertOnSubmit(newDr);
                dr.SubmitChanges();

                var newq = (from p in dr.DurationSystems
                         orderby p.DurationId descending
                         select p).First();

                durationId = newq.DurationId;
            }

            return durationId;
        }