public CompanyFormViewModel ReadCompany(int id, string culture)
        {
            var query = (from c in context.Companies
                         where c.Id == id
                         select new CompanyFormViewModel
            {
                Id = c.Id,
                CommFileNo = c.CommFileNo,
                Consolidation = c.Consolidation,
                CountryId = c.CountryId,
                Email = c.Email,
                InsuranceNo = c.InsuranceNo,
                Language = c.Language,
                Name = c.Name,
                LocalName = HrContext.TrlsName(c.Name, culture),
                Memo = c.Memo,
                Purpose = c.Purpose,
                TaxCardNo = c.TaxCardNo,
                WebSite = c.WebSite,
                TaxAuthority = c.TaxAuthority,
                SearchName = c.SearchName,
                CreatedTime = c.CreatedTime,
                CreatedUser = c.CreatedUser,
                ModifiedTime = c.ModifiedTime,
                ModifiedUser = c.ModifiedUser,
                Attachments = HrContext.GetAttachments("Company", c.Id),
                LegalForm = c.LegalForm,
                Office = c.Office,
                Region = c.Region,
                Responsible = c.Responsible
            }).FirstOrDefault();

            return(query);
        }
        //Read Medical Request
        public MedicalRequestViewModel ReadMedical(int id)
        {
            var res = (from c in context.BenefitRequests
                       where c.Id == id
                       select new MedicalRequestViewModel
            {
                Id = c.Id,
                ApprovalStatus = c.ApprovalStatus,
                Description = c.Description,
                EmpId = c.EmpId,
                Attachments = HrContext.GetAttachments("MedicalRequests", c.Id),
                CreatedTime = c.CreatedTime,
                CompanyCost = c.CompanyCost,
                EmpCost = c.EmpCost,
                CurrRate = c.CurrRate,
                RequestDate = c.RequestDate,
                ServiceId = c.ServiceId,
                ServCost = c.ServCost,
                ProviderId = c.ProviderId,
                BenefitId = c.BenefitId,
                Curr = c.Curr,
                BenefitPlanId = c.BenefitPlanId,
                BeneficiaryId = c.BeneficiaryId,
                ModifiedTime = c.ModifiedTime,
                ModifiedUser = c.ModifiedUser,
                CreatedUser = c.CreatedUser,
            }).FirstOrDefault();

            return(res);
        }
Beispiel #3
0
        public RecievedCustodyForm ReadEditRecievedCustody(int id, string culture)
        {
            var res = (from e in context.EmpCustodies
                       where e.Id == id && e.delvryDate == null
                       join c in context.Custody on e.CustodyId equals c.Id
                       select new RecievedCustodyForm
            {
                Id = e.Id,
                CustodyId = c.Id,
                Name = c.Name,
                CompanyId = c.CompanyId,
                CustodyCatId = c.CustodyCatId,
                PurchaseDate = c.PurchaseDate,
                RecvStatus = c.Status,
                PurchaseAmount = c.PurchaseAmount,
                ItemCode = c.ItemCode,
                Qty = 1,
                SerialNo = c.SerialNo,
                Attachments = HrContext.GetAttachments("RecieveCustody", id),
                EmpId = e.EmpId,
                RecvDate = e.RecvDate,
                Notes = e.Notes,
                BranchId = e.BranchId
            }).FirstOrDefault();

            return(res);
        }
Beispiel #4
0
        public EmpTasksViewModel GetManagerEmpTask(int Id)
        {
            EmpTasksViewModel task = context.EmpTasks.Where(t => t.Id == Id)
                                     .Select(t => new EmpTasksViewModel
            {
                Id           = t.Id,
                Description  = t.Description,
                Priority     = t.Priority,
                Status       = t.Status,
                TaskCat      = t.TaskCat,
                TaskNo       = t.TaskNo,
                AssignedTime = t.AssignedTime,
                Attachments  = HrContext.GetAttachments("EmpTasksForm", t.Id),
                StartTime    = t.StartTime,
                EndTime      = t.EndTime,
                Duration     = t.Duration,
                EmpListId    = t.EmpListId,
                ExpectDur    = t.ExpectDur,
                Unit         = t.Unit,
                Required     = t.Required,
                EmpId        = t.EmpId
            }).FirstOrDefault();

            return(task);
        }
