예제 #1
0
 // Gán dữ liệu.
 private void setData(StageDTO stageDTO)
 {
     stageDTO.ProjectID    = cbbProjectID.Text.Trim();
     stageDTO.Stage        = txtEdtStage.Text.Trim();
     stageDTO.StageSubject = txtEdtStageSubject.Text.Trim();
     stageDTO.Status       = txtEdtStatus.Text.Trim();
 }
예제 #2
0
        public List <int> getDataListStageAndStageOrdinalNumberFollowProjectIDForQuickAccessTaskWorking(string projectID)
        {
            string str_Query = ("SELECT * FROM STAGE WHERE PROJECTID = '" + projectID + "' ORDER BY STAGE ASC");

            DataTable dt_Data = DataProvider.Instance.ExecuteQuery(str_Query);

            if (dt_Data == null)
            {
                return(null);
            }

            List <int> lst_Result = new List <int>();

            int i_StageLocal = 0;
            int i_StageOrdinalNumberLocal = 0;

            foreach (DataRow item in dt_Data.Rows)
            {
                StageDTO stageDTOTemp = new StageDTO(item);
                if (stageDTOTemp.Status == StaticVarClass.status_NotComplete)
                {
                    i_StageLocal = int.Parse(stageDTOTemp.Stage);
                    lst_Result.Add(i_StageLocal);
                    lst_Result.Add(i_StageOrdinalNumberLocal);
                    break;
                }

                i_StageOrdinalNumberLocal += 1;
            }

            return(lst_Result);
        }
