protected void SaveGroupsButton_Click(object sender, EventArgs e) { var user = (User)Session["User"]; DataClassesDataContext db = new DataClassesDataContext(Handler_Global.connectString); if (user == null) { return; } var user_saved_layout = db.Users.First <User>(eu => eu.UserID == user.UserID); if (user_saved_layout == null) { return; } var layoutString = OpsLiveGrid.SaveClientLayout(); user_saved_layout.Layout_OpsLive = layoutString; var groupsString = ""; for (Int32 i = 0; i < OpsLiveGrid.VisibleRowCount; i++) { if (OpsLiveGrid.IsGroupRow(i) && OpsLiveGrid.IsRowExpanded(i)) { groupsString += i.ToString() + ";"; } } if (groupsString != "") { user_saved_layout.Layout_Groups_OpsLiveGrid = groupsString; } db.SubmitChanges(); }
protected void LiveCaller_BackFromWalking_Button_Click(object sender, EventArgs e) { var user = (User)Session["User"]; if (user == null) { return; } var AhwalMappingID = Request.Form["LiveCaller_AwahlMappingID"]; if (AhwalMappingID == null) { return; } var personState = new PatrolPersonState(); personState.PatrolPersonStateID = Core.Handler_AhwalMapping.PatrolPersonState_BackFromWalking; var result = Core.Handler_AhwalMapping.Ops_ChangePersonState(user, Convert.ToInt64(AhwalMappingID), personState); if (result.StatusID == Core.Handler_Operations.Opeartion_Status_Success) { OpsLiveGrid.DataBind(); } LiveCaller_PopUp.ShowOnPageLoad = false; }
protected void OpsLiveGrid_CustomJSProperties(object sender, ASPxGridViewClientJSPropertiesEventArgs e) { Dictionary <object, int> visibleIndices = new Dictionary <object, int>(); for (int i = 0; i < OpsLiveGrid.VisibleRowCount; i++) { if (!visibleIndices.ContainsKey(OpsLiveGrid.GetRowValues(i, OpsLiveGrid.KeyFieldName))) { visibleIndices.Add(OpsLiveGrid.GetRowValues(i, OpsLiveGrid.KeyFieldName), i); } } e.Properties["cpIndices"] = visibleIndices; }
protected void AttahcIncidentSubmitButton_Click(object sender, EventArgs e) { if (AttachIncident_GridLookUp.Value == null) { return; } if (Request.Form["AttachIncidentMappingID"] != null) { if (Request.Form["AttachIncidentMappingID"].ToString().Equals(DBNull.Value) || Request.Form["AttachIncidentMappingID"].ToString() == "") { return; } DataClassesDataContext db = new DataClassesDataContext(Handler_Global.connectString); var mappingID = Convert.ToInt16(Request.Form["AttachIncidentMappingID"]); // var mappingID = OpsLiveGrid.GetRowValues(rowIndex, "AhwalMappingID"); var personmapping = db.AhwalMappings.FirstOrDefault <AhwalMapping>(em => em.AhwalMappingID == Convert.ToInt64(mappingID)); if (personmapping != null) { //we have to check the current state of the person, if he is not in one of the allowed statees, we cannot handover the incident to him var selectedIncidentID = AttachIncident_GridLookUp.Value; if (selectedIncidentID != null) { var incidentObj = db.Incidents.FirstOrDefault <Incident>(a => a.IncidentID == Convert.ToInt64(selectedIncidentID)); if (incidentObj == null) { return; } var usersession = (User)Session["User"]; if (usersession == null) { return; } var user = (User)usersession; Core.Handler_Incidents.HandOver_Incident_To_Person(user, personmapping, incidentObj); OpsLiveGrid.DataBind(); IncidentsGrid.DataBind(); OpsLive_IncidentAttach_PopUp.ShowOnPageLoad = false; } } } }
protected void AttachedIncident_Release_Button_Click(object sender, EventArgs e) { if (Request.Form["AttachIncidentMappingID"] != null) { if (Request.Form["AttachIncidentMappingID"].ToString().Equals(DBNull.Value) || Request.Form["AttachIncidentMappingID"].ToString() == "") { return; } DataClassesDataContext db = new DataClassesDataContext(Handler_Global.connectString); var mappingID = Convert.ToInt16(Request.Form["AttachIncidentMappingID"]); // var mappingID = OpsLiveGrid.GetRowValues(rowIndex, "AhwalMappingID"); var personmapping = db.AhwalMappings.FirstOrDefault <AhwalMapping>(em => em.AhwalMappingID == Convert.ToInt64(mappingID)); if (personmapping != null) { if (personmapping.IncidentID != null && !personmapping.IncidentID.Equals(DBNull.Value)) { var incidentObj = db.Incidents.FirstOrDefault <Incident>(a => a.IncidentID == personmapping.IncidentID); if (incidentObj == null) { return; } var usersession = (User)Session["User"]; if (usersession == null) { return; } var user = (User)usersession; Core.Handler_Incidents.UnHandOver_Incident_To_Person(user, personmapping, incidentObj); OpsLiveGrid.DataBind(); IncidentsGrid.DataBind(); } } } OpsLive_States_PopUp.ShowOnPageLoad = false; }
protected void CloseAllGroupsButton_Click(object sender, EventArgs e) { OpsLiveGrid.CollapseAll(); }
protected void OpenAllGroupsButton_Click(object sender, EventArgs e) { OpsLiveGrid.ExpandAll(); }
protected void OpsLiveGrid_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e) { var user = (User)Session["User"]; if (user == null) { return; } var value = OpsLiveGrid.GetRowValues(e.VisibleIndex, "AhwalMappingID").ToString(); var personState = new PatrolPersonState(); if (e.ButtonID == "Away") { personState.PatrolPersonStateID = Core.Handler_AhwalMapping.PatrolPersonState_Away; var result = Core.Handler_AhwalMapping.Ops_ChangePersonState(user, Convert.ToInt64(value), personState); if (result.StatusID == Core.Handler_Operations.Opeartion_Status_Success) { OpsLiveGrid.DataBind(); } } else if (e.ButtonID == "Land") { personState.PatrolPersonStateID = Core.Handler_AhwalMapping.PatrolPersonState_Land; var result = Core.Handler_AhwalMapping.Ops_ChangePersonState(user, Convert.ToInt64(value), personState); if (result.StatusID == Core.Handler_Operations.Opeartion_Status_Success) { OpsLiveGrid.DataBind(); } } else if (e.ButtonID == "BackFromAway") { personState.PatrolPersonStateID = Core.Handler_AhwalMapping.PatrolPersonState_Back; var result = Core.Handler_AhwalMapping.Ops_ChangePersonState(user, Convert.ToInt64(value), personState); if (result.StatusID == Core.Handler_Operations.Opeartion_Status_Success) { OpsLiveGrid.DataBind(); } } else if (e.ButtonID == "BackFromLand") { personState.PatrolPersonStateID = Core.Handler_AhwalMapping.PatrolPersonState_Sea; var result = Core.Handler_AhwalMapping.Ops_ChangePersonState(user, Convert.ToInt64(value), personState); if (result.StatusID == Core.Handler_Operations.Opeartion_Status_Success) { OpsLiveGrid.DataBind(); } } else if (e.ButtonID == "WalkingPatrol") { personState.PatrolPersonStateID = Core.Handler_AhwalMapping.PatrolPersonState_WalkingPatrol; var result = Core.Handler_AhwalMapping.Ops_ChangePersonState(user, Convert.ToInt64(value), personState); if (result.StatusID == Core.Handler_Operations.Opeartion_Status_Success) { OpsLiveGrid.DataBind(); } } else if (e.ButtonID == "BackFromWalking") { personState.PatrolPersonStateID = Core.Handler_AhwalMapping.PatrolPersonState_BackFromWalking; var result = Core.Handler_AhwalMapping.Ops_ChangePersonState(user, Convert.ToInt64(value), personState); if (result.StatusID == Core.Handler_Operations.Opeartion_Status_Success) { OpsLiveGrid.DataBind(); } } }
protected void OpsLiveGrid_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e) { if (e.CellType != GridViewTableCommandCellType.Data) { return; } if (e.ButtonID == "Away") { if (OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_SunRise.ToString() || OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_Sea.ToString() || OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_Back.ToString() || OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_BackFromWalking.ToString()) { e.Visible = DefaultBoolean.True; } else { e.Visible = DefaultBoolean.False; } } if (e.ButtonID == "Land") { if (OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_SunRise.ToString() || OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_Sea.ToString() || OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_Back.ToString() || OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_BackFromWalking.ToString()) { e.Visible = DefaultBoolean.True; } else { e.Visible = DefaultBoolean.False; } } if (e.ButtonID == "WalkingPatrol") { if (OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_SunRise.ToString() || OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_Sea.ToString() || OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_Back.ToString() || OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_BackFromWalking.ToString()) { e.Visible = DefaultBoolean.True; } else { e.Visible = DefaultBoolean.False; } } if (e.ButtonID == "BackFromAway") { if (OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_Away.ToString()) { e.Visible = DefaultBoolean.True; } else { e.Visible = DefaultBoolean.False; } } if (e.ButtonID == "BackFromLand") { if (OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_Land.ToString()) { e.Visible = DefaultBoolean.True; } else { e.Visible = DefaultBoolean.False; } } if (e.ButtonID == "BackFromWalking") { if (OpsLiveGrid.GetRowValues(e.VisibleIndex, "PatrolPersonStateID").ToString() == Core.Handler_AhwalMapping.PatrolPersonState_WalkingPatrol.ToString()) { e.Visible = DefaultBoolean.True; } else { e.Visible = DefaultBoolean.False; } } }