public ActionResult RegisterBooks(string mode, string id) { LibraryViewModel lvModel = new LibraryViewModel(); lvModel.MODE = mode; if (mode != null && string.Equals(mode, "EDIT", StringComparison.OrdinalIgnoreCase)) { //Populate edit data using id passed in URL, if id==null then show error message StatusDTO <BookMasterDTO> dto = _bookmasterSvc.Select(Convert.ToInt32(id)); lvModel.BookMasterId = dto.ReturnObj.BookMasterId; lvModel.BookName = dto.ReturnObj.BookName; lvModel.AuthorName1 = dto.ReturnObj.AuthorName1; lvModel.AuthorName2 = dto.ReturnObj.AuthorName2; lvModel.PurchaseDate = dto.ReturnObj.PurchaseDate; lvModel.AccNo = dto.ReturnObj.AccNo; lvModel.AccDate = dto.ReturnObj.AccDate; lvModel.CALLNO = dto.ReturnObj.CALLNO; lvModel.ISBNNo = dto.ReturnObj.ISBNNo; lvModel.Edition = dto.ReturnObj.Edition; lvModel.Publisher = dto.ReturnObj.Publisher; lvModel.PublishingYear = dto.ReturnObj.PublishingYear; lvModel.Place = dto.ReturnObj.Place; lvModel.Series = dto.ReturnObj.Series; lvModel.Price = dto.ReturnObj.Price; lvModel.NOFCD = dto.ReturnObj.NOFCD; lvModel.BookCategory = dto.ReturnObj.BookCategory; lvModel.Location = dto.ReturnObj.Location; } lvModel.BookCategoryList = _uiddlRepo.getBookCategoryDropDown(); lvModel.LocationList = _uiddlRepo.getLocationDropDown(); return(View(lvModel)); }
public IHttpActionResult GetStatus(int id) { string userId = User.Identity.GetUserId(); StatusDTO status = (from s in db.Status where s.UserId == userId && s.Id == id select new StatusDTO { Id = s.Id, Name = s.Name, Products = s.Products.Select(prod => new ProductDTO() { Id = prod.Id, Name = prod.Name, Price = prod.Price }).ToList() }).FirstOrDefault(); if (status == null) { return(NotFound()); } return(Ok(status)); }
public StatusDTO vratiStatus(int id) { MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["BP_PosteSrpske"].ConnectionString); conn.Open(); // List<PosiljkaStatusDTO> posiljkeS = new List<PosiljkaStatusDTO>(); StatusDTO status = null; MySqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM posiljkastatus WHERE IdStatus = @IdStatus"; //cmd.Parameters.AddWithValue("@kartaId", kartaID); cmd.Parameters.AddWithValue("@IdStatus", id); MySqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { status = new StatusDTO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2)); } reader.Close(); conn.Close(); return(status); }
public StatusDTO <TransactionMasterDTO> Select(int rowId) { StatusDTO <TransactionMasterDTO> status = new StatusDTO <TransactionMasterDTO>(); status.IsException = false; status.IsSuccess = false; using (IDbSvc dbSvc = new DbSvc(_configSvc)) { try { MySqlCommand command = new MySqlCommand(); command.CommandText = "SELECT TranMasterId, TransactionType, IsPenalty, Frequency, DayToRun, YearlyDayToRun, IsdifferentTo FROM transactionmaster WHERE TranMasterId=@trMaster"; command.Parameters.Add("@trMaster", MySqlDbType.Int32).Value = rowId; command.Connection = dbSvc.GetConnection() as MySqlConnection; MySqlDataAdapter dataAdap = new MySqlDataAdapter(command); _dtResult = new DataTable("TRANS_MASTER"); dataAdap.Fill(_dtResult); if (_dtResult != null && _dtResult.Rows.Count > 0) { status.IsSuccess = true; status.ReturnObj = new TransactionMasterDTO(); status.ReturnObj.TranMasterId = rowId; status.ReturnObj.TransactionType = _dtResult.Rows[0]["TransactionType"].ToString(); status.ReturnObj.IsPenalty = string.Equals(_dtResult.Rows[0]["IsPenalty"].ToString(), "1") ? true : false; status.ReturnObj.IsDiffTo = _dtResult.Rows[0]["IsdifferentTo"].ToString(); } return(status); } catch (Exception exp) { _logger.Log(exp); throw exp; } } }
public void Delete(StatusDTO status) { using (UnitOfWorkProvider.Create()) { statusService.Delete(status.Id); } }
public static void Create(StatusDTO statusDTO) { Status status = MapperTransform <Status, StatusDTO> .ToEntity(statusDTO); Database.Statuses.Create(status); Database.Save(); }
public List <StatusDTO> ClinicalScheduleStatusList() // Status das Marcações de Consulta e Ordens de Serviço { List <StatusDTO> lista = new List <StatusDTO>(); try { BaseDados.ComandText = "stp_CLI_STATUS_MARCACAO_OBTERPORFILTRO"; MySqlDataReader dr = BaseDados.ExecuteReader(); while (dr.Read()) { StatusDTO dto = new StatusDTO(); dto.Codigo = int.Parse(dr[0].ToString()); dto.Descricao = dr[1].ToString(); dto.Sigla = dr[2].ToString(); dto.Estado = int.Parse(dr[3].ToString()); lista.Add(dto); } lista.Insert(0, new StatusDTO { Codigo = -1, Descricao = "-Seleccione-" }); } catch (Exception ex) { } finally { BaseDados.FecharConexao(); } return(lista); }
private async Task <List <StatusDTO <int, bool> > > AddRolesToUser(IdentityUser user, ManageUserRoleDTO model) { var response = new List <StatusDTO <int, bool> >(); foreach (var role in model.Roles) { var status = new StatusDTO <int, bool> { Name = role }; if (!await roleManager.RoleExistsAsync(role)) { status.Status = false; status.Error = $"{role} NOT_FOUND"; response.Add(status); continue; } var result = await userManager.AddToRoleAsync(user, role); status.Status = result.Succeeded; status.Error = string.Join('\r', result.Errors.Select(e => e.Description)); response.Add(status); } return(response); }
public async Task <ActionResult <MessageStatus> > Put(int id, StatusDTO status) { MessageStatus statusDb = (MessageStatus)status; if (statusDb == null) { return(BadRequest()); } using (MailingServiceDbContext serviceDbContext = new MailingServiceDbContext()) { try { var statusDbLast = await serviceDbContext.MessageStatuses.FindAsync(id); statusDbLast.StatusName = status.Name; await serviceDbContext.SaveChangesAsync(); return(Ok(statusDbLast)); } catch (Exception ex) { return(BadRequest(ex.Message)); } } }
public void SaveStatus(ref StatusDTO status) { SqlCommand command = new SqlCommand(); SqlParameter paramNewStatusId = new SqlParameter(); bool isNewRecord = false; if (status.IdStatus.Equals(Common.DTOBase.Int_NullValue)) { command = GetDbSprocCommand("INSERTSTATUS"); paramNewStatusId = CreateOutputParameter("@NEWSTATUSID", SqlDbType.Int); command.Parameters.Add(paramNewStatusId); isNewRecord = true; } else { command = GetDbSprocCommand("UPDATESTATUS"); command.Parameters.Add(CreateParameter("@ID", status.IdStatus)); } command.Parameters.Add(CreateParameter("@NAME", status.NameStatus, 30)); // Exécute la commande. command.Connection.Open(); int nb = command.ExecuteNonQuery(); command.Connection.Close(); if (nb == 1) { if (isNewRecord && nb == 1) { status.IdStatus = (int)paramNewStatusId.Value; } } }
/// <summary> /// Méthode permettant d'obtenir le statut /// </summary> /// <param name="idstatus"></param> /// <returns></returns> public Status GetStatus(int idstatus) { DALWSR_Result r1 = dal.GetStatusByIdAsync(idstatus, CancellationToken.None); StatusDTO statusDto = (StatusDTO)r1.Data; return(new Status(statusDto)); }
public async Task <IActionResult> PostStatusTk([FromBody] StatusDTO statusTk) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var map = Mapper.Map <StatusTk>(statusTk); _context.StatusTk.Add(map); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (StatusTkExists(map.MessageId)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetStatusTk", new { id = map.MessageId }, statusTk)); }
public async Task <IActionResult> PutStatusTk([FromRoute] string id, [FromBody] StatusDTO statusTk) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != statusTk.MessageId) { return(BadRequest()); } _context.Entry(Mapper.Map <StatusTk>(statusTk)).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StatusTkExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// get pagination query /// </summary> /// <param name="status">the status object</param> /// <param name="count">all items number (after the filters were applied)</param> /// <param name="parameters">unnamed parameters list</param> /// <returns></returns> private string getPagingQuery(StatusDTO status, int count, List <string> parameters, string initialQuery) { StringBuilder query = new StringBuilder(); int startIndex, endIndex; string order = " order by id "; try { if (status != null && status.data != null && count > status.data.number) { startIndex = status.data.currentPage * status.data.number; endIndex = startIndex + status.data.number; if (!String.IsNullOrEmpty(this.SortQuery.ToString())) { order = this.SortQuery.ToString(); } query.AppendLine(" SELECT * FROM ( SELECT *, ROW_NUMBER() OVER ( " + order + " ) as row FROM Item " + this.FilterQuery.ToString() + ") a WHERE row > " + startIndex + " and row <= " + endIndex); } else { query.AppendLine(initialQuery); } } catch (Exception ex) { Logger.Error("getPagingQuery: " + ex.Message + " " + ex.StackTrace); } return(query.ToString()); }
public PosiljkaStatusDTO posiljkaStatusKartaIPosiljka(int posiljkaID, int kartaID) { // throw new NotImplementedException(); MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["BP_PosteSrpske"].ConnectionString); conn.Open(); // List<PosiljkaStatusDTO> posiljkeS = new List<PosiljkaStatusDTO>(); PosiljkaStatusDTO pt = null; MySqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM posiljkastatus WHERE IdKartaZakljucka = @kartaId AND IdPosiljka = @IdPosiljka";//status poslane - te trebaju za prijem! cmd.Parameters.AddWithValue("@kartaId", kartaID); cmd.Parameters.AddWithValue("@IdPosiljka", posiljkaID); MySqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { PosiljkaDAO posDAO = DAOFactory.getDAOFactory().getPosiljkaDAO(); PosiljkaDTO posiljka = posDAO.vratiPosiljku(reader.GetInt32(1)); KartaZakljuckaDAO kzDAO = DAOFactory.getDAOFactory().getKartaZakljuckaDAO(); KartaZakljuckaDTO karta = kzDAO.vratiKartaZakljucka(reader.GetInt32(2)); StatusDAO sDAO = DAOFactory.getDAOFactory().getStatusDAO(); StatusDTO sDTO = sDAO.vratiStatus(reader.GetInt32(3)); pt = new PosiljkaStatusDTO(sDTO, posiljka, karta, reader.GetInt32(0)); } reader.Close(); conn.Close(); return(pt); }
public StatusDTO <UserTransactionDTO> Delete(UserTransactionDTO data) { StatusDTO <UserTransactionDTO> status = new StatusDTO <UserTransactionDTO>(); status.IsSuccess = false; using (IDbSvc dbSvc = new DbSvc(_configSvc)) { try { dbSvc.OpenConnection(); MySqlCommand command = new MySqlCommand(); command.CommandText = "DELETE FROM UserTransaction WHERE UserTransactionId=@userTrans"; command.Parameters.Add("@userTrans", MySqlDbType.Int32).Value = data.UserTransactionId; command.Connection = dbSvc.GetConnection() as MySqlConnection; if (command.ExecuteNonQuery() > 0) { status.IsSuccess = true; } return(status); } catch (Exception exp) { _logger.Log(exp); throw exp; } } }
public async Task <IActionResult> Create(StatusDTO statusDto) { var status = _mapper.Map <Status>(statusDto); await _service.Create(status); return(Ok()); }
public StatusDTO UpdateTransLastRunNextRun(UserTransactionDTO userTrans) { StatusDTO status = new StatusDTO(); status.IsSuccess = false; using (IDbSvc dbSvc = new DbSvc(_configSvc)) { try { dbSvc.OpenConnection(); MySqlCommand command = new MySqlCommand(); command.CommandText = "UPDATE UserTransaction SET LastAutoTransactionOn=@lastTransOn, NextAutoTransactionOn=@nextAutoTransOn WHERE UserTransactionId=@userTrans"; command.Parameters.Add("@lastTransOn", MySqlDbType.Date).Value = userTrans.LastAutoTransactionOn; command.Parameters.Add("@nextAutoTransOn", MySqlDbType.Date).Value = userTrans.NextAutoTransactionOn; command.Parameters.Add("@userTrans", MySqlDbType.Int32).Value = userTrans.UserTransactionId; command.Connection = dbSvc.GetConnection() as MySqlConnection; if (command.ExecuteNonQuery() > 0) { status.IsSuccess = true; } return(status); } catch (Exception exp) { _logger.Log(exp); throw exp; } } }
public StatusDTO ObterPorPK(StatusDTO dto) { try { BaseDados.ComandText = "stp_RH_STATUS_FUNCIONARIO_OBTERPORPK"; BaseDados.AddParameter("CODIGO", dto.Codigo); dto = new StatusDTO(); MySqlDataReader dr = BaseDados.ExecuteReader(); if (dr.Read()) { dto.Codigo = int.Parse(dr[0].ToString()); dto.Descricao = dr[1].ToString(); dto.Sigla = dr[2].ToString(); dto.Estado = int.Parse(dr[3].ToString()); } } catch (Exception ex) { dto.Sucesso = false; dto.MensagemErro = ex.Message.Replace("'", ""); } finally { BaseDados.FecharConexao(); } return(dto); }
public void Edit(StatusDTO statusDto) { var status = _repository.Get(statusDto.Id); status.Name = statusDto.Name; _repository.Edit(status); }
public StatusDTO Alterar(StatusDTO dto) { try { BaseDados.ComandText = "stp_RH_STATUS_FUNCIONARIO_ALTERAR"; BaseDados.AddParameter("DESCRICAO", dto.Descricao); BaseDados.AddParameter("SIGLA", dto.Sigla); BaseDados.AddParameter("SITUACAO", dto.Estado); BaseDados.AddParameter("CODIGO", dto.Codigo); BaseDados.ExecuteNonQuery(); dto.Sucesso = true; } catch (Exception ex) { dto.Sucesso = false; dto.MensagemErro = ex.Message.Replace("'", ""); } finally { BaseDados.FecharConexao(); } return(dto); }
public string ToString(StatusDTO status) { string str; str = string.Format("{0}. {1} ", status.Id, status.Name); return(str); }
public void Update(StatusDTO status) { using (UnitOfWorkProvider.Create()) { statusService.Update(status); } }
public IHttpActionResult PutStatus(string id, StatusDTO status) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != status.StatusId) { return(BadRequest()); } try { bizStatus.updateStatus(status); } catch (DbUpdateConcurrencyException) { if (!StatusExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public PathWatcher(string inputPath, IFileManager fileManager, IBarcodeManager barcodeManager, IDocumentManager documentManager, IPublisher <IEnumerable <byte> > documentPublisher, IPublisher <StatusDTO> statusPublisher) { _fileManager = fileManager; _barcodeManager = barcodeManager; _documentManager = documentManager; _documentPublisher = documentPublisher; _statusPublisher = statusPublisher; _status = new StatusDTO { Value = ServiceStatuses.Waiting, ServiceName = Guid.NewGuid().ToString() }; _statusTimer = new SystemTimer(_statusInterval) { Enabled = false, AutoReset = true }; _watcher = new FileSystemWatcher(inputPath); _worker = new Thread(WorkProcess); _watcher.Created += Watcher_Created; _statusTimer.Elapsed += StatusTimer_Elapsed; }
public IHttpActionResult PostStatus(StatusDTO status) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { bizStatus.createStatus(status); } catch (DbUpdateException) { if (StatusExists(status.StatusId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = status.StatusId }, status)); }
private static void ChangeStatus(int sleepTime, bool useSpecificTimer) { dynamic obj = File.ReadAllText(Directory.GetParent(Environment.CurrentDirectory).Parent?.Parent?.FullName + "/config/status.json"); dynamic json = JArray.Parse(obj); foreach (var status in json) { if (!TimeSpan.TryParse((string)status.schedule, out var timer) && useSpecificTimer) { continue; } if ((DateTime.Now.Hour != timer.Hours || DateTime.Now.Minute != timer.Minutes) && useSpecificTimer) { continue; } var objectToSerialize = new StatusDTO { text = (string)status.text, emoji_id = (string)status.emoji_id, emoji_name = (string)status.emoji_name }; var result = JsonConvert.SerializeObject(objectToSerialize); result = "{\"custom_status\": " + result + "}"; Request(result); Thread.Sleep(sleepTime); } }
// GET: Transaction/TransactionMaster public ActionResult TransactionMaster() { Helpers.UIDropDownRepo uiDDLRepo = new Helpers.UIDropDownRepo(_ddlRepo); TransactionMasterVM trMasterVM = new TransactionMasterVM(); trMasterVM.TransTypeList = uiDDLRepo.getTransactionTypes(); trMasterVM.IsDiffToList = uiDDLRepo.getTransactionIsDiffTo(); trMasterVM.FrequencyList = uiDDLRepo.getTransactionFrequencies(); trMasterVM.MODE = "ADD"; trMasterVM.Active = true; StatusDTO <List <TransactionMasterDTO> > status = _trMaster.GetAllTransactioMasters(); if (status.IsSuccess && status.ReturnObj != null && status.ReturnObj.Count > 0) { trMasterVM.SearchList = new List <TransactionMasterVM>(); TransactionMasterVM trVM = null; foreach (TransactionMasterDTO trDto in status.ReturnObj) { trVM = new TransactionMasterVM(); trVM.DayToRun = trDto.DayToRun; trVM.Frequency = trDto.Frequency; trVM.IsDiffTo = trDto.IsDiffTo; trVM.IsPenalty = trDto.IsPenalty; trVM.TranMasterId = trDto.TranMasterId; trVM.TransactionName = trDto.TransactionName; trVM.TransactionType = trDto.TransactionType; trVM.YearlyDayToRun = trDto.YearlyDayToRun; trVM.Active = trDto.Active; trMasterVM.SearchList.Add(trVM); } } return(View(trMasterVM)); }
public ActionResult UpdateVehicleStatus([FromBody] StatusDTO body) { if (body == null) { return(BadRequest("Invalid body.")); } if (string.IsNullOrEmpty(body.VehicleId)) { return(BadRequest("Invalid vehicle id.")); } if (!_business.IsVehicleExists(body.VehicleId)) { return(BadRequest("Vehicle does not exists in system.")); } var result = _business.UpdateVehicleStatus(body.VehicleId.Trim(), body.Message, body.Time); if (!result) { return(BadRequest("Can not update vehicle status.")); } return(Ok()); }
public async Task <IActionResult> submitpractice([FromBody] StatusDTO assessment) { User user = _helperService.GetUser(); if (user == null) { return(Ok(new ErrorDto { StatusCode = StatusCodes.Status401Unauthorized, Message = "Unauthorized" })); } else { var acc = await _context.Assessment.Where(x => (x.Id == assessment.assessmentId)).SingleOrDefaultAsync(); if (acc == null) { return(Ok(new { StatusCode = StatusCodes.Status200OK, message = "Invalid assessment info.", result = "" })); } else { _context.Entry <Assessment>(acc).State = EntityState.Detached; Assessment ac = new Assessment(); ac.Id = acc.Id; _context.Assessment.Attach(ac); ac.AssessmentStatusId = 1; await _context.SaveChangesAsync(); } return(Ok(new { StatusCode = StatusCodes.Status200OK, message = "Assessment submitted successfully", result = "" })); } }