Example #1
0
        /// <summary>
        /// Converts this instance of <see cref="agreements"/> to an instance of <see cref="agreementsDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="agreements"/> to convert.</param>
        public static agreementsDTO ToDTO(this agreements entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new agreementsDTO();

            dto.id_act              = entity.id_act;
            dto.name                = entity.name;
            dto.description         = entity.description;
            dto.id_user_responsible = entity.id_user_responsible;

            entity.OnDTO(dto);

            return(dto);
        }
Example #2
0
        /// <summary>
        /// Converts this instance of <see cref="agreementsDTO"/> to an instance of <see cref="agreements"/>.
        /// </summary>
        /// <param name="dto"><see cref="agreementsDTO"/> to convert.</param>
        public static agreements ToEntity(this agreementsDTO dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new agreements();

            entity.id_act              = dto.id_act;
            entity.name                = dto.name;
            entity.description         = dto.description;
            entity.id_user_responsible = dto.id_user_responsible;

            dto.OnEntity(entity);

            return(entity);
        }
Example #3
0
        //---------------------------------------------------------------------- buttons changed ------ <<

        //---------------------------------------------------------------------- buttons add ---------- >>

        private void btn_agreement_add_Click(object sender, EventArgs e)
        {
            var Agr = new agreements()
            {
                id_user          = dc.users.FirstOrDefault(u => u.user_name == id_user.SelectedItem.ToString()).user_id,
                balance          = Int32.Parse(balance.Value.ToString()),
                login            = login.Text,
                password         = password.Text,
                id_coverage_area = Int32.Parse(id_coverage_area.SelectedItem.ToString()),
                num_apartment    = Int32.Parse(num_house.Value.ToString()),
                date_connection  = Convert.ToDateTime(date_connection.Text),
                id_co_worker     = dc.co_workers.FirstOrDefault(c => c.co_worker_name == id_co_worker.SelectedItem.ToString()).co_worker_id,
                id_rate          = dc.rates.FirstOrDefault(r => r.name_rate == id_rate.SelectedItem.ToString()).rate_id
            };

            dc.agreements.InsertOnSubmit(Agr);
            dc.SubmitChanges();

            fillAgreements();
        }
Example #4
0
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="agreements"/> converted from <see cref="agreementsDTO"/>.</param>
 static partial void OnEntity(this agreementsDTO dto, agreements entity);
Example #5
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="agreementsDTO"/> converted from <see cref="agreements"/>.</param>
 static partial void OnDTO(this agreements entity, agreementsDTO dto);