Beispiel #1
0
        private async void btnOk_Click(Object sender, EventArgs e)
        {
            if (btnPlan.Checked)
            {
                frmContractPlan frm = new frmContractPlan(userID);
                this.Close();
                frm.ShowDialog();
            }
            if (btnFatura.Checked)
            {
                try
                {
                    if (invoiceID == "")
                    {
                        MessageBox.Show("Você deve selecionar ao menos uma fatura!");
                    }
                    else
                    {
                        documentReference = db.Collection("users").Document(userID).Collection("invoices").Document(invoiceID);
                        documentSnapshot  = await documentReference.GetSnapshotAsync();

                        invoices = documentSnapshot.ConvertTo <Invoices>();
                        Query         Query     = db.Collection("plans");
                        QuerySnapshot snapshots = await Query.GetSnapshotAsync();

                        foreach (DocumentSnapshot documentSnapshot in snapshots)
                        {
                            plans = documentSnapshot.ConvertTo <Plans>();
                            if (invoices.planName.Contains(plans.name) && invoices.planName.Contains(plans.type))
                            {
                                planID = documentSnapshot.Id;
                            }
                        }
                        frmFinalizeClient frm = new frmFinalizeClient(userID, planID);
                        this.Close();
                        frm.ShowDialog();
                    }
                }
                catch
                {
                }
            }
            if (btnClient.Checked)
            {
                frmEditClient frm = new frmEditClient(userID);
                this.Close();
                frm.ShowDialog();
            }
        }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (Settings.UserRole.guest || Settings.UserRole.manager_group || Settings.UserRole.manager_raspisania || Settings.UserRole.manager_sections || Settings.UserRole.manager_trainer)
            {
                Bunifu.Snackbar.Show(this.FindForm(), "Не достаточно прав для этого действия", 3000, Snackbar.Views.SnackbarDesigner.MessageTypes.Error);
            }
            else
            {
                frmEditClient frmEdit = new frmEditClient();
                frmEdit.customerid       = int.Parse(grid.CurrentRow.Cells[0].Value.ToString());
                frmEdit.txtName.Text     = grid.CurrentRow.Cells[1].Value.ToString();
                frmEdit.txtLastName.Text = grid.CurrentRow.Cells[2].Value.ToString();
                frmEdit.txtPhone.Text    = grid.CurrentRow.Cells[3].Value.ToString();
                var str = grid.CurrentRow.Cells[4].Value.ToString();
                frmEdit.gender          = str.Replace(" ", "");
                frmEdit.txtAddress.Text = grid.CurrentRow.Cells[5].Value.ToString();
                new PopupEffect.transparentBg(this, frmEdit);

                PopulateDatatoDatagrid();
            }
        }