protected void uiGridViewCrew_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DataRowView objData = (DataRowView)e.Row.DataItem;
         Crew current = new Crew();
         current.LoadByPrimaryKey(Convert.ToInt32(objData["CrewID"].ToString()));
         Label temp = (Label)e.Row.FindControl("uiLabelName");
         temp.Text = current.Name;
         Label temp2 = (Label)e.Row.FindControl("uiLabelStaffNo");
         if (!current.IsColumnNull("StaffNo"))
         {
             temp2.Text = current.StaffNo.ToString();
         }
         if (objData["PositionID"] != null)
         {
             Label pos = (Label)e.Row.FindControl("uiLabelPosition");
             Position Currentpos = new Position();
             Currentpos.LoadByPrimaryKey(Convert.ToInt32(objData["PositionID"].ToString()));
             pos.Text = Currentpos.Title;
         }
     }
 }
Ejemplo n.º 2
0
        protected void uiRadGridActivityLog_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
            {
                DataRowView row = (DataRowView)e.Item.DataItem;
                Crew c = new Crew();
                c.LoadByPrimaryKey(Convert.ToInt32(row["CrewID"].ToString()));
                Label CrewName = (Label)e.Item.FindControl("uiLabelName");
                CrewName.Text = c.Name;

                Flight_BLL.Activities Act = new Flight_BLL.Activities();
                Act.LoadByPrimaryKey(Convert.ToInt32(row["ActivityID"].ToString()));
                Label ActName = (Label)e.Item.FindControl("uiLabelActivityName");
                ActName.Text = Act.Name;

            }
        }
        protected void uiRadGridCrew_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "EditCrew")
            {
                Crew objData = new Crew();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                CurrentCrew = objData;
                FillCrewData();
                uiPanelEdit.Visible = true;
                uiPanelViewAll.Visible = false;

            }

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

                if (Membership.GetUser(objData.Username) != null)
                {
                    Membership.DeleteUser(objData.Username);
                }

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

                SearchCrew();
            }
        }