예제 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            // get service price from helpdesk service price //
            HelperMethods methods      = new HelperMethods();
            int           servicePrice = methods.GetServicePrice(txbx_id_service.Text);

            // get current balance  //
            ArrayList currentPrices = CardDetailsDB.GetAllCardData();
            int       balance       = methods.GetCurrentBalance();

            // operation with balance //
            int changedCurrentPrice = 0;

            if (balance >= servicePrice)
            {
                changedCurrentPrice = balance - servicePrice;
                balance             = changedCurrentPrice;

                user_current_money.Text = Convert.ToString(changedCurrentPrice) + " AZN";
                foreach (CardModel prices in currentPrices)
                {
                    prices.CardPrice = Convert.ToString(balance);
                }
                MessageBox.Show("Xidmət sifariş olundu" + "\n" + "Əməkdaşlar sizinlə əlaqə saxlıyacaq");
                // hide elements when id btn clicks //
                lbl_service_idText.Visible = false;
                txbx_id_service.Visible    = false;
                btn_buy_service.Visible    = false;
            }
            else
            {
                MessageBox.Show("Balansınızda kifayyət qədər məbləğ yoxdur" + "\n" + "Zəhmət olmasa balansı artırın");
            }
        }
예제 #2
0
        private void HelpdeskServiceForm_Load(object sender, EventArgs e)
        {
            // loads all services from services database //
            ArrayList services = ServicesDB.GetAllServices();

            foreach (Services_Model service in services)
            {
                lbl_helpdesk_serviceName.Text  += service.Service_Name + "\n \n";
                lbl_helpdesk_servicePrice.Text += service.Service_Price + "\n \n";
                lbl_helpdesk_serviceID.Text    += service.Service_ID + "--" + "\n \n";
            }

            //get user current money from database//
            ArrayList cards = CardDetailsDB.GetAllCardData();

            foreach (CardModel card in cards)
            {
                user_current_money.Text = card.CardPrice;
            }

            // hide elements when helpdesk service form loads //
            lbl_service_idText.Visible = false;
            txbx_id_service.Visible    = false;
            btn_buy_service.Visible    = false;
        }
예제 #3
0
        private void btn_saleCard_Click(object sender, EventArgs e)
        {
            //writeing card details to cardModel//
            CardModel cardModel = new CardModel();

            cardModel.CardNumber     = txbx_generated_card_number.Text;
            cardModel.CardPrice      = txbx_card_price.Text;
            cardModel.CardCreate     = DateTime.Now;
            cardModel.CardExpiryDate = DateTime.Now.AddMonths(3);

            //adding card to card database//
            CardDetailsDB.AddingCard(cardModel);
            MessageBox.Show("Kart satışa çıxarıldı" + "\n" + "Istifadəçi artıq kart ilə qeydiyyatdan keçə bilər" + "\n"
                            + "Kart nömrəsi: " + txbx_generated_card_number.Text);
        }
예제 #4
0
        private void AdminManagementForm_Load(object sender, EventArgs e)
        {
            // adding card,card using date,card when created and card expiry date information to admin management form //
            ArrayList userData = UserDatabase.GetAllUsersData();

            foreach (UserModel user in userData)
            {
                lbl_when_used_date.Text = Convert.ToString(user.CardUsedTime);

                if (user.Name == null)
                {
                    lbl_card_user.Text = user.Email;
                }
                else
                {
                    lbl_card_user.Text = user.Name;
                }
            }

            // adding card details form cardDB to admin managment form //
            ArrayList cardData = CardDetailsDB.GetAllCardData();

            foreach (CardModel card in cardData)
            {
                lbl_card_create_time.Text = Convert.ToString(card.CardCreate);
                lbl_expary_date.Text      = Convert.ToString(card.CardExpiryDate);
                lbl_card_price.Text       = card.CardPrice;
                lbl_card_number.Text      = card.CardNumber;
            }

            // adding card details to cards list //
            ArrayList cardDetails = CardDetailsDB.GetAllCardData();

            foreach (CardModel card in cardDetails)
            {
                lbl_list_card_numbers.Text += card.CardNumber + "\n";
                lbl_list_card_prices.Text  += card.CardPrice + "\n";
            }

            // hide edit section when form loads //
            month_list.Visible      = false;
            years_list.Visible      = false;
            lbl_edit_name.Visible   = false;
            btn_edit_submit.Visible = false;
            days_list.Visible       = false;
            lbl_cards_list.Visible  = false;
        }
예제 #5
0
        private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // remove user from database //
            ArrayList cardData = CardDetailsDB.GetAllCardData();
            ArrayList userData = UserDatabase.GetAllUsersData();

            cardData.Clear();
            userData.Clear();

            // clearing data from labels //
            lbl_when_used_date.Text   = "";
            lbl_card_user.Text        = "";
            lbl_card_create_time.Text = "";
            lbl_expary_date.Text      = "";
            lbl_card_price.Text       = "";
            lbl_card_number.Text      = "";
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            // checking txbx values if card details contain in database payment will be successfull //
            if (BankCards.Card_Number == txbx_bank_card_number.Text && BankCards.Card_Expiry_Date == txbx_expiry_date.Text &&
                BankCards.Card_Cvc == txbx_cvc_number.Text)
            {
                // adding amount to balance //
                ArrayList cardData    = CardDetailsDB.GetAllCardData();
                int       cardBalance = Convert.ToInt32(BankCards.Card_Balance);
                int       txbxAmount  = Convert.ToInt32(txbx_payment_amount.Text);
                if (txbxAmount <= cardBalance)
                {
                    int userAmount  = 0;
                    int userBalance = 0;

                    MessageBox.Show("Ödəniş uğurlu yerinə yetirildi" + "\n" + "Zəhmət olmasa balansı yoxluyun");
                    foreach (CardModel card in cardData)
                    {
                        userAmount    += Convert.ToInt32(txbx_payment_amount.Text);
                        userBalance    = Convert.ToInt32(card.CardPrice);
                        userBalance   += userAmount;
                        card.CardPrice = Convert.ToString(userBalance) + "AZN";
                    }
                    // returnig to helpdesk service form //
                    HelpdeskServiceForm service_form = new HelpdeskServiceForm();
                    service_form.Show();
                    Visible = false;
                }
                else
                {
                    MessageBox.Show("Balansınızda kifayyət qədər məbləğ yoxdur");
                }
            }
            else
            {
                MessageBox.Show("Kartın məlumatları düzgün deyil");
            }
        }