//data: { 'Id': item.EMP_EmployeeID, 'Assesment': item.Assesment, 'Name': item.EmployeeName, 'Image': item.EMP_Photo, 'JobTitle': item.JBT_JobTitle }, public ActionResult userEvaluationView(string Id, string Assesment, string Name, string Image, string JobTitle) { eTracLoginModel ObjLoginModel = null; string Employee_Id = string.Empty; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } List <GWCQUestionModel> ListQuestions = new List <GWCQUestionModel>(); try { Employee_Id = Cryptography.GetDecryptedData(Id, true); } catch (Exception e) { Employee_Id = Id; } ListQuestions = _GlobalAdminManager.GetGWCQuestions(Employee_Id, Assesment == "30"?"31":Assesment == "60"?"61":"91"); ViewData["employeeInfo"] = new GWCQUestionModel() { EmployeeName = Name, AssessmentType = Assesment, Image = Image, JobTitle = JobTitle }; return(PartialView("userEvaluationView", ListQuestions)); }
public ActionResult userExpectationsView(string Id, string Assesment, string FinYear, string FinQuarter) { eTracLoginModel ObjLoginModel = null; string Employee_Id = string.Empty; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } List <GWCQUestionModel> ListQuestions = new List <GWCQUestionModel>(); try { Employee_Id = Cryptography.GetDecryptedData(Id, true); } catch (Exception e) { Employee_Id = Id; } ListQuestions = _GlobalAdminManager.GetGWCQuestions(Employee_Id, Assesment); foreach (var item in ListQuestions) { item.EEL_FinencialYear = FinYear; item.EEL_FinQuarter = FinQuarter; item.AssessmentType = Assesment; } return(PartialView("userExpectationsView", ListQuestions)); }
public ActionResult OperationDashboard() { eTracLoginModel ObjLoginModel = null; long Totalrecords = 0; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } //#region WO //UserType _UserType = (WorkOrderEMS.Helper.UserType)ObjLoginModel.UserRoleId; //if (_UserType == UserType.Administrator) // ViewBag.Location = _ICommonMethod.GetLocationByAdminId(ObjLoginModel.UserId); //else if (_UserType == UserType.Manager) // ViewBag.Location = _ICommonMethod.GetLocationByManagerId(ObjLoginModel.UserId); //else //ViewBag.Location = _ICommonMethod.GetAllLocation(); //ViewBag.AssignToUserWO = _GlobalAdminManager.GetLocationEmployeeWO(ObjLoginModel.LocationID); //ViewBag.AssignToUser = _GlobalAdminManager.GetLocationEmployee(ObjLoginModel.LocationID); //ViewBag.Asset = _ICommonMethod.GetAssetList(ObjLoginModel.LocationID); //ViewBag.GetAssetListWO = _ICommonMethod.GetAssetListWO(ObjLoginModel.LocationID); //ViewBag.UpdateMode = false; //ViewBag.PriorityLevel = _ICommonMethod.GetGlobalCodeData("WORKPRIORITY"); //ViewBag.WorkRequestType = _ICommonMethod.GetGlobalCodeData("WORKREQUESTTYPE"); //ViewBag.WorkRequestProjectTypeID = _ICommonMethod.GetGlobalCodeData("WORKREQUESTPROJECTTYPE"); //ViewBag.FacilityRequest = _ICommonMethod.GetGlobalCodeData("FACILITYREQUESTTYPE"); //ViewBag.StateId = _ICommonMethod.GetStateByCountryId(1); //#endregion WO return(PartialView("_OperationDashboard")); }
public void ProcessRequest(HttpContext context) { int ProjectID = 0; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); System.Collections.Specialized.NameValueCollection forms = context.Request.Form; HttpRequest request = context.Request; HttpResponse response = context.Response; string strOperation = forms.Get("oper"); string _search = request["_search"]; string textSearch = request["txtSearch"] ?? ""; int? numberOfRows = Convert.ToInt32(request["rows"]); int? pageIndex = Convert.ToInt32(request["page"]); string sortColumnName = request["sidx"]; string sortOrderBy = request["sord"]; if (Convert.ToInt32(request["id"]) != 0) { long?id = Convert.ToInt32(request["id"]); //obj_StaffUserBusiness.Deleteuser(id); } ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int)); var ProjectList = _GlobalAdminManager.GetAllProject(ProjectID, "GetAllProject", pageIndex, numberOfRows, sortColumnName, sortOrderBy, textSearch, paramTotalRecords); string output = BuildJQGridResults(ProjectList, Convert.ToInt32(numberOfRows), Convert.ToInt32(pageIndex), Convert.ToInt32(paramTotalRecords.Value)); response.Write(output); }
public void ProcessRequest(HttpContext context) { int?ProjectID = 0, UserID = 0; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); System.Collections.Specialized.NameValueCollection forms = context.Request.Form; HttpRequest request = context.Request; HttpResponse response = context.Response; string strOperation = forms.Get("oper"); string _search = request["_search"]; string textSearch = request["txtSearch"] ?? ""; int? numberOfRows = Convert.ToInt32(request["rows"]); int? pageIndex = Convert.ToInt32(request["page"]); string sortColumnName = request["sidx"]; string sortOrderBy = request["sord"]; string filter = request["filter"]; if (request["UserID"] != "") { UserID = Convert.ToInt32(request["UserID"]); //obj_StaffUserBusiness.Deleteuser(id); } if (request["UserID"] != "") { UserID = Convert.ToInt32(request["UserID"]); //obj_StaffUserBusiness.Deleteuser(id); } DateTime StartDate = DateTime.UtcNow; DateTime EndDate = DateTime.UtcNow; eTracLoginModel ObjLoginModel = null; long iUserID = 0; if (context.Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(context.Session["eTrac"]); iUserID = ObjLoginModel.UserId; } long LocationID = Convert.ToInt64(context.Session["eTrac_SelectedDasboardLocationID"]); ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int)); var WorkRequestList = _GlobalAdminManager.GetAllWorkRequestAssignment(ProjectID, UserID, "GetWorkOrderWeekHistory", pageIndex, numberOfRows, sortColumnName, sortOrderBy, textSearch, LocationID, iUserID, StartDate, EndDate, filter, "", paramTotalRecords); if (WorkRequestList.Count() > 0) { string output = BuildJQGridResults(WorkRequestList, Convert.ToInt32(numberOfRows), Convert.ToInt32(pageIndex), Convert.ToInt32(paramTotalRecords.Value)); response.Write(output); } else { JQGridResults result = new JQGridResults(); List <JQGridRow> rows = new List <JQGridRow>(); result.rows = rows.ToArray(); result.page = 0; result.total = 0; result.records = 0; response.Write(new JavaScriptSerializer().Serialize(result)); } }
public ActionResult ePeopleDashboard() { eTracLoginModel ObjLoginModel = null; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } return(PartialView("_ePeopleDashboard")); }
public ActionResult HiringOnBoardingDashboard() { eTracLoginModel ObjLoginModel = null; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } return(PartialView("~/Views/NewAdmin/ePeople/_HiringOnBoardingDashboard.cshtml")); }
public ActionResult PerformanceManagementGrid() { eTracLoginModel ObjLoginModel = null; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } return(PartialView("_306090Grid")); }
public ActionResult OperationReports() { eTracLoginModel ObjLoginModel = null; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } return(PartialView("~/Views/NewAdmin/_Reports.cshtml")); }
public ActionResult EMaintananceDashboard() { eTracLoginModel ObjLoginModel = null; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } return(PartialView("~/Views/NewAdmin/WorkOrderView/_WorkOrderDashboard.cshtml")); }
public ActionResult DisplayLocationData(int LocationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, String sidx = null, string txtSearch = null) { eTracLoginModel ObjLoginModel = null; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); if (LocationId == null) { LocationId = Convert.ToInt32(ObjLoginModel.LocationID); } } try { sord = string.IsNullOrEmpty(sord) ? "desc" : sord; sidx = string.IsNullOrEmpty(sidx) ? "LocationId" : sidx; var obj_Common_B = new Common_B(); ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int)); var data = _GlobalAdminManager.LocationDetailByLocationID(LocationId); if (data.Count() > 0) { var ListLocationModel = new ListLocationModel(); var serivces = obj_Common_B.GetLocationServicesByLocationID(LocationId, 0); foreach (var locList in data) { //var id = Cryptography.GetEncryptedData(locList.LocationId.ToString(), true); ListLocationModel.LocationName = locList.LocationName; ListLocationModel.Address = locList.Address1 + "," + locList.Address2; ListLocationModel.City = locList.City; ListLocationModel.State = locList.LocationState; ListLocationModel.Country = locList.LocationCountry; ListLocationModel.Mobile = locList.PhoneNo + " / " + locList.Mobile; ListLocationModel.Description = locList.Description; ListLocationModel.ZipCode = locList.ZipCode; ListLocationModel.LocationSubTypeDesc = locList.LocationSubTypeDesc; //ListLocationModel.LocationCode = locList.Loc; ListLocationModel.LocationServices = serivces; } details.ListLocationModel = ListLocationModel; } } catch (Exception ex) { } return(View(details)); }
public JsonResult GetWorkOrderList(long LocationId, long workRequestProjectId, string filterwrtype, string filterqrc, string filter) { eTracLoginModel ObjLoginModel = null; var details = new List <WorkRequestAssignmentModelList>(); long UserId = 0, RequestedBy = 0; int? rows = 20; int?page = 1; int? TotalRecords = 10; string sord = null; String sidx = null; string txtSearch = ""; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); UserId = ObjLoginModel.UserId; if (LocationId == 0) { LocationId = Convert.ToInt32(ObjLoginModel.LocationID); } } sord = string.IsNullOrEmpty(sord) ? "desc" : sord; sidx = string.IsNullOrEmpty(sidx) ? "CreatedDate" : sidx; DateTime StartDate = DateTime.UtcNow; DateTime EndDate = DateTime.UtcNow; var obj_Common_B = new Common_B(); ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int)); var data = _GlobalAdminManager.GetAllWorkRequestAssignmentList(workRequestProjectId, RequestedBy, "GetAllWorkRequestAssignment", page, rows, sidx, sord, txtSearch, LocationId, UserId, StartDate, EndDate, (filter == "All" ? "" : filter), (filterqrc == "All" ? "" : filterqrc), (filterwrtype == "All" ? "" : filterwrtype), paramTotalRecords); if (data.Count() > 0) { foreach (var item in data) { item.id = Cryptography.GetEncryptedData(item.WorkRequestAssignmentID.ToString(), true); item.QRCType = String.IsNullOrEmpty(item.QRCType) ? ((item.eFleetVehicleID != null && item.eFleetVehicleID != "" ? "Shuttle Bus" : "N/A")) : item.QRCType + " (" + item.QRCodeID + ")"; item.FacilityRequestType = (item.FacilityRequestType == null || item.FacilityRequestType.TrimWhiteSpace() == "" || item.FacilityRequestType.Trim() == "") ? "N/A" : item.FacilityRequestType; item.ProfileImage = item.ProfileImage == null ? HostingPrefix + ConstantImages.Replace("~", "") + "no-profile-pic.jpg" : HostingPrefix + ProfilePicPath.Replace("~", "") + item.ProfileImage; item.AssignedWorkOrderImage = item.AssignedWorkOrderImage == null ? HostingPrefix + ConstantImages.Replace("~", "") + "no-asset-pic.png" : HostingPrefix + WorkRequestImagepath.Replace("~", "") + item.AssignedWorkOrderImage; details.Add(item); } return(Json(details, JsonRequestBehavior.AllowGet)); } else { return(Json(details, JsonRequestBehavior.AllowGet)); } }
public void ProcessRequest(HttpContext context) { try { int LocationID = 0; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); System.Collections.Specialized.NameValueCollection forms = context.Request.Form; HttpRequest request = context.Request; HttpResponse response = context.Response; string strOperation = forms.Get("oper"); string _search = request["_search"]; string textSearch = request["txtSearch"] ?? ""; int? numberOfRows = Convert.ToInt32(request["rows"]); int? pageIndex = Convert.ToInt32(request["page"]); string sortColumnName = request["sidx"]; string sortOrderBy = request["sord"]; if (Convert.ToInt32(request["id"]) != 0) { long?id = Convert.ToInt32(request["id"]); //obj_StaffUserBusiness.Deleteuser(id); } ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int)); var LocationList = _GlobalAdminManager.GetAllLocationList(LocationID, "GetAllLocation", pageIndex, numberOfRows, sortColumnName, sortOrderBy, textSearch, paramTotalRecords); if (LocationList.Count() > 0) { string output = BuildJQGridResults(LocationList, Convert.ToInt32(numberOfRows), Convert.ToInt32(pageIndex), Convert.ToInt32(paramTotalRecords.Value)); response.Write(output); } else { JQGridResults result = new JQGridResults(); List <JQGridRow> rows = new List <JQGridRow>(); result.rows = rows.ToArray(); result.page = 0; result.total = 0; result.records = 0; response.Write(new JavaScriptSerializer().Serialize(result)); } } catch (Exception ex) { throw ex; } }
/// <summary>Create /// <CreatedBy>Nagendra Upwanshi</CreatedBy> /// <CreatedOn>Nov-18-2014</CreatedOn> /// <CreatedFor>Load UI for Create New User</CreatedFor> /// </summary> /// <param name="usr"></param> /// <returns></returns> public ActionResult Index(string usr) { try { long LocationID = 0, UserID = 0; eTracLoginModel obj_eTracLoginModel = new eTracLoginModel(); if (Session["eTrac"] != null) { obj_eTracLoginModel = (eTracLoginModel)Session["eTrac"]; UserID = obj_eTracLoginModel.UserId; LocationID = Convert.ToInt64(Session["eTrac_SelectedDasboardLocationID"]); } ObjectParameter obj_ObjectParameter = new ObjectParameter("TotalRecords", typeof(int)); ObjectParameter obj_ObjectParameter2 = new ObjectParameter("TotalRecords", typeof(int)); GlobalAdminManager obj_GlobalAdminManager = new GlobalAdminManager(); // ViewBag.AllWorkOrder = obj_GlobalAdminManager.GetAllWorkRequestAssignment(0, 0, "GetAllWorkRequestAssignment", 1, 100000000, "WorkRequestAssignmentID", "asc", "", LocationID, obj_eTracLoginModel.UserId, DateTime.Now, DateTime.Now, "", obj_ObjectParameter).Count(); ViewBag.AllAssignedWorkOrder = obj_GlobalAdminManager.GetAllWorkRequestAssignment(0, 0, "GetAllAssignedWorkRequest", 1, 100000000, "WorkRequestAssignmentID", "asc", "", LocationID, obj_eTracLoginModel.UserId, DateTime.Now, DateTime.Now, "", obj_ObjectParameter2).Count(); return(View()); } catch (Exception ex) { ViewBag.Message = ex.Message; ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger; return(View("Error")); } }
/// <summary> /// Created By Ashwajit Bansod Dated : Sept-26-2017 /// For Fetching only employee records from UserRegistration /// </summary> /// <returns></returns> public List <EmployeeModel> GetAllEmployees(long LocationId, long DriverID) { try { workorderEMSEntities objworkorderEMSEntities = new workorderEMSEntities(); var objeFleetDriverRepository = new eFleetDriverRepository(); var objeFleetDriver = new eFleetDriver(); List <EmployeeModel> lstEmployee = new List <EmployeeModel>(); var objGlobalAdminManager = new GlobalAdminManager(); lstEmployee = objGlobalAdminManager.GetLocationEmployeeforGenericLocServices(LocationId, 190, 4); //lstEmployee = objworkorderEMSEntities.UserRegistrations.Where(d => d.IsDeleted == false && d.UserType == 3 ).Select(c => new EmployeeModel() //{ // FirstName = c.FirstName + " " + c.LastName, // UserId = c.UserId, // ProfileImage = c.ProfileImage == null ? "" : HostingPrefix + ProfilePicPath.Replace("~", "") + c.ProfileImage, // // ProfileImage = c.ProfileImage, // UserType = c.UserType //}).ToList(); var listDriver = objworkorderEMSEntities.eFleetDrivers.Where(x => x.IsDeleted == false && x.LocationID == LocationId).Select(r => new EmployeeModel() { FirstName = r.UserRegistration.FirstName + " " + r.UserRegistration.LastName, UserId = r.EmployeeName.Value, ProfileImage = r.UserRegistration.ProfileImage == null ? "" : HostingPrefix + ProfilePicPath.Replace("~", "") + r.UserRegistration.ProfileImage, UserType = r.UserRegistration.UserType }).Distinct().ToList(); var t = lstEmployee.Where(a => !listDriver.Any(b => a.UserId == b.UserId)).ToList(); return(t); } catch (Exception ex) { Exception_B.Exception_B.exceptionHandel_Runtime(ex, "public List<EmployeeModel> GetAllEmployees()", "Exception While Getting All Employee.", null); throw; } }
public ActionResult userAssessmentView(string Id, string Assesment) { eTracLoginModel ObjLoginModel = null; string Employee_Id = string.Empty; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); var details = new LocationDetailsModel(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); } List <GWCQUestionModel> ListQuestions = new List <GWCQUestionModel>(); try { Employee_Id = Cryptography.GetDecryptedData(Id, true); } catch (Exception e) { Employee_Id = Id; } ListQuestions = _GlobalAdminManager.GetGWCQuestions(Employee_Id, Assesment); return(PartialView("userAssessmentView", ListQuestions)); }
/// <summary> /// Created By : Bhushan Dod on 18/01/2015 /// Description : This function used for signalR persistent connection alert on screen if new WO created or any chnage in table for dashboard progress,pending. /// </summary> /// <param name="IsGlobalAsax"></param> /// <returns></returns> public async Task <WorkOrderEMS.Hubs.NotificationModel.WorkRequestAssignment> WorkOrderDetailsForPushNotificationSignalR(bool IsGlobalAsax = false) { try { var returnData = new WorkOrderEMS.Hubs.NotificationModel.WorkRequestAssignment(); GlobalAdminManager objGlobalAdminManager = new GlobalAdminManager(); using (var connection = new SqlConnection(_connString)) { connection.Open(); //var query = @"SELECT [WorkRequestAssignmentID],[WorkOrderCode],[WorkOrderCodeID],[WorkRequestProjectType],[LocationID],[CreatedBy],[ModifiedDate] FROM [dbo].[WorkRequestAssignment] order by 1 desc"; using (var command = new SqlCommand("signalRPushNotifyForWorkOrder", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@SignalRDate", SqlDbType.Date).Value = date; command.Notification = null; var dependency = new SqlDependency(command); dependency.OnChange += new OnChangeEventHandler(dependency_OnChange); if (connection.State == ConnectionState.Closed) { connection.Open(); } var reader = await command.ExecuteReaderAsync(); while (reader.Read()) { returnData.LocationID = (long)reader["LocationID"]; returnData.WorkRequestAssignmentID = (long)reader["WorkRequestAssignmentID"]; returnData.WorkRequestProjectType = (long)reader["WorkRequestProjectType"]; returnData.WorkOrderCode = (string)reader["WorkOrderCode"]; returnData.WorkOrderCodeID = (long)reader["WorkOrderCodeID"]; returnData.CreatedBy = (long)reader["CreatedBy"]; returnData.SafetyHazard = (bool)reader["SafetyHazard"]; if (IsGlobalAsax == false) { eTracLoginModel objLoginSession = new eTracLoginModel(); objLoginSession = (eTracLoginModel)HttpContext.Current.Session["eTrac"]; dynamic LocWoList = objGlobalAdminManager.WorkOrderDetailsForPushNotificaitonSignal("", objLoginSession.UserId, objLoginSession.UserRoleId, returnData.LocationID); if (LocWoList == true && returnData.CreatedBy == objLoginSession.UserId) { returnData = null; } if (LocWoList == false) { returnData = null; } } break; } } } return(returnData); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public Result SaveClientNewUserRegistrationforAll(UserModel objUserModel, out long qrcId, bool IsManagerRegistration, DARModel objDARModel, long locationId, long createdBy, string action) { try { qrcId = 0; ObjUserRepository = new UserRepository(); ObjManagerUser = new UserRegistration(); objGlobalCodesRepository = new GlobalCodesRepository(); if (CheckDuplicateUser(objUserModel.UserEmail.Trim(), objUserModel.UserId, out qrcId, objUserModel.AlternateEmail, objUserModel.EmployeeID)) { objUserModel.IsEmailVerify = true; objUserModel.IsLoginActive = true; objUserModel.SubscriptionEmail = objUserModel.UserEmail; using (TransactionScope TransScope = new TransactionScope()) { if (objUserModel.UserId == 0) { objUserModel.FirstName = objUserModel.FirstName.ToTitleCase(); objUserModel.LastName = objUserModel.LastName.ToTitleCase(); AutoMapper.Mapper.CreateMap <UserModel, UserRegistration>(); string DOB = objUserModel.DOB; objUserModel.DOB = null; ObjManagerUser = AutoMapper.Mapper.Map(objUserModel, ObjManagerUser); ObjManagerUser.ProfileImage = (objUserModel.ProfileImage != null) ? objUserModel.ProfileImageFile : "no-profile-pic.jpg"; if (!string.IsNullOrEmpty(DOB)) { ObjManagerUser.DOB = Convert.ToDateTime(DOB, CultureInfo.InvariantCulture); } ObjManagerUser.IsEmailVerify = false; //added by vijay sahu 12 june 2015 , by default it should not be true ObjManagerUser.IsLoginActive = false; //Added By Bhushan Dod on 04/Sep/2016 for User type of user. ObjManagerUser.UserType = objUserModel.SelectedUserType; ObjUserRepository.Add(ObjManagerUser); if (ObjManagerUser.UserId > 0) { objUserModel.Address.UserId = ObjManagerUser.UserId; objAddressManager.SaveAddress(objUserModel.Address); if (objUserModel.SelectedUserType == Convert.ToInt64(UserType.GlobalAdmin, CultureInfo.InvariantCulture) || objUserModel.SelectedUserType == Convert.ToInt64(UserType.ITAdministrator, CultureInfo.InvariantCulture) || objUserModel.SelectedUserType == Convert.ToInt64(UserType.Administrator, CultureInfo.InvariantCulture) //Commented by Bhushan on 30/05/2016 for no need to check manager bcoz objBB.AssignRoleAndPermission code is doing same // || objUserModel.UserType == Convert.ToInt64(UserType.Manager, CultureInfo.InvariantCulture) ) { _ICommonMethodAdmin.AssignLocationToAdminUser(locationId, ObjManagerUser.UserId); } else if (objUserModel.SelectedUserType == Convert.ToInt64(UserType.Manager, CultureInfo.InvariantCulture)) { _ICommonMethodAdmin.AssignLocationToManagerUser(locationId, ObjManagerUser.UserId); } else if (objUserModel.SelectedUserType == Convert.ToInt64(UserType.Employee, CultureInfo.InvariantCulture)) { _ICommonMethodAdmin.AssignLocationToEmployeeUser(locationId, ObjManagerUser.UserId); } Result objResult = _ICommonMethod.SaveDAR(objDARModel); ////this block is used for assigning roles to the users.. { WorkOrderEMS.BusinessLogic.Managers.Common_B objBB = new WorkOrderEMS.BusinessLogic.Managers.Common_B(); byte a = objBB.AssignRoleAndPermission(ObjManagerUser.UserId, objUserModel.UserType, locationId, createdBy, ""); } if (objUserModel.SelectedServicesID != "" && objUserModel.SelectedServicesID != null && objUserModel.SelectedServicesID.Trim() != "") { GlobalAdminManager ObjGlobalAdminManager = new GlobalAdminManager(); var userServicesID = objUserModel.SelectedServicesID.Split(','); if (userServicesID != null && userServicesID.Length > 0) { foreach (var service in userServicesID) { if (service != null && !string.IsNullOrEmpty(service) && Convert.ToInt64(service, CultureInfo.InvariantCulture) > 0) { long WidgetId = Convert.ToInt64(service, CultureInfo.InvariantCulture); var IsInserted = CommonMethodManager.AddPermissionDetail(WidgetId, ObjManagerUser.UserId, objUserModel.SelectedLocationId.Value); } } //Added By Bhushan Dod on 07/06/2016 for bydefault setting when location created according to loc services. ObjGlobalAdminManager.SaveByDefaultWidgetSetting(locationId, objUserModel.SelectedServicesID, ObjManagerUser.UserId); } } //COMMENTED BY BHUSHAN DOD FOR MULTIPLE ENTRIES INSERTED IN ADMINLOCATIONMAPPING //if (objUserModel.UserType == 6) // only for admin user mapping with location. //{ // _ICommonMethodAdmin.AssignLocationToAdminUser(locationId, ObjManagerUser.UserId); //} //////////////////if (objUserModel.UserType == 3) // only for admin user mapping with location. //////////////////{ ////////////////// using (workorderEMSEntities Context = new workorderEMSEntities()) ////////////////// { ////////////////// EmployeeLocationMappingRepository objmapping = new EmployeeLocationMappingRepository(); ////////////////// objmapping.DeleteAll(x => x.EmployeeUserId == objUserModel.UserId && x.LocationId == locationId); ////////////////// EmployeeLocationMapping MapEntity = new EmployeeLocationMapping(); ////////////////// MapEntity.LocationId = locationId; ////////////////// MapEntity.EmployeeUserId = objUserModel.UserId; ////////////////// MapEntity.ModifiedBy = createdBy; ////////////////// MapEntity.CreatedBy = createdBy; ////////////////// MapEntity.CreatedOn = DateTime.Now; ////////////////// objmapping.Add(MapEntity); ////////////////// objmapping.SaveChanges(); ////////////////// } //////////////////} //_ICommonMethod.GetAdminByIdCode objUserModel.UserId = ObjManagerUser.UserId; TransScope.Complete(); return(Result.Completed); } else { return(Result.Failed); } } else { UpdateUser(objUserModel, out qrcId, IsManagerRegistration); objUserModel.Address.UserId = objUserModel.UserId; objAddressManager.SaveAddress(objUserModel.Address); Result objResult = _ICommonMethod.SaveDAR(objDARModel); TransScope.Complete(); return(Result.UpdatedSuccessfully); } } } else { return(Result.DuplicateRecord); } } catch (Exception) { throw; } }
public JsonResult GetListLocation(string _search, long?UserId, int?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null) { eTracLoginModel ObjLoginModel = null; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); //if (locationId == null) //{ // locationId = Convert.ToInt32(ObjLoginModel.LocationID); //} UserId = ObjLoginModel.UserId; } JQGridResults result = new JQGridResults(); var result1 = new List <ListLocationModel>(); List <JQGridRow> rowss = new List <JQGridRow>(); sord = string.IsNullOrEmpty(sord) ? "desc" : sord; sidx = string.IsNullOrEmpty(sidx) ? "LocationId" : sidx; txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator); try { ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int)); var data = _GlobalAdminManager.ListAllLocation(locationId, page, rows, sidx, sord, txtSearch, paramTotalRecords); foreach (var locList in data) { //Convert Id to Encrypted data var id = Cryptography.GetEncryptedData(locList.LocationId.ToString(), true); locList.Id = id; result1.Add(locList); } //This is for JSGrid var tt = result1.ToArray(); //foreach (var locList in result1) //{ // JQGridRow row = new JQGridRow(); // row.id = Cryptography.GetEncryptedData(locList.LocationId.ToString(), true); // row.cell = new string[11]; // row.cell[0] = locList.LocationName; // row.cell[1] = locList.Address + "," + locList.City + ", " + locList.State + ", " + locList.ZipCode + "," + locList.Country; // row.cell[2] = locList.LocationAdministrator; // row.cell[3] = locList.LocationManager; // row.cell[4] = locList.LocationEmployee; // row.cell[5] = locList.City; // row.cell[6] = locList.State; // row.cell[7] = locList.Country; // row.cell[8] = locList.PhoneNo + " / " + locList.Mobile; // row.cell[9] = locList.Description; // row.cell[10] = Convert.ToString(locList.QRCID); // rowss.Add(row); //} result.rows = rowss.ToArray(); result.page = Convert.ToInt32(page); result.total = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value); result.records = Convert.ToInt32(TotalRecords.Value); return(Json(tt, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } }
public JsonResult GeDARList(long?LocationId, int?TastType, long?EmployeeId, string FromDate, string ToDate, string FromTime, string ToTime) { eTracLoginModel ObjLoginModel = null; DARManager objDARDetailsList = new DARManager(); var details = new List <WorkRequestAssignmentModelList>(); long UserId = 0; string sord = null; String sidx = null; string txtSearch = ""; GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager(); if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); UserId = ObjLoginModel.UserId; if (LocationId == 0) { LocationId = Convert.ToInt32(ObjLoginModel.LocationID); UserId = ObjLoginModel.UserId; } } //Getting client date time. var clientdt = DateTime.UtcNow.GetClientDateTimeNow(); //flag status for if user filter record in time span so to date is till midnight. bool isUTCDay = true; //Fetching record like 2017-06-11T00:00:00-04:00 to 2017-06-12T00:0000-04:00 string fromDate = (FromDate == null || FromDate == " " || FromDate == "") ? clientdt.Date.ToString() : FromDate; string toDate = (ToDate == null || ToDate == " " || ToDate == "") ? clientdt.AddDays(1).Date.ToString() : ToDate; //maintaining flag if interval date come then need to fetch record till midnight of todate day if (ToDate != null && ToDate != "" && FromDate != "null") { DateTime tt = Convert.ToDateTime(toDate); if (tt.ToLongTimeString() == "12:00:00 AM") { isUTCDay = false; } } if (fromDate != null && toDate != null) { DateTime frmd = Convert.ToDateTime(fromDate); DateTime tod = Convert.ToDateTime(toDate); ////if interval date come then need to fetch record till midnight of todate day if ((frmd.Date != tod.Date) && (tod.ToLongTimeString() == "12:00:00 AM") && isUTCDay == false) { tod = tod.AddDays(1).Date; toDate = tod.ToString(); } if ((frmd.Date == tod.Date) && (tod.ToLongTimeString() == "12:00:00 AM")) { tod = tod.AddDays(1).Date; toDate = tod.ToString(); } } //Converting datetime from userTZ to UTC fromDate = Convert.ToDateTime(fromDate).ConvertClientTZtoUTC().ToString(); toDate = Convert.ToDateTime(toDate).ConvertClientTZtoUTC().ToString(); int?rows = 20; int?page = 1; sord = string.IsNullOrEmpty(sord) ? "desc" : sord; sidx = string.IsNullOrEmpty(sidx) ? "CreatedDate" : sidx; var obj_Common_B = new Common_B(); ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int)); var data = objDARDetailsList.GetDARDetails(UserId, LocationId, EmployeeId, TastType, page, rows, sord, sord, txtSearch, paramTotalRecords, fromDate, toDate); if (data.Count() > 0) { return(Json(data, JsonRequestBehavior.AllowGet)); } else { return(Json(data, JsonRequestBehavior.AllowGet)); } }
public string SurveyHTMLToPdf(string HTML, string FileName, long WorkAssignmentId) { GlobalAdminManager objM = new GlobalAdminManager(); FileName = FileName.Replace(' ', '+').Replace('/', '@');//Here @ char replace due to '/' encrypt id it break the URL to open file in HTMLToPDF string waterMarkSurveyFilename = "eTrac" + FileName + ".pdf"; string HostingPrefix = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["hostingPrefix"]); var fileName = System.Web.HttpContext.Current.Server.MapPath("~/Content/eMaintenance/SurveyDownload/") + FileName + ".pdf"; var objData = objM.GetDataForRendringHTML(WorkAssignmentId); //---------------------------- Document doc = new Document(PageSize.A4, 30f, 30f, 40f, 30f); iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, new FileStream(fileName, FileMode.CreateNew)); doc.Open(); try { //var content = writer.DirectContent; //var pageBorderRect = new iTextSharp.text.Rectangle(doc.PageSize); //pageBorderRect.Left += doc.LeftMargin; //pageBorderRect.Right -= doc.RightMargin; //pageBorderRect.Top -= doc.TopMargin; //pageBorderRect.Bottom += doc.BottomMargin; //content.SetColorStroke(BaseColor.BLACK); //content.Rectangle(pageBorderRect.Left, pageBorderRect.Bottom, pageBorderRect.Width, pageBorderRect.Height); //content.Stroke(); //Logo string imageURL = System.Web.HttpContext.Current.Server.MapPath("~/Images/logo-etrac.png"); iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageURL); jpg.Alignment = 3; jpg.SpacingBefore = 30f; jpg.ScaleToFit(80f, 60f); jpg.SpacingBefore = 10f; jpg.SpacingAfter = 1f; doc.Add(jpg); Paragraph objFormName = new Paragraph("Customer Assistance Survey Form"); objFormName.Alignment = 3; objFormName.SpacingBefore = 3f; objFormName.SpacingAfter = 3f; objFormName.IndentationLeft = 3f; doc.Add(objFormName); StyleSheet css = new StyleSheet(); css.LoadTagStyle("body", "face", "Times-Roman"); css.LoadTagStyle("body", "font", "Times"); css.LoadTagStyle("body", "size", "11pt"); css.LoadTagStyle("body", "color", "#000"); foreach (IElement element in HTMLWorker.ParseToList( new StringReader(HTML), css)) { doc.Add(element); } var font1 = FontFactory.GetFont("Times-Roman", 11, Font.NORMAL, BaseColor.BLACK); PdfPTable table = new PdfPTable(2); PdfPCell cell = new PdfPCell(new Phrase("Customer Name: " + StringExtensionMethods.ToTitleCase(objData.CustomerName), font1)); cell.Colspan = 1; cell.Border = 0; cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right table.AddCell(cell); cell = new PdfPCell(new Phrase("Employee Name: " + StringExtensionMethods.ToTitleCase(objData.AssignedFirstName) + ' ' + StringExtensionMethods.ToTitleCase(objData.AssignedLastName), font1)); cell.Colspan = 1; cell.Border = 0; cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right table.AddCell(cell); doc.Add(table); } catch (Exception) { throw; } finally { doc.Close(); // Watermark code string watermarkLoc = System.Web.HttpContext.Current.Server.MapPath("~/Images/eTrac380-light.png"); PdfReader pdfReader = new PdfReader(fileName); PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(fileName.Replace(FileName + ".pdf", waterMarkSurveyFilename), FileMode.Create)); iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(watermarkLoc); var pageSize = pdfReader.GetPageSizeWithRotation(1); var x = pageSize.Width / 2 - img.ScaledWidth / 2; var y = pageSize.Height / 2 - img.ScaledHeight / 2; img.SetAbsolutePosition(x, y); //img.ScaleToFit(100f,120f); PdfContentByte waterMark; for (int page = 1; page <= pdfReader.NumberOfPages; page++) { waterMark = pdfStamper.GetUnderContent(page); waterMark.AddImage(img); } pdfStamper.FormFlattening = true; pdfStamper.Close(); pdfReader.Close(); //delete old file. No more need of that file. System.IO.File.Delete(fileName); } ////Render PlaceHolder to temporary stream //System.IO.StringWriter stringWrite = new StringWriter(); //System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); //StringReader reader = new StringReader(HTML); ////Create PDF document //Document doc = new Document(PageSize.A4); //HTMLWorker parser = new HTMLWorker(doc); //PdfWriter.GetInstance(doc, new FileStream(fileName, //FileMode.Create)); //doc.Open(); ///********************************************************************************/ //var interfaceProps = new Dictionary<string, Object>(); //var ih = new ImageHander() { BaseUri = Request.Url.ToString() }; //interfaceProps.Add(HTMLWorker.IMG_PROVIDER, ih); //foreach (IElement element in HTMLWorker.ParseToList( //new StringReader(HTML), null)) //{ // doc.Add(element); //} //doc.Close(); //Response.Clear(); //Response.Buffer = true; //Response.ContentType = "application/pdf"; //Response.AddHeader("content-disposition", "attachment;filename=" + FileName); // to open file prompt Box open or Save file //Response.Charset = ""; //Response.Cache.SetCacheability(HttpCacheability.NoCache); //Response.WriteFile(fileName); //Response.End(); //return FileName; commented bcoz for wtermark we need tosave same file name in db return(waterMarkSurveyFilename); }