Ejemplo n.º 1
0
        public void UpdateTaskRecord(AddNewTaskListViewModel model, int UserId)
        {
            Task_List record = _db.Task_List.Where(x => x.Id == model.IdRecord).FirstOrDefault();

            record.Title          = model.Title;
            record.Description    = model.Description;
            record.AssignTo       = model.Assign;
            record.LastModifiedBy = UserId;

            if (model.DueDate != null)
            {
                var DyeDateToString = model.DueDate;
            }
            record.AlterBeforeDays = model.AlertBeforeDays;
            record.Status          = model.Status;
            record.Difualt         = true;
            record.LastModified    = DateTime.Now;
            _db.SaveChanges();
        }
Ejemplo n.º 2
0
        public ActionResult DeteteTask(int Id)
        {
            Task_List AddUser = _db.Task_List.Where(x => x.Id == Id).FirstOrDefault();

            AddUser.Archived     = true;
            AddUser.LastModified = DateTime.Now;
            _db.SaveChanges();
            var listrecord = _EmployeeProfileMethod.GetNewstaskrecord();
            MeEmployeeLeaverWizard modal = new MeEmployeeLeaverWizard();

            foreach (var item in listrecord)
            {
                TaskList m = new TaskList();
                m.TaskId      = item.Id;
                m.Title       = item.Title;
                m.Description = item.Description;
                m.EmployeeId  = Convert.ToInt32(item.AssignTo);
                m.DueDate     = Convert.ToDateTime(item.DueDate);
                modal.TaskList.Add(m);
            }
            return(PartialView("_Partial_Step-5", modal));
        }
Ejemplo n.º 3
0
        public void UpdateTaskRecord(AddNewTaskListViewModel model, int UserId)
        {
            if (model.IsTemp == 0)
            {
                Task_List record = _db.Task_List.Where(x => x.Id == model.IdRecord).FirstOrDefault();

                record.Title          = model.Title;
                record.Description    = model.Description;
                record.AssignTo       = model.Assign;
                record.LastModifiedBy = UserId;

                if (model.DueDate != null)
                {
                    var DyeDateToString = DateTime.ParseExact(model.DueDate, inputFormat, CultureInfo.InvariantCulture);
                    record.DueDate = Convert.ToDateTime(DyeDateToString.ToString(outputFormat));
                }
                record.AlterBeforeDays = model.AlertBeforeDays;
                record.Status          = model.Status;
                record.Difualt         = true;
                record.LastModified    = DateTime.Now;
                _db.SaveChanges();
            }
            else
            {
                Employee_Task_Temp save = _db.Employee_Task_Temp.Where(x => x.Id == model.IdRecord).FirstOrDefault();
                save.Title       = model.Title;
                save.Description = model.Description;
                save.AssignTo    = model.Assign;
                if (model.DueDate != null)
                {
                    var DyeDateToString = DateTime.ParseExact(model.DueDate, inputFormat, CultureInfo.InvariantCulture);
                    save.DueDate = Convert.ToDateTime(DyeDateToString.ToString(outputFormat));
                }
                save.AlterBeforeDays = model.AlertBeforeDays;
                save.Status          = model.Status;
                save.LastModified    = DateTime.Now;
                _db.SaveChanges();
            }
        }
