Exemple #1
0
        private void USR_Login_Button_Click(object sender, EventArgs e)
        {
            Airline_Reservation_SystemDBCDataContext uLD = new Airline_Reservation_SystemDBCDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Mzs Munna\Documents\Visual Studio 2013\Projects\Air_Reservation_System\Air_Reservation_System\Airline_Reservation_System.mdf;Integrated Security=True;Connect Timeout=30");


            var x = from a in uLD.Customer_Infos
                    where a.CName == USR_UNBox.Text
                    //|| a.CEmail == USR_UNBox.Text
                    && a.CPassword == USR_PassBox.Text
                    select a;

            if (x.Any())
            {
                userID = x.First().CID;
                MessageBox.Show("Login Success!");
                UserHome uHP = new UserHome(this, userID);
                uHP.Show();
                this.Hide();
                //AdminPanel alp = new AdminPanel(this);
                //this.Hide();
                //alp.Show();
            }
            else
            {
                MessageBox.Show("Login Failed!");
            }
        }
Exemple #2
0
        private void UI_Update_IB_Click(object sender, EventArgs e)
        {
            Airline_Reservation_SystemDBCDataContext uHLD = new Airline_Reservation_SystemDBCDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Mzs Munna\Documents\Visual Studio 2013\Projects\Air_Reservation_System\Air_Reservation_System\Airline_Reservation_System.mdf;Integrated Security=True;Connect Timeout=30");

            //string cID = "";
            string cName        = "";
            string cGender      = "";
            string cDOB         = "";
            string cPN          = "";
            string cEID         = "";
            string cPPNo        = "";
            string cNationality = "";
            string cHName       = "";
            string cCrdN        = "";
            string cPass        = "";

            //x.First().CID = Convert.ToInt32(CIDTB.Text);
            cName        = CustomerName.Text;
            cGender      = CustomerGender.SelectedItem.ToString();
            cDOB         = CustomerDOB.Text;
            cPN          = CustomerPN.Text;
            cEID         = CustomerEID.Text;
            cPPNo        = CustomerPassportNo.Text;
            cNationality = CustomerNationality.Text;
            cHName       = CardHolderNameTB.Text;
            cCrdN        = CreditCardNoTB.Text;
            cPass        = User_Pass_TB.Text;

            bool allDigitPP   = cPPNo.All(char.IsDigit);
            bool allDigitPN   = cPN.All(char.IsDigit);
            bool allDigitCCNo = cCrdN.All(char.IsDigit);
            int  warning      = 0;
            int  nameV        = 0;

            if ((cName == "") || (cGender == "") || (cDOB == "") || (cPN == "") || (cEID == "") || (cNationality == "") || (cPPNo == ""))
            {
                MessageBox.Show("Can't keep any field blank!!! Fill up all to proceed!");
            }
            else
            {
                if (allDigitPP == false)
                {
                    MessageBox.Show("Invalid Passport Number");
                    warning = 3;
                }

                if (allDigitPN == false)
                {
                    MessageBox.Show("Invalid Phone Number");
                    warning = 4;
                }

                if (allDigitCCNo == false)
                {
                    MessageBox.Show("Invalid ID Number");
                    warning = 5;
                }

                if (Regex.IsMatch(cNationality, @"^[a-zA-Z]+$") == true) //all character
                {
                    //MessageBox.Show("All are letters");
                }
                else
                {
                    MessageBox.Show("Not a valid Nation!");
                    warning = 6;
                }

                if (Regex.IsMatch(cHName, @"^[a-zA-Z]+$") == true) //all character
                {
                    //MessageBox.Show("All are letters");
                }
                else
                {
                    MessageBox.Show("Not a valid Card Holder Name!");
                    warning = 7;
                }

                if (Regex.IsMatch(cName, @"^[a-zA-Z ]{2,30}$") == true)
                {
                    //MessageBox.Show("valid name no number upto 30!");
                    nameV = 1;
                }
                else
                {
                    //MessageBox.Show("Invalid name");
                    warning = 1;
                }

                if (nameV == 0)
                {
                    if (Regex.IsMatch(cName, @"^[a-zA-Z ]{2,26}[0-9]{1,4}$") == true)
                    {
                        //MessageBox.Show("at first letter then number up to 5");
                        warning = 0;
                    }
                    else
                    {
                        MessageBox.Show("Invalid name");
                        warning = 1;
                    }
                }

                if (Regex.IsMatch(cEID, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$") == true)
                {
                    //MessageBox.Show("VALID EMAIL ID");
                    //warning = 0;
                }
                else
                {
                    MessageBox.Show("Invalid email id");
                    warning = 2;
                }

                if (warning == 0)
                {
                    //MessageBox.Show("Go to next form! :) "+warning);
                    //PaymentMethodPanel pMF=new PaymentMethodPanel(this, flightListNo, totalAmount, cID, cName, cGender, cDOB, cPN, cEID, cPPNo, cNationality,intoE,intoB,sEAvail,sBAvail);
                    //pMF.Show();
                    //this.Hide();
                    var x = from a in uHLD.Customer_Infos
                            where a.CID == userID
                            select a;

                    x.First().CID              = Convert.ToInt32(CIDTB.Text);
                    x.First().CName            = CustomerName.Text;
                    x.First().CGender          = CustomerGender.Text;
                    x.First().CDOB             = CustomerDOB.Text;
                    x.First().CPhone_Num       = CustomerPN.Text;
                    x.First().CEmail           = CustomerEID.Text;
                    x.First().CPassport_No     = CustomerPassportNo.Text;
                    x.First().CNationality     = CustomerNationality.Text;
                    x.First().Card_Holder_Name = CardHolderNameTB.Text;
                    x.First().Credit_Card_No   = Convert.ToInt32(CreditCardNoTB.Text);
                    x.First().CPassword        = User_Pass_TB.Text;

                    uHLD.SubmitChanges();

                    MessageBox.Show("Update Successfull!");
                    UserHome uH2 = new UserHome(cLF, userID);
                    this.Hide();
                    uH2.Show();
                }
            }
        }