Beispiel #1
0
        private void btn_vehi_update_Click(object sender, EventArgs e)
        {
            VehicalObject objvehi = new VehicalObject();


            objvehi.VehicalNo   = txtb_vehi_vehicalno.Text;
            objvehi.Capacity    = txtb_vehi_capacity.Text;
            objvehi.Type1       = txtb_vehi_type.Text;
            objvehi.Make        = comb_vehi_make.Text;
            objvehi.Model       = txtb_vehi_model.Text;
            objvehi.Status      = comb_vehi_status.Text;
            objvehi.Description = rtxt_vehi_description.Text;

            if (vehicalValidation())
            {
                try
                {
                    MegaCoolMethods mcm    = new MegaCoolMethods();
                    bool            result = mcm.Editvehical(objvehi);

                    if (result)
                    {
                        MessageBox.Show("Successfully Edited", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        deliveryFillGrid();
                        vehi_clear();
                    }
                    else
                    {
                        MessageBox.Show("Unable to Edit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch (ApplicationException appEx)
                {
                    MessageBox.Show(appEx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Beispiel #2
0
        private void btn_service_update_Click(object sender, EventArgs e)
        {
            VehicalObject objvehi = new VehicalObject();


            objvehi.VehicalNo       = txtb_service_vehiNo.Text;
            objvehi.Ser_description = rtxtb_service_description.Text;
            objvehi.Last_ser_date   = dtp_service_lastserdate.Value.Date;
            objvehi.Last_ser_milage = float.Parse(txtb_service_lastsermilage.Text);
            objvehi.Next_ser_date1  = dtp_service_nextserdate.Value.Date;
            objvehi.Next_ser_milage = float.Parse(txtb_service_nextsermilage.Text);

            try
            {
                MegaCoolMethods mcm    = new MegaCoolMethods();
                bool            result = mcm.updateService(objvehi);

                if (result)
                {
                    MessageBox.Show("Successfully Edited", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    serviceFillGrid();
                }
                else
                {
                    MessageBox.Show("Unable to Edit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (ApplicationException appEx)
            {
                MessageBox.Show(appEx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        private void btn_del_update_Click(object sender, EventArgs e)
        {
            DeliveryObject objdel  = new DeliveryObject();
            CustomerObject objcus  = new CustomerObject();
            SalesObject    objInv  = new SalesObject();
            EmployeeObject objemp  = new EmployeeObject();
            VehicalObject  objvehi = new VehicalObject();



            //chechk whether text feilds are empty or not
            if (txtb_del_deliveryno.Text == "" || txtb_del_invoiceid.Text == "" || txtb_del_cusid.Text == "" || txtb_del_driver.Text == "" || txtb_del_vehicalno.Text == "" || comb_del_status.Text == "" || rtxtb_del_description.Text == "" || txtb_del_from.Text == "" || txtb_del_to.Text == "" || txtb_del_distance.Text == "" || txtb_del_rate.Text == "" || txtb_del_cost.Text == "")
            {
                MessageBox.Show("Please fill the all required feilds");
            }
            else
            {
                // objdel.DeliveryNo1 = txtb_del_deliveryno.Text;
                //  objInv.InvoiceID1 = Convert.ToInt32(txtb_del_invoiceid.Text);
                //  objcus.Nic = txtb_del_cusid.Text;
                objemp.empid        = Convert.ToInt32(txtb_del_driver.Text);
                objvehi.VehicalNo   = txtb_del_vehicalno.Text;
                objdel.Status1      = comb_del_status.Text;
                objdel.Description1 = rtxtb_del_description.Text;
                objdel.From1        = txtb_del_from.Text;
                objdel.To1          = txtb_del_to.Text;
                objdel.Distance1    = Convert.ToDouble(txtb_del_distance.Text);
                objdel.Rate1        = Convert.ToDouble(txtb_del_rate.Text);
                objdel.Cost1        = Convert.ToDouble(txtb_del_cost.Text);
                objdel.Date         = dtp_del_delDate.Value.Date;

                //show the confirmation dialog box
                DialogResult dr;
                dr = MessageBox.Show("Do you want to save the record", "Confirm", MessageBoxButtons.YesNo);
                string Dr = dr.ToString();

                if (Dr == "Yes")
                {
                    try
                    {
                        MegaCoolMethods mcm    = new MegaCoolMethods();
                        bool            result = mcm.AddNewdelivery(objdel, objcus, objInv, objemp, objvehi);


                        if (result)
                        {
                            MessageBox.Show("Successfully Saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            // FillMemberDetails();
                        }
                        else
                        {
                            MessageBox.Show("Unable to Save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    catch (ApplicationException appEx)
                    {
                        MessageBox.Show(appEx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    catch (SqlException ex)
                    {
                        if (ex.Number == 2627)
                        {
                            MessageBox.Show("This Delivery Number is already Exsists");
                        }
                    }

                    rbtn_del_delivery.Checked = true;
                    deliveryDELIVERYFillGrid();
                    deliveryProcessingDELIVERYFillGrid();
                    //else
                    //    MessageBox.Show("Data is not entered");

                    //deliveryFillGrid();
                    //vehi_clear();
                }
                //}
            }
        }
Beispiel #4
0
        private void btn_vehi_add_Click(object sender, EventArgs e)
        {
            if (vehicalValidation())
            {
                VehicalObject objvehi = new VehicalObject();


                objvehi.VehicalNo   = txtb_vehi_vehicalno.Text;
                objvehi.Type1       = txtb_vehi_type.Text;
                objvehi.Make        = comb_vehi_make.Text;
                objvehi.Model       = txtb_vehi_model.Text;
                objvehi.Status      = comb_vehi_status.Text;
                objvehi.Capacity    = txtb_vehi_capacity.Text;
                objvehi.Description = rtxt_vehi_description.Text;

                //chechk whether text feilds are empty or not
                if (objvehi.VehicalNo == "" || objvehi.Type1 == "" || objvehi.Make == "" || objvehi.Model == "" || objvehi.Status == "" || objvehi.Capacity == "" || objvehi.Description == "")
                {
                    MessageBox.Show("Please fill the all required feilds");
                }
                else
                {
                    //show the confirmation dialog box
                    DialogResult dr;
                    dr = MessageBox.Show("Do you want to save the record", "Confirm", MessageBoxButtons.YesNo);
                    string Dr = dr.ToString();

                    if (Dr == "Yes")
                    {
                        try
                        {
                            MegaCoolMethods mcm    = new MegaCoolMethods();
                            bool            result = mcm.AddNewvehical(objvehi);

                            if (result)
                            {
                                MessageBox.Show("Successfully Saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                // FillMemberDetails();
                            }
                            else
                            {
                                MessageBox.Show("Unable to Save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        catch (ApplicationException appEx)
                        {
                            MessageBox.Show(appEx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }

                        catch (SqlException ex)
                        {
                            if (ex.Number == 2627)
                            {
                                MessageBox.Show("This vehical Number is already Exsists");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Data is not entered");
                    }

                    deliveryFillGrid();
                    vehi_clear();
                }
            }
        }
Beispiel #5
0
        private void btn_service_add_Click(object sender, EventArgs e)
        {
            VehicalObject objvehi = new VehicalObject();


            objvehi.VehicalNo       = txtb_service_vehiNo.Text;
            objvehi.Ser_description = rtxtb_service_description.Text;
            objvehi.Last_ser_date   = dtp_service_lastserdate.Value.Date;
            objvehi.Last_ser_milage = float.Parse(txtb_service_lastsermilage.Text);
            objvehi.Next_ser_date1  = dtp_service_nextserdate.Value.Date;
            objvehi.Next_ser_milage = float.Parse(txtb_service_nextsermilage.Text);


            //chechk whether text feilds are empty or not
            if (txtb_service_vehiNo.Text == "" || rtxtb_service_description.Text == "" || dtp_service_lastserdate.Value.ToString() == "" || txtb_service_lastsermilage.Text == "" || dtp_service_nextserdate.Value.ToString() == "" || txtb_service_nextsermilage.Text == "")
            {
                MessageBox.Show("Please fill the all required feilds");
            }
            else
            {
                //show the confirmation dialog box
                DialogResult dr;
                dr = MessageBox.Show("Do you want to save the record", "Confirm", MessageBoxButtons.YesNo);
                string Dr = dr.ToString();

                if (Dr == "Yes")
                {
                    try
                    {
                        MegaCoolMethods mcm = new MegaCoolMethods();
                        MessageBox.Show("1");
                        bool result = mcm.AddNewservice(objvehi);

                        if (result)
                        {
                            MessageBox.Show("Successfully Saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            serviceFillGrid();
                        }
                        else
                        {
                            MessageBox.Show("Unable to Save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    catch (ApplicationException appEx)
                    {
                        MessageBox.Show(appEx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    catch (SqlException ex)
                    {
                        if (ex.Number == 2627)
                        {
                            MessageBox.Show("This vehical records are already Exsists");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Data is not entered");
                }
            }
        }