Ejemplo n.º 1
0
        private void setUserServices()
        {
            //Set user services
            try {
                bool canCancel = false;
                bool canManage = this.cboSchedule.SelectedItem.ToString() == "Today" || this.cboSchedule.SelectedItem.ToString() == "Advanced";
                try {
                    int id = Convert.ToInt32(this.grdSchedule.ActiveRow.Cells["ID"].Value);
                    DispatchDataset.ClientInboundScheduleTableRow appointment = (DispatchDataset.ClientInboundScheduleTableRow) this.mSchedule.ClientInboundScheduleTable.Select("ID=" + id)[0];
                    canCancel = appointment.IsActualArrivalNull();
                }
                catch { }

                this.cboSchedule.Enabled = true;
                this.csNew.Enabled       = canManage && this.grdSchedule.Focused && (RoleServiceGateway.IsDispatchSupervisor);
                this.csOpen.Enabled      = this.grdSchedule.Focused && this.grdSchedule.ActiveRow != null;
                this.csClone.Enabled     = canManage && this.grdSchedule.Focused && this.grdSchedule.ActiveRow != null && (RoleServiceGateway.IsDispatchSupervisor);
                this.csCancel.Enabled    = canManage && this.grdSchedule.Focused && canCancel && (RoleServiceGateway.IsDispatchSupervisor);
                this.csRefresh.Enabled   = true;

                this.csTempNew.Enabled     = this.grdTemplates.Focused && (RoleServiceGateway.IsDispatchSupervisor);
                this.csTempOpen.Enabled    = this.grdTemplates.Focused && this.grdTemplates.ActiveRow != null && (RoleServiceGateway.IsDispatchSupervisor);
                this.csTempCancel.Enabled  = this.grdTemplates.Focused && this.grdTemplates.ActiveRow != null && (RoleServiceGateway.IsDispatchSupervisor);
                this.csTempLoad.Enabled    = canManage && this.grdTemplates.Focused && this.grdTemplates.Selected.Rows.Count > 0 && (RoleServiceGateway.IsDispatchSupervisor);
                this.csTempRefresh.Enabled = true;
            }
            catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); }
            finally { Application.DoEvents(); if (this.ServiceStatesChanged != null)
                      {
                          this.ServiceStatesChanged(this, new EventArgs());
                      }
            }
        }
Ejemplo n.º 2
0
 public dlgClientInboundFreight(DispatchDataset.ClientInboundScheduleTableRow freight, bool isTemplate = false)
 {
     //Constructor
     try {
         InitializeComponent();
         this.mAppt          = freight;
         this.mIsNewSchedule = this.mAppt.IsIDNull() || (!this.mAppt.IsIDNull() && this.mAppt.ID == 0);
         this.mIsTemplate    = isTemplate;
     }
     catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
 }
Ejemplo n.º 3
0
 private void OnScheduleAfterRowUpdate(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e)
 {
     //
     try {
         this.grdSchedule.Update();
         int id = Convert.ToInt32(this.grdSchedule.ActiveRow.Cells["ID"].Value);
         DispatchDataset.ClientInboundScheduleTableRow appointment = (DispatchDataset.ClientInboundScheduleTableRow) this.mSchedule.ClientInboundScheduleTable.Select("ID=" + id)[0];
         FreightGateway.ChangeClientInboundFreight(appointment);
         Refresh();
     }
     catch (Exception ex) { App.ReportError(ex, true, LogLevel.Warning); }
 }
