Exemplo n.º 1
0
        public ActionResult Register(RegisterModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var completed = true;

            if (!completed)
            {
                ModelState.AddModelError("", "Fel fan");
                return(View());
            }

            Profiles profile = new Profiles();

            profile.About     = model.About;
            profile.Age       = Int32.Parse(model.Age);
            profile.Email     = model.Email;
            profile.Gender    = model.Gender;
            profile.Lastname  = model.Lastname;
            profile.Firstname = model.Firstname;

            SECURITY security = new SECURITY();

            security.USERNAME   = model.Username;
            security.PASSWORD   = model.Password;
            security.VISIBILITY = true;

            _usersRepository.insertUser(profile, security);

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 2
0
        public void setProposalName(ArccView arccView)
        {
            ARCCDbContext db   = new ARCCDbContext();
            SECURITY      user = db.securityDB.Where(u => u.Email.Equals(arccView.user.Email) && u.Password.Equals(arccView.user.Password)).FirstOrDefault();

            for (int i = 0; i < arccView.scores.Count; i++)
            {
                arccView.scores[i].Proposal_Name = user.LastName;
            }
        }
Exemplo n.º 3
0
        public bool checkLogin(ArccView arccView)
        {
            ARCCDbContext db   = new ARCCDbContext();
            SECURITY      user = db.securityDB.Where(u => u.Email.Equals(arccView.user.Email) && u.Password.Equals(arccView.user.Password)).FirstOrDefault();

            if (user != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        public static SECURITY GetByString(string item)
        {
            Array    values    = Enum.GetValues(typeof(SECURITY));
            SECURITY security1 = SECURITY.UNCLASSIFIED;
            int      index     = 0;

            foreach (string security2 in SecurityList())
            {
                if (security2.Equals(item))
                {
                    security1 = (SECURITY)values.GetValue(index);
                    break;
                }
                ++index;
            }
            return(security1);
        }
Exemplo n.º 5
0
        public static string GetSecurityDesc(SECURITY item)
        {
            Array         values     = Enum.GetValues(typeof(SECURITY));
            List <string> stringList = SecurityList();
            string        str        = stringList[stringList.Count - 1];
            int           index      = 0;

            foreach (object obj in values)
            {
                if (item.Equals(obj))
                {
                    str = stringList[index];
                    break;
                }
                ++index;
            }
            return(str);
        }
Exemplo n.º 6
0
        public static List <string> MaxSecurityLevel(SECURITY max)
        {
            List <string> stringList1 = SecurityList();
            List <string> stringList2 = new List <string>();
            Array         values      = Enum.GetValues(typeof(SECURITY));
            int           index       = 0;
            bool          flag        = false;

            foreach (object obj in values)
            {
                if (max.Equals(obj) || flag)
                {
                    stringList2.Add(stringList1[index]);
                    flag = true;
                }
                ++index;
            }
            return(stringList2);
        }
Exemplo n.º 7
0
        public ActionResult Login(LoginModel user)
        {
            SECURITY _user = new SECURITY();

            _user.USERNAME = user.Username;
            _user.PASSWORD = user.Password;
            var usr = _usersRepository.loginUser(_user);

            if (usr != null)
            {
                Session["UserID"]   = usr.PID.ToString();
                Session["Username"] = usr.USERNAME.ToString();
                return(RedirectToAction("LoggedIn"));
            }
            else
            {
                ModelState.AddModelError("", "Username or password is invalid.");
            }

            return(View());
        }
Exemplo n.º 8
0
        public AccountPanel(string name, string data, SECURITY security)
        {
            InitializeComponent();
            Dock                  = DockStyle.Top;
            AccountName.Text      = name;
            AccountRank.Text      = data;
            lblSecurity.BackColor = Color.Transparent;
            lblSecurity.Text      = LangCtrl.GetString("sec_Unclassified", "Unclassified");
            switch (security)
            {
            case SECURITY.TOPSECRET:
            {
                lblSecurity.ForeColor = Color.Yellow;
                lblSecurity.BackColor = Color.Red;
                lblSecurity.Text      = LangCtrl.GetString("sec_TopSecret", "Top Secret");
                return;
            }

            case SECURITY.SECRET:
            {
                lblSecurity.ForeColor = Color.White;
                lblSecurity.BackColor = Color.Orange;
                lblSecurity.Text      = LangCtrl.GetString("sec_Secret", "Secret");
                return;
            }

            case SECURITY.OFFICIAL:
            {
                lblSecurity.ForeColor = Color.Black;
                lblSecurity.BackColor = Color.Yellow;
                lblSecurity.Text      = LangCtrl.GetString("sec_Official", "Official");
                return;
            }

            default:
            {
                return;
            }
            }
        }
Exemplo n.º 9
0
 private void btn_Search_Click(object sender, EventArgs e)
 {
     try
     {
         int num1 = 0;
         int num2 = 0;
         if (ValidateSearch())
         {
             DataPanel.Controls.Clear();
             DataPanel.SuspendLayout();
             SECURITY        security      = Global.GlobalAccount.Security;
             Guid            guid          = Guid.Empty;
             List <DataFile> dataFileList1 = new List <DataFile>();
             string          str           = string.Empty;
             using (RPM_DataFile rpmDataFile = new RPM_DataFile())
             {
                 List <DataFile> dataFileList2 = rpmDataFile.QryGlobalCatalog(btnByFileDate.Checked, FromDate.Value.Value, ToDate.Value.Value, txtRMS.Text, txtCAD.Text, txtSet.Text, chk_FilterEvidence.Checked);
                 if (dataFileList2.Count > 0)
                 {
                     foreach (DataFile df in dataFileList2)
                     {
                         if (guid != df.AccountId)
                         {
                             guid = df.AccountId;
                             using (RPM_Account rpmAccount = new RPM_Account())
                             {
                                 Account account = rpmAccount.GetAccount(df.AccountId);
                                 str = string.Format("{0} • {1}", account.ToString(), account.BadgeNumber);
                                 string       data         = string.Format("Rank: {0}", account.Rank);
                                 AccountPanel accountPanel = new AccountPanel(str, data, account.Security);
                                 DataPanel.Controls.Add(accountPanel);
                                 DataPanel.Controls.SetChildIndex(accountPanel, 0);
                                 ++num2;
                             }
                         }
                         if (security <= df.Security)
                         {
                             CatalogObject catalogObject = new CatalogObject(num1 + 1, df, str);
                             DataPanel.Controls.Add(catalogObject);
                             DataPanel.Controls.SetChildIndex(catalogObject, 0);
                             ++num1;
                         }
                     }
                 }
                 else
                 {
                     Label label = new Label();
                     label.Dock = DockStyle.Top;
                     label.Font = new Font("Verdana", 16f);
                     label.Text = LangCtrl.GetString("gc_NoResults", "NO RESULTS FOUND");
                     DataPanel.Controls.Add(label);
                 }
             }
             gcFileCount.Text = string.Format(LangCtrl.GetString("gcFileCount", "Files: {0}"), num1);
             gc_Accounts.Text = string.Format(LangCtrl.GetString("gc_Accounts", "Accounts: {0}"), num2);
         }
         object[] objArray = new object[] { FromDate.Value.Value, ToDate.Value.Value, txtRMS.Text, txtCAD.Text, chk_FilterEvidence.Checked, num2, num1 };
         string   str2     = string.Format("{0} to {1} RMS: {2} CAD: {3} Evidence: {4}   RESULT> Accounts: {5} Files: {6}", objArray);
         Global.Log("SEARCH GC", string.Concat("Global Catalog> ", str2));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     DataPanel.ResumeLayout();
 }
Exemplo n.º 10
0
 public static int SecurityValue(SECURITY security)
 {
     return((int)security);
 }
Exemplo n.º 11
0
		public static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, FILE_SHARE dwShareMode, [In] ref SECURITY_ATTRIBUTES lpSecurityAttributes, FileMode dwCreationDisposition, SECURITY dwFlagsAndAttributes, IntPtr hTemplateFile);
Exemplo n.º 12
0
		public static extern IntPtr CreateFile(string lpFileName, ACCESS_MASK dwDesiredAccess, FILE_SHARE dwShareMode, IntPtr lpSecurityAttributes, FileMode dwCreationDisposition, SECURITY dwFlagsAndAttributes, IntPtr hTemplateFile);
Exemplo n.º 13
0
 //private void CheckedApplicationList()
 //{
 //    try
 //    {
 //        foreach (Application a in ApplicationList)
 //        {
 //            CustomList<RuleDetails> upDate = SecurityRuleDetailList.FindAll(f => f.ApplicationID == a.ApplicationID);
 //            CustomList<RuleDetails> newUpdate = new CustomList<RuleDetails>();
 //            newUpdate = upDate.FindAll(f => f.CanInsert == true || f.CanSelect == true || f.CanUpdate == true || f.CanDelete == true);
 //            if (newUpdate.Count != 0)
 //                a.IsSaved = true;
 //            else
 //                a.IsSaved = false;
 //        }
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 private void SetDataInControls(SECURITY.DAO.SecurityRule sR)
 {
     try
     {
         txtSecurityRuleCode.Text = sR.SecurityRuleCode.ToString();
         //cboCompany.SelectedValue = sR.CompanyID.ToString();
         txtSecurityRuleName.Text = sR.SecurityRuleName.ToString();
         //txtSecurityRuleDescription.Text = sR.SecurityRuleDescription.ToString();
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Exemplo n.º 14
0
        private void PopulateSecurityRuleInformation(SECURITY.DAO.SecurityRule sR)
        {
            try
            {
                SetDataInControls(sR);
                objSecurityRuleDetailList = manager.GetAllSecurityRule_ObjectWithSecurityRule(sR.SecurityRuleCode);
                SecurityRuleDetailList = objSecurityRuleDetailList;
                if (SecurityRuleDetailList.Count != 0)
                {
                    cboApplication.SelectedValue = SecurityRuleDetailList[0].ApplicationID;

                    CustomList<SECURITY.DAO.Menu> menu = manager.GetAllMenuByApplicationID(SecurityRuleDetailList[0].ApplicationID);
                    MenuList = menu.FindAll(f => f.FormName != "");
                    CustomList<RuleDetails> tSROList = SecurityRuleDetailList.FindAll(f => f.ApplicationID == SecurityRuleDetailList[0].ApplicationID);
                    foreach (RuleDetails tSRO in tSROList)
                    {
                        CustomList<SECURITY.DAO.Menu> sMemuList = MenuList.FindAll(f => f.ApplicationID == tSRO.ApplicationID && f.MenuID == tSRO.ObjectID);
                        foreach (SECURITY.DAO.Menu m in sMemuList)
                        {
                            m.CanInsert = tSRO.CanInsert;
                            m.CanSelect = tSRO.CanSelect;
                            m.CanUpdate = tSRO.CanUpdate;
                            m.CanDelete = tSRO.CanDelete;
                        }
                    }
                }

                //if (SecurityRuleDetailList.Count != 0)
                //{
                //    foreach (RuleDetails sRO in SecurityRuleDetailList)
                //    {
                //        TempRuleDetails objNewSRO = new TempRuleDetails();
                //        objNewSRO.ApplicationID = sRO.ApplicationID;
                //        objNewSRO.ObjectID = sRO.ObjectID;
                //        objNewSRO.ObjectType = "Menu";
                //        objNewSRO.CanInsert = sRO.CanInsert;
                //        objNewSRO.CanSelect = sRO.CanSelect;
                //        objNewSRO.CanUpdate = sRO.CanUpdate;
                //        objNewSRO.CanDelete = sRO.CanDelete;
                //        TempSecurityRuleDetailList.Add(objNewSRO);
                //    }
                //}

                //CheckedApplicationList();
                //foreach (Application a in ApplicationList)
                //{
                //    if (a.IsSaved == true)
                //    {
                //CustomList<ST.SECURITY.DAO.Menu> menu = manager.GetAllMenuByApplicationID(a.ApplicationID);
                //MenuList = menu.FindAll(f => f.FormName != "");
                //CustomList<RuleDetails> tSROList = SecurityRuleDetailList.FindAll(f => f.ApplicationID == a.ApplicationID);
                //foreach (RuleDetails tSRO in tSROList)
                //{
                //    CustomList<ST.SECURITY.DAO.Menu> sMemuList = MenuList.FindAll(f => f.ApplicationID == tSRO.ApplicationID && f.MenuID == tSRO.ObjectID);
                //    foreach (ST.SECURITY.DAO.Menu m in sMemuList)
                //    {
                //        m.CanInsert = tSRO.CanInsert;
                //        m.CanSelect = tSRO.CanSelect;
                //        m.CanUpdate = tSRO.CanUpdate;
                //        m.CanDelete = tSRO.CanDelete;
                //    }
                //}
                //break;
                //    }
                //}
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }