Пример #1
0
 private bool SpellCheck()
 {
     HideErrorMark();
     if (comboBox1.Text.Length < 3)
     {
         label11.Visible = true;
         return(false);
     }
     if (textBox1.Text.Length < 3)
     {
         label8.Visible = true;
         return(false);
     }
     if (CalcDate.DaysDiff(dateTimePicker1.Value, DateTime.Now) < (-31) || CalcDate.DaysDiff(dateTimePicker1.Value, DateTime.Now) > 365)
     {
         label9.Visible = true;
         return(false);
     }
     if (CalcDate.DaysDiff(dateTimePicker2.Value, DateTime.Now) < (-365) || CalcDate.DaysDiff(dateTimePicker2.Value, DateTime.Now) > 1)
     {
         label10.Visible = true;
         return(false);
     }
     HideErrorMark();
     return(true);
 }
Пример #2
0
        private void ShowTasks()
        {
            UnregisterEventDGV1();
            dataGridView1.Visible = false;
            dataGridView1.Rows.Clear();
            int        index     = 0;
            List <int> numSlaves = new List <int>();

            foreach (Employees currExecutor in allExecutors)
            {
                numSlaves.Add(currExecutor.ID);
            }
            if (numSlaves.Count > 0)
            {
                string            strInSlaves = string.Join(",", numSlaves.Select(x => x.ToString()).ToArray());
                DataRowCollection drcTasks    = db2.GetTasksForSlave(strInSlaves, currentShowMadeTask, glb.employeeID);
                if (drcTasks.Count > 0)
                {
                    foreach (DataRow dr in drcTasks)
                    {
                        //if (dr["ISDELETE"].ToString().Equals("0"))
                        {
                            string dtDateInit   = GetShortDateOnly(dr["DATEINIT"].ToString());
                            string dtDeadLine   = GetShortDateOnly(dr["DEADLINE"].ToString());
                            string dtMakeDate   = GetShortDateOnly(dr["MAKEDATE"].ToString());
                            string dtCommitDate = GetShortDateOnly(dr["COMMITDATE"].ToString());
                            string dtDateDoc    = GetShortDateOnly(dr["DATEDOC"].ToString());
                            string priority     = "нормальний";
                            if (dr["PRIORITY"].ToString().Equals("1"))
                            {
                                priority = "високий";
                            }
                            if (dr["PRIORITY"].ToString().Equals("2"))
                            {
                                priority = "терміново";
                            }

                            index = dataGridView1.Rows.Add(dr["ID"].ToString(),
                                                           dr["SUBJECT"].ToString(),
                                                           dr["SHORTDESCRIPTION"].ToString(),
                                                           dr["SLAVEFIO"].ToString(),
                                                           dtDateInit,
                                                           dtDeadLine,
                                                           dtMakeDate,
                                                           dr["MAKETASK"],
                                                           dr["MASTERFIO"].ToString(),
                                                           dtCommitDate,
                                                           dr["COMMITMAKE"],
                                                           priority,
                                                           dtDateDoc,
                                                           dr["NUMBERDOC"].ToString(),
                                                           dr["EXECUTORID"].ToString(),
                                                           dr["MANAGERID"].ToString());
                            if (dr["COMMITMAKE"].ToString().Equals("0")) //завдання не виконано
                            {
                                int daysDiff = CalcDate.DaysDiffNow(dtDeadLine);
                                if (daysDiff < 0)
                                {
                                    dataGridView1.Rows[index].DefaultCellStyle.ForeColor = Color.Red;
                                }
                                else if (daysDiff < 7)
                                {
                                    dataGridView1.Rows[index].DefaultCellStyle.ForeColor = Color.Green;
                                }
                                else
                                {
                                    dataGridView1.Rows[index].DefaultCellStyle.ForeColor = Color.Blue;
                                }
                            }
                            else
                            {
                                dataGridView1.Rows[index].DefaultCellStyle.ForeColor = Color.Black;
                            }
                        }
                    }
                }
            }
            dataGridView1.Visible = true;
            RegisterEventsDGV1();
        }