Beispiel #5
0
        public CustodyFormViewModel ReadCustObject(int id, string culture)
        {
            var res = (from c in context.Custody
                       where c.Id == id
                       select new CustodyFormViewModel
            {
                Id = c.Id,
                Name = c.Name,
                Code = c.Code,
                CustodyCatId = c.CustodyCatId,
                Description = c.Description,
                SerialNo = c.SerialNo,
                Attachments = HrContext.GetAttachments("Custody", c.Id),
                PurchaseDate = c.PurchaseDate,
                JobId = c.JobId,
                BranchId = c.BranchId,
                Status = c.Status,
                PurchaseAmount = c.PurchaseAmount,
                ItemCode = c.ItemCode,
                Qty = c.Qty,
                Curr = c.Curr,
                Freeze = c.Freeze,
                CurrencyRate = c.CurrencyRate == 0 ? 1 : c.CurrencyRate,
                CreatedTime = c.CreatedTime,
                CreatedUser = c.CreatedUser,
                ModifiedTime = c.ModifiedTime,
                ModifiedUser = c.ModifiedUser
            }).FirstOrDefault();

            return(res);
        }
Beispiel #6
0
        public ComplaintRequestViewModel GetRequest(int requestId, string culture)
        {
            ComplaintRequestViewModel Request = (from req in context.ComplainRequests
                                                 where req.Id == requestId
                                                 join p in context.People on req.EmpId equals p.Id
                                                 select new ComplaintRequestViewModel()
            {
                Id = req.Id,
                RequestDate = req.RequestDate,
                EmpId = req.EmpId,
                Employee = HrContext.TrlsName(p.Title + " " + p.FirstName + " " + p.Familyname, culture),
                ApprovalStatus = req.ApprovalStatus,
                RejectReason = req.RejectReason,
                RejectDesc = req.RejectDesc,
                CancelReason = req.CancelReason,
                CancelDesc = req.CancelDesc,
                Attachments = HrContext.GetAttachments("ComplaintRequest", req.Id),
                CreatedTime = req.CreatedTime,
                CreatedUser = req.CreatedUser,
                ModifiedTime = req.ModifiedTime,
                ModifiedUser = req.ModifiedUser,
                ComplainType = req.ComplainType,
                Description = req.Description,
                Against = req.Against
            }).FirstOrDefault();

            return(Request);
        }
