示例#1
0
        public ActionResult Index()
        {
            List <object> mylsit = new List <object>();

            Managment db = new Managment();


            var result = from y in db.Posts
                         where (
                from x in db.Responding_Posts

                select x.Post_ID
                ).Contains(y.ID)
                         select y;

            var z = from f in result  where !
                    (
                from p in db.Projects
                select p.POST_ID


                    ).Contains(f.ID)
                    select f;

            mylsit.Add(z.ToList());
            mylsit.Add(db.Sending_Requests.ToList());



            return(View(mylsit));
        }
示例#2
0
 public DialogRouteBus(Managment modelo, Form1 principal)
 {
     this.modelo    = modelo;
     this.principal = principal;
     InitializeComponent();
     addItems();
 }
示例#3
0
 public bool  ISemailExisit(string EmailID)
 {
     using (Managment db = new Managment())
     {
         var v = db.Users.Where(a => a.Email == EmailID).FirstOrDefault();
         return(v != null);
     }
 }
示例#4
0
        public void Get_all_database()
        {
            var managment = new Managment(
                clientEmail: "*****@*****.**",
                privateKey: File.ReadAllBytes(System.IO.Directory.GetCurrentDirectory() + "\\SheetDB.p12")
                );

            managment.GetAllDatabases().ToList();
        }
示例#5
0
        public void Get_table()
        {
            var managment = new Managment(
                clientEmail: "*****@*****.**",
                privateKey: File.ReadAllBytes(System.IO.Directory.GetCurrentDirectory() + "\\SheetDB.p12")
                );

            managment.GetDatabase("Teste").GetTable <Pessoa>("Teste");
        }
示例#6
0
        public override string[] GetRolesForUser(string username)
        {
            Managment db   = new Managment();
            string    data = db.Users.Where(a => a.Email == username).FirstOrDefault().Type;

            string[] result = { data };

            return(result);
        }
示例#7
0
        public void Delete_Permission()
        {
            var managment = new Managment(
                clientEmail: "*****@*****.**",
                privateKey: File.ReadAllBytes(System.IO.Directory.GetCurrentDirectory() + "\\SheetDB.p12")
                );

            managment.GetDatabase("Teste").GetPermission("*****@*****.**").Delete();
        }
示例#8
0
        public ActionResult register([Bind(Exclude = "IsEmailVerified,ActivationCode")]  User user)
        {
            bool   Status  = false;
            string message = "";

            if (ModelState.IsValid)
            {
                #region // Email validation
                var isexsist = ISemailExisit(user.Email);
                if (isexsist)
                {
                    ModelState.AddModelError("Exist", "Email Already Exsit");
                    return(View(user));
                }

                #endregion


                #region // Activation code generation
                user.ActivationCode = Guid.NewGuid();
                #endregion

                #region // password Hashing
                user.password        = crypto.Hash(user.password);
                user.confirmpassword = crypto.Hash(user.confirmpassword);
                #endregion

                #region // Convert a photo to binary
                byte[] data = new byte[user.File.ContentLength];
                user.File.InputStream.Read(data, 0, user.File.ContentLength);
                user.Photo = data;
                #endregion

                user.IsEmailVerified = false;

                #region // save to the database
                using (Managment db = new Managment())
                {
                    db.Users.Add(user);
                    db.SaveChanges();
                    sendverficationlink(user.Email, user.ActivationCode.ToString());
                    message = "Registeraton successfully done !we have sent an activation link to your Email " + user.Email;
                    Status  = true;
                }

                #endregion
            }

            else
            {
                message = "Invalid Request";
            }
            ViewBag.Message = message;
            ViewBag.Status  = Status;
            return(View(user));
        }
        public ActionResult Index()
        {
            List <object> listprojects = new List <object>();
            Managment     db           = new Managment();

            listprojects.Add(db.Projects.ToList());
            var user = from u in db.Users where u.Job_Description == "TL" || u.Job_Description == "JE" select u;

            listprojects.Add(user.ToList());
            return(View(listprojects));
        }