Ejemplo n.º 4
0
        public void SaveData(AdminTaskViewModel model, List <TaskDocumentViewModel> documentList, int userId)
        {
            if (model.Id > 0)
            {
                Task_List task = _db.Task_List.Where(x => x.Id == model.Id).FirstOrDefault();
                task.Title        = model.Title;
                task.Category     = (int)model.CategoryId;
                task.AssignTo     = model.AssignToId;
                task.InRelationTo = model.InRelationToId;
                var DyeDateToString = DateTime.ParseExact(model.DueDate, inputFormat, CultureInfo.InvariantCulture);
                task.DueDate         = Convert.ToDateTime(DyeDateToString.ToString(outputFormat));
                task.Status          = (int)model.StatusId;
                task.AlterBeforeDays = model.AlertBeforeDays;
                task.Description     = model.Description;
                task.LastModifiedBy  = userId;
                task.LastModified    = DateTime.Now;
                _db.SaveChanges();


                foreach (var item in _db.Task_Documents.Where(x => x.TaskId == task.Id).ToList())
                {
                    _db.Task_Documents.Remove(item);
                    _db.SaveChanges();
                }
                foreach (var item in documentList)
                {
                    Task_Documents taskDocument = new Task_Documents();
                    taskDocument.TaskId               = task.Id;
                    taskDocument.NewName              = item.newName;
                    taskDocument.OriginalName         = item.originalName;
                    taskDocument.Description          = item.description;
                    taskDocument.Archived             = false;
                    taskDocument.UserIDCreatedBy      = userId;
                    taskDocument.CreatedDate          = DateTime.Now;
                    taskDocument.UserIDLastModifiedBy = userId;
                    taskDocument.LastModified         = DateTime.Now;
                    _db.Task_Documents.Add(taskDocument);
                    _db.SaveChanges();
                }
            }
            else
            {
                Task_List task = new Task_List();
                task.Title        = model.Title;
                task.Category     = (int)model.CategoryId;
                task.AssignTo     = model.AssignToId;
                task.InRelationTo = model.InRelationToId;
                var DyeDateToString = DateTime.ParseExact(model.DueDate, inputFormat, CultureInfo.InvariantCulture);
                task.DueDate         = Convert.ToDateTime(DyeDateToString.ToString(outputFormat));
                task.Status          = (int)model.StatusId;
                task.AlterBeforeDays = model.AlertBeforeDays;
                task.Description     = model.Description;
                task.Archived        = false;
                task.CreatedBy       = userId;
                task.Created         = DateTime.Now;
                task.LastModifiedBy  = userId;
                task.LastModified    = DateTime.Now;
                _db.Task_List.Add(task);
                _db.SaveChanges();


                foreach (var item in documentList)
                {
                    Task_Documents taskDocument = new Task_Documents();
                    taskDocument.TaskId               = task.Id;
                    taskDocument.NewName              = item.newName;
                    taskDocument.OriginalName         = item.originalName;
                    taskDocument.Description          = item.description;
                    taskDocument.Archived             = false;
                    taskDocument.UserIDCreatedBy      = userId;
                    taskDocument.CreatedDate          = DateTime.Now;
                    taskDocument.UserIDLastModifiedBy = userId;
                    taskDocument.LastModified         = DateTime.Now;
                    _db.Task_Documents.Add(taskDocument);
                    _db.SaveChanges();
                }
            }
        }