Ejemplo n.º 4
0
        private void OnItemClick(object sender, System.EventArgs e)
        {
            dlgClientInboundFreight dlg = null;

            DispatchDataset.ClientInboundScheduleTableRow appointment = null;
            int id = 0;

            try {
                ToolStripItem item = (ToolStripItem)sender;
                switch (item.Name)
                {
                case "csNew":
                    appointment = new DispatchDataset().ClientInboundScheduleTable.NewClientInboundScheduleTableRow();
                    switch (this.cboSchedule.SelectedItem.ToString())
                    {
                    case "Today": appointment.ScheduleDate = DateTime.Today; break;

                    case "Advanced": appointment.ScheduleDate = DateTime.Today.AddDays(1); break;
                    }
                    appointment.ConsigneeName = "ARGIX LOGISTICS NATIONAL";
                    appointment.CarrierName   = "ARGIX";
                    appointment.IsTemplate    = false;
                    dlg      = new dlgClientInboundFreight(appointment);
                    dlg.Font = this.Font;
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        FreightGateway.AddClientInboundFreight(appointment);
                        Refresh();
                    }
                    break;

                case "csOpen":
                    id = Convert.ToInt32(this.grdSchedule.ActiveRow.Cells["ID"].Value);
                    DispatchDataset.ClientInboundScheduleTableRow _freight = (DispatchDataset.ClientInboundScheduleTableRow) this.mSchedule.ClientInboundScheduleTable.Select("ID=" + id)[0];
                    appointment           = new DispatchDataset().ClientInboundScheduleTable.NewClientInboundScheduleTableRow();
                    appointment.ItemArray = _freight.ItemArray;
                    dlg      = new dlgClientInboundFreight(appointment);
                    dlg.Font = this.Font;
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        FreightGateway.ChangeClientInboundFreight(appointment);
                        Refresh();
                    }
                    break;

                case "csClone":
                    id          = Convert.ToInt32(this.grdSchedule.ActiveRow.Cells["ID"].Value);
                    appointment = (DispatchDataset.ClientInboundScheduleTableRow) this.mSchedule.ClientInboundScheduleTable.Select("ID=" + id)[0];
                    DispatchDataset.ClientInboundScheduleTableRow clone = new DispatchDataset().ClientInboundScheduleTable.NewClientInboundScheduleTableRow();
                    switch (this.cboSchedule.SelectedItem.ToString())
                    {
                    case "Today": clone.ScheduleDate = DateTime.Today; break;

                    case "Advanced": clone.ScheduleDate = DateTime.Today.AddDays(1); break;
                    }
                    clone.VendorName       = appointment.VendorName;
                    clone.ConsigneeName    = appointment.ConsigneeName;
                    clone.ScheduledArrival = clone.ScheduleDate.Date + appointment.ScheduledArrival.TimeOfDay;
                    if (!appointment.IsAmountNull())
                    {
                        clone.Amount = appointment.Amount;
                    }
                    if (!appointment.IsAmountTypeNull())
                    {
                        clone.AmountType = appointment.AmountType;
                    }
                    if (!appointment.IsFreightTypeNull())
                    {
                        clone.FreightType = appointment.FreightType;
                    }
                    if (!appointment.IsCommentsNull())
                    {
                        clone.Comments = appointment.Comments;
                    }
                    clone.IsTemplate = false;
                    dlg      = new dlgClientInboundFreight(clone);
                    dlg.Font = this.Font;
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        FreightGateway.AddClientInboundFreight(clone);
                        Refresh();
                    }
                    break;

                case "csCancel":
                    Cancel();
                    break;

                case "csRefresh": Refresh(); break;

                case "csTempNew":
                    appointment = new DispatchDataset().ClientInboundScheduleTable.NewClientInboundScheduleTableRow();
                    appointment.ConsigneeName = "ARGIX LOGISTICS NATIONAL";
                    appointment.IsTemplate    = true;
                    dlg      = new dlgClientInboundFreight(appointment, true);
                    dlg.Font = this.Font;
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        FreightGateway.AddClientInboundFreight(appointment);
                        Refresh();
                    }
                    break;

                case "csTempOpen":
                    id = Convert.ToInt32(this.grdTemplates.ActiveRow.Cells["ID"].Value);
                    DispatchDataset.ClientInboundScheduleTableRow _template = (DispatchDataset.ClientInboundScheduleTableRow) this.mTemplates.ClientInboundScheduleTable.Select("ID=" + id)[0];
                    appointment           = new DispatchDataset().ClientInboundScheduleTable.NewClientInboundScheduleTableRow();
                    appointment.ItemArray = _template.ItemArray;
                    dlg      = new dlgClientInboundFreight(appointment, true);
                    dlg.Font = this.Font;
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        FreightGateway.ChangeClientInboundFreight(appointment);
                        Refresh();
                    }
                    break;

                case "csTempCancel":
                    id = Convert.ToInt32(this.grdTemplates.ActiveRow.Cells["ID"].Value);
                    if (MessageBox.Show(this, "Are you sure you want to cancel appointment template " + id.ToString() + "?", App.Product, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        FreightGateway.CancelClientInboundFreight(id, DateTime.Now, Environment.UserName);
                        Refresh();
                    }
                    break;

                case "csTempLoad":
                    for (int i = 0; i < this.mTemplates.ClientInboundScheduleTable.Rows.Count; i++)
                    {
                        if (this.mTemplates.ClientInboundScheduleTable[i].Selected == true)
                        {
                            appointment              = new DispatchDataset().ClientInboundScheduleTable.NewClientInboundScheduleTableRow();
                            appointment.ItemArray    = this.mTemplates.ClientInboundScheduleTable[i].ItemArray;
                            appointment.CreateUserID = Environment.UserName;
                            appointment.Created      = DateTime.Now;
                            switch (this.cboSchedule.SelectedItem.ToString())
                            {
                            case "Today": appointment.ScheduleDate = DateTime.Today; break;

                            case "Advanced": appointment.ScheduleDate = DateTime.Today.AddDays(1); break;
                            }
                            appointment.ScheduledArrival = appointment.ScheduleDate.Date + appointment.ScheduledArrival.TimeOfDay;
                            appointment.IsTemplate       = false;
                            FreightGateway.AddClientInboundFreight(appointment);
                        }
                    }
                    Refresh();
                    break;

                case "csTempRefresh": Refresh(); break;
                }
            }
            catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); }
            finally { setUserServices(); this.Cursor = Cursors.Default; }
        }