public ResponseBo Save(AlonePersonBo saveBo)
        {
            ResponseBo responseBo = new ResponseBo();

            try
            {
                using (SqlConnection conn = DbAccess.Connection.GetConn())
                {
                    var p = new DynamicParameters();
                    base.AddStandartSpParams(ref p, saveBo);

                    p.Add("@Id", saveBo.Id, DbType.Int64, ParameterDirection.Input);
                    p.Add("@Name", saveBo.Name, DbType.String, ParameterDirection.Input, 50);
                    p.Add("@Surname", saveBo.Surname, DbType.String, ParameterDirection.Input, 50);
                    p.Add("@Email", saveBo.Email, DbType.String, ParameterDirection.Input, 50);

                    p.Add("@PersonTypeId", saveBo.PersonTypeId, DbType.Int32, ParameterDirection.Input);

                    p.Add("@StatId", saveBo.StatId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@DefaultCurrencyId", saveBo.DefaultCurrencyId, DbType.Int32, ParameterDirection.Input);

                    p.Add("@Phone", saveBo.Phone, DbType.String, ParameterDirection.Input);
                    p.Add("@Notes", saveBo.Notes, DbType.String, ParameterDirection.Input, 255);

                    p.Add("@TaxOffice ", saveBo.TaxOffice, DbType.String, ParameterDirection.Input, 255);
                    p.Add("@TaxNumber ", saveBo.TaxNumber, DbType.String, ParameterDirection.Input, 50);

                    p.Add("@AddressCityId", saveBo.AddressCityId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@AddressDistrictId", saveBo.AddressDistrictId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@AddressCountryId", saveBo.AddressCountryId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@AddressStateId", saveBo.AddressStateId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@AddressNotes ", saveBo.AddressNotes, DbType.String, ParameterDirection.Input, 255);

                    p.Add("@ParentRelationPersonId", saveBo.ParentRelationPersonId, DbType.Int64, ParameterDirection.Input);
                    p.Add("@ChildRelationTypeId", saveBo.ChildRelationTypeId, DbType.Int32, ParameterDirection.Input);

                    conn.Execute("spAloneSave", p, commandType: CommandType.StoredProcedure);
                    responseBo.Message    = p.Get <string>("@Message");
                    responseBo.IsSuccess  = p.Get <bool>("@IsSuccess");
                    responseBo.ReturnedId = p.Get <long?>("@ReturnedId");
                }
            }
            catch (Exception ex)
            {
                responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, saveBo);
            }

            return(responseBo);
        }
Esempio n. 2
0
        public ResponseDto Save(AlonePersonDto saveDto)
        {
            ResponseDto responseDto = new ResponseDto();

            AlonePersonBo personAccountBo = new AlonePersonBo()
            {
                Id      = saveDto.Id,
                Name    = saveDto.Name,
                Surname = saveDto.Surname,
                Email   = saveDto.Email,

                PersonTypeId = saveDto.PersonTypeId,

                StatId            = saveDto.StatId,
                DefaultCurrencyId = saveDto.DefaultCurrencyId,


                Phone = saveDto.Phone,
                Notes = saveDto.Notes,

                ParentRelationPersonId = saveDto.ParentRelationPersonId,
                ChildRelationTypeId    = saveDto.ChildRelationTypeId,

                TaxNumber = saveDto.TaxNumber,
                TaxOffice = saveDto.TaxOffice,

                PersonAddressId   = saveDto.PersonAddressId,
                AddressCountryId  = saveDto.AddressCountryId,
                AddressStateId    = saveDto.AddressStateId,
                AddressCityId     = saveDto.AddressCityId,
                AddressDistrictId = saveDto.AddressDistrictId,
                AddressNotes      = saveDto.AddressNotes,

                Session = Session
            };

            ResponseBo responseBo = alonePersonBusiness.Save(personAccountBo);

            responseDto = responseBo.ToResponseDto();

            return(responseDto);
        }