Exemple #1
0
        public Tuple <int, dynamic> AddAppointments(TASK groupMeeting, string ClientId, string ConnectionString)
        {
            var Errormsg = new SqlParameter
            {
                ParameterName = "@ErrorMsg",
                Size          = -1,
                DbType        = System.Data.DbType.String,
                Direction     = System.Data.ParameterDirection.Output
            };

            try

            {
                string strConnectionString = GetConnectionString(ConnectionString, ClientId);
                int    rowAffected         = 0;
                using (SqlConnection con = new SqlConnection(strConnectionString))
                {
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }



                    string     query = "insert into Tasks (remark,StartTime,Label,EndTime,LakNum,OwnerIds,LtName,PLACE,Teur,TIK_IN,WITHWHO,AllDayEvent) values('" + groupMeeting.Remark + "','" + Convert.ToDateTime(groupMeeting.StartTime).ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss") + "','" + groupMeeting.Label + "','" + Convert.ToDateTime(groupMeeting.EndTime).ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss") + "','" + groupMeeting.lakNum + "','" + groupMeeting.OwnerIds + "','" + groupMeeting.LtName + "','" + groupMeeting.PLACE + "','" + groupMeeting.Teur + "','" + groupMeeting.TIK + "','" + groupMeeting.withwho + "','" + groupMeeting.AllDayEvent + "')";
                    SqlCommand cmd   = new SqlCommand(query, con);
                    rowAffected = cmd.ExecuteNonQuery();
                }



                return(new Tuple <int, dynamic>(rowAffected, Errormsg.Value));
            }
            catch (Exception e) { throw e.InnerException; }
        }
Exemple #2
0
        // GET: TASK/Edit/5
        public ActionResult Edit(int?id)
        {
            TASK customer = new TASK();

            customer = dao.Read(Convert.ToInt32(id));
            return(View(customer));
        }
Exemple #3
0
        public async Task ModifyTask(TaskModificationModel modificationModel, USER user)
        {
            TEAM team = _teamRepository.GetTeamById(modificationModel.TeamId);
            TASK task = _taskRepository.GetTaskById(modificationModel.TaskId);

            if (task != null && team != null)
            {
                if (_permissionService.CheckPermissionToCreateTasks(user, team.ID))
                {
                    task.TITLE       = modificationModel.Title;
                    task.DESCRIPTION = modificationModel.Description;
                    task.DEATHLINE   = modificationModel.Deathline;
                    task.START_TIME  = modificationModel.StartTime;
                    task.END_TIME    = modificationModel.EndTime;
                    task.USER        = String.IsNullOrEmpty(modificationModel.AssignedToId) ? null : await _userRepository.GetUserById(modificationModel.AssignedToId);

                    task.TASK_STATUS = _taskRepository.GetTaskStatusById(modificationModel.StatusId);
                }
                else
                {
                    if (_permissionService.CheckPermissionToAssignTasks(user, team.ID))
                    {
                        task.USER = String.IsNullOrEmpty(modificationModel.AssignedToId) ? null : await _userRepository.GetUserById(modificationModel.AssignedToId);
                    }
                    if (task.USER == user)
                    {
                        task.TASK_STATUS = _taskRepository.GetTaskStatusById(modificationModel.StatusId);
                    }
                }

                _taskRepository.UpdateTasks(new List <TASK> {
                    task
                });
            }
        }
