public ActionResult Edit([Bind(Include = "RepairId,RepairDescription,RepairPrice,RepairTitel,MaterialId,StateId")] tbl_Repair tbl_Repair) { if (ModelState.IsValid) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN") || Session["UserRole"].Equals("SUBADMIN")) { ViewBag.OnlineUser = Session["UserName"].ToString(); ViewBag.OnlineUserRole = Session["UserRole"].ToString(); ViewBag.StationName = db.tbl_State.ToList(); db.Entry(tbl_Repair).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } } ViewBag.MaterialId = new SelectList(db.tbl_Material, "MaterialId", "MaterialCode", tbl_Repair.MaterialId); return(View(tbl_Repair)); }
public ActionResult Edit([Bind(Include = "MissiveId,MissiveTitel,MissiveText,MissiveFileUrl,MissiveDate,MissiveNumber,MissiveUserId")] tbl_Missives tbl_Missives, HttpPostedFileBase Fdoc) { if (ModelState.IsValid) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN") || Session["UserRole"].Equals("ADMIN")) { if (Fdoc != null) { var Fi1 = Path.GetExtension(Fdoc.FileName); var Ri1 = Path.Combine(Server.MapPath("~/Documents/Doc/"), string.Format("{0}{1}", tbl_Missives.MissiveId.ToString(), Fi1)); Fdoc.SaveAs(Ri1); tbl_Missives.MissiveFileUrl = string.Format("Documents/Doc/{0}{1}", tbl_Missives.MissiveId.ToString(), Fi1); } db.Entry(tbl_Missives).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } } ViewBag.MissiveUserId = new SelectList(db.tbl_User, "UserId", "UserUserName", tbl_Missives.MissiveUserId); return(View(tbl_Missives)); }
public ActionResult Edit([Bind(Include = "AccidentMid,AccidentId,MaterialId,tedad")] tbl_AccidentM tbl_AccidentM) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN") || Session["UserRole"].Equals("ADMIN") || Session["UserRole"].Equals("SUBADMIN") || Session["UserRole"].Equals("OPRATOR")) { ViewBag.OnlineUser = Session["UserName"].ToString(); ViewBag.OnlineUserRole = Session["UserRole"].ToString(); if (ModelState.IsValid) { db.Entry(tbl_AccidentM).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Edit", "Accident", new { id = tbl_AccidentM.AccidentId })); } } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } ViewBag.AccidentId = new SelectList(db.tbl_Accident, "AccidentId", "AccidentEventLocation", tbl_AccidentM.AccidentId); ViewBag.MaterialId = new SelectList(db.tbl_Material, "MaterialId", "MaterialCode", tbl_AccidentM.MaterialId); return(View(tbl_AccidentM)); }
public ActionResult Edit([Bind(Include = "OrId,OrTel,OrTitel,OrAdress")] tbl_Organizations tbl_Organizations) { if (ModelState.IsValid) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN")) { ViewBag.OnlineUser = Session["UserName"].ToString(); ViewBag.OnlineUserRole = Session["UserRole"].ToString(); db.Entry(tbl_Organizations).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } } return(View(tbl_Organizations)); }
public ActionResult Edit([Bind(Include = "ShiftId,ShiftName,StateId")] tbl_shift tbl_shift) { if (ModelState.IsValid) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN")) { ViewBag.OnlineUser = Session["UserName"].ToString(); ViewBag.OnlineUserRole = Session["UserRole"].ToString(); db.Entry(tbl_shift).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } } ViewBag.StateId = new SelectList(db.tbl_State, "StateId", "StateName", tbl_shift.StateId); return(View(tbl_shift)); }
public ActionResult Edit([Bind(Include = "UserId,UserUserName,UserPassword,EmployeeId,UserRole")] tbl_User tbl_User) { if (ModelState.IsValid) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN") || Session["UserRole"].Equals("SUBADMIN")) { ViewBag.OnlineUser = Session["UserName"].ToString(); ViewBag.OnlineUserRole = Session["UserRole"].ToString(); db.Entry(tbl_User).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } } ViewBag.EmployeeId = new SelectList(db.tbl_Employee, "EmployeeId", "EmployeeCode", tbl_User.EmployeeId); return(View(tbl_User)); }
public ActionResult Edit([Bind(Include = "ShiftRegisterid,ShiftRegisterDec,ShiftRegisterCommandor,ShiftRegisterTimeStart,ShiftRegisterTimeEnd,ShiftRegisterDateStart,ShiftRegisteridDateEnd,ShiftRegisterurl,ShiftRegisterShifId")] tbl_ShiftRegister tbl_ShiftRegister) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN") || Session["UserRole"].Equals("ADMIN") || Session["UserRole"].Equals("SUBADMIN") || Session["UserRole"].Equals("OPRATOR")) { ViewBag.OnlineUser = Session["UserName"].ToString(); ViewBag.OnlineUserRole = Session["UserRole"].ToString(); if (ModelState.IsValid) { db.Entry(tbl_ShiftRegister).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } ViewBag.ShiftRegisterShifId = new SelectList(db.tbl_shift, "ShiftId", "ShiftName", tbl_ShiftRegister.ShiftRegisterShifId); return(View(tbl_ShiftRegister)); }
public ActionResult Edit([Bind(Include = "InjuredID,InjuredName,InjuredLastName,InjuredSex,InjuredType,InjuredTypeinjury,InjuredDescription,InjuredLocation")] tbl_Injured tbl_Injured) { if (ModelState.IsValid) { db.Entry(tbl_Injured).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_Injured)); }
public ActionResult Edit([Bind(Include = "EmployeeId,EmployeeCode,EmployeeName,EmployeeLastName,EmployeePhone,EmployeeAdress,EmployeePicUrl,StateId,EmployeeFName,EmployeeMCode,EmployeeBirthdate,EmployeeSex,EmployeeWork,EmployeeDateRegistered")] tbl_Employee tbl_Employee, HttpPostedFileBase pic) { Random rand = new Random(); int ra; if (ModelState.IsValid) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN") || Session["UserRole"].Equals("SUBADMIN")) { ViewBag.OnlineUser = Session["UserName"].ToString(); ViewBag.OnlineUserRole = Session["UserRole"].ToString(); ra = rand.Next(111111, 999999); while (db.tbl_Employee.FirstOrDefault(f => f.EmployeeId == ra) != null) { ra = rand.Next(111111, 999999); } if (pic != null) { var Fi1 = Path.GetExtension(pic.FileName); var Ri1 = Path.Combine(Server.MapPath("~/Documents/Pic/"), string.Format("{0}{1}", ra.ToString(), Fi1)); pic.SaveAs(Ri1); tbl_Employee.EmployeePicUrl = string.Format("Documents/Pic/{0}{1}", ra.ToString(), Fi1); } else { tbl_Employee.EmployeePicUrl = "no image yet"; } db.Entry(tbl_Employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } } ViewBag.StateId = new SelectList(db.tbl_State, "StateId", "StateName", tbl_Employee.StateId); return(View(tbl_Employee)); }
public ActionResult Edit([Bind(Include = "MaterialId,MaterialCode,MaterialName,MaterialPic,MaterialType,MaterialVahed")] tbl_Material tbl_Material, HttpPostedFileBase Fdoc) { Random rand = new Random(); int ra; if (ModelState.IsValid) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN") || Session["UserRole"].Equals("ADMIN")) { ViewBag.OnlineUser = Session["UserName"].ToString(); ViewBag.OnlineUserRole = Session["UserRole"].ToString(); ra = rand.Next(111111, 999999); while (db.tbl_Material.FirstOrDefault(f => f.MaterialId == ra) != null) { ra = rand.Next(111111, 999999); } if (Fdoc != null) { var Fi1 = Path.GetExtension(Fdoc.FileName); var Ri1 = Path.Combine(Server.MapPath("~/Documents/Pic/"), string.Format("{0}{1}", ra.ToString(), Fi1)); Fdoc.SaveAs(Ri1); tbl_Material.MaterialPic = string.Format("Documents/Pic/{0}{1}", ra.ToString(), Fi1); } else { tbl_Material.MaterialPic = "No Image Yet"; } db.Entry(tbl_Material).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } } return(View(tbl_Material)); }
public ActionResult Edit([Bind(Include = "UsageId,UsageTitel,UsageDescription")] tbl_Usage tbl_Usage) { if (ModelState.IsValid) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN")) { db.Entry(tbl_Usage).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } } return(View(tbl_Usage)); }
public ActionResult Edit([Bind(Include = "AccidentId,AccidentEventLocation,AccidentDescrption,AccidentTime,AccidentDate,AccidentReportUrl,AccidentWid,AccidentTypeId,AccidentZone,AccidentUserId,AccidentUsageId,AccidentTimeStartOperation,AccidentTimeEndOperation,AccidentTimeToClear,AccidentReporter,AccidentReportReciver,AccidentReportType,AccidentSiteFloors,AccidentBuildingType,AccidentBuildingOwner,AccidentBuildingTel,AccidentBuildingTenant,AccidentOtherType,AccidentPreliminaryMeasures,AccidentDescriptionOperation,AccidentDamageDescriptionO,AccidentDamageDescriptionL,AccidentReportProducer,AccidentOperationsCommander,DateAdd,AccidentOperationProblems,AccidentCause")] tbl_Accident tbl_Accident, HttpPostedFileBase pic, int[] OperatingStation, int injured) { if (ModelState.IsValid) { if (Session["OnlineUser"] != null) { if (Session["UserRole"].Equals("SUPERADMIN") || Session["UserRole"].Equals("ADMIN") || Session["UserRole"].Equals("SUBADMIN")) { ViewBag.OnlineUser = Session["UserName"].ToString(); ViewBag.OnlineUserRole = Session["UserRole"].ToString(); db.Entry(tbl_Accident).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Accessdenied", "Home")); } } else { return(RedirectToAction("Login", "Account")); } } ViewBag.AccidentTypeId = db.tbl_AccidentType.ToList(); ViewBag.AccidentUsageId = db.tbl_Usage.ToList(); ViewBag.AccidentWid = db.tbl_weather.ToList(); ViewBag.AccidentUserId = db.tbl_User.ToList(); ViewBag.OpState = db.tbl_State.ToList(); ViewBag.Organization = db.tbl_Organizations.ToList(); ViewBag.Emp = db.tbl_Employee.ToList(); ViewBag.material = db.tbl_Material.ToList(); ViewBag.Cause = db.tbl_Cause.ToList(); return(View(tbl_Accident)); }