예제 #1
0
    private void Fields(HelperModel helperModel)
    {
        int x, z;

        x = helperModel.GetX();
        z = helperModel.GetZ();
        bool canClose = false;

        _toColor.Clear();
        while (true)
        {
            if (helperModel.isBorder(x, z))
            {
                break;
            }
            if (_gameManager.Field[x, z].layer == LayerMask.NameToLayer(helperModel.NoneLayer))
            {
                break;
            }
            else if (_gameManager.Field[x, z].layer == LayerMask.NameToLayer(helperModel.CurrentLayer))
            {
                canClose = true;
                break;
            }
            else
            {
                _toColor.Add(_gameManager.Field[x, z]);
            }
            x += helperModel.ForX;
            z += helperModel.ForZ;
        }
        ColorChange(canClose, helperModel.CurrentLayer);
    }
예제 #2
0
    private void CheckFields(string noneLayer, string currentLayer, int posX, int posZ)
    {
        HelperModel helperModel = new HelperModel(posX, posZ, noneLayer, currentLayer);

        helperModel.ForX    = PreviousField;
        helperModel.ForZ    = CurrentField;
        helperModel.ResultX = CurrentField;
        helperModel.ResultZ = CurrentField;
        Fields(helperModel);
        helperModel.ForZ = PreviousField;
        Fields(helperModel);
        helperModel.ForX = CurrentField;
        Fields(helperModel);
        helperModel.ForX    = NextField;
        helperModel.ResultX = _length;
        Fields(helperModel);
        helperModel.ForZ = CurrentField;
        Fields(helperModel);
        helperModel.ForZ    = NextField;
        helperModel.ResultZ = _length;
        Fields(helperModel);
        helperModel.ForX    = CurrentField;
        helperModel.ResultX = CurrentField;
        Fields(helperModel);
        helperModel.ForX = PreviousField;
        Fields(helperModel);
    }
예제 #3
0
    private void Supprot(HelperModel helperModel)
    {
        int  x, z;
        bool canClose;

        x        = helperModel.GetX();
        z        = helperModel.GetZ();
        canClose = false;
        while (true)
        {
            if (helperModel.isBorder(x, z))
            {
                break;
            }
            if (_gameManager.Field[x, z].layer == LayerMask.NameToLayer(helperModel.CurrentLayer))
            {
                break;
            }
            else if (_gameManager.Field[x, z].layer == LayerMask.NameToLayer(helperModel.NoneLayer))
            {
                canClose = true;
            }
            else
            {
                if (canClose)
                {
                    _toSupport.Add(_gameManager.Field[x, z]);
                }
                break;
            }
            x += helperModel.ForX;
            z += helperModel.ForZ;
        }
    }
예제 #4
0
        public ActionResult ProcessMission(int id = 1)
        {
            //------------Background identity check-------------//
            if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                return(Redirect("/Home/Index"));
            }

            Collaborator coll = dal.GetCollaborator(System.Web.HttpContext.Current.User.Identity.Name);

            if ((HelperModel.CheckCDS(coll) == false))             //if not CDS
            {
                return(Redirect("/Home/Index"));
            }
            //--------------------------------------------------//
            Mission model = dal.GetMission(id);

            //string[] collId = new string[model.CollList.Count];
            //int i = 0;
            //foreach (Collaborator c in dal.GetMission(id).CollList)
            //{
            //	collId[i++] = c.Id.ToString();
            //}

            //ViewBag.Collablist = GetMultiCollaborators(collId);

            return(View(model));
        }
 private void LogIn_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     try
     {
         // Disconnect or Connect on login button press
         if (IsConnected || IsConnectionInProgress)
         {
             Disconnect();
         }
         else
         {
             HelperModel.SaveSettings(this);
             LogMessage("Attempting to connect to " + CicServer + " as " + CicUsername);
             _session.ConnectAsync(new SessionSettings(),
                                   new HostSettings(new HostEndpoint(CicServer)),
                                   new ICAuthSettings(CicUsername, CicPassword),
                                   new StationlessSettings(),
                                   null, null);
         }
     }
     catch (Exception ex)
     {
         LogMessage(ex);
     }
 }
