protected void uiGridViewCrew_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteCrew")
     {
         SectorCrew objData = new SectorCrew();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         BindCrew();
     }
 }
Пример #2
0
        protected void uiRadGrid_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "EditSector")
            {
                Sector objData = new Sector();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                uiTextBoxSectorFlightNo.Text = objData.FlightNo;
                uiTextBoxDate.Text = objData.SectorDate.ToString("dd/MM/yyyy");
                uiDropDownListSectorFrom.SelectedValue = objData.From_AirportID.ToString();
                uiDropDownListSectorTo.SelectedValue = objData.To_AirportID.ToString();
                CurrentSector = objData;
                IsEdit = true;
                CanLoad = true;
                uiPanelEdit.Visible = true;
                uiPanelViewAll.Visible = false;
            //                BindSectors();
                BindCrew();
                BindPilots();
                CanLoad = false;
            }

            else if (e.CommandName == "DeleteSector")
            {
                Sector objData = new Sector();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                if ((objData.IsColumnNull("IsReturnSector") || objData.IsReturnSector == false) && !objData.IsColumnNull("ReturnSectorID"))
                {
                    Sector ReturnFlight = new Sector();
                    ReturnFlight.LoadByPrimaryKey(objData.ReturnSectorID);
                    ReturnFlight.IsReturnSector = false;
                    ReturnFlight.Save();

                }
                SectorCrew crew = new SectorCrew();
                crew.GetCrewBySectorID(objData.SectorID);
                SectorPilot pilots = new SectorPilot();
                pilots.GetPilotBySectorID(objData.SectorID);

                pilots.DeleteAll();
                pilots.Save();

                crew.DeleteAll();
                crew.Save();

                objData.MarkAsDeleted();
                objData.Save();

                BindReportData();
            }
        }
Пример #3
0
        protected void uiLinkButtonSave_Click(object sender, EventArgs e)
        {
            if (!IsEdit)
            {
                CurrentSector = new Sector();
                CurrentSector.AddNew();
            }
            CurrentSector.AirCraft_AirPlaneID = 1;
            CurrentSector.FlightNo = uiTextBoxSectorFlightNo.Text;
            CurrentSector.SectorDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null);
            CurrentSector.IsPAX = true;
            CurrentSector.From_AirportID = Convert.ToInt32(uiDropDownListSectorFrom.SelectedValue);
            CurrentSector.To_AirportID = Convert.ToInt32(uiDropDownListSectorTo.SelectedValue);
            CurrentSector.Save();

            if (IsEdit)
            {
                SectorPilot Oldpilots = new SectorPilot();
                Oldpilots.GetPilotBySectorID(CurrentSector.SectorID);
                Oldpilots.DeleteAll();
                Oldpilots.Save();

                SectorCrew OldCrew = new SectorCrew();
                OldCrew.GetCrewBySectorID(CurrentSector.SectorID);
                OldCrew.DeleteAll();
                OldCrew.Save();
            }

            CurrentPilots = new SectorPilot();
            for(int i=0 ;i< CurrentPilotsTable.Rows.Count ; i++)
            {
                CurrentPilots.AddNew();
                CurrentPilots.SectorID = CurrentSector.SectorID;
                CurrentPilots.PilotID = Convert.ToInt32(CurrentPilotsTable.Rows[i]["PilotID"]);
               // CurrentPilots.PositionID = Convert.ToInt32(CurrentPilotsTable.Rows[i]["PositionID"]);

            }
            CurrentPilots.Save();

            CurrentCrew = new SectorCrew();
            for (int i = 0; i < CurrentCrewTable.Rows.Count; i++)
            {
                CurrentCrew.AddNew();
                CurrentCrew.SectorID = CurrentSector.SectorID;
                CurrentCrew.CrewID = Convert.ToInt32(CurrentCrewTable.Rows[i]["CrewID"]);
              //  CurrentCrew.PositionID = Convert.ToInt32(CurrentCrewTable.Rows[i]["PositionID"]);
            }

            CurrentCrew.Save();

            if (MasterSector != null)
            {
                MasterSector.ReturnSectorID = CurrentSector.SectorID;
                CurrentSector.IsReturnSector = true;
                MasterSector.Save();
                CurrentSector.Save();
            }

            BindReportData();
            uiPanelViewAll.Visible = true;
            uiPanelEdit.Visible = false;

            MasterSector = null;
            CurrentSector = null;
            CurrentCrew = null;
            CurrentPilots = null;
            CurrentCrewTable = null;
            CurrentPilotsTable = null;
        }
 protected void uiLinkButtonAddCrew_Click(object sender, EventArgs e)
 {
     SectorCrew Member = new SectorCrew();
     if (!CrewExists(Convert.ToInt32(uiDropDownListCrew.SelectedValue)))
     {
         Member.AddNew();
         Member.SectorID = CurrentSector.SectorID;
         Member.PositionID = Convert.ToInt32(uiDropDownListCrewPos.SelectedValue);
         Member.CrewID = Convert.ToInt32(uiDropDownListCrew.SelectedValue);
         Member.Save();
     }
     BindCrew();
 }
