Professional Documents
Culture Documents
Assignment # 2
namespace Assignment2FACADE
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
public class AutoClosingMessageBox
{
System.Threading.Timer _timeoutTimer;
string _caption;
AutoClosingMessageBox(string text, string caption, int timeout)
{
_caption = caption;
_timeoutTimer = new System.Threading.Timer(OnTimerElapsed,
null, timeout, System.Threading.Timeout.Infinite);
using (_timeoutTimer)
MessageBox.Show(text, caption);
}
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 1
Visual Programming
{
_username.ValidateUser(UserName, Password);
}
public void CreditcardConfirmation(string cardNum, string ccv, string
datem,string datey)
{
_creditcard.ValidateCreditcard(cardNum, ccv, datem, datey);
}
public void PaymentVerification(double total)
{
_payamount.CreditLimit(total);
}
}
class Username
{
public void ValidateUser(string userName, string password)
{
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 2
Visual Programming
ob8.BtnSignout.Visible = true;
Form2 ob7 = (Form2)Application.OpenForms["Form2"];
ob7.Close();
}
else
{
MessageBox.Show("Enter wrong credentials");
}
class Creditcard
{
}
else
MessageBox.Show("Invalid Credit Card");
}
class Payamount
{
public void CreditLimit(double PayAmount)
{
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 3
Visual Programming
ob7.BtnPayNow.Visible = false;
ob7.BtnGoBack.Visible = true;
}
else
{
AutoClosingMessageBox.Show("Payment Successfull", "Redirecting....",
1000);
}
}
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 4
Visual Programming
Form2:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Assignment2FACADE
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 5
Visual Programming
}
public Label lblLoginError
{
get { return this.lblLoginFirst; }
}
public void EnablelblFirst()
{
this.lblLoginFirst.Enabled = true;
}
}
}
Form3:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Assignment2FACADE
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 6
Visual Programming
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 7
Visual Programming
try
{
double CcvNo = Int64.Parse(txtCCardNum.Text);
}
catch (FormatException)
{
try
{
double CcvNo = Int64.Parse(txtCCardNum.Text);
}
catch (FormatException)
{
}
}
}
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 8
Visual Programming
Form4:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Assignment2FACADE
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
}
public Label lblSalesprice
{
get { return this.lblSalesPrice; }
}
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 9
Visual Programming
}
public Label lblSippingharges
{
get { return this.lblShippingCharges; }
}
public void EnableshippingCharges()
{
this.lblShippingCharges.Enabled = true;
}
}
public Label lblSubTtl
{
get { return this.lblSubtotal; }
}
public void EnablelblSubttl()
{
this.lblSubtotal.Enabled = true;
}
}
public Label lblWhtTx
{
get { return this.lblWhtTax; }
}
public void EnableWhtTx()
{
this.lblWhtTax.Enabled = true;
}
}
public Label lblTtl
{
get { return this.lblTotal; }
}
public void Enablettl()
{
this.lblTotal.Enabled = true;
}
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 10
Visual Programming
}
else if (cmbPaymentMethod.Text == "Cash On Delivery")
{
Form1 ob2 = (Form1)Application.OpenForms["Form1"];
ob2.LbltxtCardLimtit.Visible = true;
double total = Convert.ToDouble(Math.Round(decimal.Parse(lblTotal.Text),
3));
ob2.LbltxtCardLimtit.Text = ("Your order is will be dispatched soon
Please Keep the exact " + total + " Ready");
ob2.Btncontinue.Visible = false;
ob2.BtnExit.Visible = true;
Close();
}
}
public Button BtnProceed
{
get { return this.btnProceed; }
}
public void EnablebtnProceed()
{
this.btnProceed.Enabled = true;
}
}
public ComboBox CmbpaymentMethod
{
get { return this.cmbPaymentMethod; }
}
public void EnablecmbPaymentMethod()
{
this.cmbPaymentMethod.Enabled = true;
}
}
public PictureBox PicVisa
{
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 11
Visual Programming
}
public Label Lbltxtpayment
{
get { return this.lbltxtPayment; }
}
public void EnableLbltxtpayment()
{
this.lbltxtPayment.Enabled = true;
}
}
public Label lblcardAsterik
{
get { return this.lblCardasterisk; }
}
public void EnableCardAsterisk()
{
this.lblCardasterisk.Enabled = true;
}
}
public Button BtnPayNow
{
get { return this.btnPaynow; }
}
public void EnablePayNow()
{
this.btnPaynow.Enabled = true;
}
}
public Label LblpayError
{
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 12
Visual Programming
Output:
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 13
Visual Programming
HUMZA-ZAHID(01-131162-008) SUBTAIN-HAIDER(01-131162-049) 14