Delegate's Excecution Time In Production Environment - delegates

Here is my previous code:
objChartControls.RFV = GetChartFacadeObj().LoadROV(chartID);
objChartControls.Vitals = GetChartFacadeObj().LoadLastVitalPrint(patientAccount, chartID);
objChartControls.Allergies = GetChartFacadeObj().LoadAllergyPrintData(long.Parse(patientAccount), long.Parse(chartID), Is_CF);
objChartControls.PMH = GetChartFacadeObj().GetPastMedicalProblems(patientAccount, chartID, Is_CF);
objChartControls.Immunization = GetChartFacadeObj().GetPatientImmunizationData_New(patientAccount, chartID, Is_CF);
objChartControls.PastHospitalization = GetChartFacadeObj().GetPastHospitialization(patientAccount, chartID, Is_CF);
objChartControls.PastSurgeries = GetChartFacadeObj().GetSurgeryProcedure(long.Parse(patientAccount), long.Parse(chartID), Is_CF);
objChartControls.Cognative = GetChartFacadeObj().GetCognative_Functional_New(long.Parse(chartID), long.Parse(patientAccount), Is_CF);
objChartControls.CarePlanNotes = GetChartFacadeObj().GetPatientCarePlan(patientAccount, chartID);
objChartControls.SocialHx = GetChartFacadeObj().GetSocialHxDetail(long.Parse(patientAccount), long.Parse(chartID), Is_CF);
objChartControls.FamilyHx = GetChartFacadeObj().GetFamilyHxDetail(chartID, patientAccount, Is_CF);
objChartControls.ROS = GetChartFacadeObj().GetPatientRosChartsPrint(patientAccount, chartID);
objChartControls.AssessmentsComment = GetChartFacadeObj().GetOfficeAssesmentComments(patientAccount, chartID); 
objChartControls.PE = GetChartFacadeObj().GetPatientPhysicalExam(chartID);
objChartControls.ChartNotes = GetChartFacadeObj().GetPatientChartNotes(patientAccount, chartID);
// objChartControls.PlanofCareNotes = GetChartFacadeObj().GetPatientPlanOfCareNotes(patientAccount, chartID);
objChartControls.OfficeAssessments = GetChartFacadeObj().GetPatientOfficeAssesmentDetails1(patientAccount, chartID, Is_CF);
objChartControls.OfficeProcedures = GetChartFacadeObj().GetPatientOfficeProcedureDetails(patientAccount, chartID);
objChartControls.Dermatology = GetPatientDermatologicalExam(patientAccount, chartID);
objChartControls.Nuerology = GetPatientNeurologilcalExam(patientAccount, chartID);
objChartControls.Muscolotecal = GetPatientMuscoloskeletalExam(patientAccount, chartID);
RxPrescription objPrescripton = new RxPrescription(GetProBaseObj().UserName.ToString(), GetProBaseObj().GetPropertyValue("ConnectionStringName").ToString(), GetProBaseObj().GetPropertyValue("PracticeCode").ToString());
objChartControls.Medication = objPrescripton.GetPatientPrescription("", patientAccount, true, chartID, Is_CF);
objChartControls.Phy.Psy = getphsydata().GetSocialRows(chartID, patientAccount, true);
objChartControls.Phy.psy_men = getphsydata().GetPhyscRows(chartID, patientAccount, true);
objChartControls.Annotation = GetChartFacadeObj().getAnotDetails(chartID, patientAccount);
objChartControls.Vascular = GetPatientPodiatryVascularExamText(patientAccount, chartID);
OfficeTest objOfficeTest = new OfficeTest();
objOfficeTest.URINALYSIS = GetChartFacadeObj().GetPatientUrinalysisDetails(chartID, patientAccount);
objOfficeTest.SugarLog = GetChartFacadeObj().GetPatientSugarLogDetails(chartID, patientAccount);
objOfficeTest.FSBG = GetChartFacadeObj().GetPatientFSBGDetails(chartID, patientAccount);
objOfficeTest.PeakFlow = GetChartFacadeObj().GetPatientPeakFlowDetails(chartID, patientAccount);
objOfficeTest.EKG = GetChartFacadeObj().GetElectrocardiogramDetails(chartID, patientAccount);
objOfficeTest.Urine_Pregnancy = GetChartFacadeObj().GetPatientCommonTestDetails(chartID, patientAccount, "Urine_Pregnancy");
objOfficeTest.RapidStrep = GetChartFacadeObj().GetPatientCommonTestDetails(chartID, patientAccount, "RapidStrep");
objOfficeTest.Hemoccult = GetChartFacadeObj().GetPatientCommonTestDetails(chartID, patientAccount, "Hemoccult");
objOfficeTest.MonospotStep = GetChartFacadeObj().GetPatientCommonTestDetails(chartID, patientAccount, "MonospotStep");
objOfficeTest.DynamicTestDetails = GetDynamicOfficeTest(chartID);
objChartControls.OBGYNText = getOBGYNHISTORY(patientAccount, chartID);
Now i convert it to delegate logic by calling them asynchronously.Here is my logic:
ChartControls objChartControls = new ChartControls();
RxPrescription objPrescripton = new RxPrescription(GetProBaseObj().UserName.ToString(), GetProBaseObj().GetPropertyValue("ConnectionStringName").ToString(), GetProBaseObj().GetPropertyValue("PracticeCode").ToString());
OfficeTest objOfficeTest = new OfficeTest();
// ali code starts
//Reason For Visit
ReasonForVisitDelegate reasonForVisit = new ReasonForVisitDelegate(GetChartFacadeObj().LoadROV);
IAsyncResult RFV = reasonForVisit.BeginInvoke(chartID, null, null);
// Vitals
VitalsDelegate vitals = new VitalsDelegate(GetChartFacadeObj().LoadLastVitalPrint);
IAsyncResult Vitals = vitals.BeginInvoke(patientAccount, chartID, null, null);
//Allergies
//4855 change id:443 (4855) start
AllergiesDelegate allergies = new AllergiesDelegate(GetChartFacadeObj().LoadAllergyPrintGlobalData);
IAsyncResult Allergies = allergies.BeginInvoke(long.Parse(patientAccount), long.Parse(chartID), "0", null, null);
//Office Assessments
OfficeAssessmentsDelegate officeAssessments = new OfficeAssessmentsDelegate(GetChartFacadeObj().GetAssessmentPrintGlobal);
IAsyncResult OfficeAssessments = officeAssessments.BeginInvoke(patientAccount, chartID, "0", null, null);
//Medication
PrescriptionDelegate prescription = new PrescriptionDelegate(GetChartFacadeObj().GetGlobalPatientPrescription);
IAsyncResult Medication = prescription.BeginInvoke(patientAccount, chartID, "0", null, null);
//Review of System
PatientROSDelegate patientReviewOfSystem = new PatientROSDelegate(GetChartFacadeObj().GetPatientRosChartsPrint);
IAsyncResult ROS = patientReviewOfSystem.BeginInvoke(patientAccount, chartID,"0",null, null);
//4855 change id:443 (4855) end
// Past Medical History
PastMedicalHistoryDelegate pastMedicalHistory = new PastMedicalHistoryDelegate(GetChartFacadeObj().GetPastMedicalProblems);
IAsyncResult PMH = pastMedicalHistory.BeginInvoke(patientAccount, chartID, Is_CF, null, null);
//Immunization
ImmunizationDelegate immunization = new ImmunizationDelegate(GetChartFacadeObj().GetPatientImmunizationData_New);
IAsyncResult Immunization = immunization.BeginInvoke(patientAccount, chartID, Is_CF, null, null);
//PastHospitalization
PastHospitalizationDelegate pastHospitalizationDelegate = new PastHospitalizationDelegate(GetChartFacadeObj().GetPastHospitialization);
IAsyncResult PastHospitalization = pastHospitalizationDelegate.BeginInvoke(patientAccount, chartID, Is_CF, null, null);
//PastSurgeries
PastSurgeriesDelegate pastSurgeries = new PastSurgeriesDelegate(GetChartFacadeObj().GetSurgeryProcedure);
IAsyncResult PastSurgeries = pastSurgeries.BeginInvoke(long.Parse(patientAccount), long.Parse(chartID), Is_CF, null, null);
//Social History
SocialHxDelegate socailHistory = new SocialHxDelegate(GetChartFacadeObj().GetSocialHxDetail);
IAsyncResult SocialHx = socailHistory.BeginInvoke(long.Parse(patientAccount), long.Parse(chartID), Is_CF, null, null);
//Family History
FamilyHxDelegate familyHistory = new FamilyHxDelegate(GetChartFacadeObj().GetFamilyHxDetail);
IAsyncResult FamilyHx = familyHistory.BeginInvoke(chartID, patientAccount, Is_CF, null, null);
//Cognative
CognativeDelegate cognative = new CognativeDelegate(GetChartFacadeObj().GetCognative_Functional_New);
IAsyncResult Cognative = cognative.BeginInvoke(long.Parse(chartID), long.Parse(patientAccount), Is_CF, null, null);
//Patient Care Plan
PatientCarePlanDelegate patientCarePlan = new PatientCarePlanDelegate(GetChartFacadeObj().GetPatientCarePlan);
IAsyncResult CarePlanNotes = patientCarePlan.BeginInvoke(patientAccount, chartID, null, null);
//Assessments Comment
AssessmentsCommentDelegate assesmentComment = new AssessmentsCommentDelegate(GetChartFacadeObj().GetOfficeAssesmentComments);
IAsyncResult AssessmentsComment = assesmentComment.BeginInvoke(patientAccount, chartID, null, null);
//Physical Exam
PhysicalExamDelegate physicalExam = new PhysicalExamDelegate(GetChartFacadeObj().GetPatientPhysicalExam);
IAsyncResult PE = physicalExam.BeginInvoke(chartID, null, null);
//Chart Notes
ChartNotesDelegate chartNotes = new ChartNotesDelegate(GetChartFacadeObj().GetPatientChartNotes);
IAsyncResult ChartNotes = chartNotes.BeginInvoke(patientAccount, chartID, null, null);
//Plan Of Care Notes
PlanofCareNotesDelegate planOfCareNotes = new PlanofCareNotesDelegate(GetChartFacadeObj().GetPatientPlanOfCareNotes);
IAsyncResult PlanofCareNotes = planOfCareNotes.BeginInvoke(patientAccount, chartID, null, null);
//Office Procedures
OfficeProceduresDelegate officeProcedures = new OfficeProceduresDelegate(GetChartFacadeObj().GetPatientOfficeProcedureDetails);
IAsyncResult OfficeProcedures = officeProcedures.BeginInvoke(patientAccount, chartID, null, null);
//Dermatology
DermatologyDelegate dermatology = new DermatologyDelegate(GetPatientDermatologicalExam);
IAsyncResult Dermatology = dermatology.BeginInvoke(patientAccount, chartID, null, null);
//Neurology
NeurologyDelegate neurology = new NeurologyDelegate(GetPatientNeurologilcalExam);
IAsyncResult Nuerology = neurology.BeginInvoke(patientAccount, chartID, null, null);
//Muscolotecal
MuscolotecalDelegate muscolotecal = new MuscolotecalDelegate(GetPatientMuscoloskeletalExam);
IAsyncResult Muscolotecal = muscolotecal.BeginInvoke(patientAccount, chartID, null, null);
//Annotation
AnnotationDelegate annotation = new AnnotationDelegate(GetChartFacadeObj().getAnotDetails);
IAsyncResult Annotation = annotation.BeginInvoke(chartID, patientAccount, null, null);
//Vascular
VascularDelegate vascular = new VascularDelegate(GetPatientPodiatryVascularExamText);
IAsyncResult Vascular = vascular.BeginInvoke(patientAccount, chartID, null, null);
//Urine Analysis
UrineAnalysisDelegate urineAnalysis = new UrineAnalysisDelegate(GetChartFacadeObj().GetPatientUrinalysisDetails);
IAsyncResult URINALYSIS = urineAnalysis.BeginInvoke(chartID, patientAccount, null, null);
//SugarLog
SugarLogDelegate sugarLog = new SugarLogDelegate(GetChartFacadeObj().GetPatientSugarLogDetails);
IAsyncResult SugarLog = sugarLog.BeginInvoke(chartID, patientAccount, null, null);
//FSBG
FsbgDelegate fsbg = new FsbgDelegate(GetChartFacadeObj().GetPatientFSBGDetails);
IAsyncResult FSBG = fsbg.BeginInvoke(chartID, patientAccount, null, null);
//Peak Flow
PeakFlowDelegate peakFlow = new PeakFlowDelegate(GetChartFacadeObj().GetPatientPeakFlowDetails);
IAsyncResult PeakFlow = peakFlow.BeginInvoke(chartID, patientAccount, null, null);
//EKG
EkgDelegate ekg = new EkgDelegate(GetChartFacadeObj().GetElectrocardiogramDetails);
IAsyncResult EKG = ekg.BeginInvoke(chartID, patientAccount, null, null);
//Urine Test
UrinePregnancyDelegate urineTest = new UrinePregnancyDelegate(GetChartFacadeObj().GetPatientCommonTestDetails);
IAsyncResult Urine_Pregnancy = urineTest.BeginInvoke(chartID, patientAccount, "Urine-Pregnancy", null, null);
//Rapid Strep
RapidStrepDelegate rapidStrp = new RapidStrepDelegate(GetChartFacadeObj().GetPatientCommonTestDetails);
IAsyncResult RapidStrep = rapidStrp.BeginInvoke(chartID, patientAccount, "Rapid Strep", null, null);
//Hemoccult
HemoccultDelegate hemocCult = new HemoccultDelegate(GetChartFacadeObj().GetPatientCommonTestDetails);
IAsyncResult Hemoccult = hemocCult.BeginInvoke(chartID, patientAccount, "Hemoccult", null, null);
//Monospot
MonospotDelegate monospot = new MonospotDelegate(GetChartFacadeObj().GetPatientCommonTestDetails);
IAsyncResult MonospotStep = monospot.BeginInvoke(chartID, patientAccount, "Monospot Step", null, null);
//Dynamic Test Detail
DynamicTestDetailDelegate dynamicTestDetail = new DynamicTestDetailDelegate(GetDynamicOfficeTest);
IAsyncResult DynamicTestDetails = dynamicTestDetail.BeginInvoke(chartID, null, null);
//Obgyn Text
ObgynTextDelegate obygnText = new ObgynTextDelegate(getOBGYNHISTORY);
IAsyncResult OBGYNText = obygnText.BeginInvoke(patientAccount, chartID, null, null);
//Social Rows
SocialRowsDelegate socialRow = new SocialRowsDelegate(getphsydata().GetSocialRows);
IAsyncResult Psy = socialRow.BeginInvoke(chartID, patientAccount, true, null, null);
//Physc Rows
PhyscRowsDelegate physRow = new PhyscRowsDelegate(getphsydata().GetPhyscRows);
IAsyncResult psy_men = physRow.BeginInvoke(chartID, patientAccount, true, null, null);
// stop invoking
objChartControls.RFV = reasonForVisit.EndInvoke(RFV);
objChartControls.Vitals = vitals.EndInvoke(Vitals);
objChartControls.Allergies = allergies.EndInvoke(Allergies);
objChartControls.PMH = pastMedicalHistory.EndInvoke(PMH);
objChartControls.Immunization = immunization.EndInvoke(Immunization);
objChartControls.PastHospitalization = pastHospitalizationDelegate.EndInvoke(PastHospitalization);
objChartControls.PastSurgeries = pastSurgeries.EndInvoke(PastSurgeries);
objChartControls.SocialHx = socailHistory.EndInvoke(SocialHx);
objChartControls.FamilyHx = familyHistory.EndInvoke(FamilyHx);
objChartControls.ROS = patientReviewOfSystem.EndInvoke(ROS);
objChartControls.Cognative = cognative.EndInvoke(Cognative);
objChartControls.CarePlanNotes = patientCarePlan.EndInvoke(CarePlanNotes);
objChartControls.AssessmentsComment = assesmentComment.EndInvoke(AssessmentsComment);
objChartControls.PE = physicalExam.EndInvoke(PE);
objChartControls.ChartNotes = chartNotes.EndInvoke(ChartNotes);
objChartControls.PlanofCareNotes = planOfCareNotes.EndInvoke(PlanofCareNotes);
objChartControls.OfficeAssessments = officeAssessments.EndInvoke(OfficeAssessments);
objChartControls.OfficeProcedures = officeProcedures.EndInvoke(OfficeProcedures);
objChartControls.Dermatology = dermatology.EndInvoke(Dermatology);
objChartControls.Nuerology = neurology.EndInvoke(Nuerology);
objChartControls.Muscolotecal = muscolotecal.EndInvoke(Muscolotecal);
objChartControls.Medication = prescription.EndInvoke(Medication);
objChartControls.Annotation = annotation.EndInvoke(Annotation);
objChartControls.Vascular = vascular.EndInvoke(Vascular);
objOfficeTest.URINALYSIS = urineAnalysis.EndInvoke(URINALYSIS);
objOfficeTest.SugarLog = sugarLog.EndInvoke(SugarLog);
objOfficeTest.FSBG = fsbg.EndInvoke(FSBG);
objOfficeTest.PeakFlow = peakFlow.EndInvoke(PeakFlow);
objOfficeTest.EKG = ekg.EndInvoke(EKG);
objOfficeTest.Urine_Pregnancy = urineTest.EndInvoke(Urine_Pregnancy);
objOfficeTest.RapidStrep = rapidStrp.EndInvoke(RapidStrep);
objOfficeTest.Hemoccult = hemocCult.EndInvoke(Hemoccult);
objOfficeTest.MonospotStep = monospot.EndInvoke(MonospotStep);
objOfficeTest.DynamicTestDetails = dynamicTestDetail.EndInvoke(DynamicTestDetails);
objChartControls.OBGYNText = obygnText.EndInvoke(OBGYNText);
objChartControls.Phy.Psy = socialRow.EndInvoke(Psy);
objChartControls.Phy.psy_men = physRow.EndInvoke(psy_men);
On local host,delegates execute faster as compared to sequential function calling .I measure code execution reading through stop watch and also in Network Tab of browser.But when this code is move to production server,it response time is slow as compared to my previous code.I take these readings three to four times.Kindly guide me why this is happening.Thanks.

Related

read QR Code from IMAGE using xamarin forms for both Android and iOS

I already try following code but getting null, I am using zxing nuget package
FileStream fs = new FileStream(imgPath, FileMode.Open, FileAccess.Read);
byte[] ImageData = new byte[fs.Length];
fs.Read(ImageData, 0, System.Convert.ToInt32(fs.Length));
fs.Close();
var barCodeReader = new BarcodeReader();
var luminanceSource = new RGBLuminanceSource(ImageData, 10, 10);
HybridBinarizer hb = new HybridBinarizer(luminanceSource);
var a = hb.createBinarizer(luminanceSource);
BinaryBitmap bBitmap = new BinaryBitmap(a);
MultiFormatReader multiFormatReader = new MultiFormatReader();
Result result = null;
result = multiFormatReader.decodeWithState(bBitmap);
string rf = result.BarcodeFormat.ToString();

HttpClient.PostAsync Image upload

Not sure what is wrong with this code. I get a generic "An error occurred while sending the request". Here is the C# code:
string t1 = "/storage/emulated/0/Android/data/com.je.EE/files/Pictures/Observations/";
string t2 = "592018 115019 AM.jpg";
string t3 = "/storage/emulated/0/Android/data/com.je.EE/files/Pictures/Observations/592018 115019 AM.jpg";
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.TransferEncodingChunked = true;
var content = new MultipartFormDataContent();
// var imageContent = new StreamContent(new FileStream("my_path.jpg", FileMode.Open, FileAccess.Read, FileShare.Read));
var imageContent = new StreamContent(new FileStream(t3, FileMode.Open, FileAccess.Read, FileShare.Read));
imageContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/jpeg");
// content.Add(imageContent, "image", "image.jpg");
content.Add(imageContent, "image", t2);
var url = "http://localhost:62810/api/Files/Upload";
await httpClient.PostAsync(url, content);

MiniProfiler - ProfiledDbDataAdapter

Trying to get MiniProfiler to profile loading a DataTable via a Stored Proc
// Use a DbDataAdapter to return data from a SP using a DataTable
var sqlConnection = new SqlConnection(#"server=.\SQLEXPRESS;database=TestDB;Trusted_Connection=True;");
DbConnection connection = new StackExchange.Profiling.Data.ProfiledDbConnection(sqlConnection, MiniProfiler.Current);
var table = new DataTable();
DbDataAdapter dataAdapter = new SqlDataAdapter("GetCountries", sqlConnection);
ProfiledDbDataAdapter prdataAdapter = new ProfiledDbDataAdapter(dataAdapter, null);
// null reference exception here - SelectCommand is null
prdataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
prdataAdapter.SelectCommand.Parameters.Add(new SqlParameter("#countryID", 2));
prdataAdapter.Fill(table);
ViewBag.table = table;
Problem: Null reference exception on SelectCommand
Please ignore lack of usings / disposing
I can successfully profile using ProfiledDbCommand to a SP:
// call a SP from DbCommand
var sqlConnection2 = new SqlConnection(#"server=.\SQLEXPRESS;database=TestDB;Trusted_Connection=True;");
DbConnection connection2 = new StackExchange.Profiling.Data.ProfiledDbConnection(sqlConnection2, MiniProfiler.Current);
if (connection2 != null)
{
using (connection2)
{
try
{
// Create the command.
DbCommand command = new SqlCommand();
ProfiledDbCommand prcommand = new ProfiledDbCommand(command, connection2, null);
prcommand.CommandType = CommandType.StoredProcedure;
prcommand.CommandText = "dbo.GetCountries";
prcommand.Parameters.Add(new SqlParameter("#countryID", 3));
prcommand.Connection = connection2;
//command.CommandText = "SELECT Name FROM Countries";
//command.CommandType = CommandType.Text;
// Open the connection.
connection2.Open();
// Retrieve the data.
DbDataReader reader = prcommand.ExecuteReader();
while (reader.Read())
{
var text = reader["Name"];
result += text + ", ";
}
}
catch (Exception ex)
{
}
}
}
Edit1:
This works:
// 2) SqlConnection, SqlDataAdapter.. dataAdapter command - works
var sqlConnection = new SqlConnection(#"server=.\SQLEXPRESS;database=TestDB;Trusted_Connection=True;");
var table = new DataTable();
//var dataAdapter = new SqlDataAdapter("GetCountries", sqlConnection);
var dataAdapter = new SqlDataAdapter("select * from countries", sqlConnection);
//dataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
//dataAdapter.SelectCommand.Parameters.AddWithValue("#countryID", 2);
dataAdapter.Fill(table);
This doesn't DataTable.. but does with DataSet
var sqlConnection = new SqlConnection(#"server=.\SQLEXPRESS;database=TestDB;Trusted_Connection=True;");
DbConnection connection = new ProfiledDbConnection(sqlConnection, MiniProfiler.Current);
DbDataAdapter dataAdapter = new SqlDataAdapter("select * from countries", sqlConnection);
ProfiledDbDataAdapter prdataAdapter = new ProfiledDbDataAdapter(dataAdapter, null);
var table = new DataTable();
var dataset = new DataSet();
// Doesn't work
//prdataAdapter.Fill(table);
// Does work
prdataAdapter.Fill(dataset);
It turns out that though ProfiledDbDataAdapter inherited from DbDataAdapter, it did not override the default functionality of DbDataAdapter.Fill(DataTable), leading to the errors that you saw.
I fixed this in the MiniProfiler code. Fix is available in nuget, version 3.0.10-beta7 and higher.
I have tested this with your code from above and it works for me:
DbConnection connection =
new ProfiledDbConnection(sqlConnection, MiniProfiler.Current);
var sql = "select * from countries";
DbDataAdapter dataAdapter = new SqlDataAdapter(sql, sqlConnection);
ProfiledDbDataAdapter prdataAdapter = new ProfiledDbDataAdapter(dataAdapter);
var table = new DataTable();
dataAdapter.Fill(table); // this now works

Magento SOAP V_2 creating order error: Payment not allowed

I am trying to create an order on Magento 1.7.2 using SOAP API V_2 using .NET consol.
I am always getting the same error "Payment not allowerd" using every payment method.
//create an order with Magento API
MagentoService proxy = new MagentoService();
string sessionId = proxy.login("xxx", "xxx");
int idCarrello = proxy.shoppingCartCreate(sessionId, "1");
proxy.UnsafeAuthenticatedConnectionSharing = false;
shoppingCartCustomerEntity clienteMagento = new shoppingCartCustomerEntity();
clienteMagento.firstname = "name";
clienteMagento.lastname = "surname";
clienteMagento.email = "xxx#mmmm.com";
clienteMagento.mode = "guest";
proxy.shoppingCartCustomerSet(sessionId, idCarrello, clienteMagento, "1");
shoppingCartCustomerAddressEntity indirizzoSpedizione = new shoppingCartCustomerAddressEntity();
shoppingCartCustomerAddressEntity indirizzoBill = new shoppingCartCustomerAddressEntity();
indirizzoSpedizione.mode = "shipping";
indirizzoSpedizione.firstname = clienteMagento.firstname;
indirizzoSpedizione.lastname = clienteMagento.lastname;
indirizzoSpedizione.street = "viale europa 32";
indirizzoSpedizione.city = "Foggia";
indirizzoSpedizione.region = "FG";
indirizzoSpedizione.telephone = "111";
indirizzoSpedizione.postcode = "71122";
indirizzoSpedizione.country_id = "IT";
indirizzoSpedizione.is_default_billing = 0;
indirizzoSpedizione.is_default_shipping = 0;
indirizzoBill.mode = "billing";
indirizzoBill.firstname = clienteMagento.firstname;
indirizzoBill.lastname = clienteMagento.lastname;
indirizzoBill.street = "viale europa 32";
indirizzoBill.city = "Foggia";
indirizzoBill.region = "FG";
indirizzoBill.telephone = "111";
indirizzoBill.postcode = "71122";
indirizzoBill.country_id = "IT";
indirizzoBill.is_default_billing = 0;
indirizzoBill.is_default_shipping = 0;
shoppingCartCustomerAddressEntity[] indirizzi = new shoppingCartCustomerAddressEntity[] { indirizzoSpedizione, indirizzoBill };
proxy.shoppingCartCustomerAddresses(sessionId, idCarrello, indirizzi, "1");
proxy.shoppingCartShippingMethod(sessionId, idCarrello, "flatrate_flatrate", "1");
shoppingCartPaymentMethodResponseEntity[] paymentMethods = proxy.shoppingCartPaymentList(sessionId, idCarrello, "1");
Console.WriteLine(paymentMethods); //paymentMethods is always empty!!
shoppingCartPaymentMethodEntity modoPagamento = new shoppingCartPaymentMethodEntity();
modoPagamento.po_number = null;
modoPagamento.method = "checkmo";
modoPagamento.cc_cid = null;
modoPagamento.cc_owner = null;
modoPagamento.cc_number = null;
modoPagamento.cc_type = null;
modoPagamento.cc_exp_year = null;
modoPagamento.cc_exp_month = null;
proxy.shoppingCartPaymentMethod(sessionId, idCarrello, modoPagamento, "1");
Here is the Exception:
//Payment method is not allowed (I tryed checkmo, banktransfer, etc)
//proxy.shoppingCartOrder(sessionId, idCarrello, "1", new string[] { });
Any idea?
Ifaced with the saeme issue. This is the solution - You forgot product, just add product to sale. Also you must do it according to this order (it will not works in other order):
shoppingCartCustomerSet(guest for simplicity);
shoppingCartCustomerAddresses();
shoppingCartProductAdd();
shoppingCartShippingMethod();
shoppingCartPaymentMethod();

Exporting to excel when there are special characters in the data ( French descriptions)

I am exporting data to excel file using Excel query table. There will be a text file with the data containing many rows, each cell is separated by | character. I am dumping the data to excel file using the following code
try
{
//Start Excel and get Application object.
oXL = new Excel.Application();
oXL.Visible = false;
oXL.UserControl = false;
//Get a new workbook.
oWBook = (Excel._Workbook)(oXL.Workbooks.Open(strFilename, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false));
oSheet = (Excel._Worksheet)oWBook.ActiveSheet;
oSheet.Activate();
//Create header row 2
oXL.ReferenceStyle = Microsoft.Office.Interop.Excel.XlReferenceStyle.xlR1C1;
Excel.Range oRange2 = oSheet.get_Range("A2", "A2");
oRange2.FormulaR1C1 = HeaderLine1;
//Create header row 2
oRange2 = oSheet.get_Range("A3", "A3");
oRange2.FormulaR1C1 = HeaderLine2;
oRange2 = oSheet.get_Range("A" + StartRowNumber.ToString().Trim(), Missing.Value);
var temp = oSheet.QueryTables.Add("TEXT;" + TextFileName, oRange2, Missing.Value);
temp.Name = TextFileName.ToUpper().Replace(".TXT", "");
temp.PreserveFormatting = true;
temp.AdjustColumnWidth = false;
temp.TextFileStartRow = 1;
temp.TextFileParseType = Microsoft.Office.Interop.Excel.XlTextParsingType.xlDelimited;
temp.TextFileTextQualifier = Microsoft.Office.Interop.Excel.XlTextQualifier.xlTextQualifierDoubleQuote;
temp.TextFileConsecutiveDelimiter = false;
temp.TextFileTabDelimiter = true;
temp.TextFileSemicolonDelimiter = false;
temp.TextFileCommaDelimiter = false;
temp.TextFileSpaceDelimiter = false;
temp.TextFileOtherDelimiter = "|";
temp.TextFilePlatform = 1252;//65001;//1252;//65001;//1200;
//http://en.wikipedia.org/wiki/Code_page
temp.TextFileColumnDataTypes = GetDataType(ColumnDataType);
temp.TextFileTrailingMinusNumbers = true;
temp.Refresh(false);
//temp.Connection.ToString();
temp.Delete();
oXL.ReferenceStyle = Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1;
oWBook.Save();
oWBook.Close(false, Missing.Value, Missing.Value);
}
catch (Exception ex)
{
oWBook.Close(false, Missing.Value, Missing.Value);
}
finally
{
oXL.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet);
oSheet = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(oWBook);
oWBook = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL);
oXL = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
}
When the text file contains some special characters( Ex French words) it will not display as they are when the excel file is opened after generating....
Can anyone help to solve this problem ?
Thanks
Suresh

Resources