Ejemplo n.º 1
0
        private void SyncTenantIntentToPurchase(ApplicationDbContext context, TenantForm tenantForm)
        {
            // Ensure that TenantIntentToPurchase Forms are added as needed
            foreach (var t in tenantForm.TenantsList)
            {
                if (t.TenantIntentToPurchase)
                {
                    // If tenant intends to purchase tenantForm unit, but the application doesn't have tenantForm purchase form, then add the form
                    if (
                        !Forms.Any(
                            x =>
                            x is TenantIntentToPurchase &&
                            ((TenantIntentToPurchase)x).IntentToPurchaseTenantName == t.TenantName))
                    {
                        Forms.Add(new TenantIntentToPurchase()
                        {
                            IntentToPurchaseTenantName = t.TenantName, IsRequired = false
                        });
                    }
                    // If tenant does intend to purchase unit, but the application has an offer form, then delete the form
                    var form =
                        Forms.FirstOrDefault(
                            x =>
                            x is TenantIntentToAcceptOfferOfLtl &&
                            ((TenantIntentToAcceptOfferOfLtl)x).IntentToAcceptOfferName == t.TenantName);
                    if (form != null)
                    {
                        Forms.Remove(form);
                        context.Forms.Remove(form);
                    }
                }
                else
                {
                    // If tenant intends to purchase tenantForm unit, but the application doesn't have an form, then add the offer form

                    if (
                        !Forms.Any(
                            x =>
                            x is TenantIntentToAcceptOfferOfLtl &&
                            ((TenantIntentToAcceptOfferOfLtl)x).IntentToAcceptOfferName == t.TenantName))
                    {
                        Forms.Add(new TenantIntentToPurchase()
                        {
                            IntentToPurchaseTenantName = t.TenantName, IsRequired = false
                        });
                    }
                    // If tenant does not intend to purchase unit, but the application has tenantForm purchase form for that tenant, then delete form
                    var form =
                        Forms.FirstOrDefault(
                            x =>
                            x is TenantIntentToPurchase &&
                            ((TenantIntentToPurchase)x).IntentToPurchaseTenantName == t.TenantName);
                    if (form != null)
                    {
                        Forms.Remove(form);
                        context.Forms.Remove(form);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUserName.Text))
            {
                txtUserName.Focus();
                MessageBox.Show("Enter your Username", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtUserName.Focus();
                return;
            }
            else if (string.IsNullOrEmpty(txtPassword.Text))
            {
                txtPassword.Focus();
                MessageBox.Show("Enter your password", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtPassword.Focus();
                return;
            }

            MySqlDataAdapter sda = new MySqlDataAdapter("SELECT * FROM login WHERE userName ='******' and password = '******'  ", conn);

            DataTable dt = new DataTable();

            sda.Fill(dt);

            if (dt.Rows.Count == 1)
            {
                TenantForm tenant = new TenantForm();
                this.Hide();
                tenant.Show();
                //((Form)main).Controls["labe1"].Text = dt.Rows[0][0].ToString();
            }
            else
            {
                MessageBox.Show("Check user name or password");
            }
        }