Example #1
0
        public Drivers()
        {
            InitializeComponent();
            DataContext = this;
            List <String> sellingCenterNameList = new HandleDatabase().getListDetailsforSales("sellingCenter");

            SellingCenter.ItemsSource = sellingCenterNameList;
        }
Example #2
0
        public ViewItems()
        {
            InitializeComponent();
            DataContext = this;
            HandleDatabase handleDatabase = new HandleDatabase();

            itemTable             = handleDatabase.getDetailsforGrid("items");
            ItemsGrid.ItemsSource = itemTable.DefaultView;
        }
Example #3
0
        public ViewCustomers()
        {
            InitializeComponent();
            DataContext = this;
            HandleDatabase handleDatabase = new HandleDatabase();
            DataTable      table          = handleDatabase.getDetailsforGrid("customer");

            CustomerGrid.ItemsSource = table.DefaultView;
        }
Example #4
0
        public UpdateCustomer(String customerID)
        {
            InitializeComponent();
            DataContext = this;

            this.customerID = customerID;
            handleDatabase  = new HandleDatabase();
            customer        = handleDatabase.getCustomerDetails(customerID);
        }
Example #5
0
        public ViewStock()
        {
            InitializeComponent();
            DataContext = this;
            HandleDatabase handleDatabase = new HandleDatabase();

            stockTable            = handleDatabase.getDetailsforGrid("stockDetails");
            StockGrid.ItemsSource = stockTable.DefaultView;
        }
        private void SellingCenter_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            String        salesCenter    = SellingCenter.SelectedValue.ToString();
            List <String> driverNameList = new HandleDatabase().getRelevantDriverDetailsForTransportation(salesCenter);
            List <String> vehicleList    = new HandleDatabase().getRelevantVehicleDetailsForTransportation(salesCenter);

            DriverName.ItemsSource = driverNameList;
            VehicleNo.ItemsSource  = vehicleList;
        }
Example #7
0
        public UpdateSupplier(String supplierID)
        {
            InitializeComponent();
            DataContext = this;

            this.supplierID = supplierID;
            handleDatabase  = new HandleDatabase();
            supplier        = handleDatabase.getSupplierDetails(supplierID);
        }
        public TransportationDetails()
        {
            InitializeComponent();
            DataContext = this;
            List <String> customerNameList      = new HandleDatabase().getListDetailsforSales("customer");
            List <String> sellingCenterNameList = new HandleDatabase().getListDetailsforSales("sellingCenter");

            CustomerName.ItemsSource  = customerNameList;
            SellingCenter.ItemsSource = sellingCenterNameList;
        }
Example #9
0
        private async void saveButton_Click(object sender, RoutedEventArgs e)
        {
            val = new Validation();
            if (val.isEmpty(firstName) || val.isEmpty(lastName) || val.isEmpty(addressLine1) || val.isEmpty(addressLine2) ||
                val.isEmpty(addressLine3) || val.isEmpty(email) || val.isEmpty(mobileNumber.ToString()) || val.isEmpty(FixedLine.ToString()))
            {
                await this.ShowMessageAsync("Error", "Input Data Cannot Be Empty", MessageDialogStyle.Affirmative);
            }
            else if (val.isNumeric(mobileNumber.ToString()) || val.isNumeric(FixedLine.ToString()))
            {
                await this.ShowMessageAsync("Error", "Contact Numbers Should Be Numeric", MessageDialogStyle.Affirmative);
            }
            else
            {
                int affectedLines = 0;
                customerData = new CustomerData();

                customerData.setFirstName(firstName);
                customerData.setLastName(lastName);
                customerData.setAddress(addressLine1, addressLine2, addressLine3);
                customerData.setEmail(email);
                customerData.setMobileNumer(mobileNumber);
                customerData.setFixedNumber(fixedNumber);

                try
                {
                    handleDatabase = new HandleDatabase();
                    affectedLines  = handleDatabase.executeCustomerEntry(customerData);

                    if (affectedLines > 0)
                    {
                        await this.ShowMessageAsync("Successfull", "Customer have been Successfully Entered", MessageDialogStyle.Affirmative);

                        FirstName.Text = "";
                        LastName.Text  = "";
                        Address1.Text  = "";
                        Address2.Text  = "";
                        Address3.Text  = "";
                        Email.Text     = "";
                        FixedLine.Text = "";
                        Mobile.Text    = "";
                    }
                    else
                    {
                        await this.ShowMessageAsync("Error", "Sorry Can not Create the Profile, Please Try again", MessageDialogStyle.Affirmative);
                    }
                }
                catch (SqlException sqlException)
                {
                    Console.WriteLine(sqlException);
                }
            }
        }
Example #10
0
        private async void saveButton_Click(object sender, RoutedEventArgs e)
        {
            val = new Validation();
            if (val.isEmpty(firstName) || val.isEmpty(lastName) || val.isEmpty(addressLine1) || val.isEmpty(addressLine2) ||
                val.isEmpty(sellingCenter) || val.isEmpty(nic) || val.isEmpty(mobileNumber.ToString()) || val.isEmpty(homeContact.ToString()))
            {
                await this.ShowMessageAsync("Error", "Data Cannot be Empty", MessageDialogStyle.Affirmative);
            }
            else if (val.isNumeric(mobileNumber.ToString()) || val.isNumeric(homeContact.ToString()))
            {
                await this.ShowMessageAsync("Error", "Contact Numbers Should be Numeric", MessageDialogStyle.Affirmative);
            }
            else
            {
                int affectedLines = 0;
                driver.FirstName   = FirstName.Text;
                driver.LastName    = LastName.Text;
                driver.Address     = Address1.Text + ' ' + Address2.Text + ' ' + Address3.Text;
                driver.NIC         = NIC.Text;
                driver.Mobile      = Convert.ToInt32(Mobile.Text);
                driver.HomeContact = Convert.ToInt32(HomeContact.Text);
                driver.SalesCenter = SellingCenter.SelectedValue.ToString();
                try
                {
                    handleDatabase = new HandleDatabase();
                    affectedLines  = handleDatabase.executeDriverEntry(driver);

                    if (affectedLines > 0)
                    {
                        await this.ShowMessageAsync("Successfull", "New Entry have been Successfully Registered", MessageDialogStyle.Affirmative);

                        FirstName.Text   = "";
                        LastName.Text    = "";
                        Address1.Text    = "";
                        Address2.Text    = "";
                        Address3.Text    = "";
                        NIC.Text         = "";
                        Mobile.Text      = "";
                        HomeContact.Text = "";
                    }
                    else
                    {
                        await this.ShowMessageAsync("Error", "Sorry Can not Proceed, Please Try again", MessageDialogStyle.Affirmative);
                    }
                    clearFields();
                }
                catch (SqlException sqlException)
                {
                    Console.WriteLine(sqlException);
                }
            }
        }
        public TransportaionDetails()
        {
            InitializeComponent();
            DataContext = this;
            HandleDatabase handleDatabase = new HandleDatabase();

            vehicleTable            = handleDatabase.getDetailsforGrid("vehicle");
            vehicleGrid.ItemsSource = vehicleTable.DefaultView;

            driverTable            = handleDatabase.getDetailsforGrid("driver");
            DriverGrid.ItemsSource = driverTable.DefaultView;

            transportationTable       = handleDatabase.getDetailsforGrid("transportation");
            TransportGrid.ItemsSource = transportationTable.DefaultView;
        }
        private async void saveButton_Click(object sender, RoutedEventArgs e)
        {
            val = new Validation();
            if (val.isEmpty(customerName) || val.isEmpty(vehicelNo) || val.isEmpty(sellingCenter) || val.isEmpty(destination) || val.isEmpty(date.ToString()) ||
                val.isEmpty(driverName) || val.isEmpty(distance.ToString()) || val.isEmpty(arrivalTime.ToString()))
            {
                await this.ShowMessageAsync("Error", "Data Cannot be Empty", MessageDialogStyle.Affirmative);
            }
            else
            {
                int affectedLines = 0;
                transport.CustomerName  = CustomerName.SelectedItem.ToString();
                transport.VehicleNo     = VehicleNo.SelectedItem.ToString();
                transport.DriverName    = DriverName.SelectedItem.ToString();
                transport.Date          = RequestDate.SelectedDate.Value;
                transport.ArrivalTime   = Convert.ToInt32(ArrivalTime.Text);
                transport.Destination   = Desination.Text;
                transport.Distance      = Convert.ToInt32(Distance.Text);
                transport.Income        = Convert.ToInt32(Income.Text);
                transport.SellingCenter = SellingCenter.SelectedValue.ToString();
                try
                {
                    handleDatabase = new HandleDatabase();
                    affectedLines  = handleDatabase.executeTransportaionRequest(transport);

                    if (affectedLines > 0)
                    {
                        await this.ShowMessageAsync("Successfull", "New Entry have been Successfully Registered", MessageDialogStyle.Affirmative);

                        this.Close();
                        MainMenu menu = new MainMenu();
                        menu.Show();
                    }
                    else
                    {
                        await this.ShowMessageAsync("Error", "Sorry Can not Proceed with transportation", MessageDialogStyle.Affirmative);

                        this.Close();
                        MainMenu menu = new MainMenu();
                        menu.Show();
                    }
                }
                catch (SqlException sqlException)
                {
                    Console.WriteLine(sqlException);
                }
            }
        }
