Exemplo n.º 1
0
        private void OnScheduleBeforeCellActivate(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e)
        {
            //Event handler for cell activated
            try {
                //Set cell editing
                switch (e.Cell.Column.Key.ToString())
                {
                case "ID":
                case "Created":
                case "CreateUserID":
                case "ScheduleDate":
                case "LoadTenderNumber":
                case "Cancelled":
                case "CancelledBy":
                case "LastUpdated":
                case "UserID":
                case "RowVersion":
                    e.Cell.Activation = Activation.NoEdit;
                    break;

                default:
                    e.Cell.Activation = RoleServiceGateway.IsDispatchSupervisor || RoleServiceGateway.IsDispatchClerk || RoleServiceGateway.IsWindowClerk || RoleServiceGateway.IsBBBClerk ? Activation.AllowEdit : Activation.NoEdit;
                    break;
                }
            }
            catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); }
            finally { setUserServices(); }
        }
Exemplo n.º 2
0
 private void OnGridBeforeCellActivate(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e)
 {
     //Event handler for data entry cell activating
     try {
         //Enable\disable cell editing
         switch (e.Cell.Column.Key.ToString())
         {
         //Allow send change if applicable subscription
         case "Send":
             bool   allow      = false;
             string terminalID = e.Cell.Row.Cells["TerminalID"].Value.ToString().Trim();
             if (terminalID.Length > 0)
             {
                 //Carrier subscriptions
                 string carrierID = e.Cell.Row.Cells["CarrierAgentID"].Value.ToString().Trim();
                 allow = (terminalID == this.mSchedule.SortCenterID.ToString() && (carrierID.Length > 0 && this.mSchedule.Trips.ShipScheduleViewTable.Select("carrierID=" + carrierID).Length > 0));
             }
             else
             {
                 //Agent subscriptions
                 string agentNumber = e.Cell.Row.Cells["CarrierAgentID"].Value.ToString().Trim();
                 allow = ((agentNumber.Length > 0) && (this.mSchedule.Trips.ShipScheduleViewTable.Select("AgentNumber='" + agentNumber + "'").Length > 0) || this.mSchedule.Trips.ShipScheduleViewTable.Select("S2AgentNumber='" + agentNumber + "'").Length > 0);
             }
             e.Cell.Activation = allow ? Activation.AllowEdit : Activation.Disabled;
             break;
         }
         e.Cell.Selected = true;
     }
     catch (Exception ex) { App.ReportError(ex); }
 }
Exemplo n.º 3
0
        private void OnGridBeforeCellActivate(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e)
        {
            //Event handler for assigned cell activated
            DateTime dt;

            try {
                //Set date limits
                switch (e.Cell.Column.Key.ToString())
                {
                case "Assign":
                    e.Cell.Activation = Activation.AllowEdit;
                    break;

                case "AssignedDate":
                    //Set assigned only if battery is assigned
                    if (Convert.ToBoolean(e.Cell.Row.Cells["Assign"].Text))
                    {
                        e.Cell.Activation = Activation.AllowEdit;

                        //Set date limits for assignment
                        this.dtGrid.MinDate = DateTime.Today.AddMonths(-1);
                        this.dtGrid.MaxDate = DateTime.Today.AddMonths(1);

                        //Validate (and correct) assigned value
                        if (e.Cell.Value != DBNull.Value)
                        {
                            dt = Convert.ToDateTime(e.Cell.Value);
                            if (dt.Ticks < this.dtGrid.MinDate.Ticks)
                            {
                                e.Cell.Value = this.dtGrid.MinDate;
                            }
                            else if (dt.Ticks > this.dtGrid.MaxDate.Ticks)
                            {
                                e.Cell.Value = this.dtGrid.MaxDate;
                            }
                        }
                    }
                    else
                    {
                        e.Cell.Activation = Activation.NoEdit;
                    }
                    break;

                default:        e.Cell.Activation = Activation.NoEdit; break;
                }
                this.dtGrid.Value = this.dtGrid.MinDate;
            }
            catch (Exception) { }
        }
Exemplo n.º 4
0
        private void OnScheduleBeforeCellActivate(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e)
        {
            //Event handler for cell activated
            try {
                //Set cell editing
                switch (e.Cell.Column.Key.ToString())
                {
                case "VendorName":
                case "ConsigneeName":
                case "ScheduledArrival":
                case "CarrierName":
                case "DriverName":
                case "Amount":
                case "AmountType":
                case "FreightType":
                case "SortDate":
                case "IsLiveUnload":
                case "TrailerNumber":
                case "ActualArrival":
                case "TDSNumber":
                case "TDSCreateUserID":
                case "In":
                case "Comments":
                    e.Cell.Activation = RoleServiceGateway.IsDispatchSupervisor || RoleServiceGateway.IsDispatchClerk || RoleServiceGateway.IsWindowClerk ? Activation.AllowEdit : Activation.NoEdit;
                    break;

                case "ID":
                case "Created":
                case "CreateUserID":
                case "ScheduleDate":
                case "IsTemplate":
                case "CancelledUserID":
                case "Cancelled":
                case "LastUpdated":
                case "UserID":
                case "RowVersion":
                    e.Cell.Activation = Activation.NoEdit;
                    break;

                default:
                    e.Cell.Activation = Activation.NoEdit;
                    break;
                }
            }
            catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); }
            finally { setUserServices(); }
        }
Exemplo n.º 5
0
        private void OnCellActivating(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e)
        {
            //Event handler for cell activated
            try {
                //Provide dynamic (value-based) activation
                switch (e.Cell.Column.Key.ToString())
                {
                case "RequestedBy":
                    e.Cell.Activation = (e.Cell.Text.Length > 0) ? Activation.NoEdit : Activation.AllowEdit;
                    break;

                default:
                    e.Cell.Activation = Activation.AllowEdit;
                    break;
                }
            }
            catch (Exception) { }
        }
Exemplo n.º 6
0
        private void OnScheduleBeforeCellActivate(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e)
        {
            //Event handler for cell activated
            try {
                //Set cell editing
                switch (e.Cell.Column.Key.ToString())
                {
                case "TrailerNumber":
                case "InboundDate":
                case "InboundCarrier":
                case "InboundSeal":
                case "InboundDriverName":
                case "TDSNumber":
                case "InitialYardLocation":
                case "OutboundDate":
                case "OutboundCarrier":
                case "OutboundSeal":
                case "OutboundDriverName":
                case "BOLNumber":
                case "Comments":
                    e.Cell.Activation = RoleServiceGateway.IsDispatchSupervisor || RoleServiceGateway.IsDispatchClerk || RoleServiceGateway.IsWindowClerk || RoleServiceGateway.IsSafetySupervisor ? Activation.AllowEdit : Activation.NoEdit;
                    break;

                case "ID":
                case "Created":
                case "CreateUserID":
                case "ScheduleDate":
                case "IsTemplate":
                case "CancelledUserID":
                case "Cancelled":
                case "LastUpdated":
                case "UserID":
                case "RowVersion":
                    e.Cell.Activation = Activation.NoEdit;
                    break;

                default:
                    e.Cell.Activation = Activation.NoEdit;
                    break;
                }
            }
            catch (Exception ex) { App.ReportError(ex); }
            finally { setUserServices(); }
        }
Exemplo n.º 7
0
 private void OnGridBeforeCellActivate(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e)
 {
     //Event handler for data entry cell activating
 }