예제 #1
0
        public AJob(PlanItem job)
        {
            InitializeComponent();

            cbStatus.DataSource = PlanItem.ListStatus;

            this.Job = job;

            ShowInfo();
        }
예제 #2
0
        private void mnsiAddJob_Click(object sender, EventArgs e)
        {
            PlanItem item = new PlanItem()
            {
                Date = dtpkDate.Value
            };

            Job.Job.Add(item);
            AddJob(item);
        }
예제 #3
0
        private void mnstripItemPlan_Click(object sender, EventArgs e)
        {
            PlanItem item = new PlanItem()
            {
                planDate = dateTimePicker.Value
            };

            data.plans.Add(item);
            AddPlanItem(item);
        }
예제 #4
0
        public EditEvent(PlanData planData, GroupPlanItem group, PlanItem item)
            :
            base(planData)
        {
            InitializeComponent();

            this.group         = group;
            this.item          = item;
            this.title.Text    = item.title;
            this.location.Text = item.location;
            this.notes.Text    = item.note;

            this.Day_Start.Text    = item.startTime.Day.ToString();
            this.Month_Start.Text  = item.startTime.Month.ToString();
            this.Year_Start.Text   = item.startTime.Year.ToString();
            this.Hour_Start.Text   = item.startTime.Hour.ToString();
            this.Minute_Start.Text = item.startTime.Minute.ToString();

            this.Day_End.Text    = item.endTime.Day.ToString();
            this.Month_End.Text  = item.endTime.Month.ToString();
            this.Year_End.Text   = item.endTime.Year.ToString();
            this.Hour_End.Text   = item.endTime.Hour.ToString();
            this.Minute_End.Text = item.endTime.Minute.ToString();

            this.Repeat.SelectedIndex = group.repeatKind;
            if (group.repeatKind == 5)
            {
                repeatValue.Text = group.repeatValue.ToString();
            }

            this.Day_RepeatEnd.Text   = group.repeatEnd.Day.ToString();
            this.Month_RepeatEnd.Text = group.repeatEnd.Month.ToString();
            this.Year_RepeatEnd.Text  = group.repeatEnd.Year.ToString();

            this.priority.SelectedIndex = (int)item.priority;

            TimeSpan ts = item.startTime - item.alert;

            if (ts.Hours == 1)
            {
                this.alert.SelectedIndex = 0;
            }
            else if (ts.Minutes == 30)
            {
                this.alert.SelectedIndex = 1;
            }
            else if (ts.Minutes == 15)
            {
                this.alert.SelectedIndex = 2;
            }
            else
            {
                this.alert.SelectedIndex = 3;
            }
        }
예제 #5
0
 public AddJob(Socket client, DateTime dateTime)
 {
     _userBO     = new User_BO();
     _planItemBO = new PlanItem_BO();
     _client     = client;
     _dateTime   = dateTime;
     InitializeComponent();
     Load_User();
     cb_status.DataSource    = PlanItem.ListStatus;
     cb_status.SelectedIndex = 0;
     _plan_Item = null;
 }
예제 #6
0
        public void EditPlanItem(PlanItem item)
        {
            var tmp = context.PlanItems.FirstOrDefault(o => o.PlanItemId == item.PlanItemId);

            tmp.Status         = item.Status;
            tmp.Job            = item.Job;
            tmp.UserID         = item.UserID;
            tmp.EstimateHour   = item.EstimateHour;
            tmp.EstimateMinute = item.EstimateMinute;
            tmp.JobContent     = item.JobContent;
            context.SaveChanges();
        }
예제 #7
0
 public AddJob(Socket client, DateTime dateTime, PlanItem planItem)
 {
     _userBO     = new User_BO();
     _planItemBO = new PlanItem_BO();
     _client     = client;
     _dateTime   = dateTime;
     _plan_Item  = planItem;
     InitializeComponent();
     cb_status.DataSource = PlanItem.ListStatus;
     Load_User();
     Show();
     cb_status.DataSource = PlanItem.ListStatus;
 }
예제 #8
0
        public AJob(PlanItem job, int userId, Socket client)
        {
            InitializeComponent();
            Client = client;
            UserId = userId;
            cbStatus.DataSource = PlanItem.ListStatus;

            this.Job = job;

            ShowInfo();
            context2 = new User_BO();
            context  = new PlanItem_BO();
        }
예제 #9
0
 private void btn_save_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (_plan_Item == null)
         {
             var      user     = _userBO.GetUserFromUserName(combo_user.SelectedItem.ToString());
             PlanItem planItem = new PlanItem();
             planItem.Date           = _dateTime;
             planItem.Job            = tb_job_name.Text;
             planItem.JobContent     = tb_job_content.Text;
             planItem.EstimateHour   = (int)nmToHours.Value;
             planItem.EstimateMinute = (int)nmtominute.Value;
             planItem.Link           = tb_link.Text;
             planItem.Status         = cb_status.SelectedItem.ToString();
             planItem.UserID         = user == null ? 0 : user.UserId;
             if (!_planItemBO.CheckPlanItem(planItem))
             {
                 MessageBox.Show("Hãy chọn đũ các trường bắt buộc.");
                 return;
             }
             _planItemBO.AddPlanItem(planItem);
             _client.Send(Serialize(string.Format("Admin,{0},{1}", user.UserName, planItem.Job)));
         }
         else
         {
             var user = _userBO.GetUserFromUserName(combo_user.SelectedItem.ToString());
             _plan_Item.Date           = _dateTime;
             _plan_Item.Job            = tb_job_name.Text;
             _plan_Item.JobContent     = tb_job_content.Text;
             _plan_Item.EstimateHour   = (int)nmToHours.Value;
             _plan_Item.EstimateMinute = (int)nmtominute.Value;
             _plan_Item.Link           = tb_link.Text;
             _plan_Item.Status         = cb_status.SelectedItem.ToString();
             _plan_Item.UserID         = user == null ? 0 : user.UserId;
             if (!_planItemBO.CheckPlanItem(_plan_Item))
             {
                 MessageBox.Show("Hãy chọn đũ các trường bắt buộc.");
                 return;
             }
             this.D.Invoke(_plan_Item);
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     catch (Exception)
     {
         MessageBox.Show("Hãy chọn đũ các trường bắt buộc.");
     }
 }
예제 #10
0
        public AJobAdmin(PlanItem job, Socket client)
        {
            _user_BO    = new User_BO();
            _planItemBo = new PlanItem_BO();
            InitializeComponent();
            Client = client;
            cbStatus.DataSource = PlanItem.ListStatus;
            Load_User();

            this.Job = job;

            ShowInfo();

            context = new PlanItem_BO();
        }
예제 #11
0
 public void Change(PlanItem oldItem, PlanItem newItem)
 {
     data.Remove(oldItem);
     data.Add(newItem);
 }
예제 #12
0
        public void DeleteItemAndFollowing(PlanItem item)
        {
            int index = data.IndexOf(item);

            data.RemoveRange(index, data.Count - index);
        }
예제 #13
0
 public void Delete(PlanItem item)
 {
     data.Remove(item);
 }
예제 #14
0
 public void Insert(PlanItem item)
 {
     data.Add(item);
 }
예제 #15
0
 public void AddPlanItem(PlanItem item)
 {
     context.PlanItems.Add(item);
     context.SaveChanges();
 }