Exemple #4
0
        //Update Operation
        public void Update(TASK obj)
        {
            TASK std = _DB.TASKs.Find(obj.ID);

            std = obj;
            _DB.SaveChanges();
        }
        public Task ChangeState(Int32 taskId, String status)
        {
            Task task = new Task();


            using (RecklessCheckListEntities context = new RecklessCheckListEntities())
            {
                Int32 valueId = (from v in context.TASK_VALUE
                                 where v.NAME == status
                                 select v.TASK_VALUE_ID).First();


                var taskSelect = from t in context.TASKs.Include("TASK_VALUE")
                                 where t.TASK_ID == taskId
                                 select t;

                if (taskSelect.Count() == 1)
                {
                    TASK contextTask = taskSelect.First();

                    contextTask.TASK_VALUE_ID = valueId;

                    context.SaveChanges();

                    task = new Task()
                    {
                        Id = contextTask.TASK_ID, Value = status, Name = contextTask.NAME
                    };
                }
            }

            return(task);
        }
        //public ResponseModel AddAppointments(Appointment appointment)
        //{

        //}

        public ResponseModel AddAppointments(Appointment appointment, string clinetId)
        {
            ResponseModel response = new ResponseModel();

            var task = new TASK
            {
                Remark      = appointment.description,
                StartTime   = appointment.startTime,
                Label       = appointment.label,
                AllDayEvent = appointment.AllDayEvent,
                EndTime     = appointment.endTime,
                LakNum      = appointment.lakNum,
                OwnerIds    = string.Join(",", appointment.ownerIds),
                LtName      = appointment.ltName,
                PLACE       = appointment.place,
                Teur        = appointment.teur,
                TIK         = appointment.tiK,
                WITHWHO     = appointment.withwho,
            };

            var getmiscellaneous = _unitOfWork.AppontmentRepository.AddAppointments(task, SessionUser.ClientID, SessionUser.ConnectionString);

            response.data   = getmiscellaneous.Item1;
            response.status = Status.Success;
            return(response);
        }
        public static void ConvertTask(TASK Task, FORMAT formatToConvert)
        {
            try
            {
                Task.STATUS = (int)EnumManager.PARAM_TASK_STATUS.EN_COURS;
                new TASK_Service().UpdateTask(Task);
                FFMpegService.Execute(Task.FILE_URL_TEMP, formatToConvert.FORMAT_FFMPEG_VALUE, Task.FILE_URL_DESTINATION);
                bool fileIsAvailable = CheckFileIsAvailable(Task.FILE_URL_DESTINATION);

                if (!fileIsAvailable)
                {
                    throw new Exception();
                }

                Task.DATE_END_CONVERSION = DateTime.Now;
                Task.STATUS = (int)EnumManager.PARAM_TASK_STATUS.EFFECTUE;
            }
            catch (Exception e)
            {
                Task.DATE_END_CONVERSION = DateTime.Now;
                Task.STATUS = (int)EnumManager.PARAM_TASK_STATUS.ERREUR;
                new TASK_Service().UpdateTask(Task);

                TRACE Trace = new TRACE {
                    FK_ID_TASK = Task.PK_ID_TASK, FK_ID_SERVER = 1, DATE_TRACE = DateTime.Now, NOM_SERVER = System.Environment.MachineName, DESCRIPTION = e.Message + " " + e.InnerException + " " + e.InnerException, METHOD = "Conversion FFMPEG Convert Task", TYPE = "ERROR"
                };
                new TRACE_Service().AddTrace(Trace);
            }
        }
        public static int GetNumberOfSplits(TASK task)
        {
            var listParam = new PARAM_LENGTH_Service().GetAll().OrderByDescending(q => q.PK_ID_PARAM_LENGTH);

            try
            {
                double megabytes = ConverterUtil.ConvertBytesToMegabytes((double)task.LENGTH);
                foreach (var param in listParam)
                {
                    if (megabytes >= param.LENGTH)
                    {
                        return((int)param.NB_OF_SPLITS);
                    }
                }
                return(1);
            }
            catch (Exception e)
            {
                task.STATUS = (int)EnumManager.PARAM_TASK_STATUS.ERREUR;
                new TASK_Service().UpdateTask(task);

                TRACE trace = new TRACE()
                {
                    FK_ID_TASK   = task.PK_ID_TASK,
                    FK_ID_SERVER = 1,
                    METHOD       = "GetNumberOfSplits problème lors de la recupération de la length",
                    TYPE         = "ERROR",
                    DESCRIPTION  = e.Message + " " + e.InnerException,
                    DATE_TRACE   = DateTime.Now,
                    NOM_SERVER   = System.Environment.MachineName
                };
                new TRACE_Service().AddTrace(trace);
                return(0);
            }
        }
