public ActionResult Authentication(FormCollection collection)
        {
            Watchman w = new Watchman();

            w.Username = collection["un"]; //Request.QueryString["un"];
            w.Password = collection["pw"]; //Request.QueryString["pw"];
            if (w.Validate())
            {
                if (w.PhotoPath != null)
                {
                    //vl.Photo = ie.ImageToBase64(vl.PhotoPath);
                    byte[] imageArray = System.IO.File.ReadAllBytes(Server.MapPath(w.PhotoPath));

                    w.Photo = Convert.ToBase64String(imageArray);
                }
                else
                {
                    w.Photo = "";
                }
                return(Json(w));
            }
            else
            {
                return(Content("Error"));
            }
        }
        public ActionResult WatchmanDelete(int ID)
        {
            Watchman w = new Watchman();

            w.WatchmanID = ID;
            w.Delete();
            return(RedirectToAction("WatchmanList"));
        }
        public ActionResult WatchmanDetail(int ID)
        {
            Watchman wm = new Watchman();

            wm.WatchmanID = ID;
            wm.SelectByID();
            ViewBag.WatchmanUpdate = wm;
            DataTable dt = wm.SelectAll();

            return(View(dt));
        }
        public Watchman ValidateWatchman(string Username, string Password)
        {
            Watchman wm = new Watchman();

            wm.Username = Username;
            wm.Password = Password;
            if (wm.Validate())
            {
                return(wm);
            }
            else
            {
                return(null);
            }
        }
        public ActionResult WatchmanDetail(FormCollection collection)
        {
            Watchman w = new Watchman();

            w.WatchmanID = Convert.ToInt32(collection["WatchmanID"]);

            if (w.WatchmanID > 0)
            {
                w.SelectByID();
                w.WatchmanID = Convert.ToInt32(collection["WatchmanID"]);
                w.Name       = collection["Name"];
                w.Mobile     = collection["Mobile"];
                w.Username   = collection["Username"];
                w.Password   = collection["Password"];
                if (Request.Files["PhotoPath"] != null)
                {
                    string path = "/uploads/" + DateTime.Now.Ticks.ToString() + "_" + Request.Files["PhotoPath"].FileName;
                    Request.Files["PhotoPath"].SaveAs(Server.MapPath(path));
                    w.PhotoPath = path;
                }
                else
                {
                    w.PhotoPath = "";
                }
                w.Update();
                return(RedirectToAction("WatchmanList"));
            }
            else
            {
                w.Name     = collection["Name"];
                w.Mobile   = collection["Mobile"];
                w.Username = collection["Username"];
                w.Password = collection["Password"];
                if (Request.Files["PhotoPath"] != null)
                {
                    string path = "/uploads/" + DateTime.Now.Ticks.ToString() + "_" + Request.Files["PhotoPath"].FileName;
                    Request.Files["PhotoPath"].SaveAs(Server.MapPath(path));
                    w.PhotoPath = path;
                }
                else
                {
                    w.PhotoPath = "";
                }
                w.Insert();
                return(RedirectToAction("WatchmanList"));
            }
        }
Beispiel #6
0
        public static IEmployee GetEmployeeInstance(UserRole role, AccessBoundry access)
        {
            IEmployee employee = new Employee(access);

            switch (role)
            {
            case UserRole.Director:
                employee = new Director(access);
                break;

            case UserRole.Manager:
                employee = new Manager(access);
                break;

            case UserRole.Executive:
                employee = new Executive(access);
                break;

            case UserRole.SalesPerson:
                employee = new SalesPerson(access);
                break;

            case UserRole.Secretary:
                employee = new Secretary(access);
                break;

            case UserRole.Developer:
                employee = new Developer(access);
                break;

            case UserRole.Watchman:
                employee = new Watchman(access);
                break;

            case UserRole.General:
                employee = new Employee(access);
                break;
            }
            return(employee);
        }
Beispiel #7
0
 /// <summary>
 /// Marks Infrastructure Score cache as initialized.
 /// </summary>
 public static void ScoreCacheIsInitialized()
 {
     initializedWatchmen |= Watchman.ScoreCache;
 }
Beispiel #8
0
 /// <summary>
 /// Marks Scanner Containers watchman as initialized.
 /// </summary>
 public static void ScannerContainersIsInitialized()
 {
     initializedWatchmen |= Watchman.ScannerContainers;
 }
Beispiel #9
0
 /// <summary>
 /// Marks Archiver as initialized.
 /// </summary>
 public static void ArchiverIsInitialized()
 {
     initializedWatchmen |= Watchman.Archiver;
 }