示例#1
0
 /// <summary>
 /// This function used to changed enabled and visible.
 /// This function used to calculate and write price ,tax and cargo amount.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void Invoice_Load(object sender, EventArgs e)
 {
     chkFirstAddress.Checked = true;
     txtAddress.Text         = LoginedCustomer.getInstance().User.Address;
     txtAddress.Enabled      = false;
     chkCreditCard.Checked   = true;
     pnlCreditCard.Visible   = true;
     pnlTransfer.Visible     = false;
     pnlVerification.Visible = false;
     chkboxMNGCargo.Checked  = true;
     for (int i = 0; i < StoreMainScreen.shoppingCards.Count; i++)
     {
         if (StoreMainScreen.shoppingCards[i].CustomerID == LoginedCustomer.getInstance().User.CustomerId)
         {
             temp = StoreMainScreen.shoppingCards[i];
             break;
         }
     }
     price          = temp.PaymentAmount;
     lblPrice.Text += price.ToString() + "₺";
     tax            = price * (0.18);
     lblTax.Text   += tax.ToString() + "₺";
     if (price >= 75)
     {
         cargoAmount = 0;
     }
     else
     {
         cargoAmount = mngCargo;
     }
     lblCargoPrice.Text = "Cargo Price: " + cargoAmount.ToString() + "₺";
     totalPrice         = price + tax + cargoAmount;
     lblTotal.Text      = "Total (with Tax): " + totalPrice.ToString() + "₺";
 }
示例#2
0
        /// <summary>
        /// This function includes Place order button click operation and send the email for verication code.
        /// </summary>
        /// <returns> This function does not return a value </returns>
        private void btnPlaceOrder_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnPlaceOrder.Text, DateTime.Now);
            if (chkCreditCard.Checked)
            {
                if (!(mtxtboxCardNumber.MaskFull || mtxtboxCVV.MaskFull || cmbMonth.Text == "" || cmbYear.Text == ""))
                {
                    MessageBox.Show("Please enter empty fields!");
                    return;
                }
                if (!System.Text.RegularExpressions.Regex.IsMatch(txtboxNameOnCard.Text, "^[a-zA-Z ]"))
                {
                    MessageBox.Show("Please enter valid name!");
                    return;
                }
            }
            //if address email telefon no control et
            DialogResult dr = MessageBox.Show("Your order will be placed. Do you want to proceed?", "Info",
                                              MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (dr == DialogResult.OK)
            {
                Random random = new Random();
                verificationCode = random.Next(1000, 9999);
                string mailMessage = "#" + (StoreMainScreen.orderList.Count + 1).ToString() + " order will be placed." + Environment.NewLine +
                                     "Please enter code shown below" + Environment.NewLine + verificationCode.ToString();
                if (SendMail(mailMessage))
                {
                    pnlVerification.Visible = true;
                }
            }
        }
示例#3
0
 /// <summary>
 /// This function used to check changed for address therefore textbox not enabled .
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void chkFirstAddress_CheckedChanged(object sender, EventArgs e)
 {
     if (chkFirstAddress.Checked)
     {
         txtAddress.Text          = LoginedCustomer.getInstance().User.Address;
         txtAddress.Enabled       = false;
         chkSecondAddress.Checked = false;
     }
 }
示例#4
0
 /// <summary>
 /// This function includes Verify button click operation and the IsVerify function is called.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void btnVerify_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnVerify.Text, DateTime.Now);
     if (mtxtboxVerificationCode.Text.Length < 16)
     {
         MessageBox.Show("Please enter verification code correctly!");
         return;
     }
     IsVerify(verificationCode);
 }
示例#5
0
 /// <summary>
 /// This function used to hold email information .
 /// </summary>
 /// <param name="message">The message string hold the verication code.</param>
 /// <returns>If the email is sent successfully, the return value is correct. </returns>
 private bool SendMail(string message)
 {
     try
     {
         MailMessage mail       = new MailMessage();
         SmtpClient  smtpServer = new SmtpClient("smtp.gmail.com");
         mail.From = new MailAddress("*****@*****.**");
         mail.To.Add(LoginedCustomer.getInstance().User.Email);
         mail.Subject           = "#" + (StoreMainScreen.orderList.Count + 1).ToString() + " Order Verification Code";
         mail.Body              = message;
         smtpServer.Port        = 587;
         smtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "fgjuzkjfdwihovpb");
         smtpServer.EnableSsl   = true;
         smtpServer.Send(mail);
         return(true);
     }
     catch
     {
         MessageBox.Show("Something went wrong!");
         return(false);
     }
 }
示例#6
0
        /// <summary>
        /// It uses for order's status for shipped.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnShip_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnShip.Text, DateTime.Now);
            DialogResult dr = MessageBox.Show("Are you sure?", "Information",
                                              MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (dr == DialogResult.Cancel)
            {
                return;
            }
            designs[selectedIndex].Card.Status = OrderStatus.shipped;
            designs[selectedIndex].SetStatus   = "Status: Shipped";
            foreach (ShoppingCard order in StoreMainScreen.orderList)
            {
                if (order.OID == designs[selectedIndex].Card.OID)
                {
                    order.Status = OrderStatus.shipped;
                    UtilUpdate.UpdateOrder(order);
                }
            }
            flpOrders.Refresh();
            btnCancel.Enabled = false;
            btnShip.Enabled   = false;
        }
示例#7
0
 /// <summary>
 /// This function includes continue shopping button click operation and show the store main screen.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void btnContinueShopping_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnContinueShopping.Text, DateTime.Now);
     StoreMainScreen.storeMainScreen.Show();
     this.Hide();
 }