public ActionResult Index(MemberModel model) { string FileName = Path.GetFileNameWithoutExtension(model.ImageFile.FileName); string FileExtension = Path.GetExtension(model.ImageFile.FileName); FileName = DateTime.Now.ToString("yyyyMMdd") + "-" + FileName.Trim() + FileExtension; string UploadPath = ConfigurationManager.AppSettings["UserUploadPath"].ToString(); model.ImagePath = UploadPath + FileName; model.ImageFile.SaveAs(model.ImagePath); tblMember member = new tblMember(); member.ImagePath = model.ImagePath; member.MemberName = model.Name; member.PhoneNumber = model.PhoneNumber; using (MVCEntities entities = new MVCEntities()) { entities.tblMembers.Add(member); entities.SaveChanges(); } return(View()); }
public ActionResult Index() { UserDal Userdal = new UserDal(); using (MVCEntities db = new MVCEntities()) { List <Courses> details = db.Courses.ToList(); List <StudentsCourses> grades = db.StudentsCourses.ToList(); var studentRecord = from d in details join g in grades on d.CourseId equals g.CourseID into table1 from g in table1.ToList() select new ViewModel { cour = d, dat = g, }; string Username = Session["UserName"].ToString(); ViewBag.ID = (from x in Userdal.Users where x.UserName == Username select x.ID).FirstOrDefault(); ViewBag.noGrade = "Not examine yet"; return(View("StudentHome", studentRecord)); } }
// GET: Employee public ActionResult Index() { MVCEntities db = new MVCEntities(); ViewBag.ListEmployee = db.employees.ToList(); return(View()); }
// GET: User public ActionResult Index() { using (MVCEntities db = new MVCEntities()) { return(View(db.UserDbs.ToList())); } }
public bool AddItem(int itemID) { var findItem = this.cartItems .Where(s => s.iID == itemID) .Select(s => s) .FirstOrDefault(); if (findItem == default(Models.CartItem)) { using (MVCEntities db = new MVCEntities()) { var icart = (from s in db.Item where s.itemID == itemID select s).FirstOrDefault(); if (icart != null) { this.AddItem(icart); } } } else { findItem.qty += 1; } return(true); }
public byte[] GetImageBytesByImageId(int ImageId) { using (MVCEntities dbContext = new MVCEntities()) { return dbContext.Profiles.Where(p => p.UserId == ImageId).SingleOrDefault().ImageData; } }
public virtual void Dispose() { if (_context != null) { _context.Dispose(); _context = null; } }
public bool IsEmailExist(string emailID) { using (MVCEntities dc = new MVCEntities()) { var v = dc.UserDbs.Where(a => a.EmailID == emailID).FirstOrDefault(); return(v != null); } }
public ActionResult Delete(int id) { MVCEntities db = new MVCEntities(); var data = db.employees.Where(x => x.id == id).First(); db.employees.Remove(data); db.SaveChanges(); return(RedirectToAction("Index")); }
static void Main(string[] args) { MVCEntities db = new MVCEntities(); List <User> users = db.Users.ToList(); List <UserPost> userPost = db.UserPosts.Where(o => o.UserID == 1).ToList(); List <Picture> picture = db.Pictures.ToList(); Console.WriteLine($"{userPost.Count}"); Console.ReadKey(); }
public ActionResult LogIn(UserDb u) { using (MVCEntities dc = new MVCEntities()) { bool isValid = dc.UserDbs.Any(x => x.EmailID == u.EmailID && x.Password == u.Password); if (isValid) { FormsAuthentication.SetAuthCookie(u.EmailID, false); return(RedirectToAction("Index", "Employees")); } ModelState.AddModelError("", "Invalid username and passoword"); return(View()); } }
public ActionResult DisplayAll() { using (var dbctx = new MVCEntities()) { var res = dbctx.tbl_site.Select(o => new Mysite { username = o.username, city = o.city, state = o.state, country = o.country }); return(View(res.ToList())); }; }
public ActionResult GetDetails(string username) { using (var dbctx = new MVCEntities()) { var res = dbctx.tbl_site.Where(o => o.username == username).Select(o => new Mysite { username = o.username, city = o.city, state = o.state, country = o.country }).SingleOrDefault(); return(View(res)); } }
static void Main(string[] args) { MVCEntities db = new MVCEntities(); Random rnd = new Random(); List <Utilizator> utilizatori = db.Utilizators.ToList(); List <Postare> postari = db.Postares.ToList(); List <Poza> poze = db.Pozas.ToList(); //Codul de jos nu are nici o logica, dar am vrut sa testez putin proprietatile + random Console.WriteLine($"Utilizatorul tau random este {utilizatori[rnd.Next(0, utilizatori.Count)].Nume}"); Console.WriteLine($"Postarea ta random este {postari[rnd.Next(0, postari.Count)].Titlu}"); Console.WriteLine("Poza ta random se va deschide imediat..."); Thread.Sleep(3000); Process.Start(poze[rnd.Next(0, poze.Count)].DrumSprePoza); Console.ReadKey(); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MVCEntities db = new MVCEntities(); var data = db.employees.Where(x => x.id == id).First(); employee employ = new employee(); employ.Name = data.Name.Trim(); employ.Gender = data.Gender.Trim(); employ.Email = data.Email.Trim(); employ.Age = data.Age.Trim(); return(View(employ)); }
public ActionResult Edit(employee model) { MVCEntities db = new MVCEntities(); if (ModelState.IsValid) { var data = db.employees.Where(x => x.id == model.id).First(); data.Name = model.Name; data.Gender = model.Gender; data.Email = model.Email; data.Age = model.Age; db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Insertdetails(Mysite ms) { using (var dbctx = new MVCEntities()) { dbctx.tbl_site.Add(new tbl_site { username = ms.username, city = ms.city, state = ms.state, country = ms.country }); dbctx.SaveChanges(); } return(RedirectToAction("DisplayAll")); }
public void CreateProject(int JobId, int EmId, int FreeId) { Project project = new Project(); project.EmployerId = EmId; project.FreelancerId = FreeId; System.Diagnostics.Debug.Write("JobId" + JobId); try { MVCEntities db = new MVCEntities(); var EmName = db.Members.FirstOrDefault(u => u.UserId.Equals(EmId)).Name; var FreeName = db.Members.FirstOrDefault(u => u.UserId.Equals(FreeId)).Name; System.Diagnostics.Debug.Write(EmName + " and " + FreeName); project.EmployerName = EmName; project.FreelancerName = FreeName; project.JobId = JobId; project.CheckConfirm = true; projectRepo.InsertUser(project); projectRepo.Save(); string strDate = DateTime.Now.ToString("MM/dd/yy H:mm:ss"); Notification EmNoti = new Notification(); EmNoti.JobId = JobId; EmNoti.EmployerId = EmId; EmNoti.FreelancerId = FreeId; EmNoti.FreelancerMsg = "I confirm your job"; EmNoti.Date = strDate; EmNoti.Type = "Job"; notiRepo.InsertNotification(EmNoti); notiRepo.Save(); System.Diagnostics.Debug.Write("PassForProject"); // return RedirectToAction("Index","Home"); } catch { // return RedirectToAction("Index", "Home"); } }
public ActionResult InsertEmployee(EmployeeModel model) { try { MVCEntities db = new MVCEntities(); employee employ = new employee(); employ.Name = model.Name; employ.Gender = model.Gender; employ.Email = model.Email; employ.Age = model.Age; db.employees.Add(employ); db.SaveChanges(); } catch (Exception ex) { throw ex; } return(RedirectToAction("Index")); }
public ActionResult DeleteJob(int id) { try { int TotalCredit; int reduceCredit = 1; MVCEntities db = new MVCEntities(); var delJob = db.Jobs.SingleOrDefault(u => u.JobId.Equals(id)); var member = db.Members.SingleOrDefault(u => u.UserId.Equals(delJob.UserId)); if (delJob != null) { delJob.Status = false ; /////////////////////// TotalCredit= member.Credit; TotalCredit = TotalCredit + reduceCredit; member.Credit=TotalCredit; if(TotalCredit==3){ //do nothhing } else { accountRepo.UpdateUser(member); accountRepo.Save(); } jobRepo.UpdateUser(delJob); jobRepo.Save(); //notification// // return RedirectToAction("ShowJob","Job"); } } catch { return View(); } return View(); }
public ActionResult Display() { List <string> dd; using (var dbctx = new MVCEntities()) { dd = new List <string>(); var res = dbctx.tbl_site.Select(o => o.username); foreach (string item in res) { dd.Add(item); } } Mysite ms = new Mysite { usernames = new SelectList(dd) }; return(View(ms)); }
public ActionResult Registration(UserDb u) { if (ModelState.IsValid) { #region//Email is already Exist var isExist = IsEmailExist(u.EmailID); if (isExist) { ViewBag.emailexist = "email already exist"; return(View(u)); } #endregion } #region //save to database using (MVCEntities dc = new MVCEntities()) { dc.UserDbs.Add(u); dc.SaveChanges(); } #endregion ViewBag.success = "registered successful"; return(View(u)); }
public BidRepository(MVCEntities context) { this.context = context; }
public AccountRepository(MVCEntities context) { this.context = context; }
public ActionResult showJobRequest(int FreelanceId) { System.Diagnostics.Debug.Write("Slot2" + FreelanceId); int uid = (int)Session["UidInProfile"]; using (MVCEntities db = new MVCEntities()) { // var JobList = from user in jobRepo.GetUsers() select user; var JobList = jobRepo.GetUsers().OrderByDescending(u => u.JobId); var jobs = new List<MyApplication.Job>(); if (JobList.Any()) { foreach (var job in JobList) { //space bar 10 times - -'' i'll fix this point later. if (job.UserId.Equals(uid) && job.Status) { jobs.Add(new MyApplication.Job() { JobId = job.JobId, Title = job.Title, InitialBudget = job.InitialBudget, finalBudget = job.finalBudget, Category = job.Category, Date = job.Date }); } } } ViewBag.FreelanceId = FreelanceId; return View(jobs); } }
public ActionResult PostJob(Job job) { int TotalCredit; int reduceCredit = 1; bool checkNotiSkill=false; int JobCount = 0; string checkCategory = ""; int uid = (int)Session["UidInProfile"]; job.UserId = uid; string strDate = DateTime.Now.ToString("MM/dd/yy H:mm:ss"); System.Diagnostics.Debug.Write("strDate " + strDate); job.Date = strDate; job.Status = true; //string strDate = DateTime.Now.Date; MVCEntities db = new MVCEntities(); var member = db.Members.SingleOrDefault(u => u.UserId.Equals(uid)); ////deal with budget////// ///// deal with Credit//////// System.Diagnostics.Debug.Write("Credit " + member.Credit); TotalCredit = member.Credit; TotalCredit = TotalCredit - reduceCredit; // System.Diagnostics.Debug.Write("TotalCredit " + TotalCredit); if (job.finalBudget <= job.InitialBudget) { ModelState.AddModelError("", "final budget should more than initial budget!"); } else { if (TotalCredit == -1) { ModelState.AddModelError("", "Credit is equal to zero So, can not post job"); } else { if (member != null) { member.Credit = TotalCredit; accountRepo.UpdateUser(member); accountRepo.Save(); } // IF USER DOES NOT INPUT OTHER SKILL// if (job.Other == null) { job.Other = "Not Identify"; } jobRepo.InsertUser(job); jobRepo.Save(); ///// Notification Here/// var getUser = db.Jobs.SingleOrDefault(u => u.UserId.Equals(uid)&&u.Date.Equals(job.Date)); // System.Diagnostics.Debug.Write("1 " + getUser.Other.TrimEnd() + " 2 " + getUser.UserId + " 3 " + getUser.JobId); //////// check match skill/////////////// var skillJobList = db.Jobs.SingleOrDefault(d => d.Date.Equals(job.Date)); var userList = from user in profileRepo.GetUsers() select user; var users = new List<MyApplication.Profile>(); if (userList.Any()) { foreach (var user in userList) { if (user.UserType.Equals("Freelancer ")) { // System.Diagnostics.Debug.Write(user.Tester + " , " +user.UserId+" , "+checkTester); // else if here // if (user.Java) { if (user.Java.Equals(skillJobList.Java)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book1!" + user.UserId); } if (user.Javascript) { if (user.Javascript.Equals(skillJobList.Javascript)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book2!" + user.UserId); } if (user.C) { if (user.C.Equals(skillJobList.C)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book3!" + user.UserId); } if (user.Cplus) { if (user.Cplus.Equals(skillJobList.Cplus)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book4!" + user.UserId); } if (user.Csharp) { if (user.Csharp.Equals(skillJobList.Csharp)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book5!" + user.UserId); } if (user.PHP) { if (user.PHP.Equals(skillJobList.PHP)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book6!" + user.UserId); } if (user.Objective_C) { if (user.Objective_C.Equals(skillJobList.Objective_C)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book7!" + user.UserId); } if (user.Python) { if (user.Python.Equals(skillJobList.Python)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book8!" + user.UserId); } if (user.ASP_NET) { if (user.ASP_NET.Equals(skillJobList.ASP_NET)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book9!" + user.UserId); } if (user.Ruby) { if (user.Ruby.Equals(skillJobList.Ruby)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book10!" + user.UserId); } if (user.SQL) { if (user.SQL.Equals(skillJobList.SQL)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book11!" + user.UserId); } if (user.Html) { if (user.Html.Equals(skillJobList.Html)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book12!" + user.UserId); } if (user.Css) { if (user.Css.Equals(skillJobList.Css)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book13!" + user.UserId); } if (user.Android) { if (user.Android.Equals(skillJobList.Android)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book14!" + user.UserId); } if (user.XML) { if (user.XML.Equals(skillJobList.XML)) checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book15!" + user.UserId); } if (user.WebDeveloper) { checkCategory = "Web Developer"; if (checkCategory.Equals(job.Category)) { checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book1!" + user.UserId); } } if (user.Tester) { checkCategory = "Tester"; if (checkCategory.Equals(job.Category)) { checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book2!" + user.UserId); } } if (user.MobileDeveloper) { checkCategory = "Mobile Devolpoer"; if (checkCategory.Equals(job.Category)) { checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book3!" + user.UserId); } } if (user.SystemDesign) { checkCategory = "System & Graphic design"; if (checkCategory.Equals(job.Category)) { checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book4!" + user.UserId); } } if (user.SystemAnalyst) { checkCategory = "System Analyst"; if (checkCategory.Equals(job.Category)) { checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book5!" + user.UserId); } } if (user.ProjectManager) { checkCategory = "Project Manager"; if (checkCategory.Equals(job.Category)) { checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book6!" + user.UserId); } } if (user.GameDeveloper) { checkCategory = "Game Developer"; if (checkCategory.Equals(job.Category)) { checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book7!" + user.UserId); } } if (user.Marketing) { checkCategory = "Marketing"; if (checkCategory.Equals(job.Category)) { checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book8!" + user.UserId); } } if (user.OthersJob) { checkCategory = "Others"; if (checkCategory.Equals(job.Category)) { checkNotiSkill = true; System.Diagnostics.Debug.Write("This is a book9!" + user.UserId); } } if (checkNotiSkill) { System.Diagnostics.Debug.Write("slot1 "); /* Notification notificationSkill = new Notification(); notificationSkill.JobId = getUser.JobId; notificationSkill.EmployerId = getUser.UserId; notificationSkill.FreelancerId = user.UserId; notificationSkill.EmployerMsg = "http://localhost:3883/DisplayJob/ShowDetailCategoryJob?jid" + getUser.JobId; notificationSkill.Status = false; notificationSkill.Date = job.Date; notificationSkill.Type = "Skill";*/ Notification notificationSkill = new Notification(); notificationSkill.FreelancerId = uid; notificationSkill.EmployerMsg = "I need your skill to do this project"; notificationSkill.EmployerId = getUser.UserId; notificationSkill.JobId = getUser.JobId; notificationSkill.Date = job.Date; notificationSkill.Status = false; notificationSkill.Type = "Skill"; System.Diagnostics.Debug.Write("1 " + getUser.JobId + " 2 " + (int)Session["UidInProfile"] + " " + getUser.UserId + " " + job.Date); notiRepo.InsertNotification(notificationSkill); notiRepo.Save(); checkNotiSkill = false; } if (!checkNotiSkill && JobCount==0) { checkNotiSkill = false; JobCount = 1; System.Diagnostics.Debug.Write("Slot2"); notifySkill(getUser.Other.TrimEnd(), getUser.UserId, getUser.JobId, getUser.Date); } } // System.Diagnostics.Debug.Write("checkNotiSkill " + checkNotiSkill); } } ////////////////////////////////////////// // notifySkill(getUser.Other.TrimEnd(),getUser.UserId,getUser.JobId,getUser.Date); ////////////////////////// return RedirectToAction("ShowJob", "Job"); } } return View(); }
public GenericRepository(MVCEntities context) { this.context = context; this.dbSet = context.Set <TEntity>(); }
private bool IsExistEmail(String Email) { bool isValid = false; try { System.Diagnostics.Debug.Write("Email " + Email); var dbContext = new MVCEntities(); var usersList = dbContext.Members.FirstOrDefault(u => u.Email == Email); // var usersList = from user in dbContext.Members.FirstOrDefault(u => u.Username == username) select user; // System.Diagnostics.Debug.Write("usersList "+usersList); if (usersList == null) { System.Diagnostics.Debug.Write("Email is not Exist"); isValid = true; //System.Diagnostics.Debug.Write("Love2 " + Session["UidInProfile"]); return isValid; } else { System.Diagnostics.Debug.Write("Email is Exist"); return isValid; } } catch { return isValid; } }
public ActionResult Login(Member member) { if (IsValid(member.Username, member.Password)) { FormsAuthentication.SetAuthCookie(member.Username, false); // Session["Username"] = member.Username; //////////////// don't forget to Edit(u => u.UserId == 434); var dbContext = new MVCEntities(); var usersList = dbContext.Members.FirstOrDefault(u => u.Username == member.Username && u.Password == member.Password); //to get profile_ID System.Diagnostics.Debug.Write("usersList " + usersList.Username + " "); if (usersList.Username.TrimEnd() == "TDADMIN") { Session["UidInProfile"] = usersList.UserId; Session["UserType"] = usersList.UserType; Session["Online"] = "Online"; return RedirectToAction("Index", "Home"); } else { var person = profileRepo.GetUsers().FirstOrDefault(u => u.UserId == usersList.UserId); Session["Name"] = usersList.Name; Session["PID"] = person.ProId; Session["Online"] = "Online"; Session["UidInProfile"] = usersList.UserId; Session["UserType"] = usersList.UserType; // Session["Picture"] = person.ImageData; System.Diagnostics.Debug.Write(" UserName ="******"Name"] + " ProID =" + Session["PID"]); System.Diagnostics.Debug.Write("Online =" + Session["Online"] + " UID =" + Session["UidInProfile"]); System.Diagnostics.Debug.Write("USertype =" + Session["UserType"]); //System.Diagnostics.Debug.Write("Usertype " + Session["UserType"] + "x"); return RedirectToAction("Index", "Home"); } } else { ModelState.AddModelError("", "Login Data is incorrect"); } return View(); }
public NotificationRepository(MVCEntities context) { this.context = context; }
public ActionResult GotoShowDetailCategoryJob(int jid,int uid,string date,string type) { // check Read to true// System.Diagnostics.Debug.Write("Slotx "+date+"x"+type+"r"); MVCEntities db = new MVCEntities(); Notification editRead = db.Notifications.FirstOrDefault(j => j.JobId.Equals(jid) && j.FreelancerId.Equals(uid)&&j.Date.Equals(date)); editRead.Read = true; Session["EmId"] = editRead.EmployerId; Session["FreeId"] = editRead.FreelancerId; notiRepo.UpdateNotification(editRead); notiRepo.Save(); // error around here System.Diagnostics.Debug.Write("jid is " + jid); Session["JobId"] = jid; // return RedirectToAction("ShowDetailCategoryJob", "DisplayJob", new { jid = jid }); if(type.Equals("Skill ")){ //f**k Session["JobId"] = jid; // Session["UserType"] = "Freelancer "; // System.Diagnostics.Debug.Write("cat" + " " + Session["UserType"]+"sS"); return RedirectToAction("ShowDetailCategoryJob", "DisplayJob", new { jid = jid }); } else { System.Diagnostics.Debug.Write("dog"); // System.Diagnostics.Debug.Write("sus" +ViewBag.EmId); return RedirectToAction("ShowJobNotification", "DisplayJob", new { jid = jid }); } // return RedirectToAction("ShowJobNotification", "DisplayJob", new { jid = jid }); }
public ActionResult progressOftheProject(int jobId) { ViewBag.files = Directory.EnumerateFiles(Server.MapPath("~/images_upload")); //show all image///////////////////////////////////////////// ViewBag.Images = Directory.EnumerateFiles(Server.MapPath("~/images_upload")) .Select(fn => "~/images_upload/" + Path.GetFileName(fn)); ///////////////////////////////////////////////////////////// // int uid = (int)Session["UidInProfile"]; // System.Diagnostics.Debug.Write("asdascxascasd "+uid); var ProjectList = projectRepo.GetUsers(); var proJs = new List<MyApplication.Project>(); // System.Diagnostics.Debug.Write("Freelencer"); if (ProjectList.Any()) { foreach (var proj in ProjectList) { if (proj.JobId.Equals(jobId)) { ViewBag.EmployerName = proj.EmployerName; ViewBag.JobId = jobId; var db = new MVCEntities(); // var getJObId = db.Projects.FirstOrDefault(u => u.JobId.Equals(x)); proJs.Add(new MyApplication.Project() { // EmployerName = proj.EmployerName, JobId = proj.JobId, FreelancerName = proj.FreelancerName, }); } } } ViewBag.check = false; return View(proJs); }
public ActionResult Bidding(DisplayBid disbid) { try { //System.Diagnostics.Debug.Write("DRAGONX" + Session["UidInProfile"]); //System.Diagnostics.Debug.Write("DRAGONX" + Session["JobId"]); int JobIdinBid = (int)Session["JobId"]; int UserIdinBid = (int)Session["UidInProfile"]; /* bidRepo.InsertUser(bid); bidRepo.Save();*/ // insert bidID. try { var db = new MVCEntities(); var userList_Id = db.Bids.FirstOrDefault(u => u.JobId == JobIdinBid && u.UserId == UserIdinBid); System.Diagnostics.Debug.Write("DRAGONE" + (int)Session["UidInProfile"]); var NameOfUser = db.Members.FirstOrDefault(n => n.UserId.Equals(UserIdinBid)).Name; disbid.JobId = (int)Session["JobId"]; disbid.UserId = (int)Session["UidInProfile"]; disbid.BidId = userList_Id.BidId; disbid.EmployerId = userList_Id.EmployerId; disbid.Name = NameOfUser; System.Diagnostics.Debug.Write("Passaaaa "+disbid.BidId); disbidRepo.InsertUser(disbid); disbidRepo.Save(); return RedirectToAction("ShowDetailCategoryJob", "DisplayJob", new { jid = (int)Session["JobId"] }); // return PartialView("Bidding"); // return RedirectToAction("ShowDetailCategoryJob", "DisplayJob", new { jid = (int)Session["JobId"] }); } //if there is bidID and want bid more than 1 time. catch { var db = new MVCEntities(); var EmployerId = db.Jobs.FirstOrDefault(u => u.JobId == JobIdinBid).UserId; Bid bid = new Bid(); bid.JobId = (int)Session["JobId"]; bid.UserId = (int)Session["UidInProfile"]; bid.Status = true; bid.EmployerId = EmployerId; bidRepo.InsertUser(bid); bidRepo.Save(); /////////////////////////// System.Diagnostics.Debug.Write("DRAGOND" + (int)Session["UidInProfile"]); var userList_Id = db.Bids.FirstOrDefault(u => u.JobId == JobIdinBid && u.UserId == UserIdinBid).BidId; var NameOfUser = db.Members.FirstOrDefault(n => n.UserId.Equals(UserIdinBid)).Name; // System.Diagnostics.Debug.Write("Pass0 "+userList_Id.BidId); ////////////////////////// disbid.JobId = (int)Session["JobId"]; disbid.UserId = (int)Session["UidInProfile"]; disbid.BidId = userList_Id; disbid.EmployerId = EmployerId; disbid.Name = NameOfUser; disbidRepo.InsertUser(disbid); disbidRepo.Save(); System.Diagnostics.Debug.Write("Pass"); return RedirectToAction("ShowDetailCategoryJob", "DisplayJob", new { jid = (int)Session["JobId"] }); // return PartialView("Bidding"); } } catch (Exception) { return PartialView("Bidding"); } }
public ProfileRepository(MVCEntities context) { this.context = context; }
public ActionResult showProjects() { int uid = (int)Session["UidInProfile"]; System.Diagnostics.Debug.Write("asdascxascasd " + uid); var ProjectList = projectRepo.GetUsers(); var Jobs = new List<MyApplication.Job>(); var UserType = Session["UserType"]; System.Diagnostics.Debug.Write("Freelencer"); if (ProjectList.Any()) { foreach (var proj in ProjectList) { if (proj.FreelancerId.Equals(uid)) { var x = proj.JobId; var db = new MVCEntities(); var getJObId = db.Jobs.FirstOrDefault(u => u.JobId.Equals(x)); Jobs.Add(new MyApplication.Job() { JobId = getJObId.JobId, Title = getJObId.Title, InitialBudget = getJObId.InitialBudget, finalBudget = getJObId.finalBudget, Category = getJObId.Category, Date = getJObId.Date }); } if (proj.EmployerId.Equals(uid)) { var x = proj.JobId; var db = new MVCEntities(); var getJObId = db.Jobs.FirstOrDefault(u => u.JobId.Equals(x)); Jobs.Add(new MyApplication.Job() { JobId = getJObId.JobId, Title = getJObId.Title, InitialBudget = getJObId.InitialBudget, finalBudget = getJObId.finalBudget, Category = getJObId.Category, Date = getJObId.Date }); } } } return View(Jobs); }
public ActionResult forgetPassword(Member mem) { //39322328 try { if (forgetPasswordService(mem.Email, mem.RegisterCode)){ MVCEntities db = new MVCEntities(); var userPassword = db.Members.SingleOrDefault(x => x.Email.Equals(mem.Email)).Password; // System.Diagnostics.Debug.Write("Password " + userPassword); sendForgetPassword(userPassword); return RedirectToAction("index", "Home"); } else { ViewData["ErrorText"] = "Email or registercode does not correct."; return View(); } } catch { return RedirectToAction("forgetPassword", "Account"); } }
public bool forgetPasswordService(String Email, String RegisterCode) { bool isValid = false; var dbContext = new MVCEntities(); try{ var usersList = dbContext.Members.FirstOrDefault(u => u.Email == Email && u.RegisterCode == RegisterCode); if (usersList != null) { if (usersList.Email.TrimEnd() == (Email) && usersList.RegisterCode.TrimEnd() == (RegisterCode)) { System.Diagnostics.Debug.Write("right here"); isValid = true; } else { System.Diagnostics.Debug.Write("right here2"); isValid = false; } return isValid; } else { System.Diagnostics.Debug.Write("right here2"); return isValid; } } catch { return isValid; } }
public BrunchRepository(MVCEntities context) { this._db = context.Brunch; this.context = context; }
public ActionResult ConfirmRegister(Member member) { try { /* if (IsExistUsername(member.Username)) {*/ member.Username = member.Email; MVCEntities db = new MVCEntities(); // System.Diagnostics.Debug.Write("TEST1 " + member.Username + " " + member.ConfirmRegisterCode); var userList_Id = db.Members.FirstOrDefault(u => u.Email == member.Email && u.ConfirmRegisterCode == member.ConfirmRegisterCode).UserId; var userList_Type = db.Members.FirstOrDefault(u => u.Email == member.Email && u.ConfirmRegisterCode == member.ConfirmRegisterCode).UserType; // var AccountComfirmCode = db.Members.FirstOrDefault(u => u.UserId == userList_Id).ConfirmRegisterCode; // var person = accountRepo.GetUsers().FirstOrDefault(u => u.UserId == userList_Id); var person = db.Members.FirstOrDefault(u => u.UserId == userList_Id); //for uid in profile if (person != null) { System.Diagnostics.Debug.Write("OK"); person.Username = member.Username; // System.Diagnostics.Debug.Write("Pure " + member.ConfirmRegisterCode + " " + AccountComfirmCode); //check confirm register code// /* if (member.ConfirmRegisterCode.TrimEnd() != person.ConfirmRegisterCode.TrimEnd()) { ModelState.AddModelError("", "The confirm register password is wrong!"); } else {*/ person.ConfirmRegisterCode = ""; person.Credit = 2; System.Diagnostics.Debug.Write("OK2" + member.Username); accountRepo.UpdateUser(person); accountRepo.Save(); System.Diagnostics.Debug.Write("OK3"); //////////////////////// Profile pro = new MyApplication.Profile(); pro.UserId = userList_Id; pro.UserType = userList_Type; System.Diagnostics.Debug.Write("pro.UserId " + pro.UserId + " and " + pro.UserType + " "); profileRepo.InsertUser(pro); profileRepo.Save(); System.Diagnostics.Debug.Write("OK4"); // } ////////////////////////////////// // delete editing information that com with the link by delete confirmRegisterCode if (IsValid(member.Username, member.Password)) { FormsAuthentication.SetAuthCookie(member.Username, false); // Session["Username"] = member.Username; //////////////// don't forget to Edit(u => u.UserId == 434); var dbContext = new MVCEntities(); var usersListRegis = dbContext.Members.FirstOrDefault(u => u.Username == member.Username && u.Password == member.Password); //to get profile_ID var personRegis = profileRepo.GetUsers().FirstOrDefault(u => u.UserId == usersListRegis.UserId); // Session["Username"] = member.Username; Session["Name"] = usersListRegis.Name; System.Diagnostics.Debug.Write("member.Name " + usersListRegis.UserId + "x" + usersListRegis.UserType); Session["PID"] = personRegis.ProId; Session["Online"] = "Online"; Session["UidInProfile"] = usersListRegis.UserId; Session["UserType"] = usersListRegis.UserType; // Session["Picture"] = personRegis.ImageData; // System.Diagnostics.Debug.Write("usersList " + Session["UidInProfile"] + "x"); //System.Diagnostics.Debug.Write("Usertype " + Session["UserType"] + "x"); return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", "Login Data is incorrect"); } // return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", "ConfirmRegister code has used already!"); return View(); } /* } else { ModelState.AddModelError("", "this Username is exist"); }*/ } catch { ModelState.AddModelError("", "ConfirmRegister code is wrongs or used to register before!"); return View(); } return View(); }
public UserRepository(MVCEntities context) { this.context = context; }
private bool IsValid(String username, String password) { bool isValid = false; try { var dbContext = new MVCEntities(); var usersList = dbContext.Members.FirstOrDefault(u => u.Username == username && u.Password == password); if (usersList != null) { if (usersList.Username.TrimEnd() == (username) && usersList.Password.TrimEnd() == (password)) { System.Diagnostics.Debug.Write("Pass"); isValid = true; } else { System.Diagnostics.Debug.Write("Fail"); isValid = false; } //isValid = true; System.Diagnostics.Debug.Write("Login"); //System.Diagnostics.Debug.Write("Love2 " + Session["UidInProfile"]); return isValid; } else { System.Diagnostics.Debug.Write("Don't Login"); return isValid; } } catch { return isValid; } }
public PositionRepository(MVCEntities context) { this._db = context.Position; this.context = context; }
public ContactRepository(MVCEntities context) { this.context = context; }
public GiftsRepository(MVCEntities context) { this._db = context.Gifts; this.context = context; }
public OrdersRepository(MVCEntities context) { this._db = context.Orders; this.context = context; }
public ClientRepository(MVCEntities context) { this._db = context.Client; this.context = context; }
///////////////////////// //service// public void notifySkill(string OtherSkills,int EmployerId,int JobId,string Date) { // System.Diagnostics.Debug.Write("4 " + OtherSkills + " 5 " + EmployerId + " 6 " + JobId); bool checktxt = false; bool checkSkill = false; //////////// /////////// for (int index = 0; index < OtherSkills.Length; index++) { if (OtherSkills[index].Equals(',')) { checktxt = true; } } if (checktxt) { String[] EmArray = OtherSkills.Split(','); int EmLen = EmArray.Length; MVCEntities db = new MVCEntities(); var usersList = profileRepo.GetUsers(); var users = new List<MyApplication.Profile>(); String[] FreeArray; if (usersList.Any()) { foreach (var user in usersList) { if (user.UserType == "Freelancer " && user.Others != null) { // int d = 0; FreeArray = user.Others.TrimEnd().Split(','); int Freelen = FreeArray.Length; for (int z = 0; z < EmLen; z++) { for (int x = 0; x < Freelen; x++) { // System.Diagnostics.Debug.Write("Value " + EmArray[z] + " and " + FreeArray[x]); //check skill match with job : return true if (EmArray[z] == FreeArray[x]) { // do the notification checkSkill = true; } }//end first for loop // System.Diagnostics.Debug.Write(" Next "); }// end second for loop }//end if-else // if (checkSkill) { /* Notification notificationSkill = new Notification(); notificationSkill.JobId = JobId; notificationSkill.EmployerId = EmployerId; notificationSkill.FreelancerId = user.UserId; notificationSkill.EmployerMsg = "http://localhost:3883/DisplayJob/ShowDetailCategoryJob?jid" + JobId; notificationSkill.Status = false; notificationSkill.Date = Date; notificationSkill.Type = "Skill";*/ Notification notificationSkill = new Notification(); notificationSkill.FreelancerId = user.UserId; notificationSkill.EmployerMsg = "I need your skill to do this project"; notificationSkill.EmployerId = EmployerId; notificationSkill.JobId = JobId; notificationSkill.Date = Date; notificationSkill.Status = false; notificationSkill.Type = "Skill"; System.Diagnostics.Debug.Write("Slot1"); notiRepo.InsertNotification(notificationSkill); notiRepo.Save(); checkSkill = false; } // }// end foreach }//end if-else }//end if-else else { if (OtherSkills.Length!=0) { string EmTxt = OtherSkills; MVCEntities db = new MVCEntities(); var usersList = profileRepo.GetUsers(); var users = new List<MyApplication.Profile>(); String[] FreeArray; if (usersList.Any()) { foreach (var user in usersList) { if (user.UserType == "Freelancer " && user.Others != null) { System.Diagnostics.Debug.Write("Name " + user.UserId); FreeArray = user.Others.TrimEnd().Split(','); int Freelen = FreeArray.Length; for (int i = 0; i < FreeArray.Length; i++) { if (FreeArray[i].Equals(EmTxt)) { System.Diagnostics.Debug.Write("Slot2" + user.UserId); // do the notification checkSkill = true; } } } // if (checkSkill) { Notification notificationSkill = new Notification(); notificationSkill.JobId = JobId; notificationSkill.EmployerId = EmployerId; notificationSkill.FreelancerId = user.UserId; notificationSkill.EmployerMsg = "http://localhost:3883/DisplayJob/ShowDetailCategoryJob?jid" + JobId; notificationSkill.Status = false; notificationSkill.Date = Date; notificationSkill.Type = "Skill"; notiRepo.InsertNotification(notificationSkill); notiRepo.Save(); checkSkill = false; } // }//end foreach } //do something } else { } } }
public ActionResult Profiles() { ////////////////is implementing right here///////////////// // ViewBag.ID = id; try { int uid = (int)Session["UidInProfile"]; // System.Diagnostics.Debug.Write("Uid in Profile is equal " + uid + " "); var dbContext = new MVCEntities(); var profile = dbContext.Profiles.FirstOrDefault(u => u.UserId == uid); System.Diagnostics.Debug.Write("UIS is equal " + uid + " "); System.Diagnostics.Debug.Write("Pid is equal " + profile.ProId + " "); Session["ProfileId"] = profile.ProId; // var profileDetail = dbContext.Profiles.FirstOrDefault(p => p.ProId == profile.ProId); try { if (Session["UserType"].Equals("Freelancer ")) { // var profileDetail = dbContext.Profiles.FirstOrDefault(p => p.ProId == (int)Session["ProfileId"]); var ProfileModel = new MyApplication.Profile(); System.Diagnostics.Debug.Write("TTTxx"); ProfileModel.Name = profile.Name; System.Diagnostics.Debug.Write("TTT " + ProfileModel.Name + " " + profile.Name); if (ProfileModel.Name == null) { ProfileModel.Name = " "; } else { ProfileModel.Name = profile.Name.TrimEnd(); } ProfileModel.Telephone = profile.Telephone; if (ProfileModel.Telephone == null) { ProfileModel.Telephone = " "; } else { ProfileModel.Telephone = profile.Telephone.TrimEnd(); } ProfileModel.Status = profile.Status; if (ProfileModel.Status == null) { ProfileModel.Status = " "; } else { ProfileModel.Status = profile.Status.TrimEnd(); } ProfileModel.Fax = profile.Fax; if (ProfileModel.Fax == null) { ProfileModel.Fax = " "; } else { ProfileModel.Fax = profile.Fax.TrimEnd(); } ProfileModel.Address = profile.Address; if (ProfileModel.Address == null) { ProfileModel.Address = " "; } else { ProfileModel.Address = profile.Address.TrimEnd(); } ProfileModel.CompanyName = profile.CompanyName; if (ProfileModel.CompanyName == null) { ProfileModel.CompanyName = " "; } else { ProfileModel.CompanyName = profile.CompanyName.TrimEnd(); } ProfileModel.About_Yourself = profile.About_Yourself; if (ProfileModel.About_Yourself == null) { ProfileModel.About_Yourself = " "; } else { ProfileModel.About_Yourself = profile.About_Yourself.TrimEnd(); } ProfileModel.Android = profile.Android; ProfileModel.ASP_NET = profile.ASP_NET; ProfileModel.C = profile.C; ProfileModel.Cplus = profile.Cplus; ProfileModel.Csharp = profile.Csharp; ProfileModel.Css = profile.Css; ProfileModel.Html = profile.Html; ProfileModel.Java = profile.Java; ProfileModel.Javascript = profile.Javascript; ProfileModel.Objective_C = profile.Objective_C; ProfileModel.PHP = profile.PHP; ProfileModel.Python = profile.Python; ProfileModel.Ruby = profile.Ruby; ProfileModel.SQL = profile.SQL; ProfileModel.XML = profile.XML; ProfileModel.Others = profile.Others; if (ProfileModel.Others == null) { ProfileModel.Others = " "; } else { ProfileModel.Others = profile.Others.TrimEnd(); } ProfileModel.WebDeveloper = profile.WebDeveloper; ProfileModel.Tester = profile.Tester; ProfileModel.MobileDeveloper = profile.MobileDeveloper; ProfileModel.SystemDesign = profile.SystemDesign; ProfileModel.SystemAnalyst = profile.SystemAnalyst; ProfileModel.ProjectManager = profile.ProjectManager; ProfileModel.GameDeveloper = profile.GameDeveloper; ProfileModel.Marketing = profile.Marketing; ProfileModel.OthersJob = profile.OthersJob; return View(ProfileModel); } else if (Session["UserType"].Equals("Employer ")) { int PID = (int)Session["ProfileId"]; System.Diagnostics.Debug.Write("HAVE++1 " + PID); var profileDetail = dbContext.Profiles.FirstOrDefault(p => p.ProId.Equals(PID)); System.Diagnostics.Debug.Write("HAVE++ " + profileDetail.Name); var ProfileModel = new MyApplication.Profile(); ProfileModel.Name = profile.Name; if (ProfileModel.Name == null) { ProfileModel.Name = " "; } else { ProfileModel.Name = profile.Name.TrimEnd(); } ProfileModel.CompanyName = profile.CompanyName; System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name); if (ProfileModel.CompanyName == null) { ProfileModel.CompanyName = " "; } else { ProfileModel.CompanyName = profile.CompanyName.TrimEnd(); } ProfileModel.Address = profile.Address; // System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name); if (ProfileModel.Address == null) { ProfileModel.Address = " "; } else { ProfileModel.Address = profile.Address.TrimEnd(); } ProfileModel.About_Yourself = profile.About_Yourself; // System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name); if (ProfileModel.About_Yourself == null) { ProfileModel.About_Yourself = " "; } else { ProfileModel.About_Yourself = profile.About_Yourself.TrimEnd(); } ProfileModel.Telephone = profile.Telephone; // System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name); if (ProfileModel.Telephone == null) { ProfileModel.Telephone = " "; } else { ProfileModel.Telephone = profile.Telephone.TrimEnd(); } ProfileModel.Fax = profile.Fax; // System.Diagnostics.Debug.Write("HAVE++2 " + ProfileModel.Name); if (ProfileModel.Fax == null) { ProfileModel.Fax = " "; } else { ProfileModel.Fax = profile.Fax.TrimEnd(); } System.Diagnostics.Debug.Write("Right here xxxx" + profile.Name); return View(ProfileModel); } } catch { } return View(); } catch { return RedirectToAction("Index", "Home"); } }
public StaffRepository(MVCEntities context) { this._db = context.Staff; this.context = context; }
public ActionResult showBiddingList() { try { // var disbidList = from user in disbidRepo.GetUsers(). select user; var disbidList = disbidRepo.GetUsers().OrderByDescending(u => u.DispBidId); var bids = new List<MyApplication.DisplayBid>(); if (disbidList.Any()) { foreach (var bid in disbidList) { if (bid.JobId.Equals((int)Session["JobId"])) { ViewBag.JobId = (int)Session["JobId"]; bids.Add(new MyApplication.DisplayBid() { EmployerId = bid.EmployerId, JobId = bid.JobId, UserId = bid.UserId, BidId = bid.BidId, Detail = bid.Detail, Budget = bid.Budget, Name = bid.Name, }); } } } //get employer ID// MVCEntities db = new MVCEntities(); // var employeeId = db.Jobs.FirstOrDefault(j => j.JobId.Equals((int)Session["JobId"])).UserId; //ViewBag.employeeId = employeeId; ////////////////// try { if (Session["UserType"].Equals("Employer ")) { ViewBag.UserType = "Employer "; } } catch { } // return View(); return PartialView("showBiddingList", bids); } catch { return View(); } }