Exemple #9
0
        /// <summary>
        /// Cria uma nova Task
        /// </summary>
        /// <param name="pTask"></param>
        public bool Save(TaskDTO pTask)
        {
            try
            {
                if (pTask.TaskID == 0)
                {
                    //Cria uma nova Task
                    TASK objTask = new TASK()
                    {
                        DATE_CREATION = DateTime.Now,
                        DESCRIPTION   = pTask.Description,
                        NAME          = pTask.Name,
                        STATUS        = (int)pTask.Status
                                        //STATUS = (int)TaskEnum.Operation.Create
                    };

                    //Adiciona o Histórico
                    objTask.TASK_HISTORY.Add(CreateHistory(TaskEnum.Operation.Create));

                    //Salva no Banco
                    objTaskDAL.Save(objTask);

                    return(true);
                }
                else
                {
                    return(Update(pTask));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #10
0
        // submit task form (process task) ////////////////////////////////

        public virtual void testProcessTaskSubmitTaskFormWithoutAuthorization()
        {
            // given
            startProcessInstanceByKey(FORM_PROCESS_KEY);
            string taskId = selectSingleTask().Id;

            try
            {
                // when
                formService.submitTaskForm(taskId, null);
                fail("Exception expected: It should not possible to submit a task form");
            }
            catch (AuthorizationException e)
            {
                // then
                string message = e.Message;
                assertTextPresent(userId, message);
                assertTextPresent(UPDATE.Name, message);
                assertTextPresent(taskId, message);
                assertTextPresent(TASK.resourceName(), message);
                assertTextPresent(UPDATE_TASK.Name, message);
                assertTextPresent(FORM_PROCESS_KEY, message);
                assertTextPresent(PROCESS_DEFINITION.resourceName(), message);
            }
        }
        /// <summary>
        /// Convert entity of database response dto of task
        /// </summary>
        /// <param name="modelDB">entity of database to convert</param>
        /// <returns>response dto of task </returns>
        private async Task <TaskResponseDTO> ConvertEntityDataBaseToResponseDTO(TASK modelDB)
        {
            try {
                return(await Task.Run(() => {
                    TaskResponseDTO modelResponse = null;
                    if (modelDB != null)
                    {
                        modelResponse = new TaskResponseDTO {
                            DESCRIPTION = modelDB.DESCRIPTION,
                            LOCAL = modelDB.LOCAL,
                            DATEINITIAL = modelDB.DATEINITIAL,
                            WARNINGTIME = modelDB.WARNINGTIME,
                            NAME = modelDB.USER.NAME,
                            SEQTASK = modelDB.SEQTASK,
                            SEQUSER = modelDB.SEQUSER
                        }
                    }
                    ;

                    return modelResponse;
                }));
            } catch (System.Exception ex) {
                throw new ApplicationException(ex.Message);
            }
        }
Exemple #12
0
        public static void CreateSplits(TASK MotherTask, VideoFile VideoFile)
        {
            int         Splits        = GetNumberOfSplits(MotherTask);
            TimeSpan    timeSpan      = new TimeSpan(VideoFile.Duration.Ticks / Splits);
            TimeSpan    begin         = new TimeSpan(0);
            long        durationTotal = VideoFile.Duration.Ticks;
            PARAM_SPLIT paramSplit    = new PARAM_SPLIT();

            while (Splits != 0)
            {
                if (Splits == GetNumberOfSplits(MotherTask))
                {
                    long stopSpan = new TimeSpan(begin.Ticks + timeSpan.Ticks).Ticks;
                    paramSplit = new PARAM_SPLIT()
                    {
                        BEGIN_PARAM_SPLIT = begin.Ticks.ToString(), END_PARAM_SPLIT = stopSpan.ToString()
                    };
                }
                else
                {
                    long stopSpan = new TimeSpan(timeSpan.Ticks + (durationTotal - timeSpan.Ticks)).Ticks;
                    paramSplit = new PARAM_SPLIT()
                    {
                        BEGIN_PARAM_SPLIT = timeSpan.Ticks.ToString(), END_PARAM_SPLIT = stopSpan.ToString()
                    };
                }

                new PARAM_SPLIT_Service().AddOrUpdateParamSplit(paramSplit);

                CreateSubTask(MotherTask, paramSplit);

                Splits--;
            }
        }
        public async Task <ResponseModel> Post([FromForm] int key, [FromForm] string values)
        {
            var newAppointment = new Appointment();

            JsonConvert.PopulateObject(values, newAppointment);
            var task = new TASK
            {
                Remark       = newAppointment.remark,
                StartTime    = Convert.ToDateTime(newAppointment.startTime),
                Label        = newAppointment.label,
                AllDayEvent  = Convert.ToBoolean(newAppointment.AllDayEvent),
                EndTime      = Convert.ToDateTime(newAppointment.endTime),
                LakNum       = newAppointment.lakNum,
                OwnerIds     = string.Join(",", newAppointment.ownerIds),
                LtName       = newAppointment.ltName,
                PLACE        = newAppointment.place,
                Teur         = newAppointment.teur,
                TIK          = newAppointment.tiK,
                WITHWHO      = newAppointment.HexBackColor,
                HexBackColor = newAppointment.HexBackColor,
                HexBarColor  = newAppointment.HexBarColor,
                HexForeColor = newAppointment.HexForeColor,
            };
            var detail = _appontmentService.UpdateAppointment(newAppointment, key);

            return(await Task.FromResult(detail));
        }
        public static string GetFileName(TASK Task)
        {
            int    count    = (Task.FILE_URL.LastIndexOf(@"\") + 1);
            string fileName = Task.FILE_URL.Substring(count);

            return(fileName);
        }
Exemple #15
0
        public HttpResponseMessage put(int id, TASK task)
        {
            try
            {
                using (TaskEntities entities = new TaskEntities())
                {
                    var entity = entities.TASK.FirstOrDefault(e => e.TaskId == id);
                    if (entity == null)
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Task doesnt exist"));
                    }
                    else
                    {
                        entity.AssignDate = task.AssignDate;
                        entity.DueDate    = task.DueDate;
                        entity.ProjectId  = task.ProjectId;
                        entity.TaskName   = task.TaskName;
                        entity.Status     = task.Status;

                        entities.SaveChanges();

                        return(Request.CreateResponse(HttpStatusCode.OK));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Exemple #16
0
        public ActionResult Delete(int id, string title)
        {
            TASK task = To_dO_List.taskList.Find(x => x.Id == id);

            To_dO_List.taskList.Remove(task);
            return(RedirectToAction("Index", "Tasks"));
        }
Exemple #17
0
        // submit task form (standalone task) ////////////////////////////////

        public virtual void testStandaloneTaskSubmitTaskFormWithoutAuthorization()
        {
            // given
            string taskId = "myTask";

            createTask(taskId);

            try
            {
                // when
                formService.submitTaskForm(taskId, null);
                fail("Exception expected: It should not possible to submit a task form");
            }
            catch (AuthorizationException e)
            {
                // then
                string message = e.Message;
                assertTextPresent(userId, message);
                assertTextPresent(UPDATE.Name, message);
                assertTextPresent(taskId, message);
                assertTextPresent(TASK.resourceName(), message);
            }

            deleteTask(taskId, true);
        }
Exemple #18
0
    private async Task RunAsync(CancellationToken cancellationToken)
    {
        // TODO: Remplacez le texte suivant par votre propre logique.
        while (!cancellationToken.IsCancellationRequested)
        {
            Trace.TraceInformation("Working");
            TASK_Service taskService = new TASK_Service();

            List <TASK> listOfTasks = taskService.GetListOfTaskByStatusToDoOrToMerge();

            if (listOfTasks.Count() > 0)
            {
                TASK task = listOfTasks.First();

                task.DATE_BEGIN_CONVERSION = DateTime.Now;
                taskService.AddOrUpdateTask(task);
                new TRACE_Service().AddTrace(new TRACE()
                {
                    FK_ID_TASK = task.PK_ID_TASK, FK_ID_SERVER = 1, METHOD = "INITIALISATION TASK", DESCRIPTION = "Récupération de la tache à effectuer"
                });
                TranscoderService.DoFFmpegConversion(task);
            }

            await Task.Delay(60000);
        }
    }
Exemple #19
0
        public static bool FFmpegMergeSplits(TASK Task, List <TASK> ListSubTasks)
        {
            try
            {
                // VideoFile videoFile = new VideoFile(Task.FILE_URL_TEMP);
                List <string> listOfUrls = new List <string>();
                foreach (var item in ListSubTasks)
                {
                    listOfUrls.Add(item.FILE_URL_DESTINATION);
                }

                string fileUrl  = Task.FILE_URL_TEMP;
                int    count    = (fileUrl.LastIndexOf(@"\") + 1);
                string fileName = fileName = fileUrl.Substring(count);
                count    = (fileName.LastIndexOf('.') + 1);
                fileName = fileName.Substring(0, count);
                Task.FILE_URL_DESTINATION = destinationFolder + @"\" + fileName + new FORMAT_Service().GetFormatById((int)Task.FK_ID_FORMAT_TO_CONVERT).FORMAT_NAME;

                VideoFile.MergeVideoSegment(listOfUrls, Task.FILE_URL_DESTINATION);
                return(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.StackTrace);
                return(false);
            }
        }
Exemple #20
0
        public static bool DoFFmpegConversion(TASK Task)
        {
            InitWorkspace();
            FORMAT formatToConvert = new FORMAT_Service().GetFormatById((int)Task.FK_ID_FORMAT_TO_CONVERT);

            try
            {
                if (Task.STATUS == (int)EnumManager.PARAM_TASK_STATUS.A_REASSEMBLER)
                {
                    Task.STATUS = (int)EnumManager.PARAM_TASK_STATUS.EN_COURS;
                    new TASK_Service().AddOrUpdateTask(Task);

                    List <TASK> listOfSubTaskByParent = new TASK_Service().GetSubTaskByMotherTask(Task.PK_ID_TASK);
                    bool        isMerged = FFmpegMergeSplits(Task, listOfSubTaskByParent);

                    if (isMerged)
                    {
                        Task.DATE_END_CONVERSION = DateTime.Now;
                        Task.STATUS = (int)EnumManager.PARAM_TASK_STATUS.EFFECTUE;
                    }
                }
                else
                if (!GetTaskAndSetIfTaskIsSplitted(Task, formatToConvert))
                {
                    Task.STATUS = (int)EnumManager.PARAM_TASK_STATUS.EN_COURS;
                    new TASK_Service().AddOrUpdateTask(Task);
                    FFMpegService.Execute(Task.FILE_URL_TEMP, formatToConvert.FORMAT_FFMPEG_VALUE, Task.FILE_URL_DESTINATION);
                    Task.DATE_END_CONVERSION = DateTime.Now;
                    Task.STATUS = (int)EnumManager.PARAM_TASK_STATUS.EFFECTUE;
                    // Verification si c'est une sous tache
                    // On vérifie si les sous taches ont été effectué ou pas.
                    if (Task.FK_ID_PARENT_TASK != null)
                    {
                        List <TASK> listOfSubTaskByParent = new TASK_Service().GetSubTaskByMotherTask((int)Task.FK_ID_PARENT_TASK);
                        int         totalEffectue         = listOfSubTaskByParent.Count(x => x.STATUS == (int)EnumManager.PARAM_TASK_STATUS.EFFECTUE);
                        if (totalEffectue.Equals(listOfSubTaskByParent.Count))
                        {
                            TASK MotherTask = new TASK_Service().GetTaskById((int)Task.FK_ID_PARENT_TASK);
                            MotherTask.STATUS = (int)EnumManager.PARAM_TASK_STATUS.A_REASSEMBLER;
                            new TASK_Service().AddOrUpdateTask(MotherTask);
                        }
                    }
                }

                new TASK_Service().AddOrUpdateTask(Task);
                return(true);
            }
            catch (Exception e)
            {
                Task.DATE_END_CONVERSION = DateTime.Now;
                Task.STATUS = (int)EnumManager.PARAM_TASK_STATUS.ERREUR;
                new TASK_Service().AddOrUpdateTask(Task);

                TRACE Trace = new TRACE {
                    FK_ID_TASK = Task.PK_ID_TASK, FK_ID_SERVER = 1, DATE_TRACE = DateTime.Now, NOM_SERVER = System.Environment.MachineName, DESCRIPTION = e.Message, METHOD = "CONVERSION FFMPEG", TYPE = "ERROR"
                };
                new TRACE_Service().AddTrace(Trace);
                return(false);
            }
        }
Exemple #21
0
        /// <summary>
        /// Atualiza uma Task
        /// </summary>
        /// <param name = "pTask" ></ param >
        public bool Update(TaskDTO pTask)
        {
            try
            {
                TASK objTask = objTaskDAL.Single(pTask.TaskID);

                if (objTask != null)
                {
                    //Atribui os novos valores a Task
                    objTask.DESCRIPTION = pTask.Description;
                    objTask.NAME        = pTask.Name;
                    objTask.STATUS      = (int)pTask.Status;

                    //Adiciona o histórico
                    objTask.TASK_HISTORY.Add(CreateHistory(TaskEnum.Operation.Update));

                    //Salva no Banco
                    objTaskDAL.Save(objTask);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #22
0
        public Tuple <List <TASK>, dynamic> GetAppointments(string ClientId, string ConnectionString)
        {
            TASK result = new TASK();

            try
            {
                string      strConnectionString = GetConnectionString(ConnectionString, ClientId);
                List <TASK> groupMeetingsList   = new List <TASK>();
                var         Errormsg            = new SqlParameter
                {
                    ParameterName = "@ErrorMsg",
                    Size          = -1,
                    DbType        = System.Data.DbType.String,
                    Direction     = System.Data.ParameterDirection.Output
                };
                using (IDbConnection con = new SqlConnection(strConnectionString))
                {
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }


                    groupMeetingsList = con.Query <TASK>("Select * from Tasks where isdeleted=0").ToList();
                    return(new Tuple <List <TASK>, dynamic>(groupMeetingsList, Errormsg.Value));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            // Info.
        }
Exemple #23
0
        /// <summary>
        /// Atribuí o status de Excluído para a Task
        /// </summary>
        /// <param name="pTaskID"></param>
        /// <returns></returns>
        public bool Delete(int pTaskID)
        {
            try
            {
                TASK objTask = objTaskDAL.Single(pTaskID);
                if (objTask != null)
                {
                    //Cria o histórico da Task
                    objTask.TASK_HISTORY.Add(CreateHistory(TaskEnum.Operation.Delete));

                    //Seta a task para Excluído
                    objTask.STATUS = (int)TaskEnum.Status.Excluido;

                    //Salva no banco
                    objTaskDAL.Save(objTask);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #24
0
        // GET: TASK/Delete/5
        public ActionResult Delete(int id)
        {
            TASK customer = new TASK();

            customer = dao.Read(id);
            return(View(customer));
        }
Exemple #25
0
        public Tuple <int, dynamic> UpdateAppointments(string PrimekeyName, TASK value, string ClientId, string ConnectionString, int id)
        {
            var Errormsg = new SqlParameter
            {
                ParameterName = "@ErrorMsg",
                Size          = -1,
                DbType        = System.Data.DbType.String,
                Direction     = System.Data.ParameterDirection.Output
            };

            try

            {
                string strConnectionString = GetConnectionString(ConnectionString, ClientId);
                int    rowAffected         = 0;
                using (SqlConnection con = new SqlConnection(strConnectionString))
                {
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }



                    //rowAffected = cmd.ExecuteNonQuery();
                    rowAffected = UpdateAppointment(PrimekeyName, id, value, "", strConnectionString);
                }



                return(new Tuple <int, dynamic>(rowAffected, Errormsg.Value));
            }
            catch (Exception e) { throw e.InnerException; }
        }
Exemple #26
0
        //Delete Operation
        public void Delete(int id)
        {
            TASK obj = new TASK();

            obj = _DB.TASKs.Find(id);
            _DB.TASKs.Remove(obj);
            _DB.SaveChanges();
        }
Exemple #27
0
        public ActionResult DeleteConfirmed(int id)
        {
            TASK tASK = db.TASK.Find(id);

            db.TASK.Remove(tASK);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #28
0
        public ActionResult DeleteConfirmed(short id)
        {
            TASK task = db.TASKS.Find(id);

            db.TASKS.Remove(task);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #29
0
        void OnPROJECTWORKPACKSMappingViewModelLoaded(IEnumerable <WORKPACK_Dashboard> entities)
        {
            IEnumerable <TASK>         PROJECTTASK = WORKPACK_DashboardViewModel.P6TASKCollection;
            IEnumerable <ProgressInfo> cumulativeEarnedDataPoints = WORKPACK_DashboardViewModel.MainViewModel.Entities.Where(x => x.Summary_CumulativeEarnedDataPoints != null).SelectMany(x => x.Summary_CumulativeEarnedDataPoints);

            cumulativeEarnedDataPoints = cumulativeEarnedDataPoints.OrderBy(x => x.ProgressDate).ToList();
            TimeSpan intervalTimeSpan = ISupportProgressReportingExtensions.ConvertProgressIntervalToPeriod(loadPROGRESS);
            CollectionViewModel <TASK, int, IP6EntitiesUnitOfWork> P6TASKCollectionViewModel = WORKPACK_DashboardViewModel.P6TASKCollectionViewModel;

            foreach (WORKPACK_Dashboard workpack in WORKPACK_DashboardViewModel.MainViewModel.Entities)
            {
                ProgressInfo fWorkpackEarnedDataPoint = cumulativeEarnedDataPoints.FirstOrDefault(dataPoint => dataPoint.WorkpackGuid == workpack.WORKPACK.GUID && dataPoint.Units > 0);
                if (fWorkpackEarnedDataPoint != null)
                {
                    ProgressInfo lWorkpackEarnedDataPoint          = cumulativeEarnedDataPoints.LastOrDefault(dataPoint => dataPoint.WorkpackGuid == workpack.WORKPACK.GUID && dataPoint.ProgressDate <= loadPROGRESS.DATA_DATE);
                    List <WORKPACK_ASSIGNMENT> workpackAssignments = workpack.WORKPACK.WORKPACK_ASSIGNMENT.Where(assignment => assignment.LOW_VALUE <= lWorkpackEarnedDataPoint.Units).OrderBy(assignment => assignment.LOW_VALUE).ToList();
                    for (int i = 0; i < workpackAssignments.Count; i++)
                    {
                        WORKPACK_ASSIGNMENT workpackAssignment = workpackAssignments[i];
                        TASK P6TASK = PROJECTTASK.FirstOrDefault(P6Task => P6Task.task_code == workpackAssignment.P6_ACTIVITYID);
                        if (P6TASK != null)
                        {
                            DateTime proposedStartDate = fWorkpackEarnedDataPoint.ProgressDate.AddDays(-1 * intervalTimeSpan.Days).AddSeconds(1);
                            if (P6TASK.act_start_date == null || P6TASK.act_start_date > proposedStartDate)
                            {
                                P6TASK.act_start_date = proposedStartDate;
                            }

                            decimal actUnits             = lWorkpackEarnedDataPoint.Units < workpackAssignment.HIGH_VALUE ? lWorkpackEarnedDataPoint.Units : workpackAssignment.HIGH_VALUE;
                            decimal actWorkUnitNormalize = i == 0 ? actUnits : (actUnits - workpackAssignments[i - 1].HIGH_VALUE);
                            P6TASK.act_work_qty = actWorkUnitNormalize;
                            if (P6TASK.remain_work_qty >= 0)
                            {
                                P6TASK.remain_work_qty = P6TASK.target_work_qty - P6TASK.act_work_qty;
                            }
                            P6TASK.remain_drtn_hr_cnt = P6TASK.target_drtn_hr_cnt * (P6TASK.remain_work_qty / P6TASK.target_work_qty);

                            if (P6TASK.remain_work_qty == 0)
                            {
                                P6TASK.status_code  = P6TASKSTATUS.TK_Complete.ToString();
                                P6TASK.act_end_date = lWorkpackEarnedDataPoint.ProgressDate;
                            }
                            else if (P6TASK.remain_work_qty > 0)
                            {
                                P6TASK.status_code  = P6TASKSTATUS.TK_Active.ToString();
                                P6TASK.act_end_date = null;
                            }
                            else if (P6TASK.status_code == P6TASKSTATUS.TK_NotStart.ToString())
                            {
                                P6TASK.status_code = P6TASKSTATUS.TK_Active.ToString();
                            }

                            P6TASKCollectionViewModel.Save(P6TASK);
                        }
                    }
                }
            }
        }
Exemple #30
0
        public int UpdateAppointment(string PrimekeyName, int id, TASK value, string ss, string strConnectionString)
        {
            // DataSet ds = new DataSet();
            // return ds;
            string        strSQL = "SELECT * FROM Tasks where " + PrimekeyName + "=" + id + "";
            DataRow       Ts     = default(DataRow);
            SqlConnection con    = new SqlConnection(strConnectionString);

            con.Open();

            SqlDataAdapter Adodapter = new SqlDataAdapter(strSQL, con); // ("SELECT * FROM [DOCS] WHERE [FullName]=@fullname", objConn)

            Adodapter.AcceptChangesDuringUpdate = true;
            Adodapter.AcceptChangesDuringFill   = true;

            DataSet ds = new DataSet("TASKS");


            Adodapter.FillSchema(ds, SchemaType.Mapped, "TASKS");
            Adodapter.Fill(ds, "TASKS");

            SqlCommandBuilder cb = new SqlCommandBuilder(Adodapter);

            cb.GetInsertCommand();
            Adodapter.Update(ds.Tables[0]);


            if (ds.Tables["TASKS"].Rows.Count > 0)
            {
                Ts = ds.Tables["TASKS"].Rows[0];
            }
            else
            {
                Ts = ds.Tables["TASKS"].NewRow();
            }


            SqlCommand cmd = new SqlCommand(strSQL, con);

            //   Ts["teur"] = value.Teur;
            Ts["teur"]        = value.Teur;
            Ts["ownerIds"]    = value.OwnerIds;
            Ts["starttime"]   = value.StartTime;
            Ts["endtime"]     = value.EndTime;
            Ts["allDayEvent"] = value.AllDayEvent;
            Ts["label"]       = value.Label;
            Ts["ltName"]      = value.LtName;
            Ts["remark"]      = value.Remark;
            Ts["place"]       = value.PLACE;
            Ts["tiK"]         = value.TIK;
            Ts["withwho"]     = value.withwho;
            Ts["lakNum"]      = value.lakNum;

            Ts["attendees"] = value.Teur;

            return(Adodapter.Update(ds, "TASKS"));
        }
        public ActionResult Create(TASK task)
        {
            if (ModelState.IsValid)
            {
                db.TASKS.Add(task);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.USER = new SelectList(db.USERS, "ID_USER", "NAME", task.USER);
            return View(task);
        }
 public ActionResult Edit(TASK task)
 {
     if (ModelState.IsValid)
     {
         db.Entry(task).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.USER = new SelectList(db.USERS, "ID_USER", "NAME", task.USER);
     return View(task);
 }
Exemple #33
0
        private void spiceText(ref string Text, TASK Task)
        {
            bool found;
            string s	= "";
            string key1	= "";
            string key2	= "";

            if (Text.Length <= 0) return;

            switch (Task)
            {
                case TASK.ENCRYPTION:
                    packTimeStamp();
                    buildKeys();
                    key1 = enspiceKey;
                    key2 = despiceKey;
                    shiftLeft(ref Text, key1.Length);
                    break;
                case TASK.DECRYPTION:
                    unpackTimeStamp(ref Text);
                    buildKeys();
                    key1 = despiceKey;
                    key2 = enspiceKey;
                    shiftRight(ref Text, key1.Length);
                    break;
            }

            for (int n = 0; n < Text.Length; n++)
            {
                found = false;

                for (int m = 0; m < key1.Length; m++)
                {
                    if (Text.Substring(n, 1) == key1.Substring(m, 1))
                    {
                        found = true;
                        s += key2.Substring(m, 1);
                    }
                }

                if (!found) s += Text.Substring(n, 1);
            }

            if (Task == TASK.ENCRYPTION)
            {
                s = timeStamp + s;
            }

            Text = s;
        }