예제 #3
0
        //--------------------------------------------- Updates --------------------------------------------
        public static bool updateStage(StageDTO pStage)
        {
            using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionRRHHDatabase"].ConnectionString))
            {
                SqlCommand command = new SqlCommand("usp_update_stage", connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.Parameters.Add("@id_stage", SqlDbType.Int);
                command.Parameters["@id_stage"].Value = pStage.id_stage;
                command.Parameters.Add("@name", SqlDbType.NVarChar);
                command.Parameters["@name"].Value = pStage.name;
                command.Parameters.Add("@stagePosition", SqlDbType.Int);
                command.Parameters["@stagePosition"].Value = pStage.stagePosition;
                command.Parameters.Add("@isCompleted", SqlDbType.Bit);
                command.Parameters["@isCompleted"].Value = pStage.isCompleted;
                command.Parameters.Add("@startDate", SqlDbType.DateTime);
                command.Parameters["@startDate"].Value = pStage.startDate;
                command.Parameters.Add("@completedDate", SqlDbType.DateTime);
                command.Parameters["@completedDate"].Value = pStage.completedDate;
                command.Parameters.Add("@userLog", SqlDbType.Int);
                command.Parameters["@userLog"].Value = pStage.userLog;

                command.Connection.Open();
                int result = command.ExecuteNonQuery();
                if (result != 0)
                {
                    return(true);
                }
                return(false);
            };
        }
예제 #4
0
        public static StageDTO getProcessStage(string id_stage)
        {
            StageDTO stage = new StageDTO();

            using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionRRHHDatabase"].ConnectionString))
            {
                SqlCommand command = new SqlCommand("usp_get_process_stage", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add("@id_stage", SqlDbType.Int);
                command.Parameters["@id_stage"].Value = id_stage;
                command.Connection.Open();
                SqlDataReader rdr = command.ExecuteReader();
                while (rdr.Read())
                {
                    stage.id_stage            = rdr["id_stage"].ToString();
                    stage.name                = rdr["name"].ToString();
                    stage.processManagment_id = rdr["processManagment_id"].ToString();
                    stage.stagePosition       = rdr["stagePosition"].ToString();
                    stage.createdBy           = rdr["createdBy"].ToString();
                    stage.createdDate         = rdr["createdDate"].ToString();
                    stage.isCompleted         = rdr["isCompleted"].ToString();
                    stage.startDate           = rdr["startDate"].ToString();
                    stage.completedDate       = rdr["completedDate"].ToString();
                    stage.isProcess           = rdr["isProcess"].ToString();
                }
            };
            return(stage);
        }
예제 #5
0
 // Gán dữ liệu.
 private void setData(StageDTO stageDTO)
 {
     stageDTO.ProjectID    = this.txtEdtProjectID.Text.Trim();
     stageDTO.Stage        = this.txtEdtStage.Text.Trim();
     stageDTO.StageSubject = this.txtEdtStageSubject.Text.Trim();
     stageDTO.Status       = StaticVarClass.status_NotComplete;
 }
예제 #6
0
 public IHttpActionResult postStage(StageDTO pStage)
 {
     if (!ProcessManagmentData.insertStage(pStage))
     {
         return(BadRequest());
     }
     return(Ok());
 }
예제 #7
0
        public async Task <ActionResult <StageDTO> > PostStages(StageDTO stageDTO)
        {
            var stage = _mapper.Map <Stage>(stageDTO);

            stage = await _stageService.Create(stage);

            return(_mapper.Map <StageDTO>(stage));
        }
예제 #8
0
        public bool updateData(StageDTO stageDTO)
        {
            if (stageDTO.ProjectID == string.Empty || stageDTO.Stage == string.Empty)
            {
                return(false);
            }

            return(StageDAO.Instance.updateData(stageDTO));
        }
예제 #9
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string str_ProjectIDLocal = this.txtEdtProjectID.Text.Trim();
            string str_StageLocal     = this.txtEdtStage.Text.Trim();

            StageDTO stageDTOLocal = new StageDTO();

            // Gán giá trị vào thuộc tính trong bảng.
            setData(stageDTOLocal);

            #region Thêm mới.
            // Thêm mới.
            if (StageDAO.Instance.addData(stageDTOLocal))
            {
                #region Cập nhật lịch sử.
                string name   = StaticVarClass.account_Username;
                string time   = DateTime.Now.ToString();
                string action = "Add project - stage: " + str_ProjectIDLocal + " - " + str_StageLocal;
                string status = "Successful";

                HistoryDTO hisDTO = new HistoryDTO(name, time, action, status);
                HistoryDAO.Instance.addData(hisDTO);
                #endregion

                this.btnNext.Enabled = true;

                // Tăng stage lên và kiểm tra có lớn hơn 20 stage không.
                i_StageGlobal++;
                if (i_StageGlobal > 20)
                {
                    this.btnOK.Enabled = false;
                }

                XtraMessageBox.Show("Successfully added project - stage: " + str_ProjectIDLocal + " - " + str_StageLocal + "!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                #region Cập nhật lịch sử.
                string name   = StaticVarClass.account_Username;
                string time   = DateTime.Now.ToString();
                string action = "Add project - stage: " + str_ProjectIDLocal + " - " + str_StageLocal;
                string status = "Failed";

                HistoryDTO hisDTO = new HistoryDTO(name, time, action, status);
                HistoryDAO.Instance.addData(hisDTO);
                #endregion

                XtraMessageBox.Show("Add project - stage: " + str_ProjectIDLocal + " - " + str_StageLocal + " failed!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            #endregion


            this.formCreatingStage_Load(null, null);
        }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageCI"/> class
 /// </summary>
 /// <param name="eventSummary">The event summary</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixtureDTO</param>
 /// <param name="semaphorePool">The semaphore pool</param>
 /// <param name="currentCulture">The current culture</param>
 /// <param name="defaultCulture">The default culture</param>
 /// <param name="fixtureTimestampCache">A <see cref="MemoryCache"/> used to cache the sport events fixtureDTO timestamps</param>
 public StageCI(StageDTO eventSummary,
                IDataRouterManager dataRouterManager,
                ISemaphorePool semaphorePool,
                CultureInfo currentCulture,
                CultureInfo defaultCulture,
                MemoryCache fixtureTimestampCache)
     : base(eventSummary, dataRouterManager, semaphorePool, currentCulture, defaultCulture, fixtureTimestampCache)
 {
     Merge(eventSummary, currentCulture, true);
 }
예제 #11
0
        public List <StageDTO> GetAllStageData(int interviewType, IQueryable <int> completedCheckList, IQueryable <int> completedStagesList)
        {
            int             totalStageScore;
            int             totalCheckListCount;
            int             completedCheckListCount;
            List <StageDTO> stageDetails = new List <StageDTO>();
            var             stages       = _dbContext.Stages.Where(x => x.InterviewTypeId == interviewType);;

            foreach (var stage in stages)
            {
                StageDTO stageDetailItem = new StageDTO();
                totalStageScore             = 0;
                completedCheckListCount     = 0;
                totalCheckListCount         = 0;
                stageDetailItem.Name        = stage.StageName;
                stageDetailItem.StageId     = stage.Id;
                stageDetailItem.Sequence    = stage.Sequence;
                stageDetailItem.IsCompleted = completedStagesList.Any(x => x == stageDetailItem.StageId);
                var stageGroups = _dbContext.StageGroups.Where(x => x.StageId == stageDetailItem.StageId);
                stageDetailItem.StageGroups = new List <GroupDTO>();
                foreach (var group in stageGroups)
                {
                    GroupDTO groupItem = new GroupDTO();
                    groupItem.GroupId  = group.Id;
                    groupItem.Name     = group.GroupName;
                    groupItem.Sequence = group.Sequence;
                    var groupCheckList = GetCheckList(groupItem.GroupId);
                    groupItem.GroupCheckList = new List <CheckListDTO>();
                    foreach (var checkList in groupCheckList)
                    {
                        CheckListDTO checkListItem = new CheckListDTO();
                        checkListItem.CheckListId = checkList.Id;
                        checkListItem.Name        = checkList.Name;
                        checkListItem.Points      = checkList.Points;
                        checkListItem.IsChecked   = completedCheckList.Any(x => x == checkList.Id);
                        if (checkListItem.IsChecked)
                        {
                            totalStageScore = totalStageScore + checkList.Points;
                            completedCheckListCount++;
                        }
                        totalCheckListCount++;
                        groupItem.GroupCheckList.Add(checkListItem);
                    }
                    stageDetailItem.StageGroups.Add(groupItem);
                }
                stageDetailItem.TotalCheckListCount     = totalCheckListCount;
                stageDetailItem.CompletedCheckListCount = completedCheckListCount;
                stageDetailItem.StageScore = totalStageScore;
                stageDetails.Add(stageDetailItem);
            }
            return(stageDetails);
        }
예제 #12
0
        public bool updateData(StageDTO stageDTO)
        {
            if (stageDTO.ProjectID == string.Empty || stageDTO.Stage == string.Empty)
            {
                return(false);
            }

            string str_Query = "UPDATE STAGE SET STAGESUBJECT = '" + stageDTO.StageSubject + "' , STATUS = '" + stageDTO.Status + "' WHERE PROJECTID = '" + stageDTO.ProjectID + "' AND STAGE = '" + stageDTO.Stage + "'";

            int i_Result = DataProvider.Instance.ExecuteNonQuery(str_Query);

            return(i_Result > 0);
        }
예제 #13
0
        public bool addData(StageDTO stageDTO)
        {
            if (stageDTO.ProjectID == string.Empty || stageDTO.Stage == string.Empty)
            {
                return(false);
            }

            string str_Query = "INSERT INTO STAGE VALUES ('" + stageDTO.ProjectID + "', '" + stageDTO.Stage + "', '" + stageDTO.StageSubject + "', '" + stageDTO.Status + "')";

            int i_Result = DataProvider.Instance.ExecuteNonQuery(str_Query);

            return(i_Result > 0);
        }
예제 #14
0
 /// <summary>
 /// Merges the specified event summary
 /// </summary>
 /// <param name="eventSummary">The event summary</param>
 /// <param name="culture">The culture</param>
 /// <param name="useLock"></param>
 public void Merge(StageDTO eventSummary, CultureInfo culture, bool useLock)
 {
     if (useLock)
     {
         lock (MergeLock)
         {
             ActualMerge(eventSummary, culture);
         }
     }
     else
     {
         ActualMerge(eventSummary, culture);
     }
 }
예제 #15
0
 public TasksModel(string id_stage)
 {
     this.stage = processManagmentProvider.getStage(id_stage).Result;
     tasks      = taskProvider.getTasks(stage.id_stage).Result;
     foreach (var task in tasks)
     {
         int stagePosition = Int32.Parse(task.taskPosition);
         if (stagePosition >= maxTaskPosition)
         {
             maxTaskPosition = stagePosition + 1;
         }
     }
     taskStates = taskProvider.getTaskStates().Result;
 }
예제 #16
0
        public bool UpdateStage(StageDTO stage)
        {
            try
            {
                this.competitionUnitOfWork.StageRepository.Update(ObjectMapper <StageDTO, StageEntity> .Map(stage));
                this.competitionUnitOfWork.SaveChanges();
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
예제 #17
0
        public List <StageDTO> GetStages(int interviewTypeId)
        {
            List <StageDTO> stagesList = new List <StageDTO>();
            var             stages     = _dbContext.Stages.Where(x => x.InterviewTypeId == interviewTypeId);

            foreach (var stageItem in stages)
            {
                StageDTO stage = new StageDTO();
                stage.StageId  = stageItem.Id;
                stage.Name     = stageItem.StageName;
                stage.Sequence = stageItem.Sequence;
                stagesList.Add(stage);
            }
            return(stagesList);
        }
 public ActionResult _DeleteStage(string id_stage)
 {
     if (ModelState.IsValid)
     {
         StageDTO stage = processManagmentProvider.getStage(id_stage).Result;
         if (processManagmentProvider.deleteStage(id_stage, Request.Cookies["user_id"].Value).Result)
         {
             if (new TaskProvider().putRefreshTaskTimes(stage.processManagment_id).Result)
             {
                 return(new HttpStatusCodeResult(200));
             }
         }
     }
     return(new HttpStatusCodeResult(404, "Can't find that"));
 }
예제 #19
0
        //-------------------------------------- Puts -----------------------------------------------

        public async Task <bool> putStage(StageDTO pParticipantDTO)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(_BaseAddress);
                var         userJson    = new JavaScriptSerializer().Serialize(pParticipantDTO);
                HttpContent contentPost = new StringContent(userJson, Encoding.UTF8, "application/json");
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", getToken());
                HttpResponseMessage response = client.PutAsync("api/processManagment/stages/", contentPost).Result;
                if (response.IsSuccessStatusCode)
                {
                    return(true);
                }
                return(false);
            }
        }
예제 #20
0
 public TaskDetailsModel(string id_task)
 {
     task          = taskProvider.getTask(id_task).Result;
     this.stageDTO = processManagmentProvider.getStage(task.stage_id).Result;
     createdBy     = userProvider.getUserbyID(task.createdBy).Result;
     taskState     = taskProvider.getTaskState(task.taskState_id).Result;
     taskType      = taskProvider.getTaskType(task.type_id).Result;
     if (taskType.needConfirm == "True")
     {
         taskResponsablesModel = new TaskResponsablesModel(task);
     }
     if (taskType.formNeeded == "True")
     {
         formQuestionsModel = new FormQuestionsModel(task);
     }
 }
 public ActionResult _EditStage(string name, string id_stage, string stagePosition)
 {
     if (ModelState.IsValid)
     {
         StageDTO stageDTO = new StageDTO();
         stageDTO.id_stage      = id_stage;
         stageDTO.name          = name;
         stageDTO.stagePosition = stagePosition;
         stageDTO.userLog       = Request.Cookies["user_id"].Value;
         if (processManagmentProvider.putStage(stageDTO).Result)
         {
             var result = new { name = name, id_stage = id_stage };
             return(Json(result));
         }
     }
     return(new HttpStatusCodeResult(404, "Can't find that"));
 }
예제 #22
0
        public async Task <StageDTO> getStage(string id_stage)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(_BaseAddress);
                StageDTO stage = new StageDTO();
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", getToken());
                HttpResponseMessage response = client.GetAsync("api/processManagment/stages/?id_stage=" + id_stage).Result;
                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();

                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    stage = serializer.Deserialize <StageDTO>(result);
                }
                return(stage);
            }
        }
예제 #23
0
        public async Task <int> AddUpdateStage(StageDTO _obj)
        {
            try
            {
                var query = "ADDUPDATESTAGE";
                var param = new DynamicParameters();
                param.Add("@STAGEID", _obj.stageId);
                param.Add("@STAGENAME", _obj.stageName);
                param.Add("@SEQUENCENUMBER", _obj.sequenceNumber);
                param.Add("@PIPEID", _obj.pipeId);
                param.Add("@USERID", _obj.createdBy);

                int Result = await Connection.ExecuteScalarAsync <int>(query, param, commandType : CommandType.StoredProcedure, transaction : Transaction);

                return(Result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #24
0
        /// <summary>
        /// Merges the specified event summary
        /// </summary>
        /// <param name="eventSummary">The event summary</param>
        /// <param name="culture">The culture</param>
        private void ActualMerge(StageDTO eventSummary, CultureInfo culture)
        {
            base.Merge(eventSummary, culture, false);

            if (eventSummary.Stages != null)
            {
                _childStages = new ReadOnlyCollection <URN>(eventSummary.Stages.Select(r => r.Id).ToList());
            }
            if (eventSummary.Tournament?.Category != null)
            {
                _categoryId = eventSummary.Tournament.Category.Id;
            }
            if (eventSummary.ParentStage != null)
            {
                _parentStageId = eventSummary.ParentStage.Id;
            }
            if (!eventSummary.AdditionalParents.IsNullOrEmpty())
            {
                _additionalParentIds = eventSummary.AdditionalParents.Select(s => s.Id);
            }
        }
예제 #25
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            // Lưu thông tin của stage mới vào bảng STAGE.
            string str_ProjectIDLocal    = this.txtEdtProjectID.Text.Trim();
            string str_StageLocal        = this.txtEdtStage.Text.Trim();
            string str_StageSubjectLocal = this.txtEdtStageSubject.Text.Trim();
            string str_StatusLocal       = StaticVarClass.status_NotComplete;

            StageDTO stageDTOTemp = new StageDTO(str_ProjectIDLocal, str_StageLocal, str_StageSubjectLocal, str_StatusLocal);

            if (StageBUS.Instance.addData(stageDTOTemp))
            {
                #region Cập nhật lịch sử.
                string name   = StaticVarClass.account_Username;
                string time   = DateTime.Now.ToString();
                string action = "Add project - stage: " + str_ProjectIDLocal + " - " + str_StageLocal;
                string status = "Successful";

                HistoryDTO hisDTO = new HistoryDTO(name, time, action, status);
                HistoryDAO.Instance.addData(hisDTO);
                #endregion

                XtraMessageBox.Show("Successfully added project - stage: " + str_ProjectIDLocal + " - " + str_StageLocal + "!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                #region Cập nhật lịch sử.
                string name   = StaticVarClass.account_Username;
                string time   = DateTime.Now.ToString();
                string action = "Add project - stage: " + str_ProjectIDLocal + " - " + str_StageLocal;
                string status = "Failed";

                HistoryDTO hisDTO = new HistoryDTO(name, time, action, status);
                HistoryDAO.Instance.addData(hisDTO);
                #endregion

                XtraMessageBox.Show("Add project - stage: " + str_ProjectIDLocal + " - " + str_StageLocal + " failed!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #26
0
        /// <summary>
        /// Merges the specified event summary
        /// </summary>
        /// <param name="eventSummary">The event summary</param>
        /// <param name="culture">The culture</param>
        private void ActualMerge(StageDTO eventSummary, CultureInfo culture)
        {
            base.Merge(eventSummary, culture, false);

            if (eventSummary.Stages != null)
            {
                // no translatable data - just replace with new value
                _childStages = new ReadOnlyCollection <StageCI>(eventSummary.Stages.Select(r => new StageCI(r, DataRouterManager, SemaphorePool, culture, DefaultCulture, FixtureTimestampCache)).ToList());
            }
            if (eventSummary.Tournament?.Category != null)
            {
                _categoryId = eventSummary.Tournament.Category.Id;
            }
            if (eventSummary.ParentStage != null)
            {
                _parentStageId = eventSummary.ParentStage.Id;
            }
            if (!eventSummary.AdditionalParents.IsNullOrEmpty())
            {
                _additionalParentIds = eventSummary.AdditionalParents.Select(s => s.Id);
            }
        }
예제 #27
0
        /// <summary>
        ///     Merges the specified event summary
        /// </summary>
        /// <param name="eventSummary">The event summary</param>
        /// <param name="culture">The culture</param>
        private void ActualMerge(StageDTO eventSummary, CultureInfo culture)
        {
            base.Merge(eventSummary, culture, false);

            if (eventSummary.ParentStage != null)
            {
                // no translatable data - just replace with new value
                _parentStage = new StageCI(eventSummary.ParentStage, DataRouterManager, SemaphorePool, culture,
                                           DefaultCulture, FixtureTimestampCache);
            }
            else
            {
                if (eventSummary.Tournament != null)
                {
                    _parentStage = new StageCI(eventSummary.Tournament.Id, DataRouterManager, SemaphorePool, culture,
                                               FixtureTimestampCache);
                }
            }

            if (eventSummary.Stages != null)
            {
                // no translatable data - just replace with new value
                _childStages = new ReadOnlyCollection <StageCI>(eventSummary
                                                                .Stages.Select(r => new StageCI(r, DataRouterManager, SemaphorePool, culture,
                                                                                                DefaultCulture, FixtureTimestampCache)).ToList());
            }

            if (eventSummary.Type != null)
            {
                _stageType = eventSummary.Type.Value == SportEventType.Parent
                    ? StageType.Parent
                    : StageType.Child;
            }

            if (eventSummary.Tournament?.Category != null)
            {
                _categoryId = eventSummary.Tournament.Category.Id;
            }
        }
예제 #28
0
        public async Task <ActionResult <StageDTO> > UpdateStage(int id, StageDTO stageDTO)
        {
            var stage = _mapper.Map <Stage>(stageDTO);

            if (stage.StageId != id)
            {
                return(BadRequest());
            }
            if (!_context.Stages.Where(x => x.StageId == stage.StageId).Any())
            {
                await _stageService.Create(stage);

                return(_mapper.Map <StageDTO>(stage));
            }
            stage = await _stageService.Update(stage);

            if (stage == null)
            {
                return(NotFound());
            }
            return(_mapper.Map <StageDTO>(stage));
        }
예제 #29
0
        // Lấy dữ liệu theo tên employee đang làm việc.
        //public StageDTO getDataObjectFollowStage(string projectID, string stage)
        //{
        //    string str_Query = ("SELECT * FROM STAGE WHERE PROJECTID = '" + projectID + "' AND STAGE = '" + stage + "'");

        //    DataTable dt_Result = DataProvider.Instance.ExecuteQuery(str_Query);

        //    if (dt_Result == null)
        //        return null;

        //    if (dt_Result.Rows.Count == 0)
        //    {
        //        StageDTO stageDToResultTemp = new StageDTO();

        //        return stageDToResultTemp;
        //    }

        //    DataRow dtR_dataRow = dt_Result.Rows[0];

        //    StageDTO stageDTOResult = new StageDTO(dtR_dataRow);

        //    return stageDTOResult;
        //}

        public StageDTO getDataObjectForUpdateWhenRemovingStage(string projectID)
        {
            string str_Query = ("SELECT * FROM STAGE WHERE PROJECTID = '"
                                + projectID + "' AND STAGE >= ALL(SELECT STAGE FROM STAGE WHERE PROJECTID = '"
                                + projectID + "')");

            DataTable dt_Data = DataProvider.Instance.ExecuteQuery(str_Query);

            if (dt_Data == null)
            {
                return(null);
            }

            if (dt_Data.Rows.Count == 0)
            {
                StageDTO stageDTOTemp = new StageDTO();
                return(stageDTOTemp);
            }

            StageDTO stageDTOResult = new StageDTO(dt_Data.Rows[0]);

            return(stageDTOResult);
        }
 public ActionResult _AddStage(string name, string id_process, string maxStagePosition)
 {
     if (ModelState.IsValid)
     {
         List <StageDTO> stages   = processManagmentProvider.getStages(id_process).Result;
         StageDTO        stageDTO = new StageDTO();
         stageDTO.processManagment_id = id_process;
         stageDTO.name    = name;
         stageDTO.userLog = Request.Cookies["user_id"].Value;
         if (stages.Count == 0)
         {
             stageDTO.stagePosition = "0";
         }
         else
         {
             stageDTO.stagePosition = (Int32.Parse(stages[stages.Count - 1].stagePosition) + 1).ToString();
         }
         if (processManagmentProvider.postStage(stageDTO).Result)
         {
             return(_StagesList(id_process));
         }
     }
     return(new HttpStatusCodeResult(404, "Can't find that"));
 }