public ActionResult Delete_Project(int id)
        {
            DataBaseFuncController db = new DataBaseFuncController();

            db.RemoveProject(id);
            return(Json(new { result = 1 }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult getNotifreq()
        {
            DataBaseFuncController db    = new DataBaseFuncController();
            List <S_ACTORS>        users = new List <S_ACTORS>();

            NOTIF act = new NOTIF();

            S_ACTORS actors = new S_ACTORS();

            var notifs = db.GetAllNotif().ToList();

            foreach (var x in notifs)
            {
                if (x.ACTOR_ID_TO.ToString() == Session["ActorId"].ToString())
                {
                    users.Add(db.GetActorDataByID(x.ACTOR_ID_FROM));
                }
            }

            Notification pum = new Notification()
            {
                Users = users,
            };

            return(PartialView("../Shared/_Req", pum));
        }
Пример #3
0
        public ActionResult Index(PROJECT project)
        {
            DataBaseFuncController db = new DataBaseFuncController();

            db.AddProject(project);

            return(Json(new { result = 1 }));
        }
Пример #4
0
        public JsonResult Sendcode(string emailreset)
        {
            Random code = new Random();

            randno = code.Next(10, 5000);
            int res = 50;

            DataBaseFuncController db = new DataBaseFuncController();

            var emails = db.GetAllActors();

            foreach (var element in emails)
            {
                if (emailreset == element.EMAIL)
                {
                    res = 11;
                    break;
                }
            }

            if (res == 11)
            {
                DateTime localDate = DateTime.Now;

                var actinfo = db.GetActorData(emailreset);

                S_ACTORS actcode = new S_ACTORS()
                {
                    CODE = randno, RESETTIME = localDate
                };
                db.UpdateActorReset(actinfo.ACTOR_ID, actcode);

                // Specify the from and to email address
                MailMessage mailMessage = new MailMessage
                                              ("*****@*****.**", emailreset);
                // Specify the email body
                mailMessage.Body = "Your Code to Reset Password is: " + randno.ToString();
                // Specify the email Subject
                mailMessage.Subject = "Reset Password";

                // No need to specify the SMTP settings as these
                // are already specified in web.config
                SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);

                // Finall send the email message using Send() method
                smtpClient.EnableSsl = true;
                smtpClient.Send(mailMessage);
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult AllUsersReqAssign(int id1, int id2)
        {
            DataBaseFuncController db = new DataBaseFuncController();

            ACTOR_PROJECT act_proj = new ACTOR_PROJECT()
            {
                ACTOR_ID = id1, PROJECT_ID = id2
            };

            db.AddProjectActor(act_proj);
            return(Json(new { result = 12 }, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        public ActionResult Index(PROJECT project)
        {
            if (!ModelState.IsValid)
            {
                return(View("Index", project));
            }
            DataBaseFuncController db = new DataBaseFuncController();

            db.AddProject(project);

            return(Json(new { result = 1 }));
        }
Пример #7
0
        public ActionResult Register(string fname, string lname, string jobdesc, HttpPostedFileBase photo, string mobile, string role, string username, string password, string email)
        {
            byte[] photos = null;

            if (photo != null)
            {
                try
                {
                    string path = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(photo.FileName));
                    photo.SaveAs(path);

                    using (MemoryStream ms = new MemoryStream())
                    {
                        photo.InputStream.CopyTo(ms);
                        photos = ms.GetBuffer();
                    }

                    ViewBag.Message = "File uploaded successfully";
                }
                catch (Exception ex)
                {
                    ViewBag.Message = "ERROR:" + ex.Message.ToString();
                }
            }

            try
            {
                S_ACTORS act = new S_ACTORS()
                {
                    FNAME = fname, LNAME = lname, JOB_DESC = jobdesc, MOBILE = Int32.Parse(mobile), AROLE = role, USERNAME = username, PASSWORD = password, EMAIL = email
                };
                DataBaseFuncController db = new DataBaseFuncController();

                if (db.AddActor(act) == "Done, Updated")
                {
                    return(Redirect("Index"));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            catch (Exception ex)
            {
                return(HttpNotFound());

                Console.WriteLine(ex);
            }
        }
        public ActionResult AllUserstoAssign(int id)
        {
            DataBaseFuncController db = new DataBaseFuncController();

            S_ACTORS act     = new S_ACTORS();
            PROJECT  project = new PROJECT();

            ProjectsUsersModel pum = new ProjectsUsersModel()
            {
                Users   = db.GetAllActors().ToList(),
                project = db.GetProjectID(id)
            };

            return(PartialView("../Shared/_ModalAssign", pum));
        }
Пример #9
0
        public ActionResult Index(PROJECT project)
        {
            if (!ModelState.IsValid)
            {
                return(View("Index", project));
            }
            DataBaseFuncController db = new DataBaseFuncController();

            project.PROJECT_OWNER = Session["UserName"].ToString();
            project.P_STATUS      = false;
            IA_ProjectEntities x = new IA_ProjectEntities();

            db.AddProject(project);


            return(Json(new { result = 1 }));
        }
Пример #10
0
        public JsonResult ResetPassword(string coderes, string emailf)
        {
            DataBaseFuncController db = new DataBaseFuncController();

            var actinfo = db.GetActorData(emailf);

            DateTime localDate = DateTime.Now;
            int      seconds   = (int)(localDate - actinfo.RESETTIME).Value.TotalSeconds;


            if (coderes == actinfo.CODE.ToString())
            {
                return(Json(22, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(25, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult AcceptReq(int id)
        {
            DataBaseFuncController db = new DataBaseFuncController();

            ACTOR_PROJECT x = new ACTOR_PROJECT()
            {
                AssignStatus = true
            };



            if (db.UpdateActorProject(id, x) == 1)
            {
                return(Json(12, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(13, JsonRequestBehavior.AllowGet));
            }
        }
Пример #12
0
        public JsonResult ResetNewPass(string newpass, string emailff)
        {
            DataBaseFuncController db = new DataBaseFuncController();

            var actinfo = db.GetActorData(emailff);

            S_ACTORS actcode = new S_ACTORS()
            {
                PASSWORD = newpass
            };

            if (db.UpdatePassReset(actinfo.ACTOR_ID, actcode) == "Done, Updated")
            {
                return(Json(60, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(66, JsonRequestBehavior.AllowGet));
            }
        }
Пример #13
0
        public string prof(string pageid, string pageurl, string actorid)
        {
            try
            {
                /*DataBaseFuncController x = new DataBaseFuncController();
                 * x.page(obj);
                 * return View();*/
                S_PAGE s = new S_PAGE()
                {
                    PAGE_URL = pageurl, ACTOR_ID_P = Int32.Parse(actorid), PAGE_ID = Int32.Parse(pageid)
                };
                DataBaseFuncController x = new DataBaseFuncController();

                x.page(s);
                return("done");
            }catch (Exception ex)
            {
                return("failed");
            }
        }
Пример #14
0
        public JsonResult Register(string fname, string lname, string jobdesc, HttpPostedFileBase photo, string mobile, string role, string username, string password, string email)
        {
            byte[] photos = null;

            if (photo != null)
            {
                try
                {
                    string path = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(photo.FileName));
                    photo.SaveAs(path);

                    using (MemoryStream ms = new MemoryStream())
                    {
                        photo.InputStream.CopyTo(ms);
                        photos = ms.GetBuffer();
                    }

                    ViewBag.Message = "File uploaded successfully";
                }
                catch (Exception ex)
                {
                    ViewBag.Message = "ERROR:" + ex.Message.ToString();
                }
            }

            try
            {
                S_ACTORS act = new S_ACTORS()
                {
                    FNAME = fname, LNAME = lname, JOB_DESC = jobdesc, MOBILE = Int32.Parse(mobile), AROLE = role, USERNAME = username, PASSWORD = password, EMAIL = email
                };
                DataBaseFuncController db = new DataBaseFuncController();

                var allactors = db.GetAllActors();


                foreach (var element in allactors)
                {
                    if (username == element.USERNAME)
                    {
                        return(Json(11, JsonRequestBehavior.AllowGet));
                    }
                }

                foreach (var element in allactors)
                {
                    if (email == element.EMAIL)
                    {
                        return(Json(12, JsonRequestBehavior.AllowGet));
                    }
                }

                if (db.AddActor(act) == "Done, Updated")
                {
                    var result = 0;
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    var result = 1;
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(ex.ToString(), JsonRequestBehavior.AllowGet));
            }
        }