Example #13
0
        private async void saveButton_Click(object sender, RoutedEventArgs e)
        {
            val = new Validation();
            if (val.isEmpty(firstName) || val.isEmpty(lastName) || val.isEmpty(addressLine1) || val.isEmpty(addressLine2) ||
                val.isEmpty(addressLine3) || val.isEmpty(email) || val.isEmpty(mobileContact.ToString()) || val.isEmpty(homeContact.ToString()))
            {
                await this.ShowMessageAsync("Error", "Input Data Cannot Be Empty", MessageDialogStyle.Affirmative);
            }
            else
            {
                int affectedLines = 0;
                customer = new CustomerData();

                customer.setFirstName(FirstName.Text);
                customer.setLastName(LastName.Text);
                customer.setAddress(Address1.Text + ' ' + Address2.Text + ' ' + Address3.Text);
                customer.setEmail(Email.Text);
                customer.setMobileNumer(Convert.ToInt32(MobileContact.Text));
                customer.setFixedNumber(Convert.ToInt32(HomeContact.Text));
                try
                {
                    handleDatabase = new HandleDatabase();
                    affectedLines  = handleDatabase.executeCustomerUpdate(customer, customerID);

                    if (affectedLines > 0)
                    {
                        await this.ShowMessageAsync("Successfull", "Customer have been Successfully Updates", MessageDialogStyle.Affirmative);

                        ViewCustomers view = new ViewCustomers();
                        view.Show();
                        this.Close();
                    }
                    else
                    {
                        await this.ShowMessageAsync("Error", "Sorry Can not Update, Please Try again", MessageDialogStyle.Affirmative);

                        ViewCustomers view = new ViewCustomers();
                        view.Show();
                        this.Close();
                    }
                }
                catch (SqlException sqlException)
                {
                    Console.WriteLine(sqlException);
                }
            }
        }
