internal bool LogAction(String reason, Guid userId)
        {
            try
            {
                var logger = new BCLoggerMapperService();

                if (_logIpAddress)
                {
                    reason = reason + " (" + Request.UserHostAddress + ")";
                }

                return(logger.AddLog(_portletTemplate.ID.AsGuid, PortalUser.Current.ID.AsGuid, userId, reason, DateTime.Now));
            }
            catch (Exception ex)
            {
                if (PortalUser.Current.IsSiteAdmin)
                {
                    divError.InnerHtml = Globalizer.GetGlobalizedString("CUS_BC_PL_ERROR_ADMIN") + ex;
                }
                else
                {
                    divError.InnerHtml = Globalizer.GetGlobalizedString("CUS_BC_PL_ERROR_USER");
                }

                divError.Visible = true;
                return(false);
            }
        }
Esempio n. 2
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 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);
            }
        }
        internal bool LogAction(String reason, Guid userId)
        {
            try
            {
                var logger = new BCLoggerMapperService();

                if (_logIpAddress)
                {
                    reason = reason + " (" + Request.UserHostAddress + ")";
                }

                return(logger.AddLog(ParentPortlet.Portlet.PortletTemplate.ID.AsGuid, PortalUser.Current.ID.AsGuid, userId, reason, DateTime.Now));
            }
            catch (Exception ex)
            {
                if (PortalUser.Current.IsSiteAdmin)
                {
                    ParentPortlet.ShowFeedback(FeedbackType.Error, Globalizer.GetGlobalizedString("CUS_BC_PL_ERROR_ADMIN") + ex);
                }
                else
                {
                    ParentPortlet.ShowFeedback(FeedbackType.Error, Globalizer.GetGlobalizedString("CUS_BC_PL_ERROR_USER"));
                }

                return(false);
            }
        }
 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 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 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 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 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);
            }
        }
Esempio n. 14
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);
            }
        }
        public Check RoleCheck(PortalUser pu, PortletTemplate portletTemplate, PortalUser currentUser = null)
        {
            if (currentUser == null)
            {
                currentUser = PortalUser.Current;
            }

            if (portletTemplate.AccessCheck("DenyAccess", pu))
            {
                return(new Check(false, Globalizer.GetGlobalizedString("CUS_BC_PL_DENIED_PERMS")));
            }

            if (pu.IsMemberOf(PortalGroup.Staff))
            {
                if (!portletTemplate.AccessCheck("CanProxyStaff", currentUser))
                {
                    return(new Check(false, Globalizer.GetGlobalizedString("CUS_BC_PL_STAFF_PERMS")));
                }
            }

            if (pu.IsMemberOf(PortalGroup.Faculty))
            {
                if (!portletTemplate.AccessCheck("CanProxyFaculty", currentUser))
                {
                    return(new Check(false, Globalizer.GetGlobalizedString("CUS_BC_PL_FACULTY_PERMS")));
                }
            }

            if (pu.IsMemberOf(PortalGroup.Students))
            {
                if (!portletTemplate.AccessCheck("CanProxyStudent", currentUser))
                {
                    return(new Check(false, Globalizer.GetGlobalizedString("CUS_BC_PL_STUDENT_PERMS")));
                }
            }

            if (pu.IsMemberOf(PortalGroup.FindByStatusCode("CAN"))) // Candidate
            {
                if (!portletTemplate.AccessCheck("CanProxyCandidate", currentUser))
                {
                    return(new Check(false, Globalizer.GetGlobalizedString("CUS_BC_PL_CANDIDATE_PERMS")));
                }
            }

            if (pu.IsMemberOf(PortalGroup.FindByStatusCode("ALM")))
            {
                if (!portletTemplate.AccessCheck("CanProxyConstituent", currentUser))
                {
                    return(new Check(false, Globalizer.GetGlobalizedString("CUS_BC_PL_CONSTITUENT_PERMS")));
                }
            }

            return(pu.IsMemberOf(PortalGroup.Administrators) ? new Check(false, Globalizer.GetGlobalizedString("CUS_BC_PL_SITE_ADMIN_PERMS")) : new Check(true));
        }
Esempio n. 16
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 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 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);
            }
        }
Esempio n. 22
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);
        }
Esempio n. 23
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 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);
        }
Esempio n. 25
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);
            }
        }
Esempio n. 26
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);
        }
 protected void BtnLoginClick(object sender, EventArgs e)
 {
     if (String.Empty == tbReason.Text.Trim())
     {
         divmessage.InnerHtml = Globalizer.GetGlobalizedString("CUS_BC_PL_REQUIRED_REASON");
         divmessage.Visible   = true;
     }
     else if (_requirePassword && !ValidPassword())
     {
         divmessage.InnerHtml = Globalizer.GetGlobalizedString("CUS_BC_PL_INVALID_PW");
         divmessage.Visible   = true;
         if (_logFailures)
         {
             var user = getPortalUserByUserName(tbUserName.Text);
             LogAction(Globalizer.GetGlobalizedString("CUS_BC_PL_INVALID_PW"), user.ID);
         }
     }
     else
     {
         PerformLogin();
     }
 }
Esempio n. 28
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);
                    }
                }
            }
        }