예제 #1
0
        private bool SaveData()
        {
            bool pass = true;

            if (CheckData())
            {
                // 刪除舊料
                if (_NationalityMappingList.Count > 0)
                {
                    UDTTransfer.UDTNationalityMappingDelete(_NationalityMappingList);
                }

                // 新增資料
                List <UDT_NationalityMapping> insertList = new List <UDT_NationalityMapping>();
                foreach (DataGridViewRow drv in dgData.Rows)
                {
                    if (drv.IsNewRow)
                    {
                        continue;
                    }

                    UDT_NationalityMapping data = new UDT_NationalityMapping();
                    data.Name     = drv.Cells[colName.Index].Value.ToString();
                    data.Eng_Name = drv.Cells[colEngName.Index].Value.ToString();
                    insertList.Add(data);
                }
                UDTTransfer.UDTNationalityMappingInsert(insertList);
                ReloadData();
            }
            else
            {
                pass = false;
                FISCA.Presentation.Controls.MsgBox.Show("畫面上資料有錯誤,請修正後再儲存!");
            }
            return(pass);
        }