public void StaticTextController_NewText()
		{
			// Arrange
			string lTitle = "Confidencial";
			string lDescription = "Información super secreta";
			string lText = "Siempre que llovió, paró";

			ManageTextHandler lController = new ManageTextHandler();
			StaticTextDTO lResult;
			StaticTextDTO lDto;


			// Act
			lDto = new StaticTextDTO()
			{
				Title = lTitle,
				Description = lDescription,
				Text = lText
			};

			lDto.Id = lController.AddText(lDto);

			// Assert
			lResult = lController.GetText(lDto.Id);
			AssertAreEqual(lDto, lResult);
		}
		void AssertAreEqual(StaticTextDTO lDto, StaticTextDTO lResult)
		{
			Assert.AreEqual(lDto.Id, lResult.Id);
			Assert.AreEqual(lDto.Title, lResult.Title);
			Assert.AreEqual(lDto.Description, lResult.Description);
			Assert.AreEqual(lDto.Text, lResult.Text);
		}
 void IAddModifyViewForm.Add(IDTO pNewStaticText)
 {
     this.txtTitle.Text = String.Empty;
     this.txtDescription.Text = String.Empty;
     this.txtText.Text = String.Empty;
     this.Text = "Agregar nuevo Texto Fijo";
     this.iOriginalStaticText = (StaticTextDTO)pNewStaticText;
 }
 public void DeleteText(StaticTextDTO pDto)
 {
     iUoW.BeginTransaction();
     try
     {
         StaticText lStaticText = Mapper.Map<StaticTextDTO, StaticText>(pDto);
         iServ.Delete(pDto.Id);
         iUoW.Commit();
     }
     catch (Exception)
     {
         iUoW.Rollback();
         throw;
     }
 }
 public void ModifyText(StaticTextDTO pDto)
 {
     iUoW.BeginTransaction();
     try
     {
         StaticText lStaticText = Mapper.Map<StaticTextDTO, StaticText>(pDto);
         iServ.Update(lStaticText);
         iUoW.Commit();
     }
     catch (Exception)
     {
         iUoW.Rollback();
         throw;
     }
 }
 public int AddText(StaticTextDTO pDto)
 {
     iUoW.BeginTransaction();
     try
     {
         StaticText lStaticText = Mapper.Map<StaticTextDTO, StaticText>(pDto);
         iServ.Create(lStaticText);
         iUoW.Commit();
         return lStaticText.Id;
     }
     catch (Exception)
     {
         iUoW.Rollback();
         throw;
     }
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                StaticTextDTO staticText = new StaticTextDTO();
                AgregarModificarTextoFijo ventana = new AgregarModificarTextoFijo();
                this.dgvStaticText.Add(ventana, staticText);
                iController.AddText(staticText);
                this.CargarDataGrid();
            }
            catch (Exception)
            {

                throw;
            }
        }
 void IAddModifyViewForm.Modify(IDTO pStaticText)
 {
     if (pStaticText == null)
     {
         throw new EntidadNulaException("El texto fijo indicado es nulo");
         //TODO excepcion argumentexception creo
     }
     else
     {
         this.iOriginalStaticText = (StaticTextDTO)pStaticText;
         this.txtTitle.Text = iOriginalStaticText.Title;
         this.txtDescription.Text = iOriginalStaticText.Description;
         this.txtText.Text = iOriginalStaticText.Text;
         this.Text = "Modificar Texto Fijo";
     }    
 }
Пример #9
0
 public void View(StaticTextDTO pStaticText)
 {
     if (pStaticText == null)
     {
         throw new EntidadNulaException("El texto fijo indicado es nulo");
         //TODO excepcion argumentexception creo
     }
     else
     {
         this.txtTitle.Text = pStaticText.Title;
         this.txtDescription.Text = pStaticText.Description;
         this.txtText.Text = pStaticText.Text;
         this.Text = "Texto Fijo: " + pStaticText.Title;
         this.ShowDialog();
     }
 }
Пример #10
0
        public StaticTextDTO GetText(int pId)
        {
            StaticTextDTO lResult = new StaticTextDTO();

            iUoW.BeginTransaction();
            try
            {
                lResult = Mapper.Map<StaticText, StaticTextDTO>(iServ.Read(pId));
            }
            finally
            {
                iUoW.Rollback();
            }

            return lResult;
        }