예제 #6
0
        public ActionResult ResetStatusMission(int id)
        {
            //------------Background identity check-------------//
            if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                return(Redirect("/Home/Index"));
            }

            Collaborator coll = dal.GetCollaborator(System.Web.HttpContext.Current.User.Identity.Name);

            if ((HelperModel.CheckCDS(coll) == false))             //if not CDS
            {
                return(Redirect("/Home/Index"));
            }
            //--------------------------------------------------//

            Mission m = dal.GetMission(id);

            if ((m.EndDate < DateTime.Now))
            {
                m.Status = MissionStatus.COMPLETED;
            }
            else if ((m.StartDate < DateTime.Now) && (m.EndDate >= DateTime.Now))
            {
                m.Status = MissionStatus.IN_PROGRESS;
            }
            else if ((m.StartDate > DateTime.Now) && (m.EndDate > DateTime.Now))
            {
                m.Status = MissionStatus.PLANNED;
            }

            dal.SaveChanges();

            return(Redirect("/Mission/Index"));
        }
예제 #7
0
        public Leave(LeaveStatus status, LeaveType type, Collaborator collaborator, DateTime startDate, DateTime endDate, string Start, string End)
        {
            Description             = collaborator.FirstName + " " + collaborator.LastName + " (" + collaborator.Service.Name + ")"; //generer un nom du type "NomPrenom (Service) - nbDemiJournées"
            Status                  = status;
            Type                    = type;
            Collaborator            = collaborator;
            StartDate               = startDate;
            EndDate                 = endDate;
            StartMorningOrAfternoon = Start;
            EndMorningOrAfternoon   = End;

            Treatment = HelperModel.ComputeTreatmentLeave(Collaborator);

            if (status == LeaveStatus.APPROVED)
            {
                this.Color = "#256cbf";
            }
            else if (status == LeaveStatus.PENDING_APPROVAL_1)
            {
                this.Color = "#c69b00";
            }
            else if (status == LeaveStatus.PENDING_APPROVAL_2)
            {
                this.Color = "#c68b90";
            }
            else
            {
                this.Color = "#bf4425";
            }
        }
        public IHttpActionResult PutEmployee(int id, HelperModel model)
        {
            var emp = db.Employees.Where(x => x.EmployeeId == id).FirstOrDefault();
            var dep = db.Departments.Where(x => x.DepartmentsId == emp.EmployeeId).FirstOrDefault();
            var com = db.Companies.Where(x => x.CompanyId == emp.EmployeeId).FirstOrDefault();
            var cr  = db.Courses.Where(x => x.CourseId == emp.EmployeeId).FirstOrDefault();

            emp.EmployeeName    = model.EmployeeName;
            emp.EmployeeAddress = model.EmployeeAddress;
            emp.EmployeeSalary  = model.EmployeeSalary;
            db.Entry(emp).State = System.Data.Entity.EntityState.Modified;

            dep.DepartmentName  = model.DepartmentName;
            db.Entry(dep).State = System.Data.Entity.EntityState.Modified;

            com.CompanyName     = model.CompanyName;
            db.Entry(com).State = System.Data.Entity.EntityState.Modified;

            cr.CourseName      = model.CourseName;
            db.Entry(cr).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();



            return(Ok("Update successfully"));
        }
