Пример #1
0
 public void SaveKeyValueItem(string ConfigName)
 {
     List<ConfigDataItem> its = new List<ConfigDataItem>();
     foreach(string key in KeyValueItemDict.Keys)
     {
         ConfigDataItem cdi = new ConfigDataItem();
         cdi.Name = key;
         cdi.Value = KeyValueItemDict[key];
         its.Add(cdi);
     }
     SetConfigDataItem(its, ConfigName);
 }
Пример #2
0
        public void SaveKeyValueItem(string ConfigName)
        {
            List <ConfigDataItem> its = new List <ConfigDataItem>();

            foreach (string key in KeyValueItemDict.Keys)
            {
                ConfigDataItem cdi = new ConfigDataItem();
                cdi.Name  = key;
                cdi.Value = KeyValueItemDict[key];
                its.Add(cdi);
            }
            SetConfigDataItem(its, ConfigName);
        }
Пример #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                // 檢查

                List<ConfigDataItem> datas = new List<ConfigDataItem>();
                // 儲存 部別
                foreach (DataGridViewRow dgvr in dgDepData.Rows)
                {
                    if (dgvr.IsNewRow)
                        continue;

                    ConfigDataItem cdi = new ConfigDataItem();
                    cdi.Name = Utility.GetDgCellValue(dgvr.Cells[colDepName.Index]);
                    cdi.Value = Utility.GetDgCellValue(dgvr.Cells[colDepValue.Index]);
                    cdi.TargetName = Utility.GetDgCellValue(dgvr.Cells[colDepTagName.Index]);
                    datas.Add(cdi);
                }
                _cd.SetConfigDataItem(datas, _ConfigDepName);

                List<ConfigDataItem> datas1 = new List<ConfigDataItem>();
                foreach(DataGridViewRow dgvr in dgClsData.Rows)
                {
                    if (dgvr.IsNewRow)
                        continue;
                    ConfigDataItem cdi = new ConfigDataItem();
                    cdi.Name = Utility.GetDgCellValue(dgvr.Cells[colClsName.Index]);
                    cdi.Value = Utility.GetDgCellValue(dgvr.Cells[colClsValue.Index]);
                    cdi.TargetName = Utility.GetDgCellValue(dgvr.Cells[colDepTagName.Index]);
                    datas1.Add(cdi);
                }
                _cd.SetConfigDataItem(datas1, _ConfigClsName);

                MsgBox.Show("儲存完成");
                this.Close();
            }
            catch(Exception ex)
            {
                MsgBox.Show("儲存過程發生錯誤," + ex.Message);
            }
        }
Пример #4
0
        private List <ConfigDataItem> ConvertXMLStrToItem(string content)
        {
            List <ConfigDataItem> value = new List <ConfigDataItem>();

            try
            {
                XElement elmRoot = XElement.Parse(content);
                foreach (XElement elm in elmRoot.Elements("Item"))
                {
                    ConfigDataItem item = new ConfigDataItem();
                    item.Name       = GetXmlAttributeString(elm, "Name");
                    item.Value      = GetXmlAttributeString(elm, "Value");
                    item.TargetName = GetXmlAttributeString(elm, "TargetName");
                    value.Add(item);
                }
            }
            catch (Exception ex)
            {
            }
            return(value);
        }
Пример #5
0
 private List<ConfigDataItem> ConvertXMLStrToItem(string content)
 {
     List<ConfigDataItem> value = new List<ConfigDataItem>();
     try
     {
         XElement elmRoot = XElement.Parse(content);
         foreach(XElement elm in elmRoot.Elements("Item"))
         {
             ConfigDataItem item = new ConfigDataItem();
             item.Name = GetXmlAttributeString(elm, "Name");
             item.Value = GetXmlAttributeString(elm, "Value");
             item.TargetName = GetXmlAttributeString(elm, "TargetName");
             value.Add(item);
         }
     }
     catch (Exception ex)
     {
     }
     return value;
 }
Пример #6
0
        private void SavePeriodDg()
        {
            _PeriodList.Clear();
            try
            {
                List<ConfigDataItem> dataList = new List<ConfigDataItem>();
                foreach (DataGridViewRow drv in dgPerdata.Rows)
                {
                    if (drv.IsNewRow)
                        continue;

                    ConfigDataItem cdi = new ConfigDataItem();
                    cdi.Name = Utility.GetDgCellValue(drv.Cells[colPerName.Index]);
                    cdi.TargetName = Utility.GetDgCellValue(drv.Cells[colPerType.Index]);
                    dataList.Add(cdi);
                    _PeriodList.Add(cdi.TargetName);
                }
                _cd.SetConfigDataItem(dataList, _ConfigName2);
            }catch(Exception ex)
            {
                MsgBox.Show("儲存節次發生錯誤," + ex.Message);
            }
        }
Пример #7
0
        private void SaveAbsenceDg()
        {
            _AbsenceDict.Clear();
            try
            {
                List<ConfigDataItem> dataList = new List<ConfigDataItem>();
                foreach (DataGridViewRow drv in dgData.Rows)
                {
                    if (drv.IsNewRow)
                        continue;

                    ConfigDataItem cdi = new ConfigDataItem();
                    cdi.Name = Utility.GetDgCellValue(drv.Cells[colName.Index]);
                    cdi.Value = Utility.GetDgCellValue(drv.Cells[colValue.Index]);
                    cdi.TargetName = Utility.GetDgCellValue(drv.Cells[colType.Index]);
                    dataList.Add(cdi);

                    if(!_AbsenceDict.ContainsKey(cdi.TargetName))
                        _AbsenceDict.Add(cdi.TargetName,cdi.Value);
                }
                _cd.SetConfigDataItem(dataList, _ConfigName1);
            }catch(Exception ex)
            {
                MsgBox.Show("儲存假別發生錯誤," + ex.Message);
            }
        }
        private void SaveDgData()
        {
            List<ConfigDataItem> datas = new List<ConfigDataItem>();
            foreach (DataGridViewRow dgvr in dgClassName.Rows)
            {
                if (dgvr.IsNewRow)
                    continue;

                ConfigDataItem cdi = new ConfigDataItem();
                cdi.Name = Utility.GetDgCellValue(dgvr.Cells[colClassName.Index]);
                cdi.Value = Utility.GetDgCellValue(dgvr.Cells[colSpecClassName.Index]);
                datas.Add(cdi);
            }
            _cd.SetConfigDataItem(datas, _ConfigClassName);
        }