Beispiel #7
0
        public EmpTasksViewModel GetEmployeeTask(int Id, string culture)
        {
            EmpTasksViewModel task = context.EmpTasks.Where(t => t.Id == Id)
                                     .Select(t => new EmpTasksViewModel
            {
                Id           = t.Id,
                EmpList      = t.EmpChklist.Name,
                Manager      = HrContext.TrlsName(t.Manager.Title + " " + t.Manager.FirstName + " " + t.Manager.Familyname, culture),
                Description  = t.Description,
                Priority     = t.Priority,
                Status       = t.Status,
                TaskCategory = HrContext.GetLookUpCode("EmpTaskCat", t.TaskCat.Value, culture),
                TaskNo       = t.TaskNo,
                AssignedTime = t.AssignedTime,
                Attachments  = HrContext.GetAttachments("EmpTasksForm", t.Id),
                StartTime    = t.StartTime,
                EndTime      = t.EndTime,
                Duration     = t.Duration,
                EmpListId    = t.EmpListId,
                ExpectDur    = t.ExpectDur,
                Unit         = t.Unit,
                Required     = t.Required,
                Employee     = HrContext.TrlsName(t.EmpChklist.Employee.Title + " " + t.EmpChklist.Employee.FirstName + " " + t.EmpChklist.Employee.Familyname, culture),
            }).FirstOrDefault();

            return(task);
        }
        public RenewRequestViewModel GetRenewRequest(int requestId)
        {
            if (requestId == 0)
            {
                return(new RenewRequestViewModel());
            }


            RenewRequestViewModel Request = context.RenewRequests.Where(r => r.Id == requestId).Select(rw => new RenewRequestViewModel
            {
                Id             = rw.Id,
                ApprovalStatus = rw.ApprovalStatus,
                ColumnName     = rw.ColumnName,
                EmpId          = rw.EmpId,
                CompanyId      = rw.CompanyId,
                NewValue       = rw.NewValue,
                NewValueId     = rw.NewValueId,
                OldValue       = rw.OldValue,
                OldValueId     = rw.OldValueId,
                RejectionRes   = rw.RejectionRes,
                RequestDate    = rw.RequestDate,
                CreatedUser    = rw.CreatedUser,
                CreatedTime    = rw.CreatedTime,
                Attachments    = HrContext.GetAttachments("RenewRequest", rw.Id)
            }).FirstOrDefault();

            return(Request);
        }
        public EmpDisciplineFormViewModel ReadEmployeeDiscipline(int Id)
        {
            var c     = context.EmpDisciplines.FirstOrDefault(a => a.Id == Id);
            var query = new EmpDisciplineFormViewModel
            {
                Id            = c.Id,
                ActDispline   = c.ActDispline,
                ActualNofDays = c.ActualNofDays,
                ActualPeriod  = c.ActualPeriod,
                DeductPoint   = c.DeductPoint,
                DescionDate   = c.DescionDate,
                DescionNo     = c.DescionNo,
                SuggPeriod    = c.SuggPeriod,
                Defense       = c.Defense,
                Description   = c.Description,
                EmpId         = c.EmpId,
                DiscplinId    = c.DiscplinId,
                ViolDate      = c.ViolDate,
                Summary       = c.Summary,
                SuggDispline  = c.SuggDispline,
                EffectEDate   = c.EffectEDate,
                Manager       = c.Manager,
                Attachments   = HrContext.GetAttachments("EmpDisciplines", c.Id),
                SuggNofDays   = c.SuggNofDays,
                IWitness      = c.Witness == null ? null : c.Witness.Split(',').Select(int.Parse).ToList(),
                ModifiedTime  = c.ModifiedTime,
                ModifiedUser  = c.ModifiedUser,
                CreatedUser   = c.CreatedUser,
                CreatedTime   = c.CreatedTime,
                InvestigatId  = c.InvestigatId
            };

            return(query);
        }
        public BenefitRequestFollowUp GetRequest(int requestId, string culture)
        {
            BenefitRequestFollowUp Request = (from req in context.BenefitRequests
                                              where req.Id == requestId
                                              join p in context.People on req.EmpId equals p.Id
                                              select new BenefitRequestFollowUp()
            {
                Id = req.Id,
                RequestDate = req.RequestDate,
                EmpId = req.EmpId,
                Employee = HrContext.TrlsName(p.Title + " " + p.FirstName + " " + p.Familyname, culture),
                ApprovalStatus = req.ApprovalStatus,
                RejectReason = req.RejectReason,
                RejectDesc = req.RejectDesc,
                CancelReason = req.CancelReason,
                CancelDesc = req.CancelDesc,
                Attachments = HrContext.GetAttachments("MedicalRequests", req.Id),
                CreatedTime = req.CreatedTime,
                CreatedUser = req.CreatedUser,
                ModifiedTime = req.ModifiedTime,
                ModifiedUser = req.ModifiedUser,
                Description = req.Description,
                CompanyCost = req.CompanyCost,
                Curr = req.Curr,
                EmpCost = req.EmpCost,
                CurrRate = req.CurrRate,
                ServCost = req.ServCost,
                ServiceId = req.ServiceId,
                ProviderId = req.ProviderId,
                BeneficiaryId = req.BeneficiaryId,
                ExpiryDate = req.ExpiryDate,
                ServEndDate = req.ServEndDate,
                ServStartDate = req.ServStartDate,
                IssueDate = req.IssueDate,
                BenefitPlanId = req.BenefitPlanId,
                BenefitId = req.BenefitId,
                PaidBy = req.PaidBy
            }).FirstOrDefault();

            return(Request);
        }
