private void dgOutsoleMaterial_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            OutsoleRawMaterialViewModel outsoleRawMaterialView = e.Row.Item as OutsoleRawMaterialViewModel;

            if (outsoleRawMaterialView == null)
            {
                return;
            }
            int columnIndex = e.Column.DisplayIndex;

            if (colDatetimeList.Contains(columnIndex))
            {
                TextBox  txtElement = (TextBox)e.EditingElement as TextBox;
                DateTime etd        = TimeHelper.Convert(txtElement.Text);
                if (String.IsNullOrEmpty(txtElement.Text) == false && etd == dtNothing)
                {
                    txtElement.Foreground = Brushes.Red;
                    txtElement.Text       = "!";
                    txtElement.SelectAll();
                }
                else
                {
                    outsoleRawMaterialView.ETDReal = etd;
                }
            }
        }
        private void btnAddMore_Click(object sender, RoutedEventArgs e)
        {
            OutsoleRawMaterialViewModel outsoleRawMaterialView = new OutsoleRawMaterialViewModel
            {
                Supplier = outsoleSupplierList.FirstOrDefault(),
                ETD      = "",
            };

            outsoleRawMaterialViewList.Add(outsoleRawMaterialView);
            dgOutsoleMaterial.ItemsSource = null;
            dgOutsoleMaterial.ItemsSource = outsoleRawMaterialViewList;
        }
        private void bwLoadData_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            colSuppliers.ItemsSource = outsoleSupplierList;
            foreach (OutsoleRawMaterialModel outsoleRawMaterial in outsoleRawMaterialList)
            {
                OutsoleRawMaterialViewModel outsoleRawMaterialView = new OutsoleRawMaterialViewModel
                {
                    Supplier = outsoleSupplierList.Where(o => o.OutsoleSupplierId == outsoleRawMaterial.OutsoleSupplierId).FirstOrDefault(),
                    ETD      = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", outsoleRawMaterial.ETD),
                    ETDReal  = outsoleRawMaterial.ETD,
                };

                outsoleRawMaterialViewList.Add(outsoleRawMaterialView);
            }
            dgOutsoleMaterial.ItemsSource = null;
            dgOutsoleMaterial.ItemsSource = outsoleRawMaterialViewList;
            btnAddMore.IsEnabled          = true;
            btnSave.IsEnabled             = true;
            this.Cursor = null;
        }