public async Task <int> SaveBusinessPartnerDetail(BusinessPartnerDetail businessPartnerDetail) { DynamicParameters parameters = new DynamicParameters(); parameters.Add("@BusinessPartnerDetailId", businessPartnerDetail.BusinessPartnerDetailId, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@BusinessPartnerId", businessPartnerDetail.BusinessPartnerId, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@TelephoneNumber1", businessPartnerDetail.TelephoneNumber1, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@TelephoneNumber2", businessPartnerDetail.TelephoneNumber2, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@MobileNumber", businessPartnerDetail.MobileNumber, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@Fax", businessPartnerDetail.Fax, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@Email", businessPartnerDetail.Email, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@WebSite", businessPartnerDetail.WebSite, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@ShippingType", businessPartnerDetail.ShippingType, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@Address1", businessPartnerDetail.Address1, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@Address2", businessPartnerDetail.Address2, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@ZipCode", businessPartnerDetail.ZipCode, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@Barangay", businessPartnerDetail.Barangay, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@Province", businessPartnerDetail.Province, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@City", businessPartnerDetail.City, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@UserId", businessPartnerDetail.UserId, System.Data.DbType.String, System.Data.ParameterDirection.Input); parameters.Add("@ChangedDate", new DateTime(businessPartnerDetail.VersionTimeStamp), System.Data.DbType.DateTime2, System.Data.ParameterDirection.Input); var rowsAffected = await UnitOfWork.Connection.ExecuteAsync( sql : SP_SAVE_BUSINESSPARTNERDETAIL, param : parameters, transaction : UnitOfWork.Transaction, commandType : System.Data.CommandType.StoredProcedure); return(rowsAffected); }
/// <summary> /// Adds a Business Partner /// </summary> public void Put(BusinessPartnerDetail businessPartner) { if (businessPartner == null || !ModelState.IsValid) { throw new HttpException((int)HttpStatusCode.BadRequest, "Invalid Request"); } businessPartnerService.AddBusinessPartner(businessPartner.CreateFrom()); }
private void ExcuteAddNewBusinessPartnerCommand() { try { var bPDetailWindow = new BusinessPartnerDetail(BusinessPartnerTypes.Customer); bPDetailWindow.ShowDialog(); var dialogueResult = bPDetailWindow.DialogResult; if (dialogueResult != null && (bool)dialogueResult) { LoadBusinessPartners(); SelectedBusinessPartner = BusinessPartners.LastOrDefault(); } } catch (Exception exception) { MessageBox.Show("Can't add customer" + Environment.NewLine + exception.Message, "Can't add customer", MessageBoxButton.OK, MessageBoxImage.Error); } }