I have created the recommended modules and comments for the student competencies database. But what's wrong, why did it not appear?
Here is the screenshot for this:
screenshot
DatabasehelperCompetencies.java
LearnerInformation.java
RecommendedModule.java
I got the code
Intent intent = getIntent();
if(intent != null) {
id = intent.getStringExtra("id");
loginName = intent.getStringExtra("name");
studentName = intent.getStringExtra("studentName");
Competencies = intent.getStringExtra("title");
Answer1 = intent.getStringExtra("answer1");
Answer2 = intent.getStringExtra("answer2");
Answer3 = intent.getStringExtra("answer3");
Answer4 = intent.getStringExtra("answer4");
RecommendedModule = intent.getStringExtra("recommendedModule");
StudentComments = intent.getStringExtra("studentComments");
}
getId = Integer.parseInt(id);
login_Name.setText(loginName);
studentname.setText(studentName);
competencies.setText(Competencies);
answer1.setText(Answer1);
answer2.setText(Answer2);
answer3.setText(Answer3);
answer4.setText(Answer4);
recommendedModule.setText(RecommendedModule);
comments.setText(StudentComments);
Related
I want to add xml to my .docx document using python-docx library. I tried this code from stackoverflow but it doesn't work, I don't know why. I get nothing when opening the docx with LibreOffice and Microsoft word.
table = document.add_table(rows=1, cols=1)
p = table.cell(0, 0).paragraphs[0]
run = p.add_run()
tag = run._r
start = docx.oxml.shared.OxmlElement('w:bookmarkStart')
start.set(docx.oxml.ns.qn('w:id'), '0')
start.set(docx.oxml.ns.qn('w:name'), '0')
tag.append(start)
ctype = docx.oxml.OxmlElement('w:complexType')
ctype.set(docx.oxml.ns.qn('w:name'), 'CT_FFCheckBox')
seq = docx.oxml.OxmlElement('w:sequence')
choice = docx.oxml.OxmlElement('w:choice')
el = docx.oxml.OxmlElement('w:element')
el.set(docx.oxml.ns.qn('w:name'), 'size')
el.set(docx.oxml.ns.qn('w:type'), 'CT_HpsMeasure')
el2 = docx.oxml.OxmlElement('w:element')
el2.set(docx.oxml.ns.qn('w:name'), 'sizeAuto')
el2.set(docx.oxml.ns.qn('w:type'), 'CT_OnOff')
choice.append(el)
choice.append(el2)
el3 = docx.oxml.OxmlElement('w:element')
el3.set(docx.oxml.ns.qn('w:name'), 'default')
el3.set(docx.oxml.ns.qn('w:type'), 'CT_OnOff')
el3.set(docx.oxml.ns.qn('w:minOccurs'), '0')
el4 = docx.oxml.OxmlElement('w:element')
el4.set(docx.oxml.ns.qn('w:name'), 'checked')
el4.set(docx.oxml.ns.qn('w:type'), 'CT_OnOff')
el4.set(docx.oxml.ns.qn('w:minOccurs'), '0')
seq.append(choice)
seq.append(el3)
seq.append(el4)
ctype.append(seq)
start.append(ctype)
end = docx.oxml.shared.OxmlElement('w:bookmarkEnd')
end.set(docx.oxml.ns.qn('w:id'), '0')
end.set(docx.oxml.ns.qn('w:name'), '0')
tag.append(end)
Can you help me? Thank you very much
PS : I find the code here
Tweaking the function from this SO post, I got this to work.
import docx
import random
def addCheckbox(para, box_id, name):
run = para.add_run()
tag = run._r
fld = docx.oxml.shared.OxmlElement('w:fldChar')
fld.set(docx.oxml.ns.qn('w:fldCharType'), 'begin')
ffData = docx.oxml.shared.OxmlElement('w:ffData')
e = docx.oxml.shared.OxmlElement('w:name')
e.set(docx.oxml.ns.qn('w:val'), 'Check1')
ffData.append(e)
ffData.append(docx.oxml.shared.OxmlElement('w:enabled'))
e = docx.oxml.shared.OxmlElement('w:calcOnExit')
e.set(docx.oxml.ns.qn('w:val'), '0')
ffData.append(e)
e = docx.oxml.shared.OxmlElement('w:checkBox')
e.append(docx.oxml.shared.OxmlElement('w:sizeAuto'))
ee = docx.oxml.shared.OxmlElement('w:default')
ee.set(docx.oxml.ns.qn('w:val'), '0')
e.append(ee)
ffData.append(e)
fld.append(ffData)
tag.append(fld)
run2 = para.add_run()
tag2 = run2._r
start = docx.oxml.shared.OxmlElement('w:bookmarkStart')
start.set(docx.oxml.ns.qn('w:id'), str(box_id))
start.set(docx.oxml.ns.qn('w:name'), name)
tag2.append(start)
run3 = para.add_run()
tag3 = run3._r
instr = docx.oxml.OxmlElement('w:instrText')
instr.text = 'FORMCHECKBOX'
tag3.append(instr)
run4 = para.add_run()
tag4 = run4._r
fld2 = docx.oxml.shared.OxmlElement('w:fldChar')
fld2.set(docx.oxml.ns.qn('w:fldCharType'), 'end')
tag4.append(fld2)
run5 = para.add_run()
tag5 = run5._r
end = docx.oxml.shared.OxmlElement('w:bookmarkEnd')
end.set(docx.oxml.ns.qn('w:id'), str(box_id))
end.set(docx.oxml.ns.qn('w:name'), name)
tag5.append(end)
if __name__ == '__main__':
document = docx.Document()
document.add_heading('Document Title', 0)
p1 = document.add_paragraph('A paragraph with a checkbox ')
addCheckbox(p1, random.randint(16*1024, 32*1024), 'justinwashere')
document.save('demo.docx')
I changed the contents of his ffData in the function to match the replacement XML in his original question.
How to update all legal entity in stripe through API?
Thanks in advance. When run this, it throws errors like invalid arguments
\Stripe\Stripe::setApiKey("");
$account = \Stripe\Account::retrieve("");
$account->first_name = "555-867-5309";
$account->save();
$acc_details = \Stripe\Account::retrieve('');
$acc_details->legal_entity['first_name'] = 'First Name';
$acc_details->legal_entity['last_name'] = 'Last Name';
$acc_details->legal_entity['dob']['day'] = '04';
$acc_details->legal_entity['dob']['month'] = '05';
$acc_details->legal_entity['dob']['year'] = '1980';
$acc_details->legal_entity['type'] = 'individual';//Either “individual” or “company”
$acc_details->legal_entity['address']['city'] = 'Abbotsford';
$acc_details->legal_entity['address']['country'] = 'CA';
$acc_details->legal_entity['address']['line1'] = '33415 Maclure Rd';
$acc_details->legal_entity['address']['line2'] = '33415 Maclure Rd';
$acc_details->legal_entity['address']['postal_code'] = 'V2S 7W2';
$acc_details->legal_entity['address']['state'] = 'BC';
$acc_details->legal_entity['personal_id_number'] = '056464654';
Can anyone see the mistake in code
def add_kraken_order():
url = 'https://api.kraken.com/0/private/AddOrder'
key = 'PuwrA+0sssssssssNOTREALsssssssssssssssssq5qj'
secret = 'NVZh7FlQBpssNOTREALssssssssssKBwq4CYSSIjspXR6XGg=='
pair = 'XXBTZEUR'
buysell = 'buy'
ordertype = 'limit'
volume = '1'
orderinfo = ('AddOrder', {'pair': pair,'type' : buysell,
'ordertype' : ordertype, 'volume' : volume,})
market='https://api.kraken.com/0/private/AddOrder'
rr=request.post.market(orderinfo)
Hello I am banging my head against the wall trying find the correct way to insert a customer location using a graph. I am currently using the PX.Objects.CR.CustomerLocationMaint graph. But when I insert or set current location it is always null.
Here is my code
private PX.Objects.CR.Location UpdateCustomerLocation(PX.Objects.AR.Customer cust, ListingRead currentListing, ListingContactRelnListing contact)
{
PX.Objects.AR.CustomerLocationMaint g = new PX.Objects.AR.CustomerLocationMaint();
g.Clear(PXClearOption.ClearAll);
g.BusinessAccount.Current = cust;
PX.Objects.CR.Location loc = new PX.Objects.CR.Location();
loc.BAccountID = cust.BAccountID;
loc.LocationCD = "RL" + contact.contact.id;
loc.Descr = currentListing.property.system_search_key;
loc.DefContactID = cust.DefContactID;
loc.IsActive = true;
loc.LocType = "CU";
g.Location.Current = loc;
loc = g.Location.Insert(loc);
PX.Objects.CR.Address addr = new PX.Objects.CR.Address();
addr.BAccountID = cust.BAccountID;
addr.AddressType = "BS";
addr.CountryID = "NZ";
addr.AddressLine1 = currentListing.property.adr_street_number + " " + currentListing.property.adr_street_name;
addr.AddressLine2 = currentListing.property.adr_suburb_or_town;
addr.AddressLine3 = currentListing.property.adr_state_or_region;
addr = g.Address.Insert(addr);
loc.DefAddressID = addr.AddressID;
g.Location.Update(loc);
g.Actions.PressSave();
return loc;
}
Given the following code, is there anyway to get Automapper to do this instead of manually setting the properties? I'm trying to avoid having to do a one to one mapping at Mapper.CreateMap, since I;m constantly adding and removing fields from Contract, and at the moment have to remember to update this method with the changes.
private void MapModelToContract(ContractDto model, Contract contract)
{
contract.Id = model.Id;
contract.ContractDetail.BuyerCornhouseName = model.ContractDetailBuyerCornhouseName;
contract.ContractDetail.CnoCornLtdToBuyer = model.ContractDetailCnoCornLtdToBuyer;
contract.ContractDetail.CnoCornPartToCornLtd = model.ContractDetailCnoCornPartToCornLtd;
contract.ContractDetail.CnoSellerCornLtd = model.ContractDetailCnoSellerCornLtd;
contract.ContractDetail.CnoSellerCornPart = model.ContractDetailCnoSellerCornPart;
contract.ContractDetail.Commission = model.ContractDetailCommission;
contract.ContractDetail.ContractPrice = model.ContractDetailContractPrice;
contract.ContractDetail.SalesPriceToCornLtd = model.ContractDetailSalesPriceToCornLtd;
contract.ContractDetail.ContractedQuantity = model.ContractDetailContractedQuantity;
contract.ContractDetail.CostWarehouseToFob = model.ContractDetailCostWarehouseToFob;
contract.ContractDetail.Date = model.ContractDetailDate;
contract.ContractDetail.DeliveryDate = model.ContractDetailDeliveryDate;
contract.ContractDetail.FinalBuyerName = model.ContractDetailFinalBuyerName;
contract.ContractDetail.FinalSalesPrice = model.ContractDetailFinalSalesPrice;
contract.ContractDetail.Grade = model.ContractDetailGrade;
contract.ContractDetail.Notes = model.ContractDetailNotes;
contract.ContractDetail.PayableQuantity = model.ContractDetailPayableQuantity;
contract.ContractDetail.SalesShipmentPeriod = model.ContractDetailSalesShipmentPeriod;
contract.ContractDetail.SellerName = model.ContractDetailSellerName;
contract.ContractDetail.ToBePaidBy = model.ContractDetailToBePaidBy;
contract.ContractDetail.SalesBasis = model.ContractDetailSalesBasis;
contract.ContractDetail.SalesFreightValue = model.ContractDetailSalesFreightValue;
contract.CurrencyContract.Date = model.CurrencyContractDate;
contract.CurrencyContract.ExchangeRate = model.CurrencyContractExchangeRate;
contract.CurrencyContract.Number = model.CurrencyContractNumber;
contract.CurrencyContract.Value = model.CurrencyContractValue;
contract.CurrencyContract.IsAcc = model.CurrencyContractIsAcc;
contract.CurrencyContract.RepaidOn = model.CurrencyContractRepaidOn;
contract.CurrencyContract.RepaymentDate = model.CurrencyContractRepaymentDate;
contract.Discounts.Reason = model.DiscountsReason;
contract.Discounts.Value = model.DiscountsValue;
contract.DocumentControl.GuaranteeLetterReceived = model.DocumentControlGuaranteeLetterReceived;
contract.DocumentControl.PhotosReceived = model.DocumentControlPhotosReceived;
contract.GoodsStatus.ContainerNumber = model.GoodsStatusContainerNumber;
contract.GoodsStatus.EtaPort = model.GoodsStatusEtaPort;
contract.GoodsStatus.ExpectedDeliveryDate = model.GoodsStatusExpectedDeliveryDate;
contract.GoodsStatus.Port = model.GoodsStatusPort;
contract.GoodsStatus.ShippedStatus = model.GoodsStatusShippedStatus;
contract.GoodsStatus.VesselDeadline = model.GoodsStatusVesselDeadline;
contract.GoodsStatus.VesselName = model.GoodsStatusVesselName;
contract.GoodsStatus.HasSellerConfirmedRelease = model.GoodsStatusHasSellerConfirmedRelease;
contract.GoodsStatus.ReceivedShippingInstructions = model.GoodsStatusReceivedShippingInstructions;
contract.GoodsStatus.Notes = model.GoodsStatusNotes;
contract.NotaFiscalCornPart.Date = model.NotaFiscalCornPartDate;
contract.NotaFiscalCornPart.ExchangeRate = model.NotaFiscalCornPartExchangeRate;
contract.NotaFiscalCornPart.Number = model.NotaFiscalCornPartNumber;
contract.NotaFiscalSeller.Date = model.NotaFiscalSellerDate;
contract.NotaFiscalSeller.GoodsReleased = model.NotaFiscalSellerGoodsReleased;
contract.NotaFiscalSeller.Number = model.NotaFiscalSellerNumber;
contract.TransferToSeller.Date = model.TransferToSellerDate;
contract.TransferToSeller.TransferredFrom = model.ContractDetailBuyerCornhouseName;
contract.TransferToSeller.Value = model.TransferToSellerValue;
contract.CommissionLawyer.IsPaid = model.CommissionLawyerIsPaid;
}
The below mapper works for you.
If the Source (ContractDto) and Destination (Contract) have same property names.
Mapper.CreateMap<ContractDto, Contract>(); // Maps if ContractDto & Contract have same property names
If the Source (ContractDto) and Destination (Contract) have diff property names. Then
Mapper.CreateMap<ContractDto, Contract>()
.ForMember(destination => destination.BuyerCornhouseName, options => options.MapFrom(source => source.ContractDetailBuyerCornhouseName))
.ForMember(destination => destination.CnoCornLtdToBuyer, options => options.MapFrom(source => source.ContractDetailCnoCornLtdToBuyer));
// Explicitly you have specify for other properties also