Example #1
0
        public EditTitleForm(bool isNewTitle, ref DataSet.TitleRow sourceTitle, ref Credential sourceCredential)
        {
            this.sourceTitle = sourceTitle;
            this.sourceCredential = sourceCredential;
            this.isNewTitle = isNewTitle;

            InitializeComponent();

            if (isNewTitle)
            {
                this.Text = "�V�����z�M�^�C�g��";
            }
            else
            {
                this.Text = "�z�M�^�C�g����ҏW";
                lvlPublikKeyTextBox.Text = LvlKeyNotModified;
            }
            titleNameTextBox.DataBindings.Add("Text", sourceTitle, "Name");
            apnsFilePathTextBox.DataBindings.Add("Text", sourceCredential, "ApnsPkcs12FilePath");
            apnsFilePasswordTextBox.DataBindings.Add("Text", sourceCredential, "ApnsPkcs12FilePassword");
            apnsIsSandboxCheckBox.DataBindings.Add("Checked", sourceCredential, "ApnsIsSandbox");
            lvlPackageNameTextBox.DataBindings.Add("Text", sourceCredential, "LvlPackageName");
            sitePathTextBox.DataBindings.Add("Text", sourceTitle, "SiteRootPath");
            standByPathTextBox.DataBindings.Add("Text", sourceTitle, "StandByPath");
            defaultPushMessageTextBox.DataBindings.Add("Text", sourceTitle, "PushMessage");
        }
Example #2
0
        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);
                }
            }
        }
Example #3
0
        static SiteConstant()
        {
            string title = ConfigurationManager.AppSettings["TitleName"];
            if (title == null)
            {
                logger.Fatal("���̃T�C�g�̃^�C�g����web.config�ɐݒ肳��Ă��܂���B");
                IsConfigurationOK = false;
                return;
            }

            string lr = ConfigurationManager.AppSettings["LvlResponseCodeShouldBe"];
            if (lr == null || !int.TryParse(lr, out LvlResponseCodeShouldBe))
            {
                logger.Fatal("LvlResponseCodeShouldBe��web.config�ɐݒ肳��Ă��Ȃ����A�l�������ł͂���܂���B");
                IsConfigurationOK = false;
                return;
            }

            DataSet.TitleDataTable tdt;
            try
            {
                TitleTableAdapter ta = new TitleTableAdapter();
                tdt = ta.GetDataByName(title);
            }
            catch (Exception e)
            {
                logger.Fatal("�f�[�^�x�[�X�ɃA�N�Z�X�ł��܂���B�f�[�^�x�[�X�̃A�J�E���g�Ɍ������Ȃ����A�܂��͐ڑ������񂪊Ԉ���Ă��܂�", e);
                IsConfigurationOK = false;
                return;
            }
            if (tdt.Count == 0)
            {
                logger.Fatal("web.config�ɐݒ肳��Ă��邱�̃T�C�g�̃^�C�g�����f�[�^�x�[�X��ɂ͑��݂��܂���B");
                IsConfigurationOK = false;
                return;
            }

            SiteConstant.title = tdt[0];

            credential = new Credential(Title);

            IsConfigurationOK = true;
        }
Example #4
0
        private void NewTitleButton_Click(object sender, EventArgs e)
        {
            DataSet.TitleDataTable dt = new DataSet.TitleDataTable();
            DataSet.TitleRow title = dt.AddTitleRow("", "", "", "");
            Credential c = new Credential();
            using (EditTitleForm f = new EditTitleForm(true, ref title, ref c))
            {
                if (f.ShowDialog() == DialogResult.OK)
                {
                    titleTableAdapter.Update(dt);
                    CredentialTableAdapter cta = new CredentialTableAdapter();
                    DataSet.CredentialDataTable cdt = new DataSet.CredentialDataTable();
                    cdt.AddCredentialRow(title, Credential.ApnsPkcs12FilePathKind, c.ApnsPkcs12FilePath);
                    cta.Update(cdt);
                    cdt.AddCredentialRow(title, Credential.ApnsPkcs12FilePasswordKind, c.ApnsPkcs12FilePassword);
                    cta.Update(cdt);
                    cdt.AddCredentialRow(title, Credential.ApnsIsSandboxKind, c.ApnsIsSandbox.ToString());
                    cta.Update(cdt);
                    cdt.AddCredentialRow(title, Credential.LvlRsaKeyValueKind, c.LvlRsaKeyValue);
                    cta.Update(cdt);
                    cdt.AddCredentialRow(title, Credential.LvlPackageNameKind, c.LvlPackageName);
                    cta.Update(cdt);

                    this.titleTableAdapter.Fill(this.dataSet.Title);
                    MessageBox.Show("�V�����z�M�^�C�g����lj����܂���");
                }
            }
        }
Example #5
0
 public static void TestSettings(DataSet.TitleRow title)
 {
     SiteConstant.title = title;
     SiteConstant.credential = new Credential(Title);
 }