Пример #5
0
        protected void uiRadGridFlights_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "EditSectorDetails")
            {

                Sector objData = new Sector();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                CurrentSector = objData;
                if (Roles.IsUserInRole("Operation") || Roles.IsUserInRole("Dispatcher"))
                {
                    Response.Redirect("~/Operation/SectorDetails.aspx?F=" + uiRadDatePickerFrom.SelectedDate.Value.ToString("dd/MM/yyyy") + "&T=" + uiRadDatePickerTo.SelectedDate.Value.ToString("dd/MM/yyyy"));
                }
                else if (Roles.IsUserInRole("Commercial"))
                {
                    Response.Redirect("~/Operation/InitiateSector.aspx?F=" + uiRadDatePickerFrom.SelectedDate.Value.ToString("dd/MM/yyyy") + "&T=" + uiRadDatePickerTo.SelectedDate.Value.ToString("dd/MM/yyyy"));
                }

            }
            else if (e.CommandName == "EditSectorPilots")
            {

                Sector objData = new Sector();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                CurrentSector = objData;
                Response.Redirect("~/Operation/SectorPilots.aspx?F=" + uiRadDatePickerFrom.SelectedDate.Value.ToString("dd/MM/yyyy") + "&T=" + uiRadDatePickerTo.SelectedDate.Value.ToString("dd/MM/yyyy"));
            }
            else if (e.CommandName == "EditSectorCrew")
            {

                Sector objData = new Sector();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                CurrentSector = objData;
                Response.Redirect("~/Operation/SectorCabinCrew.aspx?F=" + uiRadDatePickerFrom.SelectedDate.Value.ToString("dd/MM/yyyy") + "&T=" + uiRadDatePickerTo.SelectedDate.Value.ToString("dd/MM/yyyy"));
            }
            else if (e.CommandName == "DeleteSector")
            {

                Sector objData = new Sector();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                CurrentSector = objData;
                SectorCrew crew = new SectorCrew();
                crew.GetCrewBySectorID(objData.SectorID);
                SectorPilot pilots = new SectorPilot();
                pilots.GetPilotBySectorID(objData.SectorID);

                pilots.DeleteAll();
                pilots.Save();

                crew.DeleteAll();
                crew.Save();

                objData.MarkAsDeleted();
                objData.Save();
                CurrentSector = null;
                SearchSectors();
            }

            else if (e.CommandName == "ViewReport")
            {

                Sector objData = new Sector();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                CurrentSector = objData;
                Response.Redirect("FlightReport.aspx?RID=" + e.CommandArgument.ToString());
            }
        }
Пример #6
0
        /* protected void uiButtonSaveMaster_Click(object sender, EventArgs e)
        {
            if (CurrentFlightReport != null)
            {
                Flight objData = CurrentFlightReport;
                //objData.FlightNo = uiTextBoxFlightNo.Text;
                objData.AirCraft_AirPlaneID = Convert.ToInt32(uiDropDownListAirCraftRegistration.SelectedValue);
                objData.ReportDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null);
                objData.IsHeavy = uiCheckBoxIsHeavy.Checked;
                objData.Save();
            }
            else
            {
                Flight objData = new Flight();
                objData.AddNew();
                //objData.FlightNo = uiTextBoxFlightNo.Text;
                objData.AirCraft_AirPlaneID = Convert.ToInt32(uiDropDownListAirCraftRegistration.SelectedValue);
                objData.ReportDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null);
                objData.IsHeavy = uiCheckBoxIsHeavy.Checked;
                objData.Save();
                CurrentFlightReport = objData;
                EnableDisableTabs();
            }
        }*/
        protected void uiRadGridFlights_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "EditSector")
            {
                Sector objData = new Sector();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                CurrentSector = objData;
                FillSectorData();
                uiPanelEdit.Visible = true;
                uiPanelViewAll.Visible = false;
                EnableDisableTabs();
                //BindSectors();
                BindCrew();
                BindPilots();
            }

            else if (e.CommandName == "DeleteSector")
            {
                Sector objData = new Sector();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                SectorCrew crew = new SectorCrew();
                crew.GetCrewBySectorID(objData.SectorID);
                SectorPilot pilots = new SectorPilot();
                pilots.GetPilotBySectorID(objData.SectorID);

                pilots.DeleteAll();
                pilots.Save();

                crew.DeleteAll();
                crew.Save();

                //sectors.DeleteAll();
                //sectors.Save();

                objData.MarkAsDeleted();
                objData.Save();

                //BindReportData();
                SearchSectors();
            }

            else if (e.CommandName == "ViewReport")
            {
                Response.Redirect("FlightReport.aspx?RID=" + e.CommandArgument.ToString());
            }
        }