public void SaveOldDetailRow(TblGlRuleMainDetailViewModel 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 TblGlRuleMainDetail(); saveRow.InjectFrom(oldRow); if (SelectedMainRow != null && SelectedMainRow.DetailsList != null) { Glclient.UpdateOrInsertTblGlRuleMainDetailsAsync(saveRow, save, SelectedMainRow.DetailsList.IndexOf(oldRow), LoggedUserInfo.DatabasEname); } } } }
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.TblGlRuleHeader == 0) { SelectedDetailRow.TblGlRuleHeader = SelectedMainRow.Iserial; } if (AllowUpdate != true && !save) { MessageBox.Show(strings.AllowUpdateMsg); return; } var rowToSave = new TblGlRuleMainDetail(); rowToSave.InjectFrom(SelectedDetailRow); Glclient.UpdateOrInsertTblGlRuleMainDetailsAsync(rowToSave, save, SelectedMainRow.DetailsList.IndexOf(SelectedDetailRow), LoggedUserInfo.DatabasEname); } } }