コード例 #1
0
ファイル: GlGenEntityViewModel.cs プロジェクト: Osama91/CCWFM
        public void SaveOldDetailRow(TblGlGenEntityViewModel oldRow)
        {
            if (oldRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(oldRow,
                                                          new ValidationContext(oldRow, null, null), valiationCollection, true);

                if (isvalid)
                {
                    var save = oldRow.Iserial == 0;
                    if (AllowUpdate != true && !save)
                    {
                        MessageBox.Show(strings.AllowUpdateMsg);
                        return;
                    }
                    var saveRow = new TblGlGenEntity();
                    saveRow.InjectFrom(oldRow);

                    if (SelectedMainRow != null && SelectedMainRow.DetailsList != null)
                    {
                        Glclient.UpdateOrInsertTblGlGenEntityAsync(saveRow, save, SelectedMainRow.DetailsList.IndexOf(oldRow),
                                                                   LoggedUserInfo.DatabasEname);
                    }
                }
            }
        }
コード例 #2
0
ファイル: GlGenEntityViewModel.cs プロジェクト: Osama91/CCWFM
        public void SaveDetailRow()
        {
            if (SelectedDetailRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedDetailRow,
                                                          new ValidationContext(SelectedDetailRow, null, null), valiationCollection, true);

                if (isvalid)
                {
                    var save = SelectedDetailRow.Iserial == 0;
                    if (SelectedDetailRow.TblGlGenEntityGroup == 0)
                    {
                        SelectedDetailRow.TblGlGenEntityGroup = SelectedMainRow.Iserial;
                    }
                    if (AllowUpdate != true && !save)
                    {
                        MessageBox.Show(strings.AllowUpdateMsg);
                        return;
                    }
                    var rowToSave = new TblGlGenEntity();
                    rowToSave.InjectFrom(SelectedDetailRow);

                    Glclient.UpdateOrInsertTblGlGenEntityAsync(rowToSave, save,
                                                               SelectedMainRow.DetailsList.IndexOf(SelectedDetailRow), LoggedUserInfo.DatabasEname);
                }
            }
        }