private void QuickSearch_SearchClick(SearchInfo result)
 {
     this.VisibleControls(true);
     this.BindRoute();
     this.lblID.Text             = result.BookingID;
     this.lblDetailID.Text       = result.BookingDetailID;
     this.QuickSearch.txtNo.Text = result.BookingNo;
     this.txtBookingNo.Text      = this.QuickSearch.txtNo.Text;
     if (String.IsNullOrEmpty(this.txtBookingNo.Text))
     {
         Globalizer.ShowMessage(MessageType.Warning, "Error!,Please check the searching form tab");
         this.ResetControl();
     }
     else
     {
         this.EnableDisableControls(true);
         this.lblTripID.Text        = result.TripID;
         this.cboTrip.SelectedValue = result.RouteID;
         this.BindTripDate();
         this.cboDate.SelectedValue = result.Date;
         this.BindTime();
         this.cboTime.SelectedValue = result.TimeID;
         this.txtBusNo.Text         = result.BusNo;
         this.txtSeatNo.Text        = result.SeatNo;
         this.txtQuantity.Text      = Convert.ToString(result.Quantity);
         this.lblCustomerID.Text    = result.CustomerID;
         this.txtName.Text          = result.CustomerName;
         this.cboGender.Text        = result.Gender;
         this.txtNRCNo.Text         = result.NRCNo;
         this.txtPhoneNo.Text       = result.PhoneNo;
     }
 }
 private bool CheckRequiredFields()
 {
     if (this.cboFromSaleNo.SelectedValue == null)
     {
         //Show warning message
         Globalizer.ShowMessage(MessageType.Warning, "From SaleNo should not be blank");
         this.cboFromSaleNo.Focus(); //set focus to control
         return(false);
     }
     else if (this.cboToSaleNo.SelectedValue == null)
     {
         //Show warning message
         Globalizer.ShowMessage(MessageType.Warning, "To SaleNo should not be blank");
         this.cboToSaleNo.Focus(); //set focus to control
         return(false);
     }
     else if (this.cboFromSaleNo.SelectedIndex > this.cboToSaleNo.SelectedIndex)
     {
         //Show warning message
         Globalizer.ShowMessage(MessageType.Warning, "From SaleNo should not be greater than To SaleNo");
         this.cboToSaleNo.Focus(); //set focus to control
         return(false);
     }
     return(true);
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                switch (this.btnSave.Text)
                {
                case "&Save":
                    if (this.CheckRequiredFields())
                    {
                        DriverController driverController = new DriverController();
                        DriverInfo       driverInfo       = new DriverInfo();
                        driverInfo.DriverID      = this.recordID;
                        driverInfo.DriverCode    = this.txtDriverCode.Text.Trim();
                        driverInfo.DriverName    = this.txtDriverName.Text.Trim();
                        driverInfo.DriverLicence = this.txtDriverLicence.Text.Trim();
                        driverInfo.NRCNo         = this.txtNRCNo.Text.Trim();
                        driverInfo.PhoneNo       = this.txtPhoneNo.Text.Trim();
                        driverInfo.Address       = this.txtAddress.Text.Trim();

                        driverController.Insert(driverInfo);

                        string log = "Form-Driver;Item-DriverCode:" + this.txtDriverCode.Text + ";action-Save";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Saved Successfully");
                    }
                    break;

                case "&Update":
                    if (this.CheckRequiredFields())
                    {
                        DriverController driverController = new DriverController();
                        DriverInfo       driverInfo       = new DriverInfo();

                        driverInfo.DriverID      = this.recordID;
                        driverInfo.DriverCode    = this.txtDriverCode.Text.Trim();
                        driverInfo.DriverName    = this.txtDriverName.Text.Trim();
                        driverInfo.DriverLicence = this.txtDriverLicence.Text.Trim();
                        driverInfo.NRCNo         = this.txtNRCNo.Text.Trim();
                        driverInfo.PhoneNo       = this.txtPhoneNo.Text.Trim();
                        driverInfo.Address       = this.txtAddress.Text.Trim();

                        driverController.UpdateByDriverID(driverInfo);

                        string log = "Form-Driver;Item-DriverCode:" + this.txtDriverCode.Text + ";action-Update";
                        userAction.Log(log);
                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Updated Successfully");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
Example #4
0
        private bool CheckRequiredFields()
        {
            if (string.IsNullOrEmpty(this.txtBusTypeCode.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Bus Type Code should not be blank");
                this.txtBusTypeCode.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtDescription.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Description should not be blank");
                this.txtDescription.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtTotalSeats.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Total Seats should not be blank");
                this.txtTotalSeats.Focus();
                return(false);
            }

            return(true);
        }
        private bool CheckRequiredFields()
        {
            if (this.cboTrip.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "Trip should not be blank");
                this.cboTrip.Focus();
                return(false);
            }

            if (this.cboDate.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "Trip Date should not be blank");
                this.cboDate.Focus();
                return(false);
            }

            if (this.cboTime.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "Time should not be blank");
                this.cboTime.Focus();
                return(false);
            }

            if (this.txtSeatNo.Text == string.Empty)
            {
                Globalizer.ShowMessage(MessageType.Warning, "Selected Seat No should not be blank");
                this.txtSeatNo.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Customer Name should not be blank");
                this.txtName.Focus();
                return(false);
            }

            if (this.cboGender.Text == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "Gender should not be blank");
                this.cboGender.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtNRCNo.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "NRC should not be blank");
                this.txtNRCNo.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtPhoneNo.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "PhoneNo should not be blank");
                this.txtPhoneNo.Focus();
                return(false);
            }
            return(true);
        }
        private void NewEditExit_NewClick(object sender, EventArgs e)
        {
            try
            {
                switch (NewEditExit.BtnNewText)
                {
                case "&New":
                    this.NewControl();
                    break;

                case "&Save":
                    if (this.CheckRequiredFields())
                    {
                        SaleController saleController = new SaleController();
                        SaleInfo       saleInfo       = new SaleInfo();
                        CustomerInfo   custInfo       = new CustomerInfo();
                        SaleDetailInfo saleDetailInfo = new SaleDetailInfo();


                        GetCustomerInfo(custInfo);
                        GetSaleInfo(saleInfo);
                        GetSaleDetailInfo(saleDetailInfo);

                        saleController.Insert(saleInfo, custInfo, saleDetailInfo);

                        this.InitializeControls();
                        Globalizer.ShowMessage(MessageType.Information, "Saved Successfully");
                        this.ResetControl();
                    }
                    break;

                case "&Update":
                    if (this.CheckRequiredFields())
                    {
                        SaleController saleController = new SaleController();
                        SaleInfo       saleInfo       = new SaleInfo();
                        CustomerInfo   custInfo       = new CustomerInfo();
                        SaleDetailInfo saleDetailInfo = new SaleDetailInfo();

                        GetCustomerInfo(custInfo);
                        GetSaleInfo(saleInfo);
                        GetSaleDetailInfo(saleDetailInfo);

                        saleController.Update(saleInfo, custInfo, saleDetailInfo);

                        this.InitializeControls();

                        //this.ResetControl();
                        Globalizer.ShowMessage(MessageType.Information, "Updated Successfully");
                        this.ResetControl();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
        private bool CheckRequiredFields()
        {
            if (this.txtUserName.Visible == true)
            {
                if (string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
                {
                    Globalizer.ShowMessage(MessageType.Warning, "User Name should not be blank");
                    this.txtUserName.Focus();
                    return(false);
                }
            }

            if (this.cboUserName.Visible == true)
            {
                if (this.cboUserName.SelectedValue == null)
                {
                    Globalizer.ShowMessage(MessageType.Warning, "User Name should not be blank");
                    this.cboUserName.Focus();
                    return(false);
                }
            }

            if (string.IsNullOrEmpty(this.txtPassword.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Password should not be blank");
                this.txtPassword.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtConfrimPassword.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Confrim Password should not be blank");
                this.txtConfrimPassword.Focus();
                return(false);
            }

            if (this.txtPassword.Text != this.txtConfrimPassword.Text)
            {
                Globalizer.ShowMessage(MessageType.Warning, "Password and Confrim Password does not match");
                this.txtConfrimPassword.Focus();
                return(false);
            }


            if (this.cboUserLevel.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "User Level should not be blank");
                this.cboUserLevel.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Name should not be blank");
                this.txtName.Focus();
                return(false);
            }
            return(true);
        }
 private bool CheckRequiredFields()
 {
     if (String.IsNullOrEmpty(txtYear.Text.Trim()))
     {
         Globalizer.ShowMessage(MessageType.Warning, "Year should not be blank");
         this.txtYear.Focus(); //set focus to control
         return(false);
     }
     return(true);
 }
 private bool CheckRequiredFieldsForDriver()
 {
     if (this.cboDriver.SelectedValue == null)
     {
         Globalizer.ShowMessage(MessageType.Warning, "Driver Name should not be blank");
         this.cboDriver.Focus();
         return(false);
     }
     return(true);
 }
 private bool CheckRequiredField()
 {
     if (this.cboTrip.SelectedValue == null)
     {
         Globalizer.ShowMessage(MessageType.Warning, "Trip should not be blank");
         this.cboTrip.Focus(); //set focus to control
         return(false);
     }
     return(true);
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                switch (this.btnSave.Text)
                {
                case "&Save":
                    if (CheckRequiredFileds())
                    {
                        LocationController locationController = new LocationController();
                        LocationInfo       locationInfo       = new LocationInfo();

                        locationInfo.LocationID   = this.recordID;
                        locationInfo.LocationCode = this.txtLocationCode.Text.Trim();
                        locationInfo.LocationName = this.txtLocationName.Text.Trim();

                        locationController.Insert(locationInfo);

                        string log = "Form-Location;Item-LocationCode:" + this.txtLocationCode.Text + ";action-Save";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Saved Successfully");
                    }
                    break;

                case "&Update":
                    if (CheckRequiredFileds())
                    {
                        LocationController locationController = new LocationController();
                        LocationInfo       locationInfo       = new LocationInfo();

                        locationInfo.LocationID   = this.recordID;
                        locationInfo.LocationCode = this.txtLocationCode.Text.Trim();
                        locationInfo.LocationName = this.txtLocationName.Text.Trim();

                        locationController.UpdateByLocationID(locationInfo);

                        string log = "Form-Location;Item-LocationCode:" + this.txtLocationCode.Text + ";action-Update";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Updated Successfully");
                    }
                    break;
                }
            }

            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
Example #12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                switch (this.btnSave.Text)
                {
                case "&Save":
                    if (CheckRequiredFields())
                    {
                        BusTypeController busTypeController = new BusTypeController();
                        BusTypeInfo       busTypeInfo       = new BusTypeInfo();

                        busTypeInfo.BusTypeID   = this.recordID;
                        busTypeInfo.BusTypeCode = this.txtBusTypeCode.Text.Trim();
                        busTypeInfo.TotalSeats  = Convert.ToInt32(this.txtTotalSeats.Text.Trim());
                        busTypeInfo.Description = this.txtDescription.Text.Trim();
                        busTypeController.Insert(busTypeInfo);
                        string log = "Form-BusType;Item-BusCode:" + this.txtBusTypeCode.Text + ";action-Save";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Saved Successfully");
                    }
                    break;

                case "&Update":
                    if (CheckRequiredFields())
                    {
                        BusTypeController busTypeController = new BusTypeController();
                        BusTypeInfo       busTypeInfo       = new BusTypeInfo();

                        busTypeInfo.BusTypeID   = this.recordID;
                        busTypeInfo.BusTypeCode = this.txtBusTypeCode.Text.Trim();
                        busTypeInfo.TotalSeats  = Convert.ToInt32(this.txtTotalSeats.Text.Trim());
                        busTypeInfo.Description = this.txtDescription.Text.Trim();

                        busTypeController.UpdateByBusTypeID(busTypeInfo);

                        string log = "Form-BusType;Item-BusCode:" + this.txtBusTypeCode.Text + ";action-Update";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Updated Successfully");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
Example #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                switch (this.btnSave.Text)
                {
                case "&Save":
                    if (CheckRequiredFields())
                    {
                        TimeScheduleController timeController = new TimeScheduleController();
                        TimeScheduleInfo       timeInfo       = new TimeScheduleInfo();

                        timeInfo.TimeID      = this.recordID;
                        timeInfo.Time        = this.txtTime.Text.Trim();
                        timeInfo.Description = this.txtDescription.Text.Trim();

                        timeController.Insert(timeInfo);

                        string log = "Form-TimeSchedule;Item-Time:" + this.txtTime.Text + ";action-Save";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Saved Successfully");
                    }
                    break;

                case "&Update":
                    if (CheckRequiredFields())
                    {
                        TimeScheduleController timeController = new TimeScheduleController();
                        TimeScheduleInfo       timeInfo       = new TimeScheduleInfo();

                        timeInfo.TimeID      = this.recordID;
                        timeInfo.Time        = this.txtTime.Text.Trim();
                        timeInfo.Description = this.txtDescription.Text.Trim();

                        timeController.UpdateByTimeID(timeInfo);

                        string log = "Form-TimeSchedule;Item-Time:" + this.txtTime.Text + ";action-Update";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Updated Successfully");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
 public bool CheckRequiredFieldForSaleNo()
 {
     if (this.cboFromSaleInvoiceNo.SelectedValue == null)
     {
         Globalizer.ShowMessage(MessageType.Warning, "From Sale Invoice No should not be blank");
         return(false);
     }
     if (this.cboToSaleInvoiceNo.SelectedValue == null)
     {
         Globalizer.ShowMessage(MessageType.Warning, "To Sale Invoice No should not be blank");
         return(false);
     }
     return(true);
 }
        private void btnProcess_Click(object sender, EventArgs e)
        {
            if (CheckRequiredField())
            {
                TripController tripController = new TripController();
                tripController.PostByTripID(this.cboTrip.SelectedValue.ToString());

                string log = "Form-TripConfirm;Item-TripConfirm:" + this.cboTrip.Text + "TripTime:" + "(" + txtTime.Text + ")" + "TripDate:" + "(" + txtTripDate.Text + ")" + ";action-Confrim";
                userAction.Log(log);

                this.BindTripID();
                this.InitializeControls();
                Globalizer.ShowMessage(MessageType.Information, "Process Successfully");
            }
        }
        private void dgvDriver_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            try
            {
                switch (e.ColumnIndex)
                {
                case 0:
                    this.recordID = this.dgvDriver.Rows[e.RowIndex].Cells["DriverID"].Value.ToString();

                    this.txtDriverCode.Text    = this.dgvDriver.Rows[e.RowIndex].Cells["DriverCode"].Value.ToString();
                    this.txtDriverName.Text    = this.dgvDriver.Rows[e.RowIndex].Cells["DriverName"].Value.ToString();
                    this.txtDriverLicence.Text = this.dgvDriver.Rows[e.RowIndex].Cells["DriverLicence"].Value.ToString();
                    this.txtNRCNo.Text         = this.dgvDriver.Rows[e.RowIndex].Cells["NRCNo"].Value.ToString();
                    this.txtPhoneNo.Text       = this.dgvDriver.Rows[e.RowIndex].Cells["PhoneNo"].Value.ToString();
                    this.txtAddress.Text       = this.dgvDriver.Rows[e.RowIndex].Cells["Address"].Value.ToString();

                    this.btnSave.Text = "&Update";
                    break;

                case 1:
                    if (Globalizer.ShowMessage(MessageType.Question, "Are you sure want to delete?") == DialogResult.Yes)
                    {
                        recordID = this.dgvDriver.Rows[e.RowIndex].Cells["DriverID"].Value.ToString();
                        DriverController driverController = new DriverController();

                        driverController.DeleteByDriverID(this.recordID);

                        string log = "Form-Driver;Item-DriverCode:" + this.txtDriverCode.Text + ";action-Delete";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Deleted Successfully");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
        private void dgvLocation_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            try
            {
                switch (e.ColumnIndex)
                {
                case 0:
                    this.recordID = this.dgvLocation.Rows[e.RowIndex].Cells["LocationID"].Value.ToString();

                    this.txtLocationCode.Text = this.dgvLocation.Rows[e.RowIndex].Cells["LocationCode"].Value.ToString();
                    this.txtLocationName.Text = this.dgvLocation.Rows[e.RowIndex].Cells["LocationName"].Value.ToString();

                    this.btnSave.Text = "&Update";
                    break;

                case 1:
                    if (Globalizer.ShowMessage(MessageType.Question, "Are you sure to delete?") == DialogResult.Yes)
                    {
                        recordID = this.dgvLocation.Rows[e.RowIndex].Cells["LocationID"].Value.ToString();

                        LocationController controller   = new LocationController();
                        LocationInfo       locationInfo = new LocationInfo();
                        locationInfo.LocationID = this.recordID;

                        controller.DeleteByLocationID(locationInfo);

                        string log = "Form-Location;Item-LocationCode:" + this.txtLocationCode.Text + ";action-Delete";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Deleted Successfully");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
Example #18
0
        private bool CheckRequiredFields()
        {
            if (this.cboRoute.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "Route should not be blank");
                this.cboRoute.Focus();
                return(false);
            }

            if (this.cboTime.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "Time should not be blank");
                this.cboTime.Focus();
                return(false);
            }
            return(true);
        }
Example #19
0
        private bool CheckRequiredFields()
        {
            if (string.IsNullOrEmpty(this.txtUserLevelCode.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "User Level  Code should not be blank");
                this.txtUserLevelCode.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtUserLevel.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "User Level should not be blank");
                this.txtUserLevel.Focus();
                return(false);
            }
            return(true);
        }
        private bool CheckRequiredFileds()
        {
            if (String.IsNullOrEmpty(this.txtLocationCode.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Location Code shouldn't be blank");
                this.txtLocationCode.Focus();
                return(false);
            }

            if (String.IsNullOrEmpty(this.txtLocationName.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Location Name shouldn't be blank");
                this.txtLocationName.Focus();
                return(false);
            }
            return(true);
        }
        private bool CheckRequiredFields()
        {
            if (string.IsNullOrEmpty(this.txtDriverCode.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Driver Code should not be blank");
                this.txtDriverCode.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtDriverName.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Driver Name should not be blank");
                this.txtDriverName.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtDriverLicence.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Driver Licence should not be blank");
                this.txtDriverLicence.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtNRCNo.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "NRC No should not be blank");
                this.txtNRCNo.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtPhoneNo.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Phone No should not be blank");
                this.txtPhoneNo.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtAddress.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Address should not be blank");
                this.txtAddress.Focus();
                return(false);
            }
            return(true);
        }
Example #22
0
        private void dgvBusType_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            try
            {
                switch (e.ColumnIndex)
                {
                case 0:
                    this.recordID = this.dgvBusType.Rows[e.RowIndex].Cells["BusTypeID"].Value.ToString();

                    this.txtBusTypeCode.Text = this.dgvBusType.Rows[e.RowIndex].Cells["BusTypeCode"].Value.ToString();
                    this.txtDescription.Text = this.dgvBusType.Rows[e.RowIndex].Cells["Description"].Value.ToString();
                    this.txtTotalSeats.Text  = this.dgvBusType.Rows[e.RowIndex].Cells["TotalSeats"].Value.ToString();

                    this.btnSave.Text = "&Update";
                    break;

                case 1:
                    if (Globalizer.ShowMessage(MessageType.Question, "Are you sure want to delete?") == DialogResult.Yes)
                    {
                        recordID = this.dgvBusType.Rows[e.RowIndex].Cells["BusTypeID"].Value.ToString();
                        BusTypeController busTypeController = new BusTypeController();

                        busTypeController.DeleteByBusTypeID(recordID);

                        string log = "Form-BusType;Item-BusCode:" + this.txtBusTypeCode.Text + ";action-Delete";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Deleted Successfully");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
Example #23
0
        private bool CheckRequiredFields()
        {
            if (this.txtRouteCode.Visible == true)
            {
                if (string.IsNullOrEmpty(this.txtRouteCode.Text.Trim()))
                {
                    Globalizer.ShowMessage(MessageType.Warning, "Route Code should not be blank");
                    this.txtRouteCode.Focus();
                    return(false);
                }
            }

            if (this.cboRouteCode.Visible == true)
            {
                if (this.cboRouteCode.SelectedValue == null)
                {
                    Globalizer.ShowMessage(MessageType.Warning, "Route Code should not be blank");
                    this.cboRouteCode.Focus();
                    return(false);
                }
            }

            if (this.cboFromLocation.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "From Location should not be blank");
                this.cboFromLocation.Focus();
                return(false);
            }

            if (this.cboToLocation.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "To Location should not be blank");
                this.cboToLocation.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtRouteName.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Route Name should not be blank");
                this.txtRouteName.Focus();
                return(false);
            }
            return(true);
        }
Example #24
0
        private void NewEditExit_EditClick(object sender, EventArgs e)
        {
            try
            {
                switch (this.NewEditExit.BtnEditText)
                {
                case "&Edit":
                    this.EnableDisableControls(false);
                    this.cboTripCode.Enabled = true;
                    this.VisibleControls(true);
                    this.BindComboBox(true);
                    this.InitializeControls();
                    break;

                case "&Delete":
                    if (this.cboTripCode.SelectedValue != null)
                    {
                        if (Globalizer.ShowMessage(MessageType.Question, "Are you sure want to delete?") == DialogResult.Yes)
                        {
                            TripController tripController = new TripController();

                            tripController.DeleteByTripID(this.cboTripCode.SelectedValue.ToString());

                            string log = "Form-TripPlan;Item-TripCode:" + this.cboTripCode.Text + ";action-Delete";
                            userAction.Log(log);

                            Globalizer.ShowMessage(MessageType.Information, "Deleted Successfully");
                            this.ResetControl();
                            this.BindTripID();
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
        private void NewEditExit_EditClick(object sender, EventArgs e)
        {
            try
            {
                switch (NewEditExit.BtnEditText)
                {
                case "&Edit":
                    this.EnableDisableControls(false);
                    this.VisibleControls(false);
                    this.VisibleCon(true);
                    this.QuickSearch.txtNo.Text = null;

                    break;

                case "&Delete":
                    if (!string.IsNullOrEmpty(this.lblID.Text.Trim()))
                    {
                        if (Globalizer.ShowMessage(MessageType.Question, "Are you sure want to delete?") == DialogResult.Yes)
                        {
                            BookingController bookingController = new BookingController();
                            bookingController.Delete(this.lblTripID.Text.Trim(), this.lblID.Text.Trim());

                            string log = "Form-BookingEntry;Item-BookingNo:" + this.txtBookingNo.Text + ";action-Delete";
                            userAction.Log(log);

                            this.InitializeControls();
                            Globalizer.ShowMessage(MessageType.Information, "Deleted Successfully");
                            this.ResetControl();
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
        private void btnPost_Click(object sender, EventArgs e)
        {
            if (rdoSaleNo.Checked)
            {
                if (CheckRequiredFieldForSaleNo())
                {
                    SaleController saleController = new SaleController();
                    saleController.PostBySaleNo(this.cboFromSaleInvoiceNo.Text, this.cboToSaleInvoiceNo.Text);

                    string log = "Form-Posting;Item-Posting:" + "From" + "(" + this.cboFromSaleInvoiceNo.SelectedText + ")" + "To" + "(" + this.cboToSaleInvoiceNo.SelectedText + ")" + ";action-Post";
                    userAction.Log(log);

                    this.BindFromSaleNo();
                    this.BindToSaleNo();
                    Globalizer.ShowMessage(MessageType.Information, "Posted Successfully");
                }
            }
            else
            {
                if (CheckRequiredFieldForSaleDate())
                {
                    try
                    {
                        SaleController saleController = new SaleController();
                        saleController.PostBySaleDate(dtpFromSaleDate.Value, dtpToSaleDate.Value);

                        string log = "Form-Posting;Item-Posting:" + "From" + "(" + this.dtpFromSaleDate.ToString() + ")" + "To" + "(" + this.dtpToSaleDate.ToString() + ")" + ";action-Post";
                        userAction.Log(log);

                        Globalizer.ShowMessage(MessageType.Information, "Posted Successfully");
                    }
                    catch (Exception ex)
                    {
                        Globalizer.ShowMessage(MessageType.Warning, ex.Message);
                    }
                }
            }
        }
Example #27
0
        private bool CheckRequiredFields()
        {
            if (this.txtBusCode.Visible == true)
            {
                if (string.IsNullOrEmpty(this.txtBusCode.Text.Trim()))
                {
                    Globalizer.ShowMessage(MessageType.Warning, "Bus Code should not be blank");
                    this.txtBusCode.Focus();
                    return(false);
                }
            }

            if (this.cboBusCode.Visible == true)
            {
                if (this.cboBusCode.SelectedValue == null)
                {
                    Globalizer.ShowMessage(MessageType.Warning, "Bus Code should not be blank");
                    this.cboBusCode.Focus();
                    return(false);
                }
            }

            if (string.IsNullOrEmpty(this.txtBusNumber.Text.Trim()))
            {
                Globalizer.ShowMessage(MessageType.Warning, "Bus No should not be blank");
                this.txtBusNumber.Focus();
                return(false);
            }

            if (this.cboBusType.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "Bus Type should not be blank");
                this.cboBusType.Focus();
                return(false);
            }
            return(true);
        }
Example #28
0
        private void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckRequiredFields())
                {
                    string   routeName = cboRoute.Text.ToString();
                    DateTime date      = dtpDate.Value;
                    string   time      = cboTime.Text.ToString();

                    BookingController bookingController = new BookingController();
                    bookingController.CancelBooking(routeName, date, time);


                    this.cboRoute.SelectedValue = 0;
                    this.cboTime.SelectedValue  = 0;
                    Globalizer.ShowMessage(MessageType.Information, "Process Successfully");
                }
            }
            catch
            {
                Globalizer.ShowMessage(MessageType.Information, "Booking is not exist for this trip.");
            }
        }
        private bool CheckRequiredFieldsForTripCode()
        {
            if (this.cboFromTripCode.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "From Trip Code should not be blank");
                this.cboFromTripCode.Focus();
                return(false);
            }

            else if (this.cboToTripCode.SelectedValue == null)
            {
                Globalizer.ShowMessage(MessageType.Warning, "To Trip Code should not be blank");
                this.cboToTripCode.Focus();
                return(false);
            }

            else if (this.cboFromTripCode.SelectedIndex > this.cboToTripCode.SelectedIndex)
            {
                Globalizer.ShowMessage(MessageType.Warning, "To Trip Code should not be greater From Trip Code");
                this.cboToTripCode.Focus();
                return(false);
            }
            return(true);
        }
Example #30
0
        private void NewEditExit_NewClick(object sender, EventArgs e)
        {
            try
            {
                switch (NewEditExit.BtnNewText)
                {
                case "&New":
                    this.EnableDisableControls(true);
                    this.BindComboBox(false);
                    this.InitializeControls();
                    this.txtBusCode.Focus();
                    break;

                case "&Save":
                    if (this.CheckRequiredFields())
                    {
                        BusController busController = new BusController();
                        BusInfo       busInfo       = new BusInfo();

                        busInfo.BusID      = string.Empty;
                        busInfo.BusCode    = this.txtBusCode.Text.Trim();
                        busInfo.BusNo      = this.txtBusNumber.Text.Trim();
                        busInfo.BusTypeID  = this.cboBusType.SelectedValue.ToString();
                        busInfo.TotalSeats = Convert.ToInt32(this.lblTotalSeat.Text.Trim());

                        busController.Insert(busInfo);

                        string log = "Form-Bus;Item-BusCode:" + this.txtBusCode.Text + ";action-Save";
                        userAction.Log(log);

                        Globalizer.ShowMessage(MessageType.Information, "Saved Successfully");
                        this.ResetControl();

                        this.txtBusCode.Focus();
                    }
                    break;

                case "&Update":
                    if (this.CheckRequiredFields())
                    {
                        BusController busController = new BusController();
                        BusInfo       busInfo       = new BusInfo();

                        busInfo.BusID      = this.cboBusCode.SelectedValue.ToString();
                        busInfo.BusCode    = this.cboBusCode.Text.Trim();
                        busInfo.BusNo      = this.txtBusNumber.Text.Trim();
                        busInfo.BusTypeID  = this.cboBusType.SelectedValue.ToString();
                        busInfo.TotalSeats = Convert.ToInt32(this.lblTotalSeat.Text.Trim());

                        busController.UpdateByBusID(busInfo);

                        string log = "Form-Bus;Item-BusCode:" + this.cboBusCode.Text + ";action-Update";
                        userAction.Log(log);

                        Globalizer.ShowMessage(MessageType.Information, "Updated Successfully");
                        this.ResetControl();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }