private void MiCancel_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show(string.Format("Confirm Cancel ?\nBạn có chắc muốn hủy ?"), this.Title, MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK)
     {
         return;
     }
     try
     {
         var confirmListByPO = btnConfirm.Tag as List <OutsoleMaterialConfirmWorkingCartModel>;
         if (confirmListByPO == null)
         {
             return;
         }
         confirmListByPO.ForEach(f => f.IsConfirm = false);
         foreach (var model in confirmListByPO)
         {
             OutsoleMaterialController.UpdateOSMaterial(model, 1);
         }
         loadSizeNoList(confirmListByPO);
         txtIndexNo.Focus();
         txtIndexNo.SelectAll();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
 }
        private void Confirm()
        {
            try
            {
                if (doMode == DoMode.Confirm)
                {
                    var confirmList = btnConfirm.Tag as List <OutsoleMaterialConfirmWorkingCartModel>;
                    if (confirmList == null || confirmList.Count() == 0)
                    {
                        return;
                    }
                    confirmList.ForEach(f => f.IsConfirm = true);
                    foreach (var model in confirmList)
                    {
                        OutsoleMaterialController.UpdateOSMaterial(model, 1);
                    }
                    MessageBox.Show("Confirmed !\nĐã xác nhận !", this.Title, MessageBoxButton.OK, MessageBoxImage.Information);
                    loadSizeNoList(confirmList);
                    loadReadyToRelease(confirmList);
                }
                else if (doMode == DoMode.Release)
                {
                    var obj = btnConfirm.Tag as object[];
                    if (obj == null)
                    {
                        return;
                    }

                    var confirmByPOList     = obj[0] as List <OutsoleMaterialConfirmWorkingCartModel>;
                    var releaseSelectedList = obj[1] as List <OutsoleMaterialConfirmWorkingCartModel>;

                    if (releaseSelectedList.Count() == 0)
                    {
                        return;
                    }

                    foreach (var cf in confirmByPOList)
                    {
                        var rlItem = releaseSelectedList.FirstOrDefault(f => f.OSCheckingID == cf.OSCheckingID);
                        if (rlItem != null)
                        {
                            cf.IsRelease    = true;
                            cf.ReleasedTime = rlItem.ReleasedTime;
                        }
                    }
                    foreach (var updateModel in releaseSelectedList)
                    {
                        OutsoleMaterialController.UpdateOSMaterial(updateModel, 2);
                    }

                    MessageBox.Show("Released !\nĐã phát hàng !", this.Title, MessageBoxButton.OK, MessageBoxImage.Information);
                    loadWorkingCart(confirmByPOList);
                    releaseSelectedList.Clear();
                }
                txtIndexNo.Focus();
                txtIndexNo.SelectAll();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }