Exemple #1
0
        public string UpdateRequest(UpdateUserRequestDetailsDTO updateUserRequestDetailsDTO)
        {
            MyRequestRepository        myRequestRepo = new MyRequestRepository();
            UpdateUserRequestDetailsDO updateUserRequestDetailsDO = new UpdateUserRequestDetailsDO
            {
                TaskId    = updateUserRequestDetailsDTO.TaskId,
                RequestNo = updateUserRequestDetailsDTO.RequestNo,
                UserName  = updateUserRequestDetailsDTO.UserName
            };
            string status = myRequestRepo.UpdateRequestDA(updateUserRequestDetailsDO);

            return(status);
        }
        public string UpdateRequestDA(UpdateUserRequestDetailsDO updateUserRequestDetailsDO)
        {
            string status;

            try
            {
                using (var context = new AWFContext())
                {
                    SqlParameter ParamTaskId = new SqlParameter("@TaskId", SqlDbType.VarChar, 20);
                    ParamTaskId.Value = updateUserRequestDetailsDO.TaskId;

                    SqlParameter ParamUserName = new SqlParameter("@UserName", SqlDbType.VarChar, 20);
                    ParamUserName.Value = updateUserRequestDetailsDO.UserName;

                    SqlParameter ParamRequestNo = new SqlParameter("@RequestNo", SqlDbType.Int);
                    ParamRequestNo.Value = Convert.ToInt32(updateUserRequestDetailsDO.RequestNo);

                    SqlParameter StatusOUT = new SqlParameter("@Status", SqlDbType.VarChar, 15);
                    StatusOUT.Direction = ParameterDirection.Output;

                    context.Database.ExecuteSqlCommand("[usp_UpdateUserRequest] @TaskId, @UserName, @RequestNo, @Status OUTPUT",
                                                       ParamTaskId,
                                                       ParamUserName,
                                                       ParamRequestNo,
                                                       StatusOUT
                                                       );

                    status = StatusOUT.Value.ToString();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(status);
        }