public JsonResult DeleteLibrary(int LibraryID) { string jsonString = string.Empty; try { library.LibraryID = LibraryID; actionResult = libraryAction.Library_Delete(library); if (actionResult.IsSuccess) { jsonString = "Success"; } else { jsonString = "Fail"; } } catch (Exception) { jsonString = "-1"; return(Json(jsonString, JsonRequestBehavior.AllowGet)); } return(Json(jsonString, JsonRequestBehavior.AllowGet)); }
public JsonResult Load_MessageMembers(string GroupName) { string jsonString = string.Empty; try { MessageGroups messageGroup = new MessageGroups(); MessageGroupsModel messageGroupModel = new MessageGroupsModel(); List <MessageGroupsModel> messageGroupList = new List <MessageGroupsModel>(); messageGroup.GroupName = GroupName; actionResult = messagesAction.MessageGroups_LoadByGroupName(messageGroup); if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0) { for (int i = 0; i < actionResult.dtResult.Rows.Count; i++) { jsonString += " <option value = " + actionResult.dtResult.Rows[i]["ID"] + " > " + actionResult.dtResult.Rows[i]["FullName"] + " </ option >"; } } } catch (Exception) { jsonString = "-1"; return(Json(jsonString, JsonRequestBehavior.AllowGet)); } return(Json(jsonString, JsonRequestBehavior.AllowGet)); }
public JsonResult Visitor_Filter(string startDate, string endDate) { string jsonString = string.Empty; try { visitor = new BaseLayer.VisitorBase(); visitor.StartDate = startDate; visitor.EndDate = endDate; List <VisitorModel> VisitorList = new List <VisitorModel>(); VisitorModel model = new VisitorModel(); actionResult = visitorAction.Visitor_Filter(visitor); if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0) { for (int i = 0; i < actionResult.dtResult.Rows.Count; i++) { jsonString += "<tr id=" + actionResult.dtResult.Rows[i]["VisitorID"].ToString() + ">"; jsonString += "<td>" + actionResult.dtResult.Rows[i]["VisitorDate"] + "</td><td>" + actionResult.dtResult.Rows[i]["VisitorName"] + "</td><td>" + actionResult.dtResult.Rows[i]["GroupIdentifier"] + "</td><td>" + actionResult.dtResult.Rows[i]["FromHoursMinutes"] + "</td><td>" + actionResult.dtResult.Rows[i]["ToHoursMinutes"] + "</td><td><a href='Index?visitorID=" + actionResult.dtResult.Rows[i]["VisitorID"].ToString() + "' class='btn small btn-info btn-sm btn-icon' title='Edit Visitor'><i class='fa fa-pencil'></i></a> | <a href ='javascript:;' onclick='DeleteVisitor(" + actionResult.dtResult.Rows[i]["VisitorID"].ToString() + ",this);' class='btn small btn-danger btn-sm -icon delete-sm' title='Delete Visitor'><i class='fa fa-trash'></i></a></td>"; jsonString += "</tr>"; } } } catch (Exception) { jsonString = "-1"; return(Json(jsonString, JsonRequestBehavior.AllowGet)); } return(Json(jsonString, JsonRequestBehavior.AllowGet)); }
public JsonResult MessageGroups_Insert(string GroupName, string UserID) { string json = string.Empty; try { if (UserID.Length > 0) { string[] UserIDList = UserID.Split(','); for (int i = 0; i <= UserIDList.Length - 1; i++) { messageGroupBase.GroupName = GroupName; messageGroupBase.UserID = UserIDList[i]; messageGroupBase.U_ID = Convert.ToInt32(UserIDList[i]); actionResult = messagesAction.MessageGroups_Insert(messageGroupBase); } } if (actionResult.IsSuccess) { json = "success"; } else { json = "fail"; } } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(json, JsonRequestBehavior.AllowGet)); }
public JsonResult MessageGroup_DeleteByUserID(string GroupName, string UserID) { string json = string.Empty; try { messageGroupBase.GroupName = GroupName; messageGroupBase.UserID = UserID; messageGroupBase.U_ID = Convert.ToInt32(Session["UserId"]); actionResult = messagesAction.MessageGroup_DeleteByUserID(messageGroupBase); if (actionResult.IsSuccess) { json = "success"; } else { json = "fail"; } } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(json, JsonRequestBehavior.AllowGet)); }
public JsonResult BannedPictures_print(string startDate, string endDate, string datacolumn) { ReportsModel reportModel = new ReportsModel(); string json = string.Empty; List <ReportsModel> reportsList = new List <ReportsModel>(); try { ReportsBase reportsBase = new ReportsBase(); reportsBase.StartDate = startDate; reportsBase.EndDate = endDate; reportsBase.TypeOfBan = datacolumn; ViewBag.datacolumn = datacolumn; actionResult = reportsAction.Banned_Pictures(reportsBase); if (actionResult.IsSuccess) { reportsList = CommonMethods.ConvertTo <ReportsModel>(actionResult.dtResult); } else { json = "fail"; } reportModel.reportsList = reportsList; } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(reportsList, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteMessage(int messageID) { string jsonString = string.Empty; try { messages.MessageID = messageID; actionResult = messagesAction.Messages_Delete(messages); if (actionResult.IsSuccess) { jsonString = "Success"; } else { jsonString = "Fail"; } } catch (Exception) { jsonString = "-1"; return(Json(jsonString, JsonRequestBehavior.AllowGet)); } return(Json(jsonString, JsonRequestBehavior.AllowGet)); }
public ActionResult UserRoles(Roles model) { RoleBase roleBase = new RoleBase(); roleBase.RoleName = model.RoleName; roleBase.ID = model.RoleId; actionResult = adminAction.UserRole_IU(roleBase); if (actionResult.IsSuccess) { int result = Convert.ToInt32(actionResult.dtResult.Rows[0][0]); if (result > 0) { TempData["SuccessMessage"] = "Role " + (model.RoleId > 0 ? "updated" : "saved") + " successfully."; if (model.RoleId == 0) { model.RoleId = result; } } else if (result == -10) { TempData["ErrorMessage"] = "Role name already exists. Please try another role name."; } else { TempData["ErrorMessage"] = "Error in saving role."; } } else { TempData["ErrorMessage"] = "Error in saving role."; } return(RedirectToAction("RolePermissions", new { Id = model.RoleId })); }
public JsonResult DeleteRole(int?Id = 0) { string json = string.Empty; try { RoleBase roleBase = new RoleBase(); roleBase.ID = Convert.ToInt32(Id); actionResult = adminAction.UserRole_DeleteById(roleBase); if (actionResult.IsSuccess) { int result = Convert.ToInt32(actionResult.dtResult.Rows[0][0]); if (result == -10) { json = "-10"; } else { json = "success"; } } else { json = "-1"; } } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(json, JsonRequestBehavior.AllowGet)); }
public JsonResult MoveToPicture(string type, int id, int MediaID) { string json = ""; try { pictureVideoBase.MediaID = MediaID; pictureVideoBase.SubFeatureID = id; pictureVideoBase.PictureType = type; actionResult = mediaAction.AssignToPicture(pictureVideoBase); if (actionResult.IsSuccess) { json = "success"; } else { json = "Fails"; } } catch (Exception ex) { ErrorReporting.WebApplicationError(ex); } return(Json(json, JsonRequestBehavior.AllowGet)); }
public ActionResult ConfirmRegistration(string id) { UserBase userBase = new UserBase(); try { if (id != "") { userBase.UserGuid = id; actionResult = adminAction.VerifyEmailAccount(userBase); if (actionResult.IsSuccess) { DataRow dr = actionResult.dtResult.Rows[0]; if (dr[0].ToString() == "1") { TempData["ErrorMessage"] = "Your account has been verified successfully."; } else if (dr[0].ToString() == "-10") { TempData["ErrorMessage"] = "Your account is not exist in our records."; } } } else { TempData["ErrorMessage"] = "Error occurred.Please try after sometime."; } } catch (Exception ex) { TempData["error"] = "Error in verifying account."; } return(RedirectToAction("Login", "Account")); }
public JsonResult UpdateCropImage(string NewSrc, string MediaID)//string FileType { string json = ""; List <MediaModel> mediaListModel = new List <MediaModel>(); try { pictureVideoBase.MediaID = Convert.ToInt32(MediaID); pictureVideoBase.FilePath = NewSrc; actionResult = mediaAction.CropMediaPicture_U(pictureVideoBase); if (actionResult.IsSuccess) { json = "success"; //mediaListModel = CommonMethods.ConvertTo<MediaModel>(actionResult.dtResult); //Newtonsoft.Json.JsonConvert.SerializeObject(mediaListModel); } else { json = "Fails"; } } catch (Exception ex) { ErrorReporting.WebApplicationError(ex); } return(Json(json, JsonRequestBehavior.AllowGet)); }
public JsonResult AssignPictures(string MediaType, string Type, int ID = 0, int IncidentID = 0, int MediaID = 0, int QuestionID = 0, int Observation = 0)//string FileType { string json = ""; List <MediaModel> mediaListModel = new List <MediaModel>(); try { commonPictureBase.ID = ID; commonPictureBase.IncidentID = IncidentID; commonPictureBase.MediaID = MediaID; commonPictureBase.MediaType = MediaType; commonPictureBase.QuestionID = QuestionID; commonPictureBase.Type = Type; commonPictureBase.Observation = Observation; actionResult = mediaAction.SubjectEmployeePicture_Insert(commonPictureBase); if (actionResult.IsSuccess) { json = "success"; //mediaListModel = CommonMethods.ConvertTo<MediaModel>(actionResult.dtResult); //Newtonsoft.Json.JsonConvert.SerializeObject(mediaListModel); } else { json = "Fails"; } } catch (Exception ex) { ErrorReporting.WebApplicationError(ex); } return(Json(json, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(LibraryModel model, HttpPostedFileBase pdfFile) { bool exists = System.IO.Directory.Exists(Server.MapPath("~/LibraryPDFFiles/")); if (!exists) { System.IO.Directory.CreateDirectory(Server.MapPath("~/LibraryPDFFiles/")); } string fileName, fileExistence = string.Empty; string destinationPath = string.Empty; fileName = Path.GetFileName(pdfFile.FileName); fileExistence = Path.GetExtension(pdfFile.FileName); destinationPath = Path.Combine(Server.MapPath("~/LibraryPDFFiles/"), model.LibraryName + fileExistence); model.FileExistence = Path.GetExtension(pdfFile.FileName); pdfFile.SaveAs(destinationPath); library.FileExistence = fileExistence; library.FilePath = destinationPath; library.FileTypeId = model.FileTypeId; library.LibraryID = model.LibraryID; library.LibraryName = model.LibraryName; actionResult = libraryAction.Library_AddEdit(library); if (actionResult.IsSuccess) { TempData["SuccessMessage"] = " Library Details Successfully Saved !!"; } else { TempData["ErrorMessage"] = "Error in Request !!"; } return(RedirectToAction("Index")); }
public JsonResult EmployeeVariance_print(string type, string startDate, string endDate) { ReportsStatisticsModel reportsModel = new ReportsStatisticsModel(); string json = string.Empty; List <ReportsStatisticsModel> reportsList = new List <ReportsStatisticsModel>(); try { ReportsStatisticsBase reportsBase = new ReportsStatisticsBase(); reportsBase.Type = type; reportsBase.StartDate = startDate; reportsBase.EndDate = endDate; actionResult = reportsAction.EmployeeVariance_print(reportsBase); if (actionResult.IsSuccess) { reportsList = CommonMethods.ConvertTo <ReportsStatisticsModel>(actionResult.dtResult); } else { json = "fail"; } reportsModel.reportsStatisticsList = reportsList; } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(reportsList, JsonRequestBehavior.AllowGet)); }
public ActionResult CheckDuplicateUser(string UserName) { string json = string.Empty; try { //check for duplicate username actionResult = adminAction.CheckDuplicateUser(UserName, null); if (actionResult.IsSuccess) { TempData["ErrorMessage"] = "User name is duplicate."; json = "-1"; } else { json = "success"; } } catch (Exception ex) { json = "-10;" + ex.Message; ErrorReporting.WebApplicationError(ex); } return(Json(json, JsonRequestBehavior.AllowGet)); }
public JsonResult GetLocationData(string type, string startDate, string endDate) { string json = string.Empty; ReportsStatisticsModel reportsModel = new ReportsStatisticsModel(); List <ReportsStatisticsModel> reportsList = new List <ReportsStatisticsModel>(); ReportsStatisticsBase reportsBase = new ReportsStatisticsBase(); reportsBase.Type = type; reportsBase.StartDate = startDate; reportsBase.EndDate = endDate; actionResult = reportsAction.LocationCount_Graph(reportsBase); if (actionResult.IsSuccess) { json += "{\"LocationCount\":[ "; foreach (DataRow dr in actionResult.dtResult.Rows) { json += "{\"results\":\"" + dr["results"].ToString() + "\",\"ShortLocation\":\"" + dr["Location"].ToString() + "\"},"; } json = json.TrimEnd(',') + "]}"; } return(Json(json, JsonRequestBehavior.AllowGet)); }
public static string[] permission(string menu, int userId) { AdminAction adminAction = new AdminAction(); CIMS.BaseLayer.ActionResult actionResult = new CIMS.BaseLayer.ActionResult(); List <Menus> PermissionList = new List <Menus>(); RoleBase roleBase = new RoleBase(); roleBase.UserId = Convert.ToInt32(userId); roleBase.MenuName = menu; actionResult = adminAction.Menus_LoadByRoleId(roleBase); if (actionResult.IsSuccess) { var permission = CommonMethods.ConvertTo <Menus>(actionResult.dtResult); if (permission[0].PermissionType > 0) { string[] result = { "true", permission[0].PermissionType.ToString() }; return(result); } } string[] failResult = { "false", "0" }; return(failResult); }
public ActionResult MessageReceive(int?messageID = 0) { MessagesModel model = new MessagesModel(); List <MessagesModel> MessagesList = new List <MessagesModel>(); messagesGroups.U_ID = Convert.ToInt32(Session["UserId"]); actionResult = messagesAction.Message_Received(messagesGroups); if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0) { MessagesList = (from DataRow row in actionResult.dtResult.Rows select new MessagesModel { MessageID = row["MessageID"] != DBNull.Value ? Convert.ToInt32(row["MessageID"]) : 0, DateSent = row["DateSent"] != DBNull.Value ? row["DateSent"].ToString() : "", FirstName = row["FirstName"] != DBNull.Value ? row["FirstName"].ToString() : "", LastName = row["LastName"] != DBNull.Value ? row["LastName"].ToString() : "", Description = row["Description"] != DBNull.Value ? row["Description"].ToString() : "", MessageText = row["MessageText"] != DBNull.Value ? row["MessageText"].ToString() : "", Draft = row["Draft"] != DBNull.Value ? row["Draft"].ToString() : "", SentToSelf = row["SentToSelf"] != DBNull.Value ? row["SentToSelf"].ToString() : "" }).ToList(); } model.MessagesList = MessagesList; return(View(model)); }
public ActionResult Index(EquipmentModel model) { equipment.userID = Convert.ToInt32(Session["UserId"]); equipment.ProblemType = model.ProblemType; equipment.Problem = model.Problem; equipment.Solution = model.Solution; equipment.StatusTime = model.StatusTime; equipment.CompletedTime = model.CompletedTime; equipment.EquipNumber = model.EquipNumber; equipment.Replacement = model.Replacement; equipment.Details = model.Details; equipment.problemID = model.problemID; equipment.Corrected = model.Corrected; actionResult = equipmentAction.EquipmentProblems_AddEdit(equipment); if (actionResult.IsSuccess) { TempData["SuccessMessage"] = "Successfully Saved !!"; } else { TempData["ErrorMessage"] = "Error in Request !!"; } return(RedirectToAction("Index")); }
public JsonResult ShowRecipients(int messageID) { string jsonString = string.Empty; try { messages.MessageID = messageID; actionResult = messagesAction.MessageRecipients_LoadByMessageID(messages); if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0) { for (int i = 0; i < actionResult.dtResult.Rows.Count; i++) { jsonString = "<tr><td>" + actionResult.dtResult.Rows[i]["FirstName"].ToString() + " " + actionResult.dtResult.Rows[i]["LastName"].ToString() + "</td><tr>"; } } } catch (Exception) { jsonString = "-1"; return(Json(jsonString, JsonRequestBehavior.AllowGet)); } return(Json(jsonString, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteEquipment(int problemID) { string jsonString = string.Empty; try { equipment.problemID = problemID; actionResult = equipmentAction.EquipmentProblems_Delete(equipment); if (actionResult.IsSuccess) { jsonString = "Success"; } else { jsonString = "Fail"; } } catch (Exception) { jsonString = "-1"; return(Json(jsonString, JsonRequestBehavior.AllowGet)); } return(Json(jsonString, JsonRequestBehavior.AllowGet)); }
public JsonResult MessageGroups_AddEdit(string GroupName, string oldGroupName) { string json = string.Empty; try { messageGroupBase.GroupName = GroupName; messageGroupBase.OldGroupName = oldGroupName; actionResult = messagesAction.MessageGroups_AddEdit(messageGroupBase); if (actionResult.IsSuccess) { json = "success"; } else { json = "fail"; } } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(json, JsonRequestBehavior.AllowGet)); }
public JsonResult WatchList_Print(string watchName) { ReportsWatchListModel reportWatchListModel = new ReportsWatchListModel(); string json = string.Empty; List <ReportsModel> reportsList = new List <ReportsModel>(); try { ReportsWatchListBase reportsWatchListBase = new ReportsWatchListBase(); reportsWatchListBase.WatchName = watchName; actionResult = reportsAction.WatchList_Print(reportsWatchListBase); if (actionResult.IsSuccess) { reportsList = CommonMethods.ConvertTo <ReportsModel>(actionResult.dtResult); } else { json = "fail"; } reportWatchListModel.reportsList = reportsList; } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(reportsList, JsonRequestBehavior.AllowGet)); }
public JsonResult LoadMessageDistribution() { string jsonString = string.Empty; try { MessageGroups messageGroup = new MessageGroups(); MessageGroupsModel messageGroupModel = new MessageGroupsModel(); List <MessageGroupsModel> messageGroupList = new List <MessageGroupsModel>(); actionResult = messagesAction.MessageGroups_LoadDistinctGroupName(); //messageGroupList = (from DataRow row in actionResult.dtResult.Rows // select new MessageGroupsModel // { // GroupName = row["GroupName"] != DBNull.Value ? row["GroupName"].ToString() : "", // }).ToList(); //messageGroupModel.MessageGroupsList = messageGroupList; if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0) { for (int i = 0; i < actionResult.dtResult.Rows.Count; i++) { jsonString += " <option value = " + actionResult.dtResult.Rows[i]["GroupName"] + " onclick = \"Fillgroup('" + actionResult.dtResult.Rows[i]["GroupName"] + "'); \" > " + actionResult.dtResult.Rows[i]["GroupName"] + " </ option >"; } } } catch (Exception) { jsonString = "-1"; return(Json(jsonString, JsonRequestBehavior.AllowGet)); } return(Json(jsonString, JsonRequestBehavior.AllowGet)); }
public JsonResult LicenseExpiry_print(string startDate, string endDate, string sortValue) { ReportsModel reportModel = new ReportsModel(); string json = string.Empty; List <EmployeeModel> employeeList = new List <EmployeeModel>(); try { ReportsBase reportsBase = new ReportsBase(); reportsBase.StartDate = startDate; reportsBase.EndDate = endDate; reportsBase.SortOrder = sortValue; actionResult = reportsAction.LicenseExpiry_print(reportsBase); if (actionResult.IsSuccess) { employeeList = CommonMethods.ConvertTo <EmployeeModel>(actionResult.dtResult); } else { json = "fail"; } reportModel.EmployeeList = employeeList; } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(employeeList, JsonRequestBehavior.AllowGet)); }
public static string[] permission(string menu, int userId) { AccountAction accountAction = new AccountAction(); CIMS.BaseLayer.ActionResult actionResult = new CIMS.BaseLayer.ActionResult(); UserBase userBase = new UserBase(); string userRoles = ""; userBase.ID = Convert.ToInt32(userId); actionResult = accountAction.Customer_LoadById(); if (actionResult.IsSuccess) { DataRow dr = actionResult.dtResult.Rows[0]; var menuNames = userRoles = dr["MenuNames"] != DBNull.Value ? dr["MenuNames"].ToString() : ""; string[] blankArray = { }; var menuArray = (menuNames != null? menuNames.Split(','):blankArray); if (menuArray.Contains(menu)) { string[] result = { "true", "15" }; return(result); } } string[] failResult = { "false", "0" }; return(failResult); }
public JsonResult PaceAudit_print(string Game, string startDate, string endDate, string SortOrder) { ReportsModel reportModel = new ReportsModel(); string json = string.Empty; List <ReportsModel> reportsList = new List <ReportsModel>(); try { ReportsBase reportsBase = new ReportsBase(); reportsBase.Game = Game; reportsBase.StartDate = startDate; reportsBase.EndDate = endDate; reportsBase.SortOrder = SortOrder; actionResult = reportsAction.PaceAudit_print(reportsBase); if (actionResult.IsSuccess) { reportsList = CommonMethods.ConvertTo <ReportsModel>(actionResult.dtResult); } else { json = "fail"; } reportModel.reportsList = reportsList; } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(reportsList, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteVisitor(int visitorID) { string jsonString = string.Empty; try { visitor.VisitorID = visitorID; actionResult = visitorAction.Visitor_Delete(visitor); if (actionResult.IsSuccess) { jsonString = "Success"; } else { jsonString = "Fail"; } } catch (Exception) { jsonString = "-1"; return(Json(jsonString, JsonRequestBehavior.AllowGet)); } return(Json(jsonString, JsonRequestBehavior.AllowGet)); }
public JsonResult ImageCount() { string jsonString = string.Empty; try { actionResult = accountAction.ImageCount(); if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0) { for (int i = 0; i < actionResult.dtResult.Rows.Count; i++) { jsonString += "<tr> <th>Total Images in CIMS :</th> <td>" + actionResult.dtResult.Rows[i]["TotalImages"] + "</td></tr>"; jsonString += "<tr> <th>Subject Images :</th> <td>" + actionResult.dtResult.Rows[i]["SubjectImages"] + "</td></tr>"; jsonString += "<tr> <th>Encoded Images :</th> <td>" + actionResult.dtResult.Rows[i]["EncodedImages"] + "</td></tr>"; jsonString += "<tr> <th>Rejected Images :</th> <td>" + actionResult.dtResult.Rows[i]["RejectedImages"] + "</td></tr>"; jsonString += "<tr> <th>Employee Images :</th> <td>" + actionResult.dtResult.Rows[i]["EmployeeImages"] + "</td></tr>"; jsonString += "<tr> <th>Images Not Encoded :</th> <td>" + actionResult.dtResult.Rows[i]["NotEncodedImages"] + "</td></tr>"; } } } catch (Exception) { jsonString = "-1"; return(Json(jsonString, JsonRequestBehavior.AllowGet)); } return(Json(jsonString, JsonRequestBehavior.AllowGet)); }