示例#10
0
        public ActionResult Leave(int postid)
        {
            using (Managment db = new Managment())
            {
                Project project = db.Projects.Find(postid);
                db.Projects.Remove(project);
                db.SaveChanges();
            }



            return(RedirectToAction("Index", "PM"));
        }
示例#11
0
        //System.Timers.Timer clock;
        //GenericTime realTime;



        public Form1()
        {
            InitializeComponent();
            //stops = new Hashtable();
            //stations = new Hashtable();
            model        = new Managment();
            options      = new GroupBox();
            realStops    = new GMapOverlay();
            onlyStations = new GMapOverlay();
            onlyStops    = new GMapOverlay();

            //bus1 = new Hashtable();
            //realTime = new GenericTime(2019,5,10,39,9,25);
        }
示例#12
0
        public void Update_Record()
        {
            var managment = new Managment(
                clientEmail: "*****@*****.**",
                privateKey: File.ReadAllBytes(System.IO.Directory.GetCurrentDirectory() + "\\SheetDB.p12")
                );

            managment.GetDatabase("Teste").GetTable <Pessoa>("Teste").Add(new Pessoa()
            {
                Id = 1, Nome = "c"
            }).Update(new Pessoa()
            {
                Id = 2, Nome = "d"
            });
        }
示例#13
0
        static void Main(string[] args)
        {
            var dbName  = "test_1";
            var bakFile = @"C:\DATA\SQLSERVER\MSSQL12.SQLEXPRESS\MSSQL\Backup\test.bak";

            Console.WriteLine("Restoring file: ");
            Console.WriteLine(bakFile);

            try
            {
                Managment.RestoreBakFile(@".\SQLEXPRESS", "sa", "P2ssw0rd", dbName, bakFile);
                Console.WriteLine("File Restored");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error:" + ex.ToString());
            }
            Console.WriteLine("Hit any key to finish!");
            Console.ReadKey();
        }
示例#14
0
        public ActionResult verifyAccount(string id)
        {
            bool status = false;

            using (Managment db = new Managment())
            {
                db.Configuration.ValidateOnSaveEnabled = false;
                var v = db.Users.Where(a => a.ActivationCode == new Guid(id)).FirstOrDefault();
                if (v != null)
                {
                    v.IsEmailVerified = true;
                    db.SaveChanges();
                    status = true;
                }
                else
                {
                    ViewBag.Message = "Invalid Request";
                }
            }
            ViewBag.status = status;
            return(View());
        }
示例#15
0
        // [ValidateAntiForgeryToken]
        public ActionResult PostNewProject(Post post)
        {
            var role = Session["Role"];
            var id   = Session["id"];

            post.User_ID = (int)id;
            if (ModelState.IsValid)
            {
                if ((string)role != "Customer")
                {
                    ModelState.AddModelError("Not Allowd", "You are not allowed to post a project");
                    return(View());
                }
                else
                {
                    using (Managment db = new Managment())
                    {
                        db.Posts.Add(post);
                        db.SaveChanges();
                    }
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
示例#16
0
        static void Main(string[] args)
        {
            var result = Managment.RestoreBakFile(@".\SQLEXPRESS", "sa", "P2ssw0rd", "test_1", @"C:\DATA\SQLSERVER\MSSQL12.SQLEXPRESS\MSSQL\Backup\test.bak");

            Console.WriteLine("Hello World!");
        }
示例#17
0
 public Form2(Managment model)
 {
     this.model = model;
     InitializeComponent();
 }
示例#18
0
        static void Main(string[] args)
        {
            //personnel Data
            Personnel     personnel     = new Personnel();
            Corporate     corporate     = new Corporate();
            Managment     managment     = new Managment();
            LowerEnlisted lowerEnlisted = new LowerEnlisted();


            Console.ForegroundColor = ConsoleColor.DarkCyan;
            Console.WriteLine("Airborne Ops Data\n");

            Thread.Sleep(1000);
            personnel.NumberOfPersonnel(150);
            corporate.NumberOfPersonnel(15);
            managment.NumberOfPersonnel(45);
            lowerEnlisted.NumberOfPersonnel(90);

            Console.ReadKey();
            Console.Clear();


            //Transportation data
            Transportation transportation = new Transportation();
            Aircraft       aircraft       = new Aircraft();
            Vehicles       vehicles       = new Vehicles();

            Thread.Sleep(1000);
            transportation.NumberOfTrans(12);
            aircraft.NumberOfTrans(4);
            aircraft.NumberOfAirCrafts(2, "C-130");
            aircraft.NumberOfAirCrafts(2, "C-17");

            Thread.Sleep(1000);

            vehicles.NumberOfTrans(8);
            vehicles.NumberOfVehicles(3, "HMMVVs");
            vehicles.NumberOfVehicles(5, "LMTVs");

            Console.ReadKey();
            Console.Clear();

            //parachute data
            Parachutes          parachutes   = new Parachutes();
            PersonnelParachutes peopleChutes = new PersonnelParachutes();
            Cargo cargo = new Cargo();

            parachutes.TotalNumberOfParachutes(6000);

            peopleChutes.TotalNumberOfParachutes(5500);
            peopleChutes.PeopleParachutes(1200, "T-10s");
            peopleChutes.PeopleParachutes(1150, "T-11M");
            peopleChutes.PeopleParachutes(3150, "T-11R");

            Thread.Sleep(1000);

            cargo.TotalNumberOfParachutes(500);
            cargo.HeavyRigParachutes(125, "G-11B");
            cargo.HeavyRigParachutes(135, "G-12");
            cargo.HeavyRigParachutes(240, "G-14");

            Console.ReadKey();
        }
示例#19
0
        public ActionResult login(login user, string Retunurl)
        {
            using (Managment db = new Managment())
            {
                var v = db.Users.Where(a => a.Email == user.Email).FirstOrDefault();

                if (v != null)
                {
                    if (string.Compare(crypto.Hash(user.password), v.password) == 0)
                    {
                        int    timeout    = user.RememberMe ? 525600 : 10;
                        var    tickt      = new FormsAuthenticationTicket(user.Email, user.RememberMe, timeout);
                        string encrypting = FormsAuthentication.Encrypt(tickt);
                        var    cookie     = new HttpCookie(FormsAuthentication.FormsCookieName, encrypting);
                        cookie.Expires = DateTime.Now.AddMinutes(timeout);
                        Response.Cookies.Add(cookie);
                        Session["First"]  = v.First_Name;
                        Session["Last"]   = v.Last_Name;
                        Session["Mobile"] = v.Mobile;
                        Session["jop"]    = v.Job_Description;
                        Session["photo"]  = v.Photo;
                        Session["id"]     = v.ID;
                        Session["Role"]   = v.Type;
                        Session["Email"]  = v.Email;


                        if (Url.IsLocalUrl(Retunurl))
                        {
                            Redirect(Retunurl);
                        }
                        else
                        {
                            if (v.Type == "Admin")
                            {
                                return(RedirectToAction("Index", "Admin"));
                            }
                            else if (v.Type == "Customer")
                            {
                                return(RedirectToAction("Index", "Customer"));
                            }
                            else if (v.Type == "PM")
                            {
                                return(RedirectToAction("Index", "PM"));
                            }
                            else if (v.Type == "TL")
                            {
                                return(RedirectToAction("Index", "TL"));
                            }
                            else if (v.Type == "JE")
                            {
                                return(RedirectToAction("Index", "JE"));
                            }
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", "Email address or password is wrong");
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Email address or password is wrong");
                }
            }


            return(View());
        }