Example #14
0
        private async void saveButton_Click(object sender, RoutedEventArgs e)
        {
            val = new Validation();
            if (val.isEmpty(location) || val.isEmpty(addressLine1) || val.isEmpty(addressLine2) || val.isEmpty(mobileNumber.ToString()) || val.isEmpty(fixedNumber.ToString()))
            {
                await this.ShowMessageAsync("Error", "Data Cannot be Empty", MessageDialogStyle.Affirmative);
            }
            else if (val.isNumeric(mobileNumber.ToString()) || val.isNumeric(fixedNumber.ToString()))
            {
                await this.ShowMessageAsync("Error", "Contact Numbers Should be Numeric", MessageDialogStyle.Affirmative);
            }
            else
            {
                int affectedLines = 0;
                salesCenter.Location    = Location.Text;
                salesCenter.FixedNumber = Convert.ToInt32(FixedLine.Text);
                salesCenter.Mobile      = Convert.ToInt32(Mobile.Text);
                salesCenter.Address     = Address1.Text + ' ' + Address2.Text + ' ' + Address3.Text;
                try
                {
                    handleDatabase = new HandleDatabase();
                    affectedLines  = handleDatabase.executeSalesCenetrEntry(salesCenter);

                    if (affectedLines > 0)
                    {
                        await this.ShowMessageAsync("Successfull", "New Sales Center have been Successfully Entered", MessageDialogStyle.Affirmative);

                        Location.Text  = "";
                        FixedLine.Text = "";
                        Mobile.Text    = "";
                        Address1.Text  = "";
                        Address2.Text  = "";
                        Address3.Text  = "";
                    }
                    else
                    {
                        await this.ShowMessageAsync("Error", "Sorry Can not add, Please Try again", MessageDialogStyle.Affirmative);
                    }
                }
                catch (SqlException sqlException)
                {
                    Console.WriteLine(sqlException);
                }
            }
        }
Example #15
0
        private async void saveButton_Click(object sender, RoutedEventArgs e)
        {
            val = new Validation();
            if (val.isEmpty(supplierName) || val.isEmpty(companyName) || val.isEmpty(addressLine1) || val.isEmpty(addressLine2) ||
                val.isEmpty(mobileContact.ToString()) || val.isEmpty(homeContact.ToString()))
            {
                await this.ShowMessageAsync("Error", "Data Cannot be Empty", MessageDialogStyle.Affirmative);
            }
            else
            {
                int affectedLines = 0;
                supplier.Suppliername  = SupplierName.Text;
                supplier.Address       = Address1.Text + ' ' + Address2.Text + ' ' + Address3.Text;
                supplier.MobileContact = Convert.ToInt32(MobileContact.Text);
                supplier.HomeContact   = Convert.ToInt32(HomeContact.Text);
                supplier.CompanyName   = CompanyName.Text;
                try
                {
                    handleDatabase = new HandleDatabase();
                    affectedLines  = handleDatabase.executeSupplierEntry(supplier);

                    if (affectedLines > 0)
                    {
                        await this.ShowMessageAsync("Successfull", "New Supplier have been Successfully Entered", MessageDialogStyle.Affirmative);

                        SupplierName.Text  = "";
                        Address1.Text      = "";
                        Address2.Text      = "";
                        Address3.Text      = "";
                        MobileContact.Text = "";
                        HomeContact.Text   = "";
                        CompanyName.Text   = "";
                    }
                    else
                    {
                        await this.ShowMessageAsync("Error", "Sorry Can not add, Please Try again", MessageDialogStyle.Affirmative);
                    }
                }
                catch (SqlException sqlException)
                {
                    Console.WriteLine(sqlException);
                }
            }
        }
Example #16
0
        public Sale()
        {
            InitializeComponent();
            DataContext = this;
            List <String> customerNameList      = new HandleDatabase().getListDetailsforSales("customer");
            List <String> sellingCenterNameList = new HandleDatabase().getListDetailsforSales("sellingCenter");
            List <String> itemNameList          = new HandleDatabase().getListDetailsforSales("item");

            CustomerName.ItemsSource  = customerNameList;
            ItemName.ItemsSource      = itemNameList;
            SellingCenter.ItemsSource = sellingCenterNameList;

            dt = new DataTable();
            dt.Columns.Add("salesID", typeof(String));
            dt.Columns.Add("itemName", typeof(String));
            dt.Columns.Add("quantity", typeof(String));
            dt.Columns.Add("purchasePrice", typeof(String));
            dt.Columns.Add("totalPrice", typeof(String));
        }
Example #17
0
        private async void saveButton_Click(object sender, RoutedEventArgs e)
        {
            val = new Validation();
            if (val.isEmpty(capacity.ToString()) || val.isEmpty(date.ToString()) || val.isEmpty(type) || val.isEmpty(vehicleNo) || val.isEmpty(salesCenter))
            {
                await this.ShowMessageAsync("Error", "Data Cannot be Empty", MessageDialogStyle.Affirmative);
            }
            else if (val.isNumeric(capacity.ToString()))
            {
                await this.ShowMessageAsync("Error", "Capacity shoul be numeric", MessageDialogStyle.Affirmative);
            }
            else
            {
                int affectedLines = 0;
                vehicle.VehicleNo   = VehicleNo.Text;
                vehicle.Type        = Type.Text;
                vehicle.Capacity    = Convert.ToInt32(Capacity.Text);
                vehicle.Date        = Convert.ToDateTime(RegisterDate.Text);
                vehicle.SalesCenter = SellingCenter.SelectedValue.ToString();
                try
                {
                    handleDatabase = new HandleDatabase();
                    affectedLines  = handleDatabase.executeVehicleDataEntry(vehicle);

                    if (affectedLines > 0)
                    {
                        await this.ShowMessageAsync("Successfull", "New Entry have been Successfully Registered", MessageDialogStyle.Affirmative);

                        clearFields();
                    }
                    else
                    {
                        await this.ShowMessageAsync("Error", "Sorry Can not Proceed, Please Try again", MessageDialogStyle.Affirmative);
                    }
                    clearFields();
                }
                catch (SqlException sqlException)
                {
                    Console.WriteLine(sqlException);
                }
                clearFields();
            }
        }
Example #18
0
        private async void loginButton_Click(object sender, RoutedEventArgs e)
        {
            String password = PasswordLogin.Password;

            handleDatabase = new HandleDatabase();
            validUser      = handleDatabase.getUser(userNameLogin, password);
            if (validUser)
            {
                await this.ShowMessageAsync("Welcome", "Welcome to IDB", MessageDialogStyle.Affirmative);

                MainMenu main = new MainMenu();
                main.Show();
                this.Close();
            }
            else
            {
                await this.ShowMessageAsync("Error", "Error, please try again", MessageDialogStyle.Affirmative);
            }
        }
Example #19
0
        private async void signUpButton_Click(object sender, RoutedEventArgs e)
        {
            String password        = PasswordNew.Password;
            String confirmPassword = ConfirmPasswordNew.Password;

            handleDatabase = new HandleDatabase();

            if (Employee.IsChecked == true)
            {
                accountType = "Employee";
            }
            else
            {
                accountType = "Admin";
            }
            try
            {
                int affectedLines = handleDatabase.createUser(userNameNew, password, accountType);

                if (affectedLines > 0)
                {
                    await this.ShowMessageAsync("Profile Created", "Your Profile has been Successfully Created", MessageDialogStyle.Affirmative);

                    UserNameNew.Text            = "";
                    PasswordNew.Password        = "";
                    ConfirmPasswordNew.Password = "";
                    SignControl.SelectedIndex   = 0;
                }
                else
                {
                    await this.ShowMessageAsync("Profile Not Created", "Sorry Can not Create the Profile, Please Try again", MessageDialogStyle.Affirmative);

                    UserNameNew.Text            = "";
                    PasswordNew.Password        = "";
                    ConfirmPasswordNew.Password = "";
                }
            }
            catch (SqlException sqlException)
            {
                Console.WriteLine(sqlException);
            }
        }