public SetABCardAccessStartingDate()
 {
     InitializeComponent();
     this.MaximumSize = this.MinimumSize = this.Size;
     _SystemListDef = new DAO.UDT_SystemListDef();
     _bgWorker = new BackgroundWorker();
     _bgWorker.DoWork += new DoWorkEventHandler(_bgWorker_DoWork);
     _GradeYearList = new List<string>();
     _bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
 }
Beispiel #2
0
 public SetABCardAccessStartingDate()
 {
     InitializeComponent();
     this.MaximumSize              = this.MinimumSize = this.Size;
     _SystemListDef                = new DAO.UDT_SystemListDef();
     _bgWorker                     = new BackgroundWorker();
     _bgWorker.DoWork             += new DoWorkEventHandler(_bgWorker_DoWork);
     _GradeYearList                = new List <string>();
     _bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
 }
Beispiel #3
0
        private void LoadUDTDataToDataGridView()
        {
            _SystemListDef = DAO.UDTTransfer.GetSystemListByName(_ConfigName);
            int rowIdx = 0;

            _GradeYearList.Sort();
            dgStatEndDateTime.Rows.Clear();
            if (!string.IsNullOrEmpty(_SystemListDef.Content))
            {
                XElement elmRoot = XElement.Parse(_SystemListDef.Content);

                foreach (string str in _GradeYearList)
                {
                    rowIdx = dgStatEndDateTime.Rows.Add();
                    List <XElement> elm = (from data in elmRoot.Elements("Item") where data.Attribute("GradeYear").Value == str select data).ToList();

                    // 年級
                    dgStatEndDateTime.Rows[rowIdx].Cells[colGradeYear.Index].Value = str;

                    if (elm.Count == 1)
                    {
                        DateTime dtStart, dtEnd;
                        if (elm[0].Attribute(strStartDateTime) != null)
                        {
                            if (DateTime.TryParse(elm[0].Attribute(strStartDateTime).Value, out dtStart))
                            {
                                dgStatEndDateTime.Rows[rowIdx].Cells[colStartDateTime.Index].Value = dtStart.ToString(_DTFormat);
                            }
                        }

                        if (elm[0].Attribute(strEndDateTime) != null)
                        {
                            if (DateTime.TryParse(elm[0].Attribute(strEndDateTime).Value, out dtEnd))
                            {
                                dgStatEndDateTime.Rows[rowIdx].Cells[colEndDateTime.Index].Value = dtEnd.ToString(_DTFormat);
                            }
                        }
                    }
                }


                // 年級唯讀
                dgStatEndDateTime.Columns[colGradeYear.Index].ReadOnly = true;
            }
            else
            {
                foreach (string str in _GradeYearList)
                {
                    rowIdx = dgStatEndDateTime.Rows.Add();
                    // 年級
                    dgStatEndDateTime.Rows[rowIdx].Cells[colGradeYear.Index].Value = str;
                }
            }
        }
        private void LoadUDTDataToDataGridView()
        {
            _SystemListDef = DAO.UDTTransfer.GetSystemListByName(_ConfigName);
            int rowIdx = 0;
            _GradeYearList.Sort();
            dgStatEndDateTime.Rows.Clear();
            if (!string.IsNullOrEmpty(_SystemListDef.Content))
            {
                XElement elmRoot = XElement.Parse(_SystemListDef.Content);

                foreach (string str in _GradeYearList)
                {
                    rowIdx = dgStatEndDateTime.Rows.Add();
                    List<XElement> elm = (from data in elmRoot.Elements("Item") where data.Attribute("GradeYear").Value==str select data).ToList();

                    // 年級
                    dgStatEndDateTime.Rows[rowIdx].Cells[colGradeYear.Index].Value = str;

                    if (elm.Count == 1)
                    {
                        DateTime dtStart, dtEnd;
                        if (elm[0].Attribute(strStartDateTime) != null)
                        {
                            if (DateTime.TryParse(elm[0].Attribute(strStartDateTime).Value, out dtStart))
                                dgStatEndDateTime.Rows[rowIdx].Cells[colStartDateTime.Index].Value = dtStart.ToString(_DTFormat);

                        }

                        if(elm[0].Attribute(strEndDateTime) !=null)
                        {
                            if (DateTime.TryParse(elm[0].Attribute(strEndDateTime).Value, out dtEnd))
                                dgStatEndDateTime.Rows[rowIdx].Cells[colEndDateTime.Index].Value = dtEnd.ToString(_DTFormat);
                        }
                    }
                }

                // 年級唯讀
                dgStatEndDateTime.Columns[colGradeYear.Index].ReadOnly = true;
            }
            else
            {
                foreach (string str in _GradeYearList)
                {
                    rowIdx = dgStatEndDateTime.Rows.Add();
                    // 年級
                    dgStatEndDateTime.Rows[rowIdx].Cells[colGradeYear.Index].Value = str;
                }
            }
        }