Ejemplo n.º 1
0
        public static string UserRegistration(Customer C1)//this method is used to add data in both login and customer table
        {
            tblCustomer C = new tblCustomer();
            tblLogin    L = new tblLogin();

            C.Customer_ID  = C1.Customer_ID;
            C.CustomerName = C1.CustomerName;


            C.DateOfBirth   = C1.DateOfBirth;
            C.EmailAddress  = C1.EmailAddress;
            C.ContactNumber = C1.ContactNumber;
            C.Country       = C1.Country;
            C.State         = C1.State;
            C.City          = C1.City;
            C.PinCode       = C1.PinCode;

            C.CustomerType = C1.CustomerType;
            d.tblCustomers.Add(C);
            d.SaveChanges();
            string CustId = C.Customer_ID;

            L.UserId   = CustId;
            L.Password = C1.Password;
            L.UserType = "Customer";
            d.tblLogins.Add(L);
            d.SaveChanges();



            return("User Registration Done Successfully with customerid " + C1.Customer_ID);
        }
Ejemplo n.º 2
0
        public static bool getpayment(tblPayment p)                    //payment values are inserted in tblpayment
        {
            tblPayment p1 = new tblPayment();
            var        E6 = from E2 in d.tblCustomers
                            where E2.Customer_ID == p.Customer_ID
                            select E2;
            tblCustomer h3 = E6.First();

            if (h3.CustomerType == "senior citizen")
            {
                p1.Customer_ID         = p.Customer_ID;
                p1.Bank_ID             = p.Bank_ID;
                p1.Credit_card_Number  = p.Credit_card_Number;
                p1.Card_Type           = p.Card_Type;
                p1.Name_on_Card        = p.Name_on_Card;
                p1.Date_of_Transaction = DateTime.Now;
                p1.Expiry_Date         = p.Expiry_Date;
                p1.CVV_Number          = p.CVV_Number;
                p1.Account_Number      = p.Account_Number;
                p1.Pin_Number          = p.Pin_Number;
                p1.Amount = p.Amount - ((5 * p.Amount) / 100);
                d.tblPayments.Add(p1);
                d.SaveChanges();
                return(true);
            }
            else
            {
                p1.Customer_ID         = p.Customer_ID;
                p1.Bank_ID             = p.Bank_ID;
                p1.Credit_card_Number  = p.Credit_card_Number;
                p1.Card_Type           = p.Card_Type;
                p1.Name_on_Card        = p.Name_on_Card;
                p1.Date_of_Transaction = DateTime.Now;
                p1.Expiry_Date         = p.Expiry_Date;
                p1.CVV_Number          = p.CVV_Number;
                p1.Account_Number      = p.Account_Number;
                p1.Pin_Number          = p.Pin_Number;
                p1.Amount = p.Amount;
                d.tblPayments.Add(p1);
                d.SaveChanges();
                return(true);
            }
        }