Ejemplo n.º 5
0
        public int SaveResourcetSet(MainResoureViewModel model)
        {
            //AspNetUser AddUser = _db.AspNetUsers.Where(x => x.Id == model.Id).FirstOrDefault();
            AspNetUser AddUser = new AspNetUser();

            //step 1
            AddUser.NameTitle    = model.Title;
            AddUser.FirstName    = model.FirstName;
            AddUser.LastName     = model.LastName;
            AddUser.OtherNames   = model.OtherNames;
            AddUser.KnownAs      = model.KnownAs;
            AddUser.SSOID        = model.SSO.ToUpper();
            AddUser.UserName     = model.UserNameEmail;
            AddUser.IMAddress    = model.IMAddress;
            AddUser.Gender       = model.Gender;
            AddUser.Archived     = false;
            AddUser.PasswordHash = model.PasswordHash;
            AddUser.CreatedDate  = DateTime.Now;
            AddUser.CreatedBy    = SessionProxy.UserId;
            if (model.DateOfBirth != null)
            {
                var DateOfBirthToString = DateTime.ParseExact(model.DateOfBirth, inputFormat, CultureInfo.InvariantCulture);
                AddUser.DateOfBirth = Convert.ToDateTime(DateOfBirthToString.ToString(outputFormat));
            }
            AddUser.Nationality     = model.Nationality;
            AddUser.NINumberSSN     = model.NIN_SSN;
            AddUser.image           = model.Picture;
            AddUser.IsReadAddReport = false;
            AddUser.IsReadArchived  = false;
            AddUser.IsReadHRRespo   = false;

            //Step 2
            if (model.StartDate != null)
            {
                var StartDateToString = DateTime.ParseExact(model.StartDate, inputFormat, CultureInfo.InvariantCulture);
                AddUser.StartDate = Convert.ToDateTime(StartDateToString.ToString(outputFormat));
            }
            AddUser.ResourceType = model.ResourceType;
            //AddUser.Reportsto = model.Reportsto;
            AddUser.AdditionalReportsto = model.AdditionalReportsto;
            AddUser.HRResponsible       = model.HRResponsible;
            AddUser.JobTitle            = model.JobTitle;
            AddUser.JobContryID         = model.JobCountrID;
            AddUser.Location            = model.Location;
            //AddUser.BusinessID = model.BusinessID;
            //AddUser.DivisionID = model.DivisionID;
            //AddUser.PoolID = model.PoolID;
            //AddUser.FunctionID = model.FunctionID;

            //step 3
            if (model.ProbationEndDate != null)
            {
                var ProbationEndDateToString = DateTime.ParseExact(model.ProbationEndDate, inputFormat, CultureInfo.InvariantCulture);
                AddUser.ProbationEndDate = Convert.ToDateTime(ProbationEndDateToString.ToString(outputFormat));
            }
            if (model.NextProbationReviewDate != null)
            {
                var NextProbationReviewDateToString = DateTime.ParseExact(model.NextProbationReviewDate, inputFormat, CultureInfo.InvariantCulture);
                AddUser.ProbationEndDate = Convert.ToDateTime(NextProbationReviewDateToString.ToString(outputFormat));
            }
            if (model.FixedTermEndDate != null)
            {
                var FixedTermEndDateToString = DateTime.ParseExact(model.FixedTermEndDate, inputFormat, CultureInfo.InvariantCulture);
                AddUser.FixedTermEndDate = Convert.ToDateTime(FixedTermEndDateToString.ToString(outputFormat));
            }
            AddUser.NoticePeriod             = model.NoticePeriodID;
            AddUser.MethodofRecruitmentSetup = model.MethodofRecruitmentSetup;
            AddUser.RecruitmentCost          = model.RecruitmentCost.ToString();
            // AddUser.CurrenciesId = model.curruncyID;
            if (model.HolidaysThisYear != null)
            {
                AddUser.Thisyear = (int)model.HolidaysThisYear;
            }
            if (model.HolidaysNextYear != null)
            {
                AddUser.Nextyear = (int)model.HolidaysNextYear;
            }
            if (model.IncludePublicHoliday != null)
            {
                if (model.IncludePublicHoliday == "on")
                {
                    AddUser.IncludePublicHoliday = true;
                }
                else
                {
                    AddUser.IncludePublicHoliday = false;
                }
            }
            if (model.HolidayEntit != 0 && model.HolidayEntit != null)
            {
                AddUser.HolidayEntitlement = model.HolidayEntit;
            }
            //step 4
            //AddUser.Country = model.CountryId;
            //AddUser.State = model.StateId;
            //AddUser.Town = model.CityyId;
            //AddUser.Airport = model.AirportId;
            //AddUser.Postcode = model.PostalCode;
            //AddUser.BankAddress = model.Address;
            AddUser.WorkPhone  = model.WorkPhone;
            AddUser.WorkMobile = model.WorkMobile;
            //AddUser.PersonalPhone = model.PersonalPhone;
            //AddUser.PersonalMobile = model.PersonalMobile;
            //AddUser.PersonalEmail = model.PersonalEmail;
            //AddUser.BankName = model.BankName;
            //AddUser.BankCode = model.BankCode;
            //AddUser.AccountNumber = model.AccountNumber;
            //AddUser.OtherAccountInformation = model.OtherAccountInformation;
            //AddUser.AccountName = model.AccountName;
            //AddUser.BankAddress = model.BankAddress;
            AddUser.CreatedBy = model.CurrentUserId;

            //Step 5
            JavaScriptSerializer         js             = new JavaScriptSerializer();
            List <AddnewtaskRecordmodel> listValueArray = js.Deserialize <List <AddnewtaskRecordmodel> >(model.JsonNewtaskList);

            foreach (var item in listValueArray)
            {
                Task_List ModelNew = new Task_List();
                ModelNew.InRelationTo    = model.Id;
                ModelNew.Title           = item.Title;
                ModelNew.Description     = item.Description;
                ModelNew.AssignTo        = item.Assign;
                ModelNew.Archived        = false;
                ModelNew.AlterBeforeDays = item.AlertBeforeDays;
                if (item.DueDate != "")
                {
                    var DueDateToString = DateTime.ParseExact(item.DueDate, inputFormat, CultureInfo.InvariantCulture);
                    ModelNew.DueDate = Convert.ToDateTime(DueDateToString.ToString(outputFormat));
                }
                ModelNew.Status       = item.Status;
                ModelNew.LastModified = DateTime.Now;
                ModelNew.Created      = DateTime.Now;
                _db.Task_List.Add(ModelNew);
            }
            _db.AspNetUsers.Add(AddUser);
            _db.SaveChanges();


            if (AddUser.Id > 0)
            {
                //Employee Relation
                EmployeeRelation _employeeRelation = new EmployeeRelation();
                _employeeRelation.UserID = AddUser.Id;
                if (model.Reportsto != null)
                {
                    _employeeRelation.Reportsto = model.Reportsto.Value;
                }
                _employeeRelation.BusinessID  = model.BusinessID;
                _employeeRelation.DivisionID  = model.DivisionID;
                _employeeRelation.PoolID      = model.PoolID;
                _employeeRelation.FunctionID  = model.FunctionID;
                _employeeRelation.CreateBy    = model.CurrentUserId;
                _employeeRelation.CreatedDate = DateTime.Now;
                _employeeRelation.IsActive    = true;
                _db.EmployeeRelations.Add(_employeeRelation);

                //Employee Address Info
                EmployeeAddressInfo _EmployeeAddressInfo = new EmployeeAddressInfo();
                _EmployeeAddressInfo.UserId         = AddUser.Id;
                _EmployeeAddressInfo.CountryId      = model.CountryId;
                _EmployeeAddressInfo.StateId        = model.StateId;
                _EmployeeAddressInfo.TownId         = model.CityyId;
                _EmployeeAddressInfo.AirportId      = model.AirportId;
                _EmployeeAddressInfo.PostCode       = model.PostalCode;
                _EmployeeAddressInfo.ContactAddress = model.Address;
                _EmployeeAddressInfo.PersonalPhone  = model.PersonalPhone;
                _EmployeeAddressInfo.PersonalMobile = model.PersonalMobile;
                _EmployeeAddressInfo.PersonalEmail  = model.PersonalEmail;
                _db.EmployeeAddressInfoes.Add(_EmployeeAddressInfo);

                EmployeeBankInfo _EmployeeBankInfo = new EmployeeBankInfo();
                _EmployeeBankInfo.UserId                  = AddUser.Id;
                _EmployeeBankInfo.BankName                = model.BankName;
                _EmployeeBankInfo.BankCode                = model.BankCode;
                _EmployeeBankInfo.AccountName             = model.AccountName;
                _EmployeeBankInfo.AccountNumber           = model.AccountNumber;
                _EmployeeBankInfo.OtherAccountInformation = model.OtherAccountInformation;
                _EmployeeBankInfo.BankAddress             = model.BankAddress;
                _EmployeeBankInfo.IBAN_No                 = model.IBAN_Number;
                _EmployeeBankInfo.SWIFT_Code              = model.SWIFT_Code;
                _db.EmployeeBankInfoes.Add(_EmployeeBankInfo);
            }

            if (model.ApplicantID != 0 && model.ApplicantID != null)
            {
                var AccepteID = _AdminTMSMethod.GetAcceptedStepId((int)model.ApplicantID);
                var data      = _db.TMS_Applicant.Where(x => x.Id == model.ApplicantID).FirstOrDefault();
                data.Archived     = true;
                data.StatusID     = AccepteID;
                data.LastModified = DateTime.Now;
            }
            _db.SaveChanges();
            return(AddUser.Id);
        }