I am trying to add a new defect in QC using OTA API. I am unable to set some mandatory fields while defect creation. Below is my code.I am using .NET framework 4.5 and C# for code development.
There is a problem with Issue Type field, constant used for Issue Type is BG_USER_02
If I set value to this Issue Type constant it shows error as "Required field can not be empty or SPACE filled" even though I already set value for status as bug1.Status = "New"
If I commented Issue Type that is
//Issue Type
//bug1["BG_USER_02"] = "Defect";
It gives error as Required field can not be empty or SPACE filled.;
Also Please tell me constant(eg.BG_USER_02) value used for following mandatory fields that is Issue Type, Product, Application & Module are correct or not If these are not proper constant values please suggest me constant values for these fields.
//Issue Type
bug1["BG_USER_02"] = "Defect";
//Product
bug1["BG_USER_07"] = "Product1";
//Application
bug1["BG_USER_08"] = "Application";
//Module
bug1["BG_USER_04"] = "Accounts";
string qcUrl = "http://localhost:XXXX/qcbin";
string qcDomain = "TestDomain";
string qcProject = "TestProject";
string qcLoginName = "user1";
string qcPassword = "user1";
TDConnection connection = new TDConnection();
connection.InitConnectionEx(qcUrl);
connection.ConnectProjectEx(qcDomain, qcProject, qcLoginName, qcPassword);
BugFactory bugFact = connection.BugFactory;
Bug bug1 = bugFact.AddItem(System.DBNull.Value);
//Summery
bug1.Summary = "This is summary";
//Detected in Cycle
bug1["BG_DETECTED_IN_RCYC"] = #"Release\Program\Test\Value";
// Detected in Release
bug1["BG_DETECTED_IN_REL"] = #"Release\Program\Test\Value";
//Issue Type
bug1["BG_USER_02"] = "Defect";
//Product
bug1["BG_USER_07"] = "Product1";
//Application
bug1["BG_USER_08"] = "Application";
//Module
bug1["BG_USER_04"] = "Accounts";
//Priority
bug1.Priority = "P1 - High";
//Severity
bug1["BG_SEVERITY"] = "SEVERITY1";
//Lines of Business
bug1.Project = "Fire";
//Reproducible
bug1["BG_REPRODUCIBLE"] = "Y";
// Owner Name
bug1.AssignedTo = "XYZ";
//Status
bug1.Status = "New";
//Detected By
bug1.DetectedBy = "user1";
//Detected on Date
bug1["BG_DETECTION_DATE"] = "9/9/2016";
//Detected in Version
bug1["BG_DETECTION_VERSION"] = "8.1.0.11";
//Description
bug1["BG_DESCRIPTION"] = "Description";
bug1.Post();
MessageBox.Show("Post");
connection.DisconnectProject();
connection.Logout();
connection.ReleaseConnection();
Thanks
Amrapali Kamble
Related
I am trying to directly charge the customer using Stripe. I am using this sample code:
var stripeChargeCreateOptions = new StripeChargeCreateOptions();
stripeChargeCreateOptions.Amount = 1000;
stripeChargeCreateOptions.Currency = "usd";
stripeChargeCreateOptions.Description = "Test";
stripeChargeCreateOptions.Source = new StripeSourceOptions()
{
Number = "4242424242424242",
ExpirationYear = "2022",
ExpirationMonth = "10",
AddressCountry = "US", // optional
AddressLine1 = "24 Beef Flank St", // optional
AddressLine2 = "Apt 24", // optional
AddressCity = "Biggie Smalls", // optional
AddressState = "NC", // optional
AddressZip = "27617", // optional
Name = "Joe Meatballs", // optional
Cvc = "1223" // optional
};
stripeChargeCreateOptions.Capture = true;
var stripeChargeService = new StripeChargeService();
StripeCharge stripeCharge = stripeChargeService.Create(stripeChargeCreateOptions);
This seems to work in test mode. Here are my 3 questions:
The amount 1000 here is 10 USD - right?
Will this also work using live keys? I heard Stripe does not allow direct charge and requires us to their Javascript and store token for us to actually charge? How is it working in test mode?
What is the importance of stripeChargeCreateOptions.Capture = true; What would happen if I set it to false?
Yes, that's right. All amounts are in cents/pence.
I don't know enough about Stripe to help you with this one I'm afraid.
This tells Stripe what process to use to carry out the transaction - it's the second half of a charge previously created with the Capture property set to 'false'. So you would later need to call the API with it set to true to actually complete the charge. See the API for more information: https://stripe.com/docs/api?lang=php#capture_charge
I made a drag-and-drop workflow, and got an Literal error while passing an object through the INargument. Any ideas how I can get around this error?
error: 'Literal': Literal only supports value types and the immutable type System.String. The type System.Object cannot be used as a literal.
I've seen some answers, but all the examples are in hard-coded workflows, and I don't want rewrite the whole workflow in hard-code.
WorkflowActivitycheckdb ActEmail = new WorkflowActivitycheckdb {
EmailList = AdminsToList,
EmailContent = tolist,
UserName = name,
UnApprovedS = UnApproved,
NumberOfUsers = tel,
NumberOfAdmins = tel2
};
WorkflowInvoker.Invoke(ActEmail);
please help.
WorkflowActivitycheckdb ActEmail = new WorkflowActivitycheckdb {
EmailList = new InArgument<Whateveryourobjectis>( x=> AdminsToList),
EmailContent = tolist,
UserName = name,
UnApprovedS = UnApproved,
NumberOfUsers = tel,
NumberOfAdmins = tel2
};
WorkflowInvoker.Invoke(ActEmail);
gl
You could try writing that particular line outside the object initializer.
Eg :
ActEmail.EmailList = AdminsToList;
Make the EmailList class immutable.
I built an ASP.net usercontrol and I am trying to get the text from the checkbox to pass to the database. My problem is I keep getting an error on submission with the method I use. Here is what I used:
ResidenceHallInspection rhi = new ResidenceHallInspection();
rhi.versionId = version.id;
rhi.submitDate = DateTime.Now;
rhi.CheckInOrOut = ddlCheck.SelectedItem.Text;
rhi.StudentId = txtStudentId.Text;
rhi.FirstName = txtFirstName.Text;
rhi.MiddleName = txtMiddleName.Text;
rhi.LastName = txtLastName.Text;
rhi.Walls = chbxWalls.SelectedItem.Text;
rhi.Windows = chbxWindows.SelectedItem.Text;
rhi.Blinds = chbxBlinds.SelectedItem.Text;
rhi.Couch = chbxCouch.SelectedItem.Text;
rhi.CommonRoomCouch = chbxCRCouch.SelectedItem.Text;
rhi.CommonRoomChair = chbxCRChair.SelectedItem.Text;
rhi.Doors = chbxDoors.SelectedItem.Text;
rhi.Carpet = chbxCarpet.SelectedItem.Text;
rhi.Ceiling = chbxCeiling.SelectedItem.Text;
rhi.CommonRoomCounter = chbxCRCounter.SelectedItem.Text;
rhi.Cabinet = chbxCabinet.SelectedItem.Text;
rhi.Phone = chbxPhone.SelectedItem.Text;
rhi.Bed = chbxBed.SelectedItem.Text;
rhi.Desk = chbxDesk.SelectedItem.Text;
rhi.DeskChairs = chbxDeskChair.SelectedItem.Text;
rhi.Tub = chbxTub.SelectedItem.Text;
rhi.Vanity = chbxVanity.SelectedItem.Text;
rhi.Notes = txtNotes.Text;
rhi.Building = txtResHall.Text;
rhi.ApartmentNumber = txtSuitNo.Text;
rhi.BedSpace = txtBedSpace.Text;
house.AddToResidenceHallInspections(rhi);
house.SaveChanges()
It would be good to see more information, such as the error you received, and possible the code and/or HTML for the custom user control. However, there are a couple of possibilities which seem likely. One is that your SelectedItem property may be null, which would cause an ObjectReferenceException to occur. Another is that Text itself is null, and that your database doesn't allow a null value for one or more of the fields you're assigning.
You can get a better answer than this rather vague one if you provide more information.
I'm having trouble performing an update in the Entity Framework. I don't really understand the behaviour I am seeing.
I am using the AdventureWorks database.
The starting value for the StateProvince is Micronesia. If I change it to Maryland, the update is successful. However, if I then try to change it back to Micronesia, I get the following error:
"Cannot insert duplicate key row in object 'Sales.SalesTerritory' with
unique index 'AK_SalesTerritory_Name'.\r\nThe statement has been
terminated."
The DAL method in question is:
public static void UpdateCustomer(CustomerDetails customerDetails)
{
AWEntities context = Common.GetContext();
var customerQuery = from c in context.Individuals
.Include("Contact")
.Include("Customer.CustomerAddresses.Address.StateProvince.SalesTerritory")
//.Include("Customer.SalesTerritory.StateProvinces")
.Where(id => id.CustomerID == customerDetails.CustomerId)
select c;
var individual = customerQuery.ToList().ElementAt(0);
Contact contact = individual.Contact;
contact.LastName = customerDetails.LastName;
contact.MiddleName = customerDetails.MiddleName;
contact.FirstName = customerDetails.FirstName;
contact.EmailAddress = customerDetails.EmailAddress;
contact.Phone = customerDetails.Phone;
contact.Title = customerDetails.Title;
AWModel.Customer customer = individual.Customer;
customer.CustomerID = customerDetails.CustomerId;
customer.SalesTerritory.Name = customerDetails.SalesTerritory;
Address address = individual.Customer.CustomerAddresses.ElementAt(0).Address;
address.AddressLine1 = customerDetails.AddressLine1;
address.AddressLine2 = customerDetails.AddressLine2;
address.City = customerDetails.City;
address.PostalCode = customerDetails.PostalCode;
address.StateProvinceID = customerDetails.SalesProvinceId;
context.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);
}
Can anyone identify the correct way to do what I am attempting.
This is occurring when you update the SalesTerritory.Name property:
customer.SalesTerritory.Name = customerDetails.SalesTerritory;
The effect is to change the SalesTerritory entity, rather than the customer entity. I believe you want something more like:
customer.SalesTerritoryID = customerDetails.SalesTerritoryID;
I have added custom attribute with the code "my_price" with "Catalog Input Type for Store Owner" set to "Price" and assigned it to the "Default" (only) attribute set.
Now, I want to set its value, everytime I add/update product with API v2 (C#). Here is the code which does not work (the value is not being set):
// Connect & Auth:
Mage_Api_Model_Server_V2_HandlerPortTypeClient handler = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
session_id = handler.login(username, api_key);
// Getting attributes set:
catalogProductAttributeSetEntity[] attributeSets;
attributeSets = handler.catalogProductAttributeSetList(session_id);
attributeSet = attributeSets[0];
string attributeset_id = attributeSet.set_id.ToString();
// Adding product:
catalogProductCreateEntity mageProduct = new catalogProductCreateEntity();
// (...) setting product's name, sku, etc.
associativeEntity AdditionalAttributes = new associativeEntity();
AdditionalAttributes.key = "my_price";
AdditionalAttributes.value = "12,33";
associativeEntity[] AssociativeEntity = new associativeEntity[1];
AssociativeEntity[0] = AdditionalAttributes;
mageProduct.additional_attributes = AssociativeEntity;
handler.catalogProductCreate(session_id, "simple", attributeset_id, sku, mageProduct, "default");
What am I doing wrong?
Magento 1.6.1.0 has a bug which results with additional attributes error.
I have upgraded my Magento to 1.6.2.0 and the problem disappeared and additional attributes works perfectly.
Quick example of how it works:
associativeEntity[] AdditionalAttributes = new associativeEntity[1];
associativeEntity AdditionalAttribute = new associativeEntity();
AdditionalAttribute.key = "myprice";
AdditionalAttribute.value = getOriginalPrice(prices).ToString();
AdditionalAttributes[0] = AdditionalAttribute;
catalogProductAdditionalAttributesEntity AdditionalAttributesEntity = new catalogProductAdditionalAttributesEntity();
AdditionalAttributesEntity.single_data = AdditionalAttributes;
mageProduct.additional_attributes = AdditionalAttributesEntity;
Hope it helps someone.
Try this and let me know the result.
AdditionalAttributes.key = "myPrice";
handler.catalogProductCreate(session_id, "simple", attributeset_id, sku, mageProduct, "default");
Give valid storeview instead of default e.g. try this:
handler.catalogProductCreate(session_id, "simple", attributeset_id, sku, mageProduct, "1");