Exemplo n.º 1
0
        public async Task <BaseResult <int> > InsertBoard(ListTaskViewModel model)
        {
            var listTask = _mapper.Map <TaskProject>(model);

            await _reposProjectTask.InsertAsync(listTask);

            return(BaseResult <int> .OK(listTask.Id, Messages.ItemInserted));
        }
Exemplo n.º 2
0
        public async Task <HttpResponse <int> > InsertListTask(ListTaskViewModel model)
        {
            var repos    = _unitOfWork.Repository <ListTask>();
            var listTask = _mapper.Map <ListTask>(model);
            await repos.InsertAsync(listTask);

            return(HttpResponse <int> .OK(listTask.Id, Messages.ItemInserted));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Update([FromBody] ListTask model, int id, ListTaskViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                var errors = ModelState.Select(x => x.Value.Errors)
                             .Where(y => y.Count > 0)
                             .ToList();
                return(BadRequest(errors));
            }

            var found = await context.ListTasks.FindAsync(id);

            if (found != null)
            {
                found.Title     = model.Title;
                found.Desc      = model.Desc;
                found.UpdatedAt = DateTime.Now;
                await context.SaveChangesAsync();

                var history = new ProjectHistory()
                {
                    ProjectId = model.ProjectId,
                    UserId    = model.UserId,
                    Content   = "Thay đổi danh sách công việc",
                    CreatedAt = DateTime.Now,
                    UpdatedAt = DateTime.Now
                };

                await context.ProjectHistories.AddAsync(history);

                await context.SaveChangesAsync();

                var FullName = await context.Users.Where(u => u.Id == model.UserId).Select(u => u.FullName).FirstAsync();

                /*==============================
                *  Get projects and projectHistory
                *  ==============================*/

                viewModel.Id        = id;
                viewModel.Title     = model.Title;
                viewModel.Desc      = model.Desc;
                viewModel.ProjectId = model.ProjectId;
                viewModel.FullName  = FullName;
                viewModel.Content   = history.Content;
                viewModel.CreatedAt = viewModel.CreatedAt;
                return(Ok(viewModel));
            }


            return(BadRequest("Không tồn tại list task"));
        }
Exemplo n.º 4
0
        private ListTaskViewModel GetTaskViewModel(Task task, ListItemModelBase parent)
        {
            var taskViewModel = new ListTaskViewModel(task, parent, _dataService, _userRepository);

            foreach (var timeEntry in task.TimeEntries)
            {
                var timeEntryViewModel = GetTimeEntryViewModel(timeEntry, taskViewModel);
                if (timeEntryViewModel != null)
                {
                    taskViewModel.Children.Add(timeEntryViewModel);
                }
            }

            return(taskViewModel);
        }
Exemplo n.º 5
0
        public async Task <BaseResult <int> > UpdateBoard(ListTaskViewModel model, int id)
        {
            var listTask = await _reposProjectTask.FindAsync(id);

            if (listTask == null)
            {
                return(BaseResult <int> .Error(Messages.ActionFailed, statusCode : System.Net.HttpStatusCode.NoContent));
            }

            listTask.Name      = model.Name;
            listTask.ProjectId = model.ProjectId;
            int saved = await _unitOfWork.SaveChangesAsync();

            if (saved > 0)
            {
                return(BaseResult <int> .OK(listTask.Id, Messages.ItemUpdated));
            }

            return(BaseResult <int> .Error(Messages.ActionFailed, statusCode : System.Net.HttpStatusCode.BadRequest));
        }
