public ActionResult EventsEdit(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var evnt = dataQueryService.GetEvent(id, new Guid(Session["UserTicket"].ToString())); var departments = dataQueryService.GetAllDeansOffices(new Guid(Session["UserTicket"].ToString())); // tu get deparmen var model = new EventsModel { departmentsList = departments.Select(d => new SelectListItem { Text = d.Department.Name, Value = d.Id.ToString() }) }; model.Id = evnt.Id; model.content = evnt.Content; model.title = evnt.Title; model.date = DateTime.Parse(evnt.Date); model.notificationDate = DateTime.Parse(evnt.NotificationDate); model.selectedDepartmentId = evnt.Department.Id; model.UserId = evnt.UserId; return(View(model)); } return(Redirect("~/Login/Login")); }
public ActionResult EventsDelete(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); EventsModel model = new EventsModel(); var evnt = dataQueryService.GetEvent(id, new Guid(Session["UserTicket"].ToString())); if (evnt != null) { model.Id = evnt.Id; model.date = DateTime.Parse(evnt.Date); model.notificationDate = DateTime.Parse(evnt.NotificationDate); model.content = evnt.Content; model.title = evnt.Title; model.departments = evnt.Department; model.UserId = evnt.UserId; return(View(model)); } return(View(model)); } return(Redirect("~/Login/Login")); }
public ActionResult MessagesEdit(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var msg = dataQueryService.GetMessage(id, new Guid(Session["UserTicket"].ToString())); var departments = dataQueryService.GetAllDeansOffices(new Guid(Session["UserTicket"].ToString())); // tu get deparmen var model = new MessagesModel { departmentsList = departments.Select(d => new SelectListItem { Text = d.Department.Name, Value = d.Id.ToString() }) }; model.Id = msg.Id; model.content = msg.Content; model.title = msg.Title; model.important = msg.Important; model.selectedDepartmentId = msg.Department.Id; model.UserId = msg.UserId; return(View(model)); } return(Redirect("~/Login/Login")); }
public ActionResult UsersEdit(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var user = dataQueryService.GetUser(id, new Guid(Session["UserTicket"].ToString())); var units = dataQueryService.GetUnits(new Guid(Session["UserTicket"].ToString())); var model = new UserModels { unitList = units.Select(u => new SelectListItem { Text = u.Name, Value = u.Id.ToString() }) }; model.id = user.Id; model.name = user.Name; model.surname = user.Surname; model.Login = user.Login; model.isAdmin = user.IsAdmin; model.selectedUnitId = user.Unit.Id; return(View(model)); } return(Redirect("~/Login/Login")); }
public ActionResult DeansOfficesEdit(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var DeansOff = dataQueryService.GetDeansOfficeInfo(id, new Guid(Session["UserTicket"].ToString())); var departments = dataQueryService.GetAllDeansOffices(new Guid(Session["UserTicket"].ToString())); var model = new DeansOfficesModel { departmentsList = departments.Select(d => new SelectListItem { Text = d.Department.Name, Value = d.Id.ToString() }) }; if (DeansOff != null) { model.Id = DeansOff.Id; model.AdditionalInfo = DeansOff.AdditionalInfo; model.Address = DeansOff.Address; model.Department = DeansOff.Department; model.OpeningHours = DeansOff.OpeningHours; model.UserId = DeansOff.UserId; model.selectedDepartmentId = DeansOff.Department.Id; return(View(model)); } return(Redirect("~/DeansOffices/DeansOffices")); } return(Redirect("~/Login/Login")); }
public void editUser(UserModels model, Guid ticket) { DataCommandService.IDataCommandService dataCommandService = new DataCommandService.DataCommandServiceClient(); DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var unit = dataQueryService.GetUnit(model.selectedUnitId, ticket); if (model.Password != null) { if (model.Password == model.repeatPassword) { DataCommandService.UserInfo user = new DataCommandService.UserInfo(); user.Id = model.id; user.Name = model.name; user.Surname = model.surname; user.Login = model.Login; user.IsAdmin = model.isAdmin; user.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(model.Password, "SHA1"); user.Unit = unitInfoConventer(unit); try { dataCommandService.AdminEditUsers(user, ticket); } catch (Exception ex) { } } } else { DataCommandService.UserEdit user = new DataCommandService.UserEdit(); user.Id = model.id; user.Name = model.name; user.Surname = model.surname; user.IsAdmin = model.isAdmin; user.Unit = unitInfoConventer(unit); try { dataCommandService.EditUsers(user, ticket); } catch (Exception ex) { } } }
public ActionResult UnitsEdit(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var unit = dataQueryService.GetUnit(id, new Guid(Session["UserTicket"].ToString())); UnitsModel model = new UnitsModel(); model.Id = unit.Id; model.Name = unit.Name; model.Description = unit.Description; return(View(model)); } return(Redirect("~/Login/Login")); }
public ActionResult EventsAdd() { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var departments = dataQueryService.GetAllDeansOffices(new Guid(Session["UserTicket"].ToString())); // tu get deparmen var model = new EventsModel { departmentsList = departments.Select(d => new SelectListItem { Text = d.Department.Name, Value = d.Id.ToString() }) }; return(View(model)); } return(Redirect("~/Login/Login")); }
public ActionResult UsersAdd() { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var units = dataQueryService.GetUnits(new Guid(Session["UserTicket"].ToString())); var userAdd = new UserModels { unitList = units.Select(u => new SelectListItem { Text = u.Name, Value = u.Id.ToString() }) }; return(View(userAdd)); } return(Redirect("~/Login/Login")); }
public ActionResult LibrariesEdit(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var library = dataQueryService.GetLibrary(id, new Guid(Session["UserTicket"].ToString())); LibrariesModel model = new LibrariesModel(); model.Id = library.Id; model.AdditionalInfo = library.AdditionalInfo; model.Address = library.Address; model.Name = library.Name; model.OpeningHours = library.OpeningHours; model.UserId = model.UserId; return(View(model)); } return(Redirect("~/Login/Login")); }
public void editMessage(MessagesModel model, Guid ticket) { DataCommandService.IDataCommandService dataCommandService = new DataCommandService.DataCommandServiceClient(); DataCommandService.MessageInfo message = new DataCommandService.MessageInfo(); DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var department = dataQueryService.GetDepartment(model.selectedDepartmentId, ticket); message.Id = model.Id; message.Title = model.title; message.Content = model.content; message.Important = model.important; message.UserId = model.UserId; message.Department = departInfoConventer(department); try { dataCommandService.EditMessages(message, ticket); } catch (Exception ex) { } }
public void editDeanOffice(DeansOfficesModel model, Guid ticket) { DataCommandService.IDataCommandService dataCommandService = new DataCommandService.DataCommandServiceClient(); DataCommandService.DeansOfficeInfo deansOffice = new DataCommandService.DeansOfficeInfo(); DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var department = dataQueryService.GetDepartment(model.selectedDepartmentId, ticket); deansOffice.Id = model.Id; deansOffice.AdditionalInfo = model.AdditionalInfo; deansOffice.Address = model.Address; deansOffice.OpeningHours = model.OpeningHours; deansOffice.UserId = model.UserId; deansOffice.Department = departInfoConventer(department); try { dataCommandService.EditDeansOffices(deansOffice, ticket); } catch (Exception ex) { } }
public void editEvent(EventsModel model, Guid ticket) { DataCommandService.IDataCommandService dataCommandService = new DataCommandService.DataCommandServiceClient(); DataCommandService.EventInfo evnt = new DataCommandService.EventInfo(); DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var department = dataQueryService.GetDepartment(model.selectedDepartmentId, ticket); evnt.Title = model.title; evnt.Content = model.content; evnt.Date = model.date.ToString(); evnt.NotificationDate = model.notificationDate.ToString(); evnt.UserId = model.UserId; evnt.Id = model.Id; evnt.Department = departInfoConventer(department); try { dataCommandService.EditEvents(evnt, ticket); } catch (Exception ex) { } }
public ActionResult MessagesDelete(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); MessagesModel model = new MessagesModel(); var message = dataQueryService.GetMessage(id, new Guid(Session["UserTicket"].ToString())); if (message != null) { model.Id = message.Id; model.content = message.Content; model.title = message.Title; model.departments = message.Department; model.important = message.Important; model.UserId = message.UserId; return(View(model)); } return(View(model)); } return(Redirect("~/Login/Login")); }
public ActionResult DeansOfficesDelete(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); DeansOfficesModel model = new DeansOfficesModel(); var DeansOff = dataQueryService.GetDeansOfficeInfo(id, new Guid(Session["UserTicket"].ToString())); if (DeansOff != null) { model.Id = DeansOff.Id; model.AdditionalInfo = DeansOff.AdditionalInfo; model.Address = DeansOff.Address; model.Department = DeansOff.Department; model.OpeningHours = DeansOff.OpeningHours; model.UserId = DeansOff.UserId; return(View(model)); } return(View(model)); } return(Redirect("~/Login/Login")); }