Beispiel #11
0
        //ReadRecievedCustody
        public RecievedCustodyForm ReadRecievedCustody(int id, string culture)
        {
            var res = (from c in context.Custody
                       where c.Id == id
                       select new RecievedCustodyForm
            {
                CustodyId = id,
                Name = c.Name,
                CompanyId = c.CompanyId,
                CustodyCatId = c.CustodyCatId,
                PurchaseDate = c.PurchaseDate,
                RecvStatus = c.Status,
                PurchaseAmount = c.PurchaseAmount,
                ItemCode = c.ItemCode,
                Qty = 1,
                SerialNo = c.SerialNo,
                Attachments = HrContext.GetAttachments("RecieveCustody", id),
            }).FirstOrDefault();

            return(res);
        }
Beispiel #12
0
        public ComplaintRequestViewModel ReadComplaint(int id)
        {
            var res = (from c in context.ComplainRequests
                       where c.Id == id
                       select new ComplaintRequestViewModel
            {
                Id = c.Id,
                Against = c.Against,
                ApprovalStatus = c.ApprovalStatus,
                ComplainType = c.ComplainType,
                Description = c.Description,
                EmpId = c.EmpId,
                Attachments = HrContext.GetAttachments("ComplainRequests", c.Id),
                CreatedTime = c.CreatedTime,
                ModifiedTime = c.ModifiedTime,
                ModifiedUser = c.ModifiedUser,
                CreatedUser = c.CreatedUser
            }).FirstOrDefault();

            return(res);
        }
        public TerminationFormViewModel ReadTermination(int id, string culture)
        {
            if (id == 0)
            {
                return new TerminationFormViewModel {
                           ServStartDate = DateTime.Now,
                           PlanedDate    = DateTime.Now
                }
            }
            ;

            return((from r in context.Terminations
                    where r.Id == id
                    select new TerminationFormViewModel
            {
                Id = r.Id,
                ActualDate = r.ActualDate,
                JoinedDate = r.ServStartDate,
                ApprovalStatus = r.ApprovalStatus,
                AssignStatus = r.AssignStatus,
                EmpId = r.EmpId,
                ServStartDate = r.ServStartDate,
                Employee = HrContext.TrlsName(r.Employee.Title + " " + r.Employee.FirstName + " " + r.Employee.Familyname, culture),
                LastAccDate = r.LastAccDate,
                LastAdjustDate = r.LastAdjustDate,
                PersonType = r.PersonType,
                PlanedDate = r.PlanedDate == null ? DateTime.Now : r.PlanedDate,
                BonusInMonths = r.BonusInMonths,
                ServYear = r.ServYear,
                TermReason = r.TermReason,
                Terminated = r.Terminated,
                CancelDesc = r.CancelDesc,
                CancelReason = r.CancelReason,
                Attachments = HrContext.GetAttachments("TermRequestForm", r.Id),
                ReasonDesc = r.ReasonDesc,
                RejectDesc = r.RejectDesc,
                RejectReason = r.RejectReason,
                RequestDate = r.RequestDate
            }).FirstOrDefault());
        }
Beispiel #14
0
        //ReadDeleverCustody
        public DeleverCustodyFormViewModel ReadDeleverCustody(int id, int EmpId, int EmpCustodyId, int companyId, string culture)
        {
            var res = (from c in context.Custody
                       where c.Id == id && c.CompanyId == companyId
                       join e in context.EmpCustodies on c.Id equals e.CustodyId where e.Id == EmpCustodyId
                       select new DeleverCustodyFormViewModel
            {
                Id = EmpCustodyId,
                CustodyId = id,
                EmpCustodyId = EmpCustodyId,
                Name = c.Name,
                CompanyId = c.CompanyId,
                CustodyCatId = c.CustodyCatId,
                delvryStatus = c.Status,
                EmpId = EmpId,
                RecvStatus = c.Status,
                Notes = e.Notes,
                RecvDate = e.RecvDate,
                Attachments = HrContext.GetAttachments("DeleverCustody", id)
            }).FirstOrDefault();

            return(res);
        }
Beispiel #15
0
        public MessageViewModel ReadFormMessage(int id, string culture)
        {
            var query = context.Messages.Where(a => a.Id == id).Select(a => new { msg = a, Attachments = HrContext.GetAttachments("EmpMessageForm", a.Id), }).FirstOrDefault();
            var mod   = new MessageViewModel()
            {
                Id            = query.msg.Id,
                All           = query.msg.All,
                Body          = query.msg.Body,
                CreatedTime   = query.msg.CreatedTime,
                IDepts        = query.msg.Depts == null ? null : query.msg.Depts.Split(',').Select(int.Parse).ToList(),
                IEmployees    = query.msg.Employees == null ? null : query.msg.Employees.Split(',').Select(int.Parse).ToList(),
                IPeopleGroups = query.msg.PeopleGroups == null ? null : query.msg.PeopleGroups.Split(',').Select(int.Parse).ToList(),
                IJobs         = query.msg.Jobs == null ? null : query.msg.Jobs.Split(',').Select(int.Parse).ToList(),
                Sent          = query.msg.Sent,
                Title         = query.msg.Title,
                Attachments   = query.Attachments
            };

            return(mod);
        }
 public int CompanyAttachmentsCount(int SourceId)
 {
     return(HrContext.GetAttachments("Company", SourceId));
 }
        public PeoplesViewModel ReadPerson(int id, string culture)
        {
            var person = (from p in context.People
                          where p.Id == id
                          select new PeoplesViewModel
            {
                Id = p.Id,
                BloodClass = p.BloodClass,
                BirthCity = p.BirthCity,
                BirthCountry = p.BirthCountry,
                WorkTel = p.WorkTel,
                ProviderId = p.ProviderId,
                EmergencyTel = p.EmergencyTel,
                BirthDate = p.BirthDate,
                ExpiryDate = p.ExpiryDate,
                Familyname = p.Familyname,
                Gender = p.Gender,
                localName = HrContext.TrlsName(p.Title + " " + p.FirstName + " " + p.Familyname, culture),
                Attachments = HrContext.GetAttachments("People", p.Id),
                BirthDstrct = p.BirthDstrct,
                Fathername = p.Fathername,
                FirstName = p.FirstName,
                HomeTel = p.HomeTel,
                GFathername = p.GFathername,
                IssueDate = p.IssueDate,
                JoinDate = p.JoinDate,
                IssuePlace = p.IssuePlace,
                KafeelId = p.KafeelId,
                InspectDate = p.InspectDate,
                MaritalStat = p.MaritalStat,
                MedStatDate = p.MedStatDate,
                Mobile = p.Mobile,
                MedicalStat = p.MedicalStat,
                Rank = p.Rank,
                MilResDate = p.MilResDate,
                MilCertGrade = p.MilCertGrade,
                MilitaryNo = p.MilitaryNo,
                MilStatDate = p.MilStatDate,
                NationalId = p.NationalId,
                MilitaryStat = p.MilitaryStat,
                Nationality = p.Nationality,
                PassportNo = p.PassportNo,
                Profession = p.Profession,
                RecommenReson = p.RecommenReson,
                Recommend = p.Recommend,
                Religion = p.Religion,
                OtherEmail = p.OtherEmail,
                Ssn = p.Ssn,
                QualificationId = p.QualificationId,
                Title = p.Title,
                WorkEmail = p.WorkEmail,
                TaxFamlyCnt = p.TaxFamlyCnt,
                BnftFamlyCnt = p.BnftFamlyCnt,
                StartExpDate = p.StartExpDate,
                EmpStatus = HrContext.GetEmpStatus(p.Id),
                CreatedTime = p.CreatedTime,
                ModifiedTime = p.ModifiedTime,
                ModifiedUser = p.ModifiedUser,
                CreatedUser = p.CreatedUser,
                PicUrl = HrContext.GetDocument("EmployeePic", p.Id),
                HasImage = p.HasImage,
                IdIssueDate = p.IdIssueDate,
                VisaNo = p.VisaNo,
                VarSubAmt = p.VarSubAmt,
                BasicSubAmt = p.BasicSubAmt,
                SubscripDate = p.SubscripDate,
                Address1 = p.Address1,
                CityId = p.CityId,
                CountryId = p.CountryId,
                DistrictId = p.DistrictId,
                HoAddress = p.HoAddress,
                Latitude = p.Latitude,
                Longitude = p.Longitude,
                TreatCardNo = p.TreatCardNo,
                Status = p.Status,
                PaperStatus = p.PaperStatus
            }).FirstOrDefault();

            return(person);
        }