protected void OnCommand(object sender, CommandEventArgs e) { // try { switch (e.CommandName) { case "Submit": //Prepare the pickup request Argix.Freight.Client.PickupRequest request = new Argix.Freight.Client.PickupRequest(); request.RequestID = 0; request.Created = DateTime.Now; request.CreateUserID = Membership.GetUser().UserName; request.ScheduleDate = DateTime.Parse(this.txtPickupDate.Text); request.CallerName = Membership.GetUser().UserName; request.ClientNumber = Profile.GetProfile(Membership.GetUser().UserName).ClientID; request.Client = " "; request.ShipperNumber = ""; request.Shipper = this.txtShipperName.Text; request.ShipperAddress = this.txtShipperStreet.Text + "\r\n" + this.txtShipperCity.Text + ", " + this.txtShipperState.Text + " " + this.txtShipperZip.Text; request.ShipperPhone = this.txtShipperPhone.Text; request.WindowOpen = int.Parse(this.txtWindowOpen.Text); request.WindowClose = int.Parse(this.txtWindowClose.Text); request.TerminalNumber = ""; request.Terminal = ""; request.DriverName = ""; request.OrderType = "P"; request.Amount = int.Parse(this.txtQuantity.Text); request.AmountType = "Pallets"; request.FreightType = "Tsort"; request.Weight = int.Parse(this.txtWeight.Text); request.Comments = this.txtComments.Text; request.IsTemplate = false; request.UserID = Membership.GetUser().UserName; request.LastUpdated = DateTime.Now; //Request a pickup int pickupID = new Argix.Freight.Client.FreightClientGateway().RequestPickup(request); //Send confirmation message to client new NotifyService().NotifyPickupConfirmation(Membership.GetUser().Email, pickupID.ToString()); //Notify client Master.ShowMessageBox("New pickup request " + pickupID.ToString() + " has been created."); this.btnSubmit.Enabled = false; this.btnCancel.Text = "Close"; break; case "Cancel": Response.Redirect("~/Client/PickupLog.aspx", false); break; } } catch (Exception ex) { Master.ReportError(ex, 4); } }
protected void OnPickupsCommand(object sender,CommandEventArgs e) { //Event handler for change in view switch (e.CommandName) { case "New": Response.Redirect("~/Client/ClientPickup.aspx?pickupid=0"); break; case "Cancel": //Cancel the selected pickup request int pickupID = int.Parse(this.grdPickups.SelectedDataKey.Value.ToString()); bool cancelled = new Argix.Freight.Client.FreightClientGateway().CancelClientPickup(pickupID); //Send confirmation message to client new NotifyService().NotifyPickupCancelled(Membership.GetUser().Email,pickupID.ToString()); //Notify client Master.ShowMessageBox("Pickup " + pickupID.ToString() + " has been cancelled."); break; } }
protected void OnPickupLogCommand(object sender, CommandEventArgs e) { //Event handler for change in view int pickupID = 0; try { switch (e.CommandName) { case "New": Response.Redirect("~/Client/PickupRequest.aspx?pickupid=0", false); break; case "Update": pickupID = int.Parse(this.grdPickupLog.SelectedDataKey.Value.ToString()); Response.Redirect("~/Client/PickupRequest.aspx?pickupid=" + pickupID.ToString(), false); break; case "Cancel": //Cancel the selected pickup request pickupID = int.Parse(this.grdPickupLog.SelectedDataKey.Value.ToString()); bool cancelled = new Argix.Freight.Client.FreightClientGateway().CancelPickup(pickupID); //Send confirmation message to client and sales rep (if applicable) Argix.Freight.Client.PickupRequest pickup = new Argix.Freight.Client.FreightClientGateway().ReadPickup(pickupID); new NotifyService().NotifyPickupCancelled(Master.CurrentClient.ContactEmail, pickupID.ToString(), pickup); if (Master.SalesRep != null && Master.CurrentClient.ID != Master.SalesRep.ID) { new NotifyService().NotifyPickupCancelled(Master.SalesRep.ContactEmail, pickupID.ToString(), pickup); } //Update log this.grdPickupLog.DataBind(); //Notify client Master.ShowMessageBox("Pickup request " + pickupID.ToString() + " has been cancelled."); break; } } catch (Exception ex) { Master.ReportError(ex, 4); } finally { OnValidateForm(null, EventArgs.Empty); } }
protected void OnCommand(object sender, CommandEventArgs e) { // try { switch (e.CommandName) { case "Submit": //Prepare the pickup request Argix.Freight.Client.PickupRequest request = null; if (this.mPickup == null) { request = new Argix.Freight.Client.PickupRequest(); request.RequestID = 0; request.Created = DateTime.Now; request.CreateUserID = "PSP"; request.ScheduleDate = DateTime.Parse(this.txtPickupDate.Text); request.CallerName = Membership.GetUser().UserName; //Need Tsort clientNumber for Dispatch request.ClientNumber = Master.CurrentClient.Number; request.Client = Master.CurrentClient.Name; request.ShipperNumber = ""; request.Shipper = this.txtShipperName.Text; request.ShipperAddress = this.txtShipperStreet.Text + "\r\n" + this.txtShipperCity.Text + ", " + this.txtShipperState.Text + " " + this.txtShipperZip.Text; request.ShipperPhone = this.txtShipperPhone.Text; request.WindowOpen = int.Parse(this.txtWindowOpen.Text.Replace(":", "")); request.WindowClose = int.Parse(this.txtWindowClose.Text.Replace(":", "")); request.TerminalNumber = "0001"; request.Terminal = "ARGIX LOGISTICS RIDGEFIELD"; request.DriverName = ""; request.OrderType = "B"; request.Amount = int.Parse(this.txtQuantity.Text); request.AmountType = "Pallets"; request.FreightType = "Tsort"; request.Weight = int.Parse(this.txtWeight.Text); request.Comments = this.txtComments.Text; request.IsTemplate = false; request.UserID = Membership.GetUser().UserName; request.LastUpdated = DateTime.Now; //Request a pickup int pickupID = new Argix.Freight.Client.FreightClientGateway().RequestPickup(request); //Send confirmation message to client and sales rep (if applicable) new NotifyService().NotifyPickupConfirmation(Master.CurrentClient.ContactEmail, pickupID.ToString(), request); if (Master.SalesRep != null && Master.CurrentClient.ID != Master.SalesRep.ID) { new NotifyService().NotifyPickupConfirmation(Master.SalesRep.ContactEmail, pickupID.ToString(), request); } //Notify client Master.ShowMessageBox("New pickup request " + pickupID.ToString() + " has been created."); this.btnSubmit.Enabled = false; this.btnCancel.Text = "Close"; } else { request = this.mPickup; request.ScheduleDate = DateTime.Parse(this.txtPickupDate.Text); request.WindowOpen = int.Parse(this.txtWindowOpen.Text.Replace(":", "")); request.WindowClose = int.Parse(this.txtWindowClose.Text.Replace(":", "")); request.Amount = int.Parse(this.txtQuantity.Text); request.Weight = int.Parse(this.txtWeight.Text); request.Comments = this.txtComments.Text; request.UserID = Membership.GetUser().UserName; request.LastUpdated = DateTime.Now; //Update the pickup bool updated = new Argix.Freight.Client.FreightClientGateway().UpdatePickup(request); //Send confirmation message to client and sales rep (if applicable) new NotifyService().NotifyPickupConfirmation(Master.CurrentClient.ContactEmail, request.RequestID.ToString(), request); if (Master.SalesRep != null && Master.CurrentClient.ID != Master.SalesRep.ID) { new NotifyService().NotifyPickupConfirmation(Master.SalesRep.ContactEmail, request.RequestID.ToString(), request); } //Notify client Master.ShowMessageBox("Pickup request " + request.RequestID.ToString() + " has been updated."); this.btnSubmit.Enabled = false; this.btnCancel.Text = "Close"; } break; case "Cancel": Response.Redirect("~/Client/PickupLog.aspx", false); break; } } catch (Exception ex) { Master.ReportError(ex, 4); } }