public Credential(DataSet.TitleRow title) { CredentialTableAdapter ta = new CredentialTableAdapter(); foreach (DataSet.CredentialRow row in ta.GetDataByTitleId(title.Id)) { if (row.Kind == ApnsPkcs12FilePathKind) { apnsPkcs12FilePath = row.Body; } else if (row.Kind == ApnsPkcs12FilePasswordKind) { apnsPkcs12FilePassword = row.Body; } else if (row.Kind == ApnsIsSandboxKind) { apnsIsSandbox = bool.Parse(row.Body); } else if (row.Kind == LvlRsaKeyValueKind) { lvlRsaKeyValue = row.Body; } else if (row.Kind == LvlPackageNameKind) { lvlPackageName = row.Body; } } }
private void editTitleButton_Click(object sender, EventArgs e) { if (titleDataGridView.SelectedRows.Count == 0) { return; } long titleId = long.Parse(titleDataGridView.SelectedRows[0].Cells[0].Value.ToString()); DataSet.TitleRow title = titleTableAdapter.GetDataById(titleId)[0]; Credential c = new Credential(title); using (EditTitleForm f = new EditTitleForm(false, ref title, ref c)) { if (f.ShowDialog() == DialogResult.OK) { CredentialTableAdapter cta = new CredentialTableAdapter(); DataSet.CredentialDataTable cdt = cta.GetDataByTitleId(title.Id); foreach (DataSet.CredentialRow cr in cdt) { if (cr.Kind == Credential.ApnsPkcs12FilePathKind) { cr.Body = c.ApnsPkcs12FilePath; } if (cr.Kind == Credential.ApnsPkcs12FilePasswordKind) { cr.Body = c.ApnsPkcs12FilePassword; } if (cr.Kind == Credential.ApnsIsSandboxKind) { cr.Body = c.ApnsIsSandbox.ToString(); } if (cr.Kind == Credential.LvlRsaKeyValueKind) { cr.Body = c.LvlRsaKeyValue; } if (cr.Kind == Credential.LvlPackageNameKind) { cr.Body = c.LvlPackageName; } } cta.Update(cdt); this.titleTableAdapter.Update(title); this.titleTableAdapter.Fill(this.dataSet.Title); } } }