private void btnCancelDocument_Click(object sender, RoutedEventArgs e) { CurrentEmployeeDocumentForm = new EmployeeDocumentViewModel(); CurrentEmployeeDocumentForm.Identifier = Guid.NewGuid(); CurrentEmployeeDocumentForm.CreateDate = DateTime.Now; CurrentEmployeeDocumentForm.ItemStatus = ItemStatus.Added; }
public ActionResult getCustomer_WorkertList() { EmployeeDocumentViewModel datamodel = new EmployeeDocumentViewModel(); foreach (var item in _employeeMethod.GetAllResourceEmployeeList().Where(x => x.AspNetUserRoles.Count() > 0 ? x.AspNetUserRoles.FirstOrDefault().RoleId != (int)Roles.SuperAdmin ? x.CreatedBy == SessionProxy.UserId : true : x.CreatedBy == SessionProxy.UserId).ToList()) { datamodel.WorkerList.Add(new SelectListItem() { Text = item.FirstName + item.LastName + "-" + item.SSOID, Value = item.Id.ToString() }); } foreach (var item in _RolesManagementMethod.GetManagersList()) { datamodel.ManagerList.Add(new SelectListItem() { Text = item.FirstName + item.LastName + "-" + item.SSOID, Value = item.Id.ToString() }); } foreach (var item in _employeeMethod.GetAllCoustomerEmployeeList().Where(x => x.AspNetUserRoles.Count() > 0 ? x.AspNetUserRoles.FirstOrDefault().RoleId != (int)Roles.SuperAdmin ? x.CreatedBy == SessionProxy.UserId : true : x.CreatedBy == SessionProxy.UserId).ToList()) { datamodel.CustomerList.Add(new SelectListItem() { Text = item.FirstName + item.LastName + "-" + item.SSOID, Value = item.Id.ToString() }); } return(Json(datamodel, JsonRequestBehavior.AllowGet)); }
private void BtnDelete_Click(object sender, RoutedEventArgs e) { var response = new EmployeeDocumentSQLiteRepository().SetStatusDeleted(CurrentEmployeeDocumentDG.Identifier); if (response.Success) { MainWindow.SuccessMessage = ((string)Application.Current.FindResource("Stavka_je_uspešno_obrisanaUzvičnik")); CurrentEmployeeDocumentForm = new EmployeeDocumentViewModel(); CurrentEmployeeDocumentForm.Identifier = Guid.NewGuid(); CurrentEmployeeDocumentForm.CreateDate = DateTime.Now; CurrentEmployeeDocumentForm.ItemStatus = ItemStatus.Added; CurrentEmployeeDocumentDG = null; EmployeeCreatedUpdated(); Thread displayThread = new Thread(() => DisplayEmployeeDocumentData()); displayThread.IsBackground = true; displayThread.Start(); } else { MainWindow.ErrorMessage = response.Message; } }
public Documents_Mailing_List() { InitializeComponent(); this.DataContext = this; FilterBusinessPartnerDocuments = new BusinessPartnerDocumentViewModel(); FilterBusinessPartnerDocuments.PropertyChanged += FilterBusinessPartnerDocuments_PropertyChanged; FilterConstructionSiteDocuments = new ConstructionSiteDocumentViewModel(); FilterConstructionSiteDocuments.PropertyChanged += FilterConstructionSiteDocuments_PropertyChanged; FilterEmployeeDocuments = new EmployeeDocumentViewModel(); FilterEmployeeDocuments.PropertyChanged += FilterEmployeeDocuments_PropertyChanged; FilterPhysicalPersonDocuments = new PhysicalPersonDocumentViewModel(); FilterPhysicalPersonDocuments.PropertyChanged += FilterPhysicalPersonDocuments_PropertyChanged; DocumentsForMail = new ObservableCollection <DocumentForMailViewModel>(); Thread td = new Thread(() => { DisplayBusinessPartnerDocumentData(); DisplayConstructionSiteDocumentData(); DisplayEmployeeDocumentData(); DisplayPhysicalPersonDocumentData(); }); td.IsBackground = true; td.Start(); }
private static EmployeeDocumentViewModel Read(SqliteDataReader query, bool readForMail = false) { int counter = 0; EmployeeDocumentViewModel dbEntry = new EmployeeDocumentViewModel(); dbEntry.Id = SQLiteHelper.GetInt(query, ref counter); dbEntry.Identifier = SQLiteHelper.GetGuid(query, ref counter); dbEntry.Employee = SQLiteHelper.GetEmployee(query, ref counter); dbEntry.Name = SQLiteHelper.GetString(query, ref counter); dbEntry.CreateDate = SQLiteHelper.GetDateTime(query, ref counter); dbEntry.Path = SQLiteHelper.GetString(query, ref counter); dbEntry.ItemStatus = SQLiteHelper.GetInt(query, ref counter); dbEntry.IsSynced = SQLiteHelper.GetBoolean(query, ref counter); dbEntry.UpdatedAt = SQLiteHelper.GetDateTime(query, ref counter); dbEntry.CreatedBy = SQLiteHelper.GetCreatedBy(query, ref counter); dbEntry.Company = SQLiteHelper.GetCompany(query, ref counter); if (readForMail) { dbEntry.Employee.Name = SQLiteHelper.GetString(query, ref counter); dbEntry.Employee.SurName = SQLiteHelper.GetString(query, ref counter); dbEntry.Employee.EmployeeCode = SQLiteHelper.GetString(query, ref counter); dbEntry.Employee.BusinessPartner = SQLiteHelper.GetBusinessPartner(query, ref counter); } return(dbEntry); }
public EmployeeDocumentResponse Create(EmployeeDocumentViewModel EmployeeDocument) { EmployeeDocumentResponse response = new EmployeeDocumentResponse(); using (SqliteConnection db = new SqliteConnection("Filename=SirmiumERPGFC.db")) { db.Open(); SqliteCommand insertCommand = db.CreateCommand(); insertCommand.CommandText = SqlCommandInsertPart; try { insertCommand = AddCreateParameters(insertCommand, EmployeeDocument); insertCommand.ExecuteNonQuery(); } catch (SqliteException error) { MainWindow.ErrorMessage = error.Message; response.Success = false; response.Message = error.Message; return(response); } db.Close(); response.Success = true; return(response); } }
public EmployeeDocumentListResponse GetFilteredEmployeeDocuments(int companyId, EmployeeDocumentViewModel filterObject) { EmployeeDocumentListResponse response = new EmployeeDocumentListResponse(); List <EmployeeDocumentViewModel> EmployeeDocuments = new List <EmployeeDocumentViewModel>(); using (SqliteConnection db = new SqliteConnection("Filename=SirmiumERPGFC.db")) { db.Open(); try { SqliteCommand selectCommand = new SqliteCommand( SqlCommandSelectPart + ", emp.EmpName as EmpName, emp.EmpSurname as EmpSurName, emp.EmpCode, " + "empBP.BusinessPartnerId, empBP.BusinessPartnerIdentifier, empBP.BusinessPartnerCode, empBP.BusinessPartnerName, empBP.BusinessPartnerInternalCode, empBP.BusinessPartnerNameGer " + "FROM EmployeeDocuments " + "LEFT JOIN (SELECT Identifier AS EmpIdentifier, Name AS EmpName, Surname AS EmpSurname, EmployeeCode AS EmpCode FROM Employees) emp ON emp.EmpIdentifier = EmployeeDocuments.EmployeeIdentifier " + "LEFT JOIN (SELECT BusinessPartnerId, BusinessPartnerIdentifier, BusinessPartnerCode, BusinessPartnername, " + "BusinessPartnerInternalCode, BusinessPartnerNameGer, EmployeeIdentifier AS BPEmployeeIdentifier FROM EmployeeByBusinessPartners) empBP ON emp.EmpIdentifier = empBP.BPEmployeeIdentifier " + "WHERE (" + " ((@EmployeeName IS NULL OR @EmployeeName = '' OR EmpName LIKE @EmployeeName) OR (@EmployeeName IS NULL OR @EmployeeName = '' OR EmpSurName LIKE @EmployeeName)) OR " + " (@EmployeeName IS NULL OR @EmployeeName = '' OR Name LIKE @EmployeeName) " + ") " + "AND (@EmployeeCode IS NULL OR @EmployeeCode = '' OR emp.EmpCode LIKE @EmployeeCode) " + "AND (@BPCode IS NULL OR @BPCode = '' OR empBP.BusinessPartnerInternalCode LIKE @BPCode) " + "AND (@DateFrom IS NULL OR @DateFrom = '' OR DATE(CreateDate) >= DATE(@DateFrom)) " + "AND (@DateTo IS NULL OR @DateTo = '' OR DATE(CreateDate) <= DATE(@DateTo)) " + "ORDER BY IsSynced, Id DESC;", db); selectCommand.Parameters.AddWithValue("@EmployeeName", (String.IsNullOrEmpty(filterObject.Search_Name) ? "" : "%" + filterObject.Search_Name + "%")); selectCommand.Parameters.AddWithValue("@EmployeeCode", (String.IsNullOrEmpty(filterObject.Search_Code) ? "" : "%" + filterObject.Search_Code + "%")); selectCommand.Parameters.AddWithValue("@BPCode", (String.IsNullOrEmpty(filterObject.Search_BPCode) ? "" : "%" + filterObject.Search_BPCode + "%")); selectCommand.Parameters.AddWithValue("@DateFrom", ((object)filterObject.Search_DateFrom) ?? DBNull.Value); selectCommand.Parameters.AddWithValue("@DateTo", ((object)filterObject.Search_DateTo) ?? DBNull.Value); selectCommand.Parameters.AddWithValue("@CompanyId", companyId); SqliteDataReader query = selectCommand.ExecuteReader(); while (query.Read()) { EmployeeDocumentViewModel dbEntry = Read(query, readForMail: true); EmployeeDocuments.Add(dbEntry); } } catch (SqliteException error) { MainWindow.ErrorMessage = error.Message; response.Success = false; response.Message = error.Message; response.EmployeeDocuments = new List <EmployeeDocumentViewModel>(); return(response); } db.Close(); } response.Success = true; response.EmployeeDocuments = EmployeeDocuments; return(response); }
private void btnEditDocument_Click(object sender, RoutedEventArgs e) { CurrentEmployeeDocumentForm = new EmployeeDocumentViewModel(); CurrentEmployeeDocumentForm.Identifier = CurrentEmployeeDocumentDG.Identifier; CurrentEmployeeDocumentForm.ItemStatus = ItemStatus.Edited; CurrentEmployeeDocumentForm.IsSynced = CurrentEmployeeDocumentDG.IsSynced; CurrentEmployeeDocumentForm.Name = CurrentEmployeeDocumentDG.Name; CurrentEmployeeDocumentForm.CreateDate = CurrentEmployeeDocumentDG.CreateDate; CurrentEmployeeDocumentForm.Path = CurrentEmployeeDocumentDG.Path; CurrentEmployeeDocumentForm.UpdatedAt = CurrentEmployeeDocumentDG.UpdatedAt; }
public ActionResult SaveDocument(EmployeeDocumentViewModel model) { bool save = _EmployeeDocument.SaveDocumentData(model, SessionProxy.UserId); if (save) { return(Json("True", JsonRequestBehavior.AllowGet)); } else { return(Json("Error", JsonRequestBehavior.AllowGet)); } }
public static EmployeeDocumentViewModel ConvertToEmployeeDocumentViewModelLite(this EmployeeDocument employeeDocument) { EmployeeDocumentViewModel EmployeeDocumentViewModel = new EmployeeDocumentViewModel() { Id = employeeDocument.Id, Identifier = employeeDocument.Identifier, Name = employeeDocument.Name, CreateDate = employeeDocument.CreateDate, Path = employeeDocument.Path, ItemStatus = employeeDocument.ItemStatus, IsActive = employeeDocument.Active, UpdatedAt = employeeDocument.UpdatedAt, CreatedAt = employeeDocument.CreatedAt }; return(EmployeeDocumentViewModel); }
public EmployeeDocumentListResponse GetEmployeeDocumentsByEmployee(int companyId, Guid EmployeeIdentifier) { EmployeeDocumentListResponse response = new EmployeeDocumentListResponse(); List <EmployeeDocumentViewModel> EmployeeDocuments = new List <EmployeeDocumentViewModel>(); using (SqliteConnection db = new SqliteConnection("Filename=SirmiumERPGFC.db")) { db.Open(); try { SqliteCommand selectCommand = new SqliteCommand( SqlCommandSelectPart + "FROM EmployeeDocuments " + "WHERE EmployeeIdentifier = @EmployeeIdentifier " + "AND CompanyId = @CompanyId " + "ORDER BY IsSynced, Id DESC;", db); selectCommand.Parameters.AddWithValue("@EmployeeIdentifier", EmployeeIdentifier); selectCommand.Parameters.AddWithValue("@CompanyId", companyId); SqliteDataReader query = selectCommand.ExecuteReader(); while (query.Read()) { EmployeeDocumentViewModel dbEntry = Read(query); EmployeeDocuments.Add(dbEntry); } } catch (SqliteException error) { MainWindow.ErrorMessage = error.Message; response.Success = false; response.Message = error.Message; response.EmployeeDocuments = new List <EmployeeDocumentViewModel>(); return(response); } db.Close(); } response.Success = true; response.EmployeeDocuments = EmployeeDocuments; return(response); }
public Employee_Document_AddEdit(EmployeeViewModel employee) { employeeService = DependencyResolver.Kernel.Get <IEmployeeService>(); employeeDocumentService = DependencyResolver.Kernel.Get <IEmployeeDocumentService>(); InitializeComponent(); this.DataContext = this; CurrentEmployee = employee; CurrentEmployeeDocumentForm = new EmployeeDocumentViewModel(); CurrentEmployeeDocumentForm.Identifier = Guid.NewGuid(); CurrentEmployeeDocumentForm.CreateDate = DateTime.Now; CurrentEmployeeDocumentForm.ItemStatus = ItemStatus.Added; Thread displayThread = new Thread(() => DisplayEmployeeDocumentData()); displayThread.IsBackground = true; displayThread.Start(); txtDocumentName.Focus(); }
private SqliteCommand AddCreateParameters(SqliteCommand insertCommand, EmployeeDocumentViewModel EmployeeDocument) { insertCommand.Parameters.AddWithValue("@ServerId", EmployeeDocument.Id); insertCommand.Parameters.AddWithValue("@Identifier", EmployeeDocument.Identifier); insertCommand.Parameters.AddWithValue("@EmployeeId", ((object)EmployeeDocument.Employee.Id) ?? DBNull.Value); insertCommand.Parameters.AddWithValue("@EmployeeIdentifier", ((object)EmployeeDocument.Employee.Identifier) ?? DBNull.Value); insertCommand.Parameters.AddWithValue("@EmployeeCode", ((object)EmployeeDocument.Employee.Code) ?? DBNull.Value); insertCommand.Parameters.AddWithValue("@EmployeeName", ((object)EmployeeDocument.Employee.Name) ?? DBNull.Value); insertCommand.Parameters.AddWithValue("@EmployeeInternalCode", ((object)EmployeeDocument.Employee.EmployeeCode) ?? DBNull.Value); insertCommand.Parameters.AddWithValue("@Name", EmployeeDocument.Name); insertCommand.Parameters.AddWithValue("@CreateDate", ((object)EmployeeDocument.CreateDate) ?? DBNull.Value); insertCommand.Parameters.AddWithValue("@Path", ((object)EmployeeDocument.Path) ?? DBNull.Value); insertCommand.Parameters.AddWithValue("@ItemStatus", ((object)EmployeeDocument.ItemStatus) ?? DBNull.Value); insertCommand.Parameters.AddWithValue("@IsSynced", EmployeeDocument.IsSynced); insertCommand.Parameters.AddWithValue("@UpdatedAt", ((object)EmployeeDocument.UpdatedAt) ?? DBNull.Value); insertCommand.Parameters.AddWithValue("@CreatedById", MainWindow.CurrentUser.Id); insertCommand.Parameters.AddWithValue("@CreatedByName", MainWindow.CurrentUser.FirstName + " " + MainWindow.CurrentUser.LastName); insertCommand.Parameters.AddWithValue("@CompanyId", MainWindow.CurrentCompany.Id); insertCommand.Parameters.AddWithValue("@CompanyName", MainWindow.CurrentCompany.CompanyName); return(insertCommand); }
public EmployeeDocumentResponse GetEmployeeDocument(Guid identifier) { EmployeeDocumentResponse response = new EmployeeDocumentResponse(); EmployeeDocumentViewModel EmployeeDocument = new EmployeeDocumentViewModel(); using (SqliteConnection db = new SqliteConnection("Filename=SirmiumERPGFC.db")) { db.Open(); try { SqliteCommand selectCommand = new SqliteCommand( SqlCommandSelectPart + "FROM EmployeeDocuments " + "WHERE Identifier = @Identifier;", db); selectCommand.Parameters.AddWithValue("@Identifier", identifier); SqliteDataReader query = selectCommand.ExecuteReader(); if (query.Read()) { EmployeeDocumentViewModel dbEntry = Read(query); EmployeeDocument = dbEntry; } } catch (SqliteException error) { MainWindow.ErrorMessage = error.Message; response.Success = false; response.Message = error.Message; response.EmployeeDocument = new EmployeeDocumentViewModel(); return(response); } db.Close(); } response.Success = true; response.EmployeeDocument = EmployeeDocument; return(response); }
public static EmployeeDocument ConvertToEmployeeDocument(this EmployeeDocumentViewModel employeeDocumentViewModel) { EmployeeDocument EmployeeDocument = new EmployeeDocument() { Id = employeeDocumentViewModel.Id, Identifier = employeeDocumentViewModel.Identifier, EmployeeId = employeeDocumentViewModel.Employee?.Id ?? null, Name = employeeDocumentViewModel.Name, CreateDate = employeeDocumentViewModel.CreateDate, Path = employeeDocumentViewModel.Path, ItemStatus = employeeDocumentViewModel.ItemStatus, Active = employeeDocumentViewModel.IsActive, CreatedById = employeeDocumentViewModel.CreatedBy?.Id ?? null, CompanyId = employeeDocumentViewModel.Company?.Id ?? null, CreatedAt = employeeDocumentViewModel.CreatedAt, UpdatedAt = employeeDocumentViewModel.UpdatedAt }; return(EmployeeDocument); }
public ActionResult EmployeeDocumentsIndex(int employee_id) { try { List <EmployeeDocumentDetail> documents = _context.EmployeeDocumentDetails.Where(d => d.employee_id == employee_id).ToList(); EmployeeDocumentViewModel viewModel = new EmployeeDocumentViewModel { DocTypes = ManageDependancyData.DocumentTypes(), EmployeeDocumentDetails = documents }; Session["EmployeeId"] = employee_id; var employee = _context.Employees.FirstOrDefault(p => p.employee_id == employee_id); ViewBag.Title = "Manage Employee Documents For " + employee.first_name + " " + employee.middle_name + " " + employee.last_name; return(View(viewModel)); } catch (Exception ex) { throw; } }
private void btnAddDocument_Click(object sender, RoutedEventArgs e) { #region Validation if (CurrentEmployeeDocumentForm.Name == null) { MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Obavezno_poljeDvotačka_Naziv")); return; } #endregion Thread th = new Thread(() => { SubmitButtonEnabled = false; CurrentEmployeeDocumentForm.Employee = CurrentEmployee; CurrentEmployeeDocumentForm.Company = new CompanyViewModel() { Id = MainWindow.CurrentCompanyId }; CurrentEmployeeDocumentForm.CreatedBy = new UserViewModel() { Id = MainWindow.CurrentUserId }; new EmployeeDocumentSQLiteRepository().Delete(CurrentEmployeeDocumentForm.Identifier); var response = new EmployeeDocumentSQLiteRepository().Create(CurrentEmployeeDocumentForm); if (!response.Success) { MainWindow.ErrorMessage = response.Message; CurrentEmployeeDocumentForm = new EmployeeDocumentViewModel(); CurrentEmployeeDocumentForm.Identifier = Guid.NewGuid(); CurrentEmployeeDocumentForm.CreateDate = DateTime.Now; CurrentEmployeeDocumentForm.ItemStatus = ItemStatus.Added; CurrentEmployeeDocumentForm.IsSynced = false; return; } CurrentEmployeeDocumentForm = new EmployeeDocumentViewModel(); CurrentEmployeeDocumentForm.Identifier = Guid.NewGuid(); CurrentEmployeeDocumentForm.CreateDate = DateTime.Now; CurrentEmployeeDocumentForm.ItemStatus = ItemStatus.Added; CurrentEmployeeDocumentForm.IsSynced = false; EmployeeCreatedUpdated(); DisplayEmployeeDocumentData(); Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { txtDocumentName.Focus(); }) ); SubmitButtonEnabled = true; }); th.IsBackground = true; th.Start(); }
public ActionResult Index(int EmployeeId) { EmployeeDocumentListModel model = new EmployeeDocumentListModel(); //model.LoginUserID = SessionProxy.UserId; model.EmployeeID = EmployeeId; var data = _EmployeeDocument.getDocumentDetailsByEmployeeId(EmployeeId); if (data.Count > 0) { foreach (var details in data) { if (!string.IsNullOrEmpty(details.DocumentPath) || !string.IsNullOrEmpty(details.Description)) { EmployeeDocumentViewModel datamodel = new EmployeeDocumentViewModel(); datamodel.Id = details.Id; datamodel.Type = "Document"; datamodel.EmployeeID = details.EmployeeID; // datamodel.LoginUserID = SessionProxy.UserId; datamodel.Description = details.Description; datamodel.DocumentOriginalPath = details.DocumentOriginalPath; datamodel.DocumentPath = details.DocumentPath; datamodel.Category = (int)details.Category; if (details.Category != 0) { var res = _otherSettingMethod.getSystemListValueById((int)details.Category); datamodel.CategoryName = res.Value; } datamodel.BusinessID = (int)details.BusinessID; if (details.BusinessID != 0) { var buz = _CompanyStructureMethod.getBusinessListById((int)details.BusinessID); if (buz != null) { datamodel.Business = buz.Name; } } datamodel.DivisionID = (int)details.DivisionID; if (details.DivisionID != 0) { var div = _CompanyStructureMethod.getDivisionById((int)details.DivisionID); if (div != null) { datamodel.Division = div.Name; } } datamodel.PoolID = (int)details.PoolID; if (details.PoolID != 0) { var pol = _CompanyStructureMethod.getPoolsListById((int)details.PoolID); if (pol != null) { datamodel.Pool = pol.Name; } } datamodel.FunctionID = (int)details.FunctionID; if (details.FunctionID != 0) { var fun = _CompanyStructureMethod.getFunctionsListById((int)details.FunctionID); if (fun != null) { datamodel.Function = fun.Name; } } datamodel.CreateDate = String.Format("{0:dd-MM-yyyy}", details.CreatedDate); datamodel.SignatureRequire = details.SignatureRequire; if (details.SignatureRequire == true) { datamodel.Signature = "YES"; } else { datamodel.Signature = "NO"; } var SigCount = _EmployeeDocument.getDocumentSignatureListByDocumentId(details.Id); if (SigCount != null) { datamodel.Signed = true; } else { datamodel.Signed = false; } model.EmployeeList.Add(datamodel); } else if (!string.IsNullOrEmpty(details.LinkDisplayText) || !string.IsNullOrEmpty(details.LinkURL)) { EmployeeDocumentViewModel datamodel = new EmployeeDocumentViewModel(); datamodel.Type = "Link"; datamodel.Id = details.Id; datamodel.EmployeeID = details.EmployeeID; // datamodel.LoginUserID = SessionProxy.UserId; datamodel.LinkDisplayText = details.LinkDisplayText; datamodel.LinkURL = details.LinkURL; datamodel.Category = (int)details.Category; if (details.Category != 0) { var res = _otherSettingMethod.getSystemListValueById((int)details.Category); datamodel.CategoryName = res.Value; } datamodel.BusinessID = (int)details.BusinessID; if (details.BusinessID != 0) { var buz = _CompanyStructureMethod.getBusinessListById((int)details.BusinessID); if (buz != null) { datamodel.Business = buz.Name; } } datamodel.DivisionID = (int)details.DivisionID; if (details.DivisionID != 0) { var div = _CompanyStructureMethod.getDivisionById((int)details.DivisionID); if (div != null) { datamodel.Division = div.Name; } } datamodel.PoolID = (int)details.PoolID; if (details.PoolID != 0) { var pol = _CompanyStructureMethod.getPoolsListById((int)details.PoolID); if (pol != null) { datamodel.Pool = pol.Name; } } datamodel.FunctionID = (int)details.FunctionID; if (details.FunctionID != 0) { var fun = _CompanyStructureMethod.getFunctionsListById((int)details.FunctionID); if (fun != null) { datamodel.Function = fun.Name; } } datamodel.CreateDate = String.Format("{0:dd-MM-yyyy}", details.CreatedDate); datamodel.SignatureRequire = details.SignatureRequire; if (details.SignatureRequire == true) { datamodel.Signature = "YES"; } else { datamodel.Signature = "NO"; } var SigCount = _EmployeeDocument.getDocumentSignatureListByDocumentId(details.Id); if (SigCount != null) { datamodel.Signed = true; } else { datamodel.Signed = false; } model.EmployeeList.Add(datamodel); } } } return(View(model)); }
public EmployeeDocumentViewModel returnList(int Id, int EmployeeID) { EmployeeDocumentViewModel datamodel = new EmployeeDocumentViewModel(); foreach (var item in _otherSettingMethod.getAllSystemValueListByKeyName("Company Document Category")) { datamodel.CategoryList.Add(new SelectListItem() { Text = item.Value, Value = item.Id.ToString() }); } foreach (var item in _CompanyStructureMethod.getAllBusinessList()) { datamodel.BusinessList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString() }); } //foreach (var item in _RolesManagementMethod.GetEmployeesList()) //{ // datamodel.WorkerList.Add(new SelectListItem() { Text = item.FirstName + item.LastName + "-" + item.SSOID, Value = item.Id.ToString() }); //} //foreach (var item in _RolesManagementMethod.GetManagersList()) //{ // datamodel.ManagerList.Add(new SelectListItem() { Text = item.FirstName + item.LastName + "-" + item.SSOID, Value = item.Id.ToString() }); //} //foreach (var item in _RolesManagementMethod.GetCustomerList()) //{ // datamodel.CustomerList.Add(new SelectListItem() { Text = item.FirstName + item.LastName + "-" + item.SSOID, Value = item.Id.ToString() }); //} foreach (var item in _employeeMethod.GetAllResourceEmployeeList().Where(x => x.AspNetUserRoles.Count() > 0 ? x.AspNetUserRoles.FirstOrDefault().RoleId != (int)Roles.SuperAdmin ? x.CreatedBy == SessionProxy.UserId : true : x.CreatedBy == SessionProxy.UserId).ToList()) { datamodel.WorkerList.Add(new SelectListItem() { Text = item.FirstName + item.LastName + "-" + item.SSOID, Value = item.Id.ToString() }); } foreach (var item in _RolesManagementMethod.GetManagersList()) { datamodel.ManagerList.Add(new SelectListItem() { Text = item.FirstName + item.LastName + "-" + item.SSOID, Value = item.Id.ToString() }); } foreach (var item in _employeeMethod.GetAllCoustomerEmployeeList().Where(x => x.AspNetUserRoles.Count() > 0 ? x.AspNetUserRoles.FirstOrDefault().RoleId != (int)Roles.SuperAdmin ? x.CreatedBy == SessionProxy.UserId : true : x.CreatedBy == SessionProxy.UserId).ToList()) { datamodel.CustomerList.Add(new SelectListItem() { Text = item.FirstName + item.LastName + "-" + item.SSOID, Value = item.Id.ToString() }); } if (Id == 0) { datamodel.Id = 0; datamodel.EmployeeID = EmployeeID; // datamodel.LoginUserID = SessionProxy.UserId; } else { var data = _EmployeeDocument.getDocumentDetailsById(Id); datamodel.Id = data.Id; datamodel.EmployeeID = data.EmployeeID; // datamodel.LoginUserID = SessionProxy.UserId; datamodel.DocumentOriginalPath = data.DocumentOriginalPath; datamodel.DocumentPath = data.DocumentPath; datamodel.LinkDisplayText = data.LinkDisplayText; datamodel.LinkURL = data.LinkURL; datamodel.Description = data.Description; datamodel.IpAddress = data.IpAddress; datamodel.BusinessID = (int)data.BusinessID; datamodel.DivisionID = (int)data.DivisionID; if (data.DivisionID != 0 && data.BusinessID != 0) { datamodel.DivisionList = bindDiv((int)data.BusinessID); datamodel.PoolList = poolDiv((int)data.DivisionID); datamodel.FunctionList = functionDiv((int)data.DivisionID); } datamodel.PoolID = (int)data.PoolID; datamodel.FunctionID = (int)data.FunctionID; datamodel.Category = (int)data.Category; datamodel.EmployeeAccess = data.EmployeeAccess; datamodel.ManagerAccess = data.ManagerAccess; datamodel.CustomerAccess = data.CustomerAccess; datamodel.SpecificWorker = data.SpecificWorker; // datamodel.WorkerID = data.WorkerID; datamodel.SpecificManager = data.SpecificManager; // datamodel.ManagerID = data.ManagerID; datamodel.SpecificCustomer = data.SpecificCustomer; // datamodel.CustomerID = data.CustomerID; datamodel.SignatureRequire = data.SignatureRequire; int CmpId = Convert.ToInt32(data.WorkerID); if (CmpId != 0 && !string.IsNullOrEmpty(data.WorkerID)) { var Employee = _db.AspNetUsers.Where(x => x.Id == CmpId).FirstOrDefault(); if (Employee != null) { datamodel.SpecificWorkerName = Employee.FirstName + " " + Employee.LastName + " " + Employee.SSOID; datamodel.WorkerID = data.WorkerID; } } int ManId = Convert.ToInt32(data.ManagerID); if (ManId != 0 && !string.IsNullOrEmpty(data.ManagerID)) { var Employee = _db.AspNetUsers.Where(x => x.Id == ManId).FirstOrDefault(); if (Employee != null) { datamodel.SpecificManagerName = Employee.FirstName + " " + Employee.LastName + " " + Employee.SSOID; datamodel.ManagerID = data.ManagerID; } } int CustId = Convert.ToInt32(data.CustomerID); if (CustId != 0 && !string.IsNullOrEmpty(data.CustomerID)) { var Employee = _db.AspNetUsers.Where(x => x.Id == CustId).FirstOrDefault(); if (Employee != null) { datamodel.SpecificCustomerName = Employee.FirstName + " " + Employee.LastName + " " + Employee.SSOID; datamodel.CustomerID = data.CustomerID; } } } return(datamodel); }
public ActionResult AddDocument(int Id, int EmployeeID) { EmployeeDocumentViewModel Model = returnList(Id, EmployeeID); return(PartialView("_partialAddEditEmployeeDocumentView", Model)); }
public bool SaveDocumentData(EmployeeDocumentViewModel DataModel, int UserId) { //DateTime Create = new DateTime(); if (DataModel.Id == 0) { Employee_Document model = new Employee_Document(); model.EmployeeID = DataModel.EmployeeID; model.DocumentOriginalPath = DataModel.DocumentOriginalPath; model.DocumentPath = DataModel.DocumentPath; model.LinkDisplayText = DataModel.LinkDisplayText; model.LinkURL = DataModel.LinkURL; model.Description = DataModel.Description; model.BusinessID = DataModel.BusinessID; model.DivisionID = DataModel.DivisionID; model.PoolID = DataModel.PoolID; model.FunctionID = DataModel.FunctionID; model.Category = DataModel.Category; model.EmployeeAccess = DataModel.EmployeeAccess; model.ManagerAccess = DataModel.ManagerAccess; model.CustomerAccess = DataModel.CustomerAccess; model.SpecificWorker = DataModel.SpecificWorker; model.WorkerID = DataModel.WorkerID; model.SpecificManager = DataModel.SpecificManager; model.ManagerID = DataModel.ManagerID; model.SpecificCustomer = DataModel.SpecificCustomer; model.CustomerID = DataModel.CustomerID; model.SignatureRequire = DataModel.SignatureRequire; model.IpAddress = DataModel.IpAddress; model.Archived = false; model.IsRead = false; model.IsReadSignature = false; model.UserIDCreatedBy = UserId; model.UserIDLastModifiedBy = UserId; model.CreatedDate = DateTime.Now; model.LastModified = DateTime.Now; _db.Employee_Document.Add(model); _db.SaveChanges(); } else { var model = _db.Employee_Document.Where(x => x.Id == DataModel.Id).FirstOrDefault(); model.EmployeeID = DataModel.EmployeeID; model.DocumentOriginalPath = DataModel.DocumentOriginalPath; model.DocumentPath = DataModel.DocumentPath; model.LinkDisplayText = DataModel.LinkDisplayText; model.LinkURL = DataModel.LinkURL; model.Description = DataModel.Description; model.BusinessID = DataModel.BusinessID; model.DivisionID = DataModel.DivisionID; model.PoolID = DataModel.PoolID; model.FunctionID = DataModel.FunctionID; model.Category = DataModel.Category; model.EmployeeAccess = DataModel.EmployeeAccess; model.ManagerAccess = DataModel.ManagerAccess; model.CustomerAccess = DataModel.CustomerAccess; model.SpecificWorker = DataModel.SpecificWorker; model.WorkerID = DataModel.WorkerID; model.SpecificManager = DataModel.SpecificManager; model.ManagerID = DataModel.ManagerID; model.SpecificCustomer = DataModel.SpecificCustomer; model.CustomerID = DataModel.CustomerID; model.SignatureRequire = DataModel.SignatureRequire; model.IpAddress = DataModel.IpAddress; model.UserIDLastModifiedBy = UserId; model.LastModified = DateTime.Now; _db.SaveChanges(); } return(true); }