Exemplo n.º 6
0
        public async Task <HttpResponse <int> > UpdateListTask(ListTaskViewModel model, int id)
        {
            var repos    = _unitOfWork.Repository <ListTask>();
            var listTask = await repos.FindAsync(id);

            if (listTask == null)
            {
                return(HttpResponse <int> .Error(Messages.ActionFailed, statusCode : System.Net.HttpStatusCode.NoContent));
            }

            listTask.Name      = model.Name;
            listTask.ProjectId = model.ProjectId;
            int saved = await _unitOfWork.SaveChangesAsync();

            if (saved > 0)
            {
                return(HttpResponse <int> .OK(listTask.Id, Messages.ItemUpdated));
            }

            return(HttpResponse <int> .Error(Messages.ActionFailed, statusCode : System.Net.HttpStatusCode.BadRequest));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Delete(int id, int UserId, ListTaskViewModel viewModel)
        {
            var found = await context.ListTasks.FindAsync(id);

            if (found != null)
            {
                context.ListTasks.Remove(found);
                await context.SaveChangesAsync();

                var history = new ProjectHistory()
                {
                    ProjectId = found.ProjectId,
                    UserId    = found.UserId,
                    Content   = "Xóa danh sách công việc",
                    CreatedAt = DateTime.Now,
                    UpdatedAt = DateTime.Now
                };

                await context.ProjectHistories.AddAsync(history);

                await context.SaveChangesAsync();

                var FullName = await context.Users.Where(u => u.Id == UserId).Select(u => u.FullName).FirstAsync();

                /*==============================
                *  Get projects and projectHistory
                *  ==============================*/

                viewModel.Id        = id;
                viewModel.Title     = found.Title;
                viewModel.Desc      = found.Desc;
                viewModel.ProjectId = found.ProjectId;
                viewModel.FullName  = FullName;
                viewModel.Content   = history.Content;
                viewModel.CreatedAt = viewModel.CreatedAt;
                return(Ok(viewModel));
            }
            return(BadRequest("Không tồn tại list task"));
        }
Exemplo n.º 8
0
        public List <ListTaskViewModel> get(ParamListDetail model)
        {
            List <ListTaskViewModel> ListData = new List <ListTaskViewModel>();
            var connectionString = context.Database.GetDbConnection().ConnectionString;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                var pPriorityLevel = string.Join(",", model.pPriorityLevel);
                //foreach (var item in model.pPriorityLevel)
                //{
                //    pPriorityLevel = pPriorityLevel + "|" + item;
                //}
                //Declare COnnection
                var        querySstring = "spMKT_POLO_TASK_INQUIRY_LIST_VIEW";
                SqlCommand command      = new SqlCommand(querySstring, connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                //Define Query Parameter
                command.Parameters.AddWithValue("@pRegion", model.pRegion);
                command.Parameters.AddWithValue("@pFPName", model.pFPName);
                command.Parameters.AddWithValue("@pBranchName", model.pBranchName);
                command.Parameters.AddWithValue("@pEmpPosition", model.pEmpPosition);
                command.Parameters.AddWithValue("@pTaskID", model.pTaskID);
                command.Parameters.AddWithValue("@pStatProspek", model.pStatProspek);
                command.Parameters.AddWithValue("@pAppID", model.pAppID);
                command.Parameters.AddWithValue("@pPriorityLevel", pPriorityLevel);
                command.Parameters.AddWithValue("@pCustName", model.pCustName);
                command.Parameters.AddWithValue("@pStatDukcapil", model.pStatDukcapil);
                command.Parameters.AddWithValue("@pSdate", model.pSdate);
                command.Parameters.AddWithValue("@pEdate", model.pEdate);
                command.Parameters.AddWithValue("@pSourceData", model.pSourceData);
                command.Parameters.AddWithValue("@pEmpNo", model.pEmpNo);
                //open Connection
                command.Connection.Open();

                //PRoses Sp
                SqlDataReader rd = command.ExecuteReader();
                while (rd.Read())
                {
                    ListTaskViewModel data = new ListTaskViewModel();
                    data.sourceData   = rd[0].ToString();
                    data.cabang       = rd[1].ToString();
                    data.regional     = rd[2].ToString();
                    data.taskID       = rd[3].ToString();
                    data.jenisTask    = rd[4].ToString();
                    data.customerID   = rd[5].ToString();
                    data.customerName = rd[6].ToString();
                    try
                    {
                        data.distributedDT = Convert.ToDateTime(rd[7].ToString()).ToString("dd/MM/yyyy HH:mm:ss.mmm");
                    }
                    catch
                    {
                        data.distributedDT = rd[7].ToString();
                    }
                    try
                    {
                        data.startedDT = Convert.ToDateTime(rd[8].ToString()).ToString("dd/MM/yyyy HH:mm:ss.mmm");
                    }
                    catch
                    {
                        data.startedDT = rd[8].ToString();
                    }
                    data.slaRemaining    = rd[9].ToString();
                    data.fieldPersonName = rd[10].ToString();
                    data.empPosition     = rd[11].ToString();
                    data.statusProspek   = rd[12].ToString();
                    data.priorityLevel   = rd[13].ToString();
                    data.aplikasiAI      = rd[14].ToString();
                    data.applicationID   = rd[15].ToString();
                    data.statusMSS       = rd[16].ToString();
                    data.statusWISE      = rd[17].ToString();
                    data.statusDukcapil  = rd[18].ToString();
                    data.soa             = rd[19].ToString();
                    data.referentorName  = rd[20].ToString();
                    data.referentorName2 = rd[21].ToString();
                    data.orderInID       = rd[22].ToString();
                    ListData.Add(data);
                }

                //Connection Close
                command.Connection.Close();
            }
            return(ListData);
        }
Exemplo n.º 9
0
        public async Task <IActionResult> UpdateBoard([FromBody] ListTaskViewModel model, [FromRoute] int boardId)
        {
            var response = await _taskService.UpdateBoard(model, boardId);

            return(StatusCode(response));
        }
Exemplo n.º 10
0
        public async Task <IActionResult> InsertBoard([FromBody] ListTaskViewModel model)
        {
            var response = await _taskService.InsertBoard(model);

            return(StatusCode(response));
        }
Exemplo n.º 11
0
        public async Task <IActionResult> UpdateListTask([FromBody] ListTaskViewModel model, int id)
        {
            var response = await _taskService.UpdateListTask(model, id);

            return(StatusCode(response));
        }
        public List <ListTaskViewModel> UploadData(UploadViewModel model, string guid)
        {
            List <ListTaskViewModel> ListData = new List <ListTaskViewModel>();
            var connectionString = context.Database.GetDbConnection().ConnectionString;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                var        querySstring = "spMKT_POLO_UPLOAD_STATUS_TASK";
                SqlCommand command      = new SqlCommand(querySstring, connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                //Define Query Parameter
                command.Parameters.AddWithValue("@pOfficeCode", model.CabId);
                command.Parameters.AddWithValue("@pOfficeName", model.BranchName);
                command.Parameters.AddWithValue("@pOfficeRegionCode", model.RegionalId);
                command.Parameters.AddWithValue("@pOfficeRegionName", model.Region);
                command.Parameters.AddWithValue("@pTaskID", model.TaskID);
                command.Parameters.AddWithValue("@pJenisTask", model.JenisTask);
                command.Parameters.AddWithValue("@pCustNo", model.CustID);
                command.Parameters.AddWithValue("@pCustName", model.CustomerName);
                command.Parameters.AddWithValue("@pDistributedDt", model.DistributedDate);
                command.Parameters.AddWithValue("@pStartedDt", model.StartedDate);
                command.Parameters.AddWithValue("@pEmpPosition", model.EmpPosition);
                command.Parameters.AddWithValue("@pSoa", model.soa);
                command.Parameters.AddWithValue("@pReferentor1", model.Referentor1);
                command.Parameters.AddWithValue("@pProduct", model.Product);
                command.Parameters.AddWithValue("@pIdNo", model.NIK);
                command.Parameters.AddWithValue("@pBirthPlace", model.TempatLahir);
                command.Parameters.AddWithValue("@pBirthDt", model.TglLahir);
                command.Parameters.AddWithValue("@pRwLeg", model.RWLeg);
                command.Parameters.AddWithValue("@pProvinsiLeg", model.ProvLeg);
                command.Parameters.AddWithValue("@pKabupatenLeg", model.KabLeg);
                command.Parameters.AddWithValue("@pKecamatanLeg", model.KecLeg);
                command.Parameters.AddWithValue("@pKelurahanLeg", model.KelLeg);
                command.Parameters.AddWithValue("@pAlamatRes", model.AlamatRes);
                command.Parameters.AddWithValue("@pRtRes", model.RTRes);
                command.Parameters.AddWithValue("@pRwRes", model.RWRes);
                command.Parameters.AddWithValue("@pProvinsiRes", model.ProvRes);
                command.Parameters.AddWithValue("@pKabupatenRes", model.KabRes);
                command.Parameters.AddWithValue("@pKecamatanRes", model.KecRes);
                command.Parameters.AddWithValue("@pKelurahanRes", model.KelRes);
                command.Parameters.AddWithValue("@pMachineNo", model.NoMesin);
                command.Parameters.AddWithValue("@pChassisNo", model.NoRangka);
                command.Parameters.AddWithValue("@pItemType", model.ItemType);
                command.Parameters.AddWithValue("@pItemDescription", model.ItemDescription);
                command.Parameters.AddWithValue("@pMobile1", model.Mobile1);
                command.Parameters.AddWithValue("@pMobile2", model.Mobile2);
                command.Parameters.AddWithValue("@pPhone1", model.Phone1);
                command.Parameters.AddWithValue("@pPhone2", model.Phone2);
                command.Parameters.AddWithValue("@pOfficePhone1", model.OfficePhone1);
                command.Parameters.AddWithValue("@pOfficePhone2", model.OfficePhone2);
                command.Parameters.AddWithValue("@pOtrPrice", model.OtrPrice);
                command.Parameters.AddWithValue("@pItemYear", model.ItemYear);
                command.Parameters.AddWithValue("@pMonthIncome", model.MonthlyIncome);
                command.Parameters.AddWithValue("@pMonthlyInstallment", model.MonthInstallment);
                command.Parameters.AddWithValue("@pDownPayment", model.DP);
                command.Parameters.AddWithValue("@pLtv", model.LTV);
                command.Parameters.AddWithValue("@pPlafond", model.Plafond);
                command.Parameters.AddWithValue("@pProfession", model.Pekerjaan);
                command.Parameters.AddWithValue("@pOsTenor", model.SisaTenor);
                command.Parameters.AddWithValue("@pTenorId", model.TenorId);
                command.Parameters.AddWithValue("@pReleaseDateBpkb", model.ReleaseDateBpkb);
                command.Parameters.AddWithValue("@pMaxPastDueDt", model.MaxPastDueDt);
                command.Parameters.AddWithValue("@pReligion", model.Religion);
                command.Parameters.AddWithValue("@pMaturityDt", model.MaturityDt);
                command.Parameters.AddWithValue("@pTglJatuhTempo", model.TanggalJatuhTempo);
                command.Parameters.AddWithValue("@pCallStat", model.StatusCall);
                command.Parameters.AddWithValue("@pAnswerCall", model.AnswerCall);
                command.Parameters.AddWithValue("@pCustRating", model.CustomerRating);
                command.Parameters.AddWithValue("@pProspectStat", model.StatusProspek);
                command.Parameters.AddWithValue("@pReasonNotProspek", model.ReasonNotProspek);
                command.Parameters.AddWithValue("@pNotes", model.Notes);
                command.Parameters.AddWithValue("@pQueueUid", guid);
                command.Parameters.AddWithValue("@pEmpNo", model.EmpNo);
                command.Parameters.AddWithValue("@pZipcodeLeg", model.KodePosLeg);
                command.Parameters.AddWithValue("@pSubZipcodeLeg", model.SubZipcodeLeg);
                command.Parameters.AddWithValue("@pZipcodeRes", model.KodePosRes);
                command.Parameters.AddWithValue("@pSubZipcodeRes", model.SubZipcodeRes);
                //open Connection
                command.Connection.Open();

                //PRoses Sp
                SqlDataReader rd = command.ExecuteReader();
                while (rd.Read())
                {
                    ListTaskViewModel data = new ListTaskViewModel();
                }

                //Connection Close
                command.Connection.Close();
            }
            return(ListData);
        }
Exemplo n.º 13
0
 private ListTimeEntryViewModel GetTimeEntryViewModel(TimeEntry timeEntry, ListTaskViewModel parent)
 {
     return(new ListTimeEntryViewModel(timeEntry, parent, _dataService, _userRepository));
 }