예제 #9
0
        public ActionResult RestaurantDetails(string name)
        {
            if (WebApiApplication.LOGED_IN && name != null)
            {
                List <int>  VIDints     = new List <int>();
                HelperModel helperModel = new HelperModel()
                {
                    RestaurantModel = WebApiApplication.restaurants.Where(r => r.RestaurantName == name).FirstOrDefault(),
                    VIDs            = VIDints
                };
                string VIDs = Session["VIDs"] as String;
                if (VIDs != String.Empty)
                {
                    List <String> VIDstrings = VIDs.Split(',').ToList();
                    VIDstrings.ForEach(v => VIDints.Add(int.Parse(v)));
                    helperModel.VIDs = VIDints;
                    return(View("RestaurantDetails", helperModel));
                }

                return(View("RestaurantDetails", helperModel));
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
예제 #10
0
        // GET: Mission
        public ActionResult Index()
        {
            //------------Background identity check-------------//
            if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                return(Redirect("/Home/Index"));
            }

            Collaborator coll = dal.GetCollaborator(System.Web.HttpContext.Current.User.Identity.Name);

            if ((HelperModel.CheckCDS(coll) == false))             //if not CDS
            {
                return(Redirect("/Home/Index"));
            }
            //--------------------------------------------------//

            List <Mission> model = new List <Mission>();

            foreach (Mission mi in dal.GetMissions())
            {
                if (mi.ChiefId == coll.Id)
                {
                    model.Add(mi);
                }
            }

            return(View(model));
        }
예제 #11
0
        public async Task <HelperDTO> GetByIdAsync(int id)
        {
            if (string.IsNullOrEmpty(id.ToString()))
            {
                return(null);
            }

            HelperModel user = await _context.Helper.AsNoTracking().FirstOrDefaultAsync(c => c.Id == id);

            HelperDTO result = new HelperDTO
            {
                DateCreated   = user.DateCreated,
                Id            = user.Id,
                Religion      = user.Religion,
                Qualification = user.Qualification,

                Guarantor = string.Concat(user.Guarantor.Surname, " ", user.Guarantor.FirstName, " ", user.Guarantor.LastName),
                FirstName = user.FirstName,
                Gender    = user.Gender,
                LastName  = user.LastName,

                DateOfBirth = user.DateOfBirth,
                State       = user.State,
                Surname     = user.Surname
            };

            _context.Dispose();

            return(result);
        }
예제 #12
0
        public async Task <bool> UpdateAsync(HelperDTO user)
        {
            try
            {
                HelperModel helper = new HelperModel()
                {
                    Religion      = user.Religion,
                    Qualification = user.Qualification,
                    FirstName     = user.FirstName,
                    Gender        = user.Gender,

                    LastName    = user.LastName,
                    DateOfBirth = user.DateOfBirth,
                    State       = user.State,
                    Surname     = user.Surname
                };

                using (var context = _context)
                {
                    context.Helper.Attach(helper);

                    await _context.SaveChangesAsync();

                    return(true);
                }
            }
            catch (Exception ex) { }

            return(false);
        }
예제 #13
0
        public async Task <bool> AddAsync(HelperDTO user)
        {
            try
            {
                HelperModel helper = new HelperModel()
                {
                    FirstName = user.FirstName,
                    LastName  = user.LastName,
                    Surname   = user.Surname,
                    Gender    = user.Gender,

                    Qualification = user.Qualification,
                    GuarantorId   = user.GuarantorId,
                    Religion      = user.Religion,
                    State         = user.State,

                    DateOfBirth = user.DateOfBirth
                };

                _context.Helper.Add(helper);

                await _context.SaveChangesAsync();

                return(Task.CompletedTask.IsCompleted);
            }
            catch (Exception ex) { }

            return(Task.CompletedTask.IsCanceled);
        }
예제 #14
0
        public ActionResult CreateAccount(Collaborator model /*, int collId*/)
        {
            if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                return(Redirect("/Home/Index"));
            }

            // Check admin privilege
            Collaborator coll = dal.GetCollaborator(System.Web.HttpContext.Current.User.Identity.Name);

            if (!HelperModel.CheckAdmin(coll))
            {
                return(Redirect("/Home/Index"));
            }

            // Validation
            if (ModelState.IsValid && ValidationLogin(model))
            {
                dal.CreateCollaborator(model.FirstName, model.LastName, model.Login, dal.EncodeMD5(model.Password));
                return(Redirect("/Admin/Index"));
            }
            else
            {
                ModelState.AddModelError("", "Le champ nom de compte doit être unique !");
            }
            return(View(model));
        }
예제 #15
0
        /*-----------------------------Details View--------------------------------*/
        public ActionResult Details(int REQUESTDETAILS_ID)
        {
            List <AccessModel> accessRequest = new List <AccessModel>();

            using (OracleConnection dbConn = new OracleConnection(HelperModel.cnnVal("OracleDB")))
            {
                accessRequest = dbConn.Query <AccessModel>(@"SELECT SECURITYCLASS.SCLASSDESC, SUBJECT_AREAS.SUBJECTAREANAME, SECURITY_ACCESS.SECURITYACCESSDESC, 
                                                                SYSTEMS.SYSTEMNAME, REQUESTDETAILS.REASON_FOR_ACCESS, REQUESTAPPROVALS.ACTIONDATE, 
                                                                REQUESTSTATUS.REQUESTSTATUS_DESCRIPTION, APPROVALLEVELS.AL_DESCRIPTION, ACCESSREQTYPE.REQTYPE_DESC,
                                                                REQUEST.REQUESTDATE
                                                            FROM SECURITYCLASS 
                                                            INNER JOIN SUBJECT_AREAS ON SECURITYCLASS.SUBJECTAREA_ID = SUBJECT_AREAS.SUBJECTAREA_ID 
                                                            INNER JOIN SECURITY_ACCESS ON SECURITYCLASS.SECURITYACCESS_ID = SECURITY_ACCESS.SECURITYACCESS_ID 
                                                            INNER JOIN SYSTEMS ON SECURITYCLASS.SYSTEMS_ID = SYSTEMS.SYSTEMS_ID 
                                                            INNER JOIN REQUESTDETAILS ON SECURITYCLASS.SECURITYCLASS_ID = REQUESTDETAILS.SECURITYCLASS_ID 
                                                            INNER JOIN REQUESTAPPROVALS ON REQUESTDETAILS.REQUESTDETAILS_ID = REQUESTAPPROVALS.REQUESTDETAILS_ID
                                                            INNER JOIN REQUESTSTATUS ON REQUESTAPPROVALS.REQSTATUS_ID = REQUESTSTATUS.REQSTATUS_ID
                                                            INNER JOIN APPROVALLEVELS ON REQUESTAPPROVALS.AL_ID = APPROVALLEVELS.AL_ID
                                                            INNER JOIN ACCESSREQTYPE ON REQUESTDETAILS.REQTYPE_ID = ACCESSREQTYPE.REQTYPE_ID
                                                            INNER JOIN REQUEST ON REQUESTDETAILS.REQ_ID = REQUEST.REQ_ID
                                                            WHERE REQUESTDETAILS.REQUESTDETAILS_ID = " + REQUESTDETAILS_ID).ToList();
            }

            foreach (var item in accessRequest)
            {
                if (item.REQUESTSTATUS_DESCRIPTION == "Pending")
                {
                    return(PartialView(item)); // Only returns the final approval in the chain
                }
            }
            return(PartialView()); // Will not run
        }
예제 #16
0
        public ActionResult Deny(ApprovalModel denial)
        {
            using (OracleConnection dbConn = new OracleConnection(HelperModel.cnnVal("OracleDB")))
            {
                if (ModelState.IsValid)
                {
                    // Mark request as denied
                    string sqlQuery1 = @"UPDATE REQUESTDETAILS SET REQSTATUS_ID = 3 WHERE REQUESTDETAILS_ID = " + denial.REQUESTDETAILS_ID;
                    // Mark approval as denied with reason of denial
                    string sqlQuery2 = @"UPDATE REQUESTAPPROVALS SET ACTIONDATE = SYSDATE, REQSTATUS_ID = 3, REASON_OF_DENIAL = '" + denial.REASON_OF_DENIAL + @"' WHERE REQUESTDETAILS_ID = " + denial.REQUESTDETAILS_ID + @" AND APPROVAL_ROCKETID = '" + testRocketID + "'";

                    dbConn.Execute(sqlQuery1);
                    dbConn.Execute(sqlQuery2);

                    /*=========Email Code Will Go Here========*/
                    /*  Notify user and supervisor of denial  */
                    /*========================================*/

                    return(PartialView("Denied"));
                }
                else
                {
                    return(PartialView("Deny"));
                }
            }
        }
예제 #17
0
        /*CONSTRUCTOR*/

        #region Default constructor
        public HomeController(ThemeConverter tConverter, ThemeDictionary dictionary, IWebHostEnvironment environment, UserColorDataModel dataModel, IConfiguration config, ColorStringConverter cConverter, HelperModel hModel)
        {
            this.environment = environment;
            this.tConverter  = tConverter;
            this.dictionary  = dictionary;
            this.dataModel   = dataModel;
            this.config      = config;
            this.cConverter  = cConverter;
            this.hModel      = hModel;
        }
예제 #18
0
        public void Post(HelperModel model)
        {
            MapCoordinate map = new MapCoordinate();

            map.Latitude     = model.Latitude;
            map.Longitude    = model.Longitude;
            map.LoactionName = model.LocationName;
            db.MapCoordinates.Add(map);
            db.SaveChanges();
        }
        public MainViewModel()
        {
            // Load the settings into this view model. This loads the authentication credentials
            HelperModel.LoadSettings(this);

            // Register command bindings for this view model
            CommandBindings.Add(new CommandBinding(UiCommands.LogInCommand, LogIn_Executed, LogIn_CanExecute));

            _session.ConnectionStateChanged += SessionOnConnectionStateChanged;

            UpdateCicConnectionStateImage(ConnectionState.None);
        }
예제 #20
0
        public ActionResult Index(EmployeeModel employee)
        {
            List <string> employeeIDs = new List <string>();

            using (OracleConnection dbConn = new OracleConnection(HelperModel.cnnVal("OracleDB")))
            {
                if (ModelState.IsValid)
                {
                    employeeIDs = dbConn.Query <string>(@"SELECT ROCKET_ID FROM EMPLOYEES").ToList();
                    if (!employeeIDs.Contains(employee.ROCKET_ID)) // if entered rocket ID is not already saved in the database, insert record
                    {                                              // Most or all of these will probably be replaced once authentication is in place
                        string sqlQuery = "INSERT INTO EMPLOYEES (ROCKET_ID, " +
                                          "FIRST_NAME, " +
                                          "MIDDLE_INITIAL, " +
                                          "LAST_NAME, " +
                                          "TITLE, " +
                                          "PHONE_NUMBER, " +
                                          "EMAIL, " +
                                          "SUPERVISOR_NAME, " +
                                          "SUPERVISOR_ROCKETID, " +
                                          "SUPERVISOR_EMAIL) " +
                                          "Values('" + employee.ROCKET_ID + "', '" +
                                          employee.FIRST_NAME + "', '" +
                                          employee.MIDDLE_INITIAL + "', '" +
                                          employee.LAST_NAME + "', '" +
                                          employee.TITLE + "', '" +
                                          employee.PHONE_NUMBER + "', '" +
                                          employee.EMAIL + "', '" +
                                          employee.SUPERVISOR_NAME + "', '" +
                                          employee.SUPERVISOR_ROCKETID + "', '" +
                                          employee.SUPERVISOR_EMAIL + "')";

                        int rowsAffected = dbConn.Execute(sqlQuery);
                    }

                    List <AccessModel> systems = new List <AccessModel>();

                    systems = dbConn.Query <AccessModel>(@"SELECT SYSTEMNAME FROM SYSTEMS").ToList();
                    foreach (var system in systems)
                    {
                        system.ROCKET_ID = employee.ROCKET_ID;
                    }

                    return(PartialView("Systems", systems));
                }
                else
                {
                    return(PartialView("Index"));
                }
            }
        }
        private string MakeFileName(string interactionIdKey, string recordingId, string mediaType,
                                    string recordingTimestamp, int sequenceNum)
        {
            // Determine timestamp
            DateTime recordingDateTime;
            string   timestamp;

            if (DateTime.TryParse(recordingTimestamp, out recordingDateTime))
            {
                timestamp = recordingDateTime.ToString();
            }
            else
            {
                timestamp = "";
            }

            // Format sequence number
            var sequenceString = "";

            if (sequenceNum > 0)
            {
                sequenceString = "_" + sequenceNum;
            }

            // Media type and extension
            var mediaTypeString = "unknown";
            var extension       = "txt";

            if (mediaType == "1")
            {
                mediaTypeString = "call";
                extension       = "wav";
            }
            else if (mediaType == "2")
            {
                mediaTypeString = "chat";
                extension       = "xml";
            }
            else if (mediaType == "3")
            {
                mediaTypeString = "email";
                extension       = "txt";
            }

            // Format filename
            // NOTE: The extension is intentionally left off as it will be added after the file is downloaded
            return(HelperModel.MakeValidFileName(string.Format("{0} [{1}] {2} ({3}){4}",
                                                               interactionIdKey, recordingId, timestamp, mediaTypeString, sequenceString, extension)));
        }
예제 #22
0
        public List <CalendarVM> ConvertLeavesIntoCalendarVM()
        {
            List <CalendarVM> leaves      = new List <CalendarVM>();
            Collaborator      currentColl = dal.GetCollaborator(User.Identity.Name);


            /* Groups :
             *  1 : own leaves
             *  2 : own service's leaves (only accepted)
             *  3 : own service's leaves (every states)
             */
            foreach (Leave l in dal.GetLeaves())
            {
                if (!HelperModel.CheckManagement(currentColl))                //if not manager, can only see own's leaves and approved service leaves
                {
                    if (l.Collaborator.Id == currentColl.Id)
                    {
                        leaves.Add(new CalendarVM(l, '1'));                         // group 1 : own leaves
                    }
                    else if ((l.Collaborator.Service.Id == currentColl.Service.Id) && (l.Status == LeaveStatus.APPROVED))
                    {
                        leaves.Add(new CalendarVM(l, '2'));                         //group 2 : can only see own leaves and own service's approved leaves
                    }
                }
                else                 //is in management
                {
                    if (l.Collaborator.Id == currentColl.Id)
                    {
                        leaves.Add(new CalendarVM(l, '1'));                         // group 1 : own leaves
                    }

                    else
                    {
                        if (HelperModel.CheckRH(currentColl))   //if RH, can also see the other leaves
                        {
                            leaves.Add(new CalendarVM(l, '3')); // group 4 : every other leaves
                        }
                        else                                    //if not RH, can only see own service leaves
                        {
                            if ((l.Collaborator.Service.Id == currentColl.Service.Id))
                            {
                                leaves.Add(new CalendarVM(l, '3'));                                 //group 3 : can see every leaves in own's service
                            }
                        }
                    }
                }
            }
            return(leaves);
        }
예제 #23
0
        /// <summary>
        ///     This function will crete and return a helper model according to inputs
        /// </summary>
        /// <param name="inputUri"> url fpr Api endpoint </param>
        /// <param name="inputModel"> Helper model object </param>
        /// <returns>
        ///     generated Helper model / null if creation fails
        /// </returns>
        public static HelperModel MapJsonToModel(Uri inputUri, HelperModel inputModel)
        {
            // get response form HttpHelper class library helper functions
            // will return null if unsuccessful.
            var response = GetResponse.GetResponseString(inputUri);

            // loop through all helper model types and deserialize and create matching helper model
            try
            {
                // if type of Pokemon
                if (inputModel.GetType() == typeof(PokemonJson))
                {
                    inputModel =
                        JsonConvert.DeserializeObject <PokemonJson>(response.Content.ReadAsStringAsync().Result);
                }

                // if type of Ability
                else if (inputModel.GetType() == typeof(AbilityJson))
                {
                    inputModel =
                        JsonConvert.DeserializeObject <AbilityJson>(response.Content.ReadAsStringAsync().Result);
                }

                // if type of List of pokemon
                else if (inputModel.GetType() == typeof(PokemonListJson))
                {
                    inputModel =
                        JsonConvert.DeserializeObject <PokemonListJson>(response.Content.ReadAsStringAsync().Result);
                }

                // if type of Simplified Pokemon
                else if (inputModel.GetType() == typeof(SimplifiedPokemonJson))
                {
                    inputModel =
                        JsonConvert.DeserializeObject <SimplifiedPokemonJson>(
                            response.Content.ReadAsStringAsync().Result);
                }


                return(inputModel);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
예제 #24
0
        // Get: account creation
        public ActionResult CreateAccount()
        {
            if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                return(Redirect("/Home/Index"));
            }

            // Check admin privilege
            Collaborator coll = dal.GetCollaborator(System.Web.HttpContext.Current.User.Identity.Name);

            if (!HelperModel.CheckAdmin(coll))
            {
                return(Redirect("/Home/Index"));
            }

            return(View());
        }
예제 #25
0
        /*----------------------------------Security Access View---------------------------------*/
        public ActionResult SecurityAccess(string SUBJECTAREANAME, string ROCKET_ID, string SYSTEMNAME)
        {
            List <AccessModel> securityAccess = new List <AccessModel>();

            using (OracleConnection dbConn = new OracleConnection(HelperModel.cnnVal("OracleDB")))
            {
                List <int> SUBJECTAREA_ID = dbConn.Query <int>(@"SELECT SUBJECTAREA_ID FROM SUBJECT_AREAS WHERE SUBJECTAREANAME = '" + SUBJECTAREANAME + "'").ToList();
                List <int> SYSTEMS_ID     = dbConn.Query <int>(@"SELECT SYSTEMS_ID FROM SYSTEMS WHERE SYSTEMNAME = '" + SYSTEMNAME + "'").ToList();
                securityAccess = dbConn.Query <AccessModel>(@"SELECT SECURITYACCESSDESC FROM SECURITY_ACCESS INNER JOIN SECURITYCLASS ON SECURITY_ACCESS.SECURITYACCESS_ID = SECURITYCLASS.SECURITYACCESS_ID WHERE SUBJECTAREA_ID = " + SUBJECTAREA_ID[0] + "AND SYSTEMS_ID = " + SYSTEMS_ID[0] + " ORDER BY SECURITYACCESSDESC").ToList();
                securityAccess = securityAccess.GroupBy(x => x.SECURITYACCESSDESC).Select(x => x.First()).ToList(); //Remove duplicates

                foreach (var access in securityAccess)
                {
                    access.ROCKET_ID = ROCKET_ID;
                }

                return(PartialView("SecurityAccess", securityAccess));
            }
        }
예제 #26
0
        /*----------------------------------Subject Areas View---------------------------------*/
        public ActionResult SubjectAreas(string SYSTEMNAME, string ROCKET_ID)
        {
            List <AccessModel> subjectAreas = new List <AccessModel>();

            using (OracleConnection dbConn = new OracleConnection(HelperModel.cnnVal("OracleDB")))
            {
                List <int> SYSTEMS_ID = dbConn.Query <int>(@"SELECT SYSTEMS_ID FROM SYSTEMS WHERE SYSTEMNAME = '" + SYSTEMNAME + "'").ToList();
                subjectAreas = dbConn.Query <AccessModel>(@"SELECT SUBJECTAREANAME FROM SUBJECT_AREAS INNER JOIN SECURITYCLASS ON SUBJECT_AREAS.SUBJECTAREA_ID = SECURITYCLASS.SUBJECTAREA_ID WHERE SYSTEMS_ID = " + SYSTEMS_ID[0] + " ORDER BY SUBJECTAREANAME").ToList();
                subjectAreas = subjectAreas.GroupBy(x => x.SUBJECTAREANAME).Select(x => x.First()).ToList(); //Remove duplicates

                foreach (var subjectArea in subjectAreas)
                {
                    subjectArea.ROCKET_ID  = ROCKET_ID;
                    subjectArea.SYSTEMNAME = SYSTEMNAME;
                }

                return(PartialView("SubjectAreas", subjectAreas));
            }
        }
예제 #27
0
 private void Helper(string currentLayer, string nextLayer)
 {
     for (int posX = 0; posX < _gameManager.Length; posX++)
     {
         for (int posZ = 0; posZ < _gameManager.Length; posZ++)
         {
             if (_gameManager.Field[posX, posZ].layer == LayerMask.NameToLayer(currentLayer))
             {
                 HelperModel helperModel = new HelperModel(posX, posZ, nextLayer, currentLayer);
                 helperModel.ForX    = PreviousField;
                 helperModel.ForZ    = CurrentField;
                 helperModel.ResultX = CurrentField;
                 helperModel.ResultZ = CurrentField;
                 Supprot(helperModel);
                 helperModel.ForZ = PreviousField;
                 Supprot(helperModel);
                 helperModel.ForX = CurrentField;
                 Supprot(helperModel);
                 helperModel.ForX    = NextField;
                 helperModel.ResultX = _length;
                 Supprot(helperModel);
                 helperModel.ForZ = CurrentField;
                 Supprot(helperModel);
                 helperModel.ForZ    = NextField;
                 helperModel.ResultZ = _length;
                 Supprot(helperModel);
                 helperModel.ForX    = CurrentField;
                 helperModel.ResultX = CurrentField;
                 Supprot(helperModel);
                 helperModel.ForX = PreviousField;
                 Supprot(helperModel);
             }
             FieldHighlight(Color.cyan, _gameManager.CanSpawn);
         }
     }
     if (_toSupport.Count == 0 && _gameManager.Chips < (_gameManager.Length * _gameManager.Length))
     {
         Helper(nextLayer, currentLayer);
         _gameManager.IsBlackTurn = !_gameManager.IsBlackTurn;
     }
 }
예제 #28
0
        public ActionResult Index()
        {
            //------------Background identity check-------------//
            if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                return(Redirect("/Home/Index"));
            }

            Collaborator coll = dal.GetCollaborator(System.Web.HttpContext.Current.User.Identity.Name);

            //not in cds = cannot see
            if ((HelperModel.CheckCDS(coll) == false))
            {
                return(Redirect("/Home/Index"));
            }

            //--------------------------------------------------//


            return(View(coll.Service));
        }
예제 #29
0
        /*==================================================================*/

        /*-----------------------------Index View-----------------------------*/
        public ActionResult Index()
        {
            List <RequestModel> requests = new List <RequestModel>();

            using (OracleConnection dbConn = new OracleConnection(HelperModel.cnnVal("OracleDB")))
            {
                requests = dbConn.Query <RequestModel>(@"SELECT REQUEST.REQUESTDATE, SECURITYCLASS.SCLASSDESC, ACCESSREQTYPE.REQTYPE_DESC, APPROVALLEVELS.AL_DESCRIPTION, 
                                                            REQUESTSTATUS.REQUESTSTATUS_DESCRIPTION, REQUESTDETAILS.REQUESTDETAILS_ID, REQUESTAPPROVALS.REQSTATUS_ID
                                                        FROM REQUESTDETAILS 
                                                        INNER JOIN SECURITYCLASS ON REQUESTDETAILS.SECURITYCLASS_ID = SECURITYCLASS.SECURITYCLASS_ID 
                                                        INNER JOIN REQUESTAPPROVALS ON REQUESTDETAILS.REQUESTDETAILS_ID = REQUESTAPPROVALS.REQUESTDETAILS_ID 
                                                        INNER JOIN ACCESSREQTYPE ON REQUESTDETAILS.REQTYPE_ID = ACCESSREQTYPE.REQTYPE_ID 
                                                        INNER JOIN APPROVALLEVELS ON REQUESTAPPROVALS.AL_ID = APPROVALLEVELS.AL_ID 
                                                        INNER JOIN REQUESTSTATUS ON REQUESTAPPROVALS.REQSTATUS_ID = REQUESTSTATUS.REQSTATUS_ID 
                                                        INNER JOIN REQUEST ON REQUEST.REQ_ID = REQUESTDETAILS.REQ_ID 
                                                        WHERE REQUEST.ROCKET_ID = '" + testRocketID + @"' 
                                                        ORDER BY REQUEST.REQUESTDATE").ToList();
            }

            return(PartialView(requests));
        }
        public IHttpActionResult PostEmployee(HelperModel model)
        {
            Employee        employee        = new Employee();
            Department      department      = new Department();
            Course          course          = new Course();
            Company         company         = new Company();
            EmployeeCourses employeeCourses = new EmployeeCourses();

            department.DepartmentName = model.DepartmentName;
            db.Departments.Add(department);
            db.SaveChanges();
            var depId = department.DepartmentsId;

            company.CompanyName = model.CompanyName;
            db.Companies.Add(company);
            db.SaveChanges();
            var comId = company.CompanyId;

            course.CourseName = model.CourseName;
            db.Courses.Add(course);
            db.SaveChanges();
            var crsId = course.CourseId;

            employee.EmployeeName    = model.EmployeeName;
            employee.EmployeeAddress = model.EmployeeAddress;
            employee.EmployeeSalary  = model.EmployeeSalary;
            employee.CompanyId       = comId;
            employee.DepartmentId    = depId;
            db.Employees.Add(employee);
            db.SaveChanges();
            var empId = employee.EmployeeId;

            employeeCourses.CourseId   = crsId;
            employeeCourses.EmployeeId = empId;
            db.EmployeeCourses.Add(employeeCourses);

            db.SaveChanges();

            return(Ok("Add successfully"));
        }