protected void Session_Start(object sender, EventArgs e) { if (User.Identity.IsAuthenticated) { SiteUtility.SetSessionVariables(User.Identity.Name); } }
private void loadData() { SiteUtility.RefreshOrgChartDataOnly(); OrganizationChart chart = SiteUtility.CurrentOrgChart; int tempPositionID = -1; bool isOK = int.TryParse(Request.QueryString[EDITPOSIDKEY], out tempPositionID); if (isOK) { WorkforcePlanningPosition position = WorkforcePlanningPositionManager.Instance.GetByID(tempPositionID); if (position.WFPPositionID == -1) { base.PrintErrorMessage(GetLocalResourceObject("PositionDoesNotExistMessage").ToString()); } else { customNewFPPSPosition.BindData(position); } } else { base.PrintErrorMessage(GetLocalResourceObject("PositionIDQuerystringNotValidMessage").ToString()); } }
public ActionResult LoginAsPrimaryUser(Guid PUseId) { //logout current user if (HttpContext.User.Identity.IsAuthenticated) { Session.Abandon(); FormsService.SignOut(); } //authenticate primary user and set session variables User oUser = new UserBL().GetById(PUseId); FormsService.SignIn(oUser.Email, false); SiteUtility.SetSessionVariables(oUser.Email); //Notification //if (oUser.HomePage == En_HomePage.Case_Management.ToString().Replace("_", " ")) // return RedirectToAction("Index", "Case", new { Area = "Clinic" }); //else if (oUser.HomePage == En_HomePage.System_Dashboard.ToString().Replace("_", " ")) //{ // return RedirectToAction("Index", "Home", new { Area = "Clinic" }); //} //else if (oUser.HomePage == En_HomePage.Finance_Dashboard.ToString().Replace("_", " ")) //{ // return RedirectToAction("Index", "Payments", new { Area = "Clinic" }); //} //else return(RedirectToAction("Index", "Home", new { Area = "Clinic" })); }
private void loadData() { SiteUtility.RefreshOrgChartDataOnly(); OrganizationChart chart = SiteUtility.CurrentOrgChart; base.PageTitle = string.Format(GetLocalResourceObject("PageTitle").ToString(), chart.OrganizationName, chart.OrgCode.OrganizationCodeValue); this.customViewChart.BindChart(chart, OrganizationChartTypeViews.Published); }
protected void btnSave_Click(object sender, EventArgs e) { try { using (LinqToSqlDataContext db = new LinqToSqlDataContext()) { EM_ProductParam productParameters = new EM_ProductParam(); if (!chkAsNew.Checked) { int paramID = 0; int.TryParse(gvEMParams.SelectedValue.ToString(), out paramID); productParameters = db.EM_ProductParams.Where(x => x.EM_ProductParamID == paramID).FirstOrDefault(); if (productParameters == null) { lblErrorMsg.Text = "Record not found to update."; return; } } productParameters.EM_ProductBillingDesc = txtBillingDesc.Text; productParameters.EM_ProductBillingCommitment = Convert.ToInt32(txtBillingCommit.Text); productParameters.EM_CoreService = Convert.ToInt32(txtCoreService.Text); productParameters.EM_CoreType = Convert.ToInt32(txtCoreType.Text); productParameters.EM_InstType_Equivalent = txtInstTypeEquiv.Text; productParameters.EM_CorePrimaryCluster = Convert.ToInt32(txtPriCluster.Text); productParameters.EM_CorePrimarySubCluster = Convert.ToInt32(txtPriSubcluster.Text); productParameters.EM_CoreSecondaryCluster = Convert.ToInt32(txtSecondarycluster.Text); productParameters.EM_CoreSecondarySubCluster = Convert.ToInt32(txtSecondarySubCluster.Text); productParameters.EM_InstType_Type = Convert.ToInt32(txtTypeID.Text); string username = SiteUtility.GetUserName(); productParameters.EM_ModifiedBy = username; productParameters.EM_ModifiedOn = DateTime.Now; productParameters.Is_Deleted_Flag = chkDeleteFlag.Checked; if (chkAsNew.Checked) { productParameters.EM_CreatedBy = username; productParameters.EM_CreatedOn = DateTime.Now; db.EM_ProductParams.InsertOnSubmit(productParameters); } db.SubmitChanges(); ResetForm(); gvEMParams.DataBind(); divForm.Visible = false; } } catch (Exception exp) { lblErrorMsg.Text = exp.Message; } }
void siteMenu_PreRender(object sender, EventArgs e) { //if you want to add your own links to the SiteMenu, //do it here //MenuItem item = new MenuItem("My Item Name", "menuKey","imageUrl","navigateUrl","target"); //you can insert the item //siteMenu.Items.AddAt(0, item); //or add it to a submenu //siteMenu.Items[0].ChildItems.Add(item); //if you add to a submenu - the hierarchy is //Home //--Dynamic Pages //-- --SubDynamic Pages //so everything has to go under "Home" //you can get around that by using "AddAt()", which will insert your links anywhere if (SiteUtility.UserCanEdit()) { MenuItem adminRoot = new MenuItem("Admin", "admin_root"); MenuItem adminSecurityRoot = new MenuItem("Membership", "admin_membership"); MenuItem adminCMSRoot = new MenuItem("CMS", "admin_cms"); MenuItem adminItem = new MenuItem("Users", "admin_users", "", "~/admin/users.aspx", ""); adminSecurityRoot.ChildItems.Add(adminItem); adminItem = new MenuItem("Roles", "admin_roles", "", "~/admin/roles.aspx", ""); adminSecurityRoot.ChildItems.Add(adminItem); adminItem = new MenuItem("Pages", "admin_cms", "", "~/admin/cmspagelist.aspx", ""); adminCMSRoot.ChildItems.Add(adminItem); adminItem = new MenuItem("New Page", "admin_cms_new", "", "~/view/newpage.aspx", ""); adminCMSRoot.ChildItems.Add(adminItem); adminRoot.ChildItems.Add(adminSecurityRoot); adminRoot.ChildItems.Add(adminCMSRoot); //find the "Home" menu //this is a little wonky - but there's just no other way to do it //sorry... foreach (MenuItem item in siteMenu.Items) { if (item.Text == "Home") { item.ChildItems.Add(adminRoot); break; } } } }
//Load Shade cards in Grid Format for Display in Grid. public string GetGridData(GridSettings grid) { try { JariCompany oJariCompany = SiteUtility.GetCurrentJariCompany(oUser); return(new ShadeCardBL().GetGridData(grid, oJariCompany.JariCompanyId)); } catch (Exception ex) { return(""); } }
protected void Page_Load(object sender, EventArgs e) { int siteID = appxCMS.Util.CMSSettings.GetSiteId(); //Addtional Site data. Build SiteDetails Obj SiteUtility.SiteDetails siteDetails = new SiteUtility.SiteDetails(); siteDetails = SiteUtility.RetrieveSiteSettings(siteID); if (siteDetails.AllowListProducts) { phSavedLists.Visible = true; } }
private void JumpLogin() { int userid = ConfigWrapper.JumpLoginID; if (userid > 0) { User currentUser = new User(userid); SiteUtility.BuildAuthenticationCookie(currentUser, currentUser.GetRoles(), currentUser.GetPermissions()); } else { throw new ApplicationException("Jump login ID not provided"); } }
protected void ShowDetail(int lineID) { List <LineDetailInfo> details = LineBLL.GetLineDetails(lineID); ltDetail.Text = ""; foreach (LineDetailInfo model in details) { string title = "<p style='color:#333333;font-weight:bold;font-size:14px'>第" + model.SortOrder + "天:" + model.Title + "</p>"; string pic = "<p>" + SiteUtility.ShowAllImage(model.DayPics, 150, 150) + "</p>"; string content = "<p>" + model.DayDesc.NewLineCharToBr() + "</p>"; string notice = "<p>温馨提示:" + model.WarmTips + "</p>"; ltDetail.Text += title + pic + content + notice + "<hr/>"; } }
//Load Selected Shade Cards in Form public PartialViewResult ManageShadeCard(int id = 0) { ShadeCard oShadeCard = new ShadeCard(); ViewBag.lstYarnTypes = new YarnTypeBL().GetAllYarnTypes(); var _JariCompany = SiteUtility.GetCurrentJariCompany(oUser); if (id > 0) { oShadeCard = new ShadeCardBL().GetById(id); } oShadeCard.JariCompanyId = _JariCompany.JariCompanyId; return(PartialView("_ManageShadeCard", oShadeCard)); }
protected void Page_Load(object sender, EventArgs e) { int siteID = appxCMS.Util.CMSSettings.GetSiteId(); SiteUtility.SiteDetails siteDetails = new SiteUtility.SiteDetails(); siteDetails = SiteUtility.RetrieveSiteSettings(siteID); if (siteDetails.HideTaradelContent) { phNoTaradelDesignerMessage.Visible = true; } else { phGeneralDesignerMessage.Visible = true; } }
protected void BindData() { if (MyLine == null) { return; } ltNotice.Text = MyLine.SignUpNotice; ltDesc.Text = MyLine.LineDesc; ltImage.Text = SiteUtility.ShowImage(MyLine.CoverPath, 200, 200, true); ltLineName.Text = MyLine.Name; ltGoTravel.Text = MyLine.GoTravel; ltBackTravel.Text = MyLine.BackTravel; TravelGroupInfo group = MyGroups.Find(s => s.ID == ddlGroup.SelectedValue.ToArrowInt()); if (group == null) { return; } ltBackDate.Text = group.BackDate.ToDateOnlyString(); ltPrice.Text = CurrentMember == null?group.OuterPrice.ToString() : group.InnerPrice.ToString(); ltNum.Text = group.TotalNum.ToString(); ltRemain.Text = group.RemainNum.ToString(); ltTime.Text = group.GatheringTime; ltPlace.Text = group.GatheringPlace; List <LineDetailInfo> details = LineBLL.GetLineDetails(MyLine.ID); ltDetail.Text = ""; foreach (LineDetailInfo model in details) { string title = "<p style='color:red;font-weight:bold;font-size:14px'>第" + model.SortOrder + "天:" + model.Title + "</p>"; string pic = "<p>" + SiteUtility.ShowAllImage(model.DayPics, 150, 150) + "</p>"; string content = "<p>" + model.DayDesc.NewLineCharToBr() + "</p>"; string notice = "<p>温馨提示:" + model.WarmTips + "</p>"; ltDetail.Text += title + pic + content + notice + "<hr/>"; } }
private void LoadProductDetails() { if (ProductID == 0) { return; } lblProductCode.Text = this.ProductCode; lblProductTitle.Text = this.ProductTitle; lblProductPrice.Text = "£" + this.ProductPrice + " (ex vat) "; //string url = SiteUtility.GetRewriterUrl("productdetailview", ProductID, ""); //lnkProductView.CommandArgument = url; //lnkProductView.AlternateText = url; lnkProductView.ImageUrl = string.IsNullOrEmpty(ThumbImageUrl) ? SiteUtility.GetSiteRoot() + "/images/noImage.gif" : SiteUtility.GetSiteRoot() + "/" + ThumbImageUrl; //btnAddToBasket.CommandArgument = ProductID.ToString(); //btnAddToBasket.Enabled = this.ProductCode.Trim() == "CS2367" ? false : true; if (Session[enumSessions.User_Role.ToString()] != null && Session[enumSessions.User_Role.ToString()].ToString().ToUpper() == "ARC_ADMIN") { lblProductPrice.Text = "0.00"; } }
public ActionResult SaveShadeCard() { ShadeCard oShadeCard = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <ShadeCard>(Request["objShadeCard"]); bool Add_Flag = new CommonBL().isNewEntry(oShadeCard.ShadeId); try { if (Request.Files != null && Request.Files.Count > 0) { using (var binaryReader = new BinaryReader(Request.Files[0].InputStream)) oShadeCard.ShadeImage = SiteUtility.ResizeImage(binaryReader.ReadBytes(Request.Files[0].ContentLength), 200, 50); } else if (oShadeCard.ShadeId != 0) { oShadeCard.ShadeImage = new ShadeCardBL().GetById(oShadeCard.ShadeId).ShadeImage; } oShadeCard.ModifiedBy = oUser.Email; oShadeCard.ModifiedOn = DateTime.UtcNow; if (Add_Flag) { new ShadeCardBL().Create(oShadeCard); } else { new ShadeCardBL().Update(oShadeCard); } return(Json(new { success = true, message = CommonMsg.Success(EntityNames.Shade, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) })); } catch (Exception ex) { return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.Shade, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) })); } }
//=============================================================================================================== // NOTES: // Logo image must exist in the white label cmsimages folder and be named 'quote-header-logo.png' // // If site has a CoBrand logo (ex: FedEx) then the file name must be in the pnd_SiteStringResourceMgr tbl and the file must be // located in the cmsimages folder structure. //=============================================================================================================== protected void Page_Load(object sender, EventArgs e) { int siteID = appxCMS.Util.CMSSettings.GetSiteId(); imgLogo.ImageUrl = "/cmsimages/" + siteID + "/quote-header-logo.png"; SiteUtility.SiteDetails siteDetails = new SiteUtility.SiteDetails(); siteDetails = SiteUtility.RetrieveSiteSettings(siteID); if (siteDetails.UseCoBrandLogo) { if (!String.IsNullOrEmpty(SiteUtility.GetStringResourceValue(siteID, "CoBrandHeaderLogo"))) { imgCoBrandLogo.ImageUrl = "/cmsimages/" + siteID + "/" + SiteUtility.GetStringResourceValue(siteID, "CoBrandHeaderLogo"); } } else { imgCoBrandLogo.Visible = false; } }
/// <summary> /// Method to post picture data with HttpWebRequest /// </summary> /// <param name="fileName">the full path of the picture file to be uploaded</param> /// <param name="requestXmlString">request xml string</param> /// <returns>response string</returns> private string sendFile(string fileName, string requestXmlString) { const string BOUNDARY = "MIME_boundary"; const string CRLF = "\r\n"; //get HttpWebRequest object HttpWebRequest req = (HttpWebRequest)WebRequest.Create(this.ApiContext.EPSServerUrl); req.Method = "POST"; req.ProtocolVersion = HttpVersion.Version11; //set proxy server if necessary if (this.ApiContext.WebProxy != null) { req.Proxy = this.ApiContext.WebProxy; } //set http headers req.Headers.Add("X-EBAY-API-COMPATIBILITY-LEVEL", this.ApiContext.Version); req.Headers.Add("X-EBAY-API-SITEID", SiteUtility.GetSiteID(this.ApiContext.Site).ToString()); req.Headers.Add("X-EBAY-API-DETAIL-LEVEL", X_EBAY_API_DETAIL_LEVEL); req.Headers.Add("X-EBAY-API-CALL-NAME", X_EBAY_API_CALL_NAME); req.ContentType = "multipart/form-data; boundary=" + BOUNDARY; //Check for oAuth - Sree 11/14/2017. if (!String.IsNullOrEmpty(this.ApiContext.ApiCredential.oAuthToken)) { req.Headers.Add("X-EBAY-API-IAF-TOKEN", this.ApiContext.ApiCredential.oAuthToken); } //read in the picture file FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); fs.Seek(0, SeekOrigin.Begin); BinaryReader br = new BinaryReader(fs); byte[] image = br.ReadBytes((int)fs.Length); br.Close(); fs.Close(); //first part of the post body string strReq1 = "--" + BOUNDARY + CRLF + "Content-Disposition: form-data; name=document" + CRLF + "Content-Type: text/xml; charset=\"UTF-8\"" + CRLF + CRLF + requestXmlString + CRLF + "--" + BOUNDARY + CRLF + "Content-Disposition: form-data; name=image; filename=image" + CRLF + "Content-Transfer-Encoding: binary" + CRLF + "Content-Type: application/octet-stream" + CRLF + CRLF; //last part of the post body string strReq2 = CRLF + "--" + BOUNDARY + "--" + CRLF; //log request message to eps server string reqInfo = "UploadSiteHostedPicturesRequest to " + this.ApiContext.EPSServerUrl; LogMessage(reqInfo, MessageType.Information, MessageSeverity.Informational); string reqMsg = Util.XmlUtility.FormatXml(requestXmlString) + CRLF + CRLF; reqMsg = System.Text.RegularExpressions.Regex.Replace(reqMsg, "<eBayAuthToken>.+</eBayAuthToken>", "<eBayAuthToken>******</eBayAuthToken>"); LogMessage(reqMsg, MessageType.ApiMessage, MessageSeverity.Informational); //Convert string to byte array byte[] postDataBytes1 = System.Text.Encoding.ASCII.GetBytes(strReq1); byte[] postDataBytes2 = System.Text.Encoding.ASCII.GetBytes(strReq2); int len = postDataBytes1.Length + postDataBytes2.Length + image.Length; req.ContentLength = len; //post the payload Stream requestStream = req.GetRequestStream(); requestStream.Write(postDataBytes1, 0, postDataBytes1.Length); requestStream.Write(image, 0, image.Length); requestStream.Write(postDataBytes2, 0, postDataBytes2.Length); requestStream.Close(); //get response and write to console HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); StreamReader responseReader = new StreamReader(resp.GetResponseStream(), Encoding.UTF8); string response = responseReader.ReadToEnd(); //log response message from eps server string respInfo = "UploadSiteHostedPicturesResponse from " + this.ApiContext.EPSServerUrl; LogMessage(respInfo, MessageType.Information, MessageSeverity.Informational); string respMsg = Util.XmlUtility.FormatXml(response) + CRLF + CRLF; LogMessage(respMsg, MessageType.ApiMessage, MessageSeverity.Informational); resp.Close(); return(response); }
protected void Page_Load(object sender, EventArgs e) { int siteID = appxCMS.Util.CMSSettings.GetSiteId(); string fileName = ""; string fileContent = ""; string appRoot = Server.MapPath("~/"); //Create siteObj SiteUtility.SiteDetails siteDetails = new SiteUtility.SiteDetails(); siteDetails = SiteUtility.RetrieveSiteSettings(siteID); //If Google Analytics script is needed... if (siteDetails.UseGoogleAnalytics) { switch (siteID) { //EDDM case 1: fileName = "GoogleAnalytics-EDDM.txt"; break; //FedEx case 41: fileName = "GoogleAnalytics-FedEx.txt"; break; //Staples Act Mgr case 78: fileName = "GoogleAnalytics-StaplesActMgr.txt"; break; //RAMP case 80: fileName = "GoogleAnalytics-RAMP.txt"; break; //FedEx LIST DEMO case 84: fileName = "GoogleAnalytics-FedEx.txt"; break; //Staples Store case 91: fileName = "GoogleAnalytics-StaplesStore.txt"; break; //Staples Consumer case 93: fileName = "GoogleAnalytics-StaplesConsumer.txt"; break; //RAMP Express case 98: fileName = "GoogleAnalytics-RAMPExpress.txt"; break; //Taradel DM case 100: fileName = "GoogleAnalytics-TaradelDM.txt"; break; default: break; } if (!String.IsNullOrEmpty(fileName)) { if (File.Exists(appRoot + "\\assets\\scripts\\" + fileName)) { phGoogleAnalyticsScript.Visible = true; fileContent = File.ReadAllText(appRoot + "\\assets\\scripts\\" + fileName); litGoogleAnalyticsScript.Text = fileContent; } } } }
protected void Button2_Click(object sender, EventArgs e) { tbCoverPath3.Text = SiteUtility.UploadPic(upCover3); }
private void LoadOrderData() { try { int orderid = 0; int.TryParse(hdnOrderID.Value, out orderid); using (LinqToSqlDataContext db = new LinqToSqlDataContext()) { var order = db.Orders.Where(x => x.OrderId == orderid).FirstOrDefault(); if (order != null) { lblOrderNumber.Text = "CSL" + order.OrderNo; lblOrderRef.Text = order.OrderRefNo; } //var orderItemsWithEM = db.USP_GetEmizonOrderItems(orderid); //var data = orderItemsWithEM.Select(x => // new // { // ProductCode = x.ProductCode, // ProductDesc = x.ProductName, // EMNO = "EMNo: " + x.EM_No + (string.IsNullOrEmpty(x.GPRSNo) ? "" : ", InstallID: " + x.GPRSNo), //only show installid if available as not all ARC's has this feature // SerialNo = string.IsNullOrEmpty(x.EM_TCD_SerialNo) ? "N/A" : x.EM_TCD_SerialNo, // } // ); //gvOrderItems.DataSource = data; //gvOrderItems.DataBind(); } } catch (Exception objException) { try { CSLOrderingARCBAL.LinqToSqlDataContext db; db = new CSLOrderingARCBAL.LinqToSqlDataContext(); db.USP_SaveErrorDetails(Request.Url.ToString(), "LoadEmizonOrderData", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, SiteUtility.GetUserName()); } catch { } } }
protected void btnUpload_Click(object sender, EventArgs e) { tbCoverPath.Text = SiteUtility.UploadPic(upCover); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { lnkCategoryName.Text = this.CategoryName; imgCatProducts.ImageUrl = string.IsNullOrEmpty(this.CategoryDefaultImage) ? SiteUtility.GetSiteRoot() + "/images/noImage.gif" : SiteUtility.GetSiteRoot() + "/" + this.CategoryDefaultImage; lnkCategoryName.NavigateUrl = "../ProductList.aspx?CategoryId=" + this.CategoryID; lnkCategoryImage.NavigateUrl = "../ProductList.aspx?CategoryId=" + this.CategoryID; hdnCatID.Value = this.CategoryID.ToString(); lblCategoryDesc.Text = this.CategoryDesc; } Submit.Click += Submit_Click; }
private ItemType FillItem() { BtnGetItem.Visible = false; ItemType item = new ItemType(); // Set UP Defaults item.Currency = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site); item.Country = SiteUtility.GetCountryCodeType(Context.Site); item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection(); item.PaymentMethods.AddRange(new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PayPal }); item.RegionID = "0"; // Set specified values from the form item.Title = this.TxtTitle.Text; item.Description = this.TxtDescription.Text; item.Quantity = Int32.Parse(TxtQuantity.Text, NumberStyles.None); item.Location = TxtLocation.Text; item.ListingDuration = CboDuration.SelectedItem.ToString(); item.PrimaryCategory = new CategoryType(); item.PrimaryCategory.CategoryID = this.TxtCategory.Text;; if (TxtStartPrice.Text.Length > 0) { item.StartPrice = new AmountType(); item.StartPrice.currencyID = item.Currency; item.StartPrice.Value = Convert.ToDouble(this.TxtStartPrice.Text); } if (TxtReservePrice.Visible && TxtReservePrice.Text.Length > 0) { item.ReservePrice = new AmountType(); item.ReservePrice.currencyID = item.Currency; item.ReservePrice.Value = Convert.ToDouble(this.TxtReservePrice.Text); } if (TxtBuyItNowPrice.Visible && TxtBuyItNowPrice.Text.Length > 0) { item.BuyItNowPrice = new AmountType(); item.BuyItNowPrice.currencyID = item.Currency; item.BuyItNowPrice.Value = Convert.ToDouble(this.TxtBuyItNowPrice.Text); } ListingEnhancementsCodeTypeCollection enhancements = new ListingEnhancementsCodeTypeCollection(); if (this.ChkBoldTitle.Checked) { enhancements.Add(ListingEnhancementsCodeType.BoldTitle); } if (this.ChkHighLight.Checked) { enhancements.Add(ListingEnhancementsCodeType.Highlight); } if (enhancements.Count > 0) { item.ListingEnhancement = enhancements; } item.ListingType = (ListingTypeCodeType)Enum.Parse(typeof(ListingTypeCodeType), CboListType.SelectedItem.ToString()); if (ChkEnableBestOffer.Visible) { item.BestOfferDetails = new BestOfferDetailsType(); item.BestOfferDetails.BestOfferEnabled = ChkEnableBestOffer.Checked; } if (TxtCategory2.Text.Length > 0) { item.SecondaryCategory = new CategoryType(); item.SecondaryCategory.CategoryID = TxtCategory2.Text; } if (TxtPayPalEmailAddress.Text.Length > 0) { item.PayPalEmailAddress = TxtPayPalEmailAddress.Text; } if (TxtApplicationData.Text.Length > 0) { item.ApplicationData = TxtApplicationData.Text; } int condition = ((ComboxItem)CboCondition.SelectedItem).Value; item.ConditionID = condition; //add shipping information item.ShippingDetails = getShippingDetails(); //add handling time item.DispatchTimeMax = 1; //add policy item.ReturnPolicy = GetPolicyForUS(); return(item); }
protected void Page_Load(object sender, EventArgs e) { int siteID = appxCMS.Util.CMSSettings.GetSiteId(); string fileName = ""; string fileContent = ""; string appRoot = Server.MapPath("~/"); //Create siteObj SiteUtility.SiteDetails siteDetails = new SiteUtility.SiteDetails(); siteDetails = SiteUtility.RetrieveSiteSettings(siteID); //If BoldChatVM Script is needed... if (siteDetails.UseBoldChatVMScript) { switch (siteID) { //EDDM case 1: fileName = "BoldChatVMScript-EDDM.txt"; break; //OLB case 11: fileName = "BoldChatVMScript-OLB.txt"; break; //Rooterman case 18: fileName = "BoldChatVMScript-Rooterman.txt"; break; //FedEx case 41: fileName = "BoldChatVMScript-FedEx.txt"; break; //The Flyer case 57: fileName = "BoldChatVMScript-TheFlyer.txt"; break; //CHHJ case 60: fileName = "BoldChatVMScript-CHHJ.txt"; break; //CoBrand case 77: fileName = "BoldChatVMScript-CoBrand.txt"; break; //Staples Act Mgr case 78: fileName = "BoldChatVMScript-StaplesActMgr.txt"; break; ////FedEx LIST DEMO //case 84: // fileName = "BoldChatVMScript-FedEx.txt"; // break; //Progressive case 90: fileName = "BoldChatVMScript-Progressive.txt"; break; //Staples Store case 91: fileName = "BoldChatVMScript-StaplesStore.txt"; break; //Staples Consumer case 93: fileName = "BoldChatVMScript-StaplesConsumer.txt"; break; //Progressive Platinum case 94: fileName = "BoldChatVMScript-ProgressivePlat.txt"; break; //Taradel DM case 100: fileName = "BoldChatVMScript-EDDM.txt"; break; default: break; } if (!String.IsNullOrEmpty(fileName)) { if (File.Exists(appRoot + "\\assets\\scripts\\" + fileName)) { phBoldChatVMScript.Visible = true; fileContent = File.ReadAllText(appRoot + "\\assets\\scripts\\" + fileName); litBoldChatVMScript.Text = fileContent; } } } }
void Submit_Click(object sender, EventArgs e) { Response.Redirect(SiteUtility.GetSiteRoot() + "/ProductList.aspx?CategoryId=" + hdnCatID.Value); }
/// <summary> /// /// </summary> internal void SendRequest() { try { if (AbstractRequest == null) { throw new ApiException("RequestType reference not set to an instance of an object.", new System.ArgumentNullException()); } if (ApiContext == null) { throw new ApiException("ApiContext reference not set to an instance of an object.", new System.ArgumentNullException()); } if (ApiContext.ApiCredential == null) { throw new ApiException("Credentials reference in ApiContext object not set to an instance of an object.", new System.ArgumentNullException()); } string apiName = AbstractRequest.GetType().Name.Replace("RequestType", ""); if (this.ApiContext.EnableMetrics) { mCallMetrics = this.ApiContext.CallMetricsTable.GetNewEntry(apiName); mCallMetrics.ApiCallStarted = System.DateTime.Now; } CustomSecurityHeaderType secHdr = this.GetSecurityHeader(); // Get default constructor. /* * ConstructorInfo svcCCTor = this.mServiceType.GetConstructor( * BindingFlags.Instance | BindingFlags.Public, null, * CallingConventions.HasThis, null, null); */ ConstructorInfo svcCCTor = this.mServiceType.GetConstructor(new Type[] { }); object svcInst = svcCCTor.Invoke(null); PropertyInfo pi; pi = this.mServiceType.GetProperty("ApiLogManager"); if (pi == null) { throw new SdkException("ApiLogManager was not found in InterfaceServiceType"); } pi.SetValue(svcInst, this.mApiContext.ApiLogManager, null); pi = this.mServiceType.GetProperty("EnableComression"); if (pi == null) { throw new SdkException("EnableComression was not found in InterfaceServiceType"); } pi.SetValue(svcInst, this.mEnableCompression, null); //Add oAuth //if (pi == null) // throw new SdkException("RequesterCredentials was not found in InterfaceServiceType"); //pi.SetValue(svcInst, this., null); if (string.IsNullOrEmpty(this.ApiContext.ApiCredential.oAuthToken)) { pi = this.mServiceType.GetProperty("RequesterCredentials"); if (pi == null) { throw new SdkException("RequesterCredentials was not found in InterfaceServiceType"); } pi.SetValue(svcInst, secHdr, null); } pi = this.mServiceType.GetProperty("WebProxy"); if (pi == null) { throw new SdkException("WebProxy was not found in InterfaceServiceType"); } pi.SetValue(svcInst, this.mApiContext.WebProxy, null); if (this.mApiContext.WebProxy != null) { LogMessage("Proxy Server is Set", MessageType.Information, MessageSeverity.Informational); } pi = this.mServiceType.GetProperty("CallMetricsEntry"); if (pi == null) { throw new SdkException("CallMetricsEntry was not found in InterfaceServiceType"); } if (this.ApiContext.EnableMetrics) { pi.SetValue(svcInst, this.mCallMetrics, null); } else { pi.SetValue(svcInst, null, null); } pi = this.mServiceType.GetProperty("OAuthToken"); if (!string.IsNullOrEmpty(this.ApiContext.ApiCredential.oAuthToken)) { this.mOAuth = this.ApiContext.ApiCredential.oAuthToken; pi.SetValue(svcInst, this.OAuth, null); } string url = ""; try { if (ApiContext.SoapApiServerUrl != null && ApiContext.SoapApiServerUrl.Length > 0) { url = String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}?callname={1}&siteid={2}&client=netsoap", ApiContext.SoapApiServerUrl, apiName, SiteUtility.GetSiteID(Site).ToString(System.Globalization.CultureInfo.InvariantCulture)); } else { url = (string)this.mServiceType.GetProperty("Url").GetValue(svcInst, null); url = String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}?callname={1}&siteid={2}&client=netsoap", url, apiName, SiteUtility.GetSiteID(Site).ToString(System.Globalization.CultureInfo.InvariantCulture)); } //svcCCTor.Url = url; this.mServiceType.GetProperty("Url").SetValue(svcInst, url, null); } catch (Exception ex) { throw new ApiException(ex.Message, ex); } LogMessage(url, MessageType.Information, MessageSeverity.Informational); //svcCCTor.Timeout = Timeout; this.mServiceType.GetProperty("Timeout").SetValue(svcInst, Timeout, null); AbstractRequest.Version = Version; if (!mDetailLevelOverride && AbstractRequest.DetailLevel == null) { AbstractRequest.DetailLevel = new DetailLevelCodeTypeCollection(); AbstractRequest.DetailLevel.AddRange(mDetailLevelList); } //Added OutputSelector to base call JIRA-SDK-561 AbstractRequest.OutputSelector = new StringCollection(); AbstractRequest.OutputSelector.AddRange(mOutputSelector); if (ApiContext.ErrorLanguage != ErrorLanguageCodeType.CustomCode) { AbstractRequest.ErrorLanguage = ApiContext.ErrorLanguage.ToString(); } //Populate the message AbstractRequest.MessageID = System.Guid.NewGuid().ToString(); Type methodtype = svcInst.GetType(); object[] reqparm = new object[] { AbstractRequest }; int retries = 0; int maxRetries = 0; bool doretry = false; CallRetry retry = null; if (mCallRetry != null) { retry = mCallRetry; maxRetries = retry.MaximumRetries; } else if (ApiContext.CallRetry != null) { retry = ApiContext.CallRetry; maxRetries = retry.MaximumRetries; } do { Exception callException = null; try { mResponse = null; mApiException = null; if (retries > 0) { LogMessage("Invoking Call Retry", MessageType.Information, MessageSeverity.Informational); System.Threading.Thread.Sleep(retry.DelayTime); } if (BeforeRequest != null) { BeforeRequest(this, new BeforeRequestEventArgs(AbstractRequest)); } //Invoke the Service DateTime start = DateTime.Now; mResponse = (AbstractResponseType)methodtype.GetMethod(apiName).Invoke(svcInst, reqparm); mResponseTime = DateTime.Now - start; if (AfterRequest != null) { AfterRequest(this, new AfterRequestEventArgs(mResponse)); } // Catch Token Expiration warning if (mResponse != null && secHdr.HardExpirationWarning != null) { ApiContext.ApiCredential.TokenHardExpirationWarning( System.Convert.ToDateTime(secHdr.HardExpirationWarning, System.Globalization.CultureInfo.CurrentUICulture)); } if (mResponse != null && mResponse.Errors != null && mResponse.Errors.Count > 0) { throw new ApiException(new ErrorTypeCollection(mResponse.Errors)); } } catch (Exception ex) { // this catches soap faults if (ex.GetType() == typeof(TargetInvocationException)) { // we never care about the outer exception Exception iex = ex.InnerException; // Parse Soap Faults if (iex.GetType() == typeof(SoapException)) { ex = ApiException.FromSoapException((SoapException)iex); } else if (iex.GetType() == typeof(InvalidOperationException)) { // Go to innermost exception while (iex.InnerException != null) { iex = iex.InnerException; } ex = new ApiException(iex.Message, iex); } else if (iex.GetType() == typeof(HttpException)) { HttpException httpEx = (HttpException)iex; String str = "HTTP Error Code: " + httpEx.StatusCode; ex = new ApiException(str, iex); } else { ex = new ApiException(iex.Message, iex); } } callException = ex; // log the message - override current switches - *if* (a) we wouldn't normally log it, and (b) // the exception matches the exception filter. if (retry != null) { doretry = retry.ShouldRetry(ex); } if (!doretry || retries == maxRetries) { throw ex; } else { string soapReq = (string)this.mServiceType.GetProperty("SoapRequest").GetValue(svcInst, null); string soapResp = (string)this.mServiceType.GetProperty("SoapResponse").GetValue(svcInst, null); LogMessagePayload(soapReq + "\r\n\r\n" + soapResp, MessageSeverity.Informational, ex); MessageSeverity svr = ((ApiException)ex).SeverityErrorCount > 0 ? MessageSeverity.Error : MessageSeverity.Warning; LogMessage(ex.Message, MessageType.Exception, svr); } } finally { string soapReq = (string)this.mServiceType.GetProperty("SoapRequest").GetValue(svcInst, null); string soapResp = (string)this.mServiceType.GetProperty("SoapResponse").GetValue(svcInst, null); if (!doretry || retries == maxRetries) { LogMessagePayload(soapReq + "\r\n\r\n" + soapResp, MessageSeverity.Informational, callException); } if (mResponse != null && mResponse.TimestampSpecified) { ApiContext.CallUpdate(mResponse.Timestamp); } else { ApiContext.CallUpdate(new DateTime(0)); } mSoapRequest = soapReq; mSoapResponse = soapResp; retries++; } } while (doretry && retries <= maxRetries); } catch (Exception ex) { ApiException aex = ex as ApiException; if (aex != null) { mApiException = aex; } else { mApiException = new ApiException(ex.Message, ex); } MessageSeverity svr = mApiException.SeverityErrorCount > 0 ? MessageSeverity.Error : MessageSeverity.Warning; LogMessage(mApiException.Message, MessageType.Exception, svr); if (mApiException.SeverityErrorCount > 0) { throw mApiException; } } finally { if (this.ApiContext.EnableMetrics) { mCallMetrics.ApiCallEnded = DateTime.Now; } } }
public static int UpdateInstallID(string InstallID, string OrderItemDetailID, string OrderID) { try { using (LinqToSqlDataContext db = new LinqToSqlDataContext()) { string emizonQueuePath = ConfigurationManager.AppSettings["EmizonQueue"].ToString(); var OrderItemDetails = db.OrderItemDetails.Where(i => i.OrderItemDetailId == Convert.ToInt32(OrderItemDetailID)).SingleOrDefault(); OrderItemDetails.GPRSNo = InstallID; db.SubmitChanges(); EmizonOrderController.AddAPIRequestToQueue(emizonQueuePath, new Emizon.APIModels.MSMQTypes.QueueOrderMessage() { orderID = Convert.ToInt32(OrderID) }); return(0); } } catch (Exception objException) { try { CSLOrderingARCBAL.LinqToSqlDataContext db; db = new CSLOrderingARCBAL.LinqToSqlDataContext(); db.USP_SaveErrorDetails("UpdateInstallID", "UpdateInstallID", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, SiteUtility.GetUserName()); return(-1); } catch { return(-1); } } }
//Methods protected void Page_Load(object sender, EventArgs e) { //get SiteDetails SiteUtility.SiteDetails siteDetails = new SiteUtility.SiteDetails(); siteDetails = SiteUtility.RetrieveSiteSettings(siteID); //Look for cookie w/ Distribution which will help reset filters. int prevDistributionID = CheckForCookie(); if (prevDistributionID > 0) { //Dist created within current visit. Reset filters to match. PreselectFilters(prevDistributionID); } if (!(Page.IsPostBack)) { //wire up controls ddlRadiusValue.Attributes.Add("onchange", "RadiusValueChanged();"); ddlRadiusType.Attributes.Add("onchange", "RadiusTypeChanged();"); txtAddress.Attributes.Add("onchange", "AddressChanged();"); txtZipCode.Attributes.Add("onchange", "ZipCodeChanged();"); txtZipCodesList.Attributes.Add("onchange", "ZipCodesListChanged();"); txtListName.Attributes.Add("placeholder", "name this list"); radAddress.Attributes.Add("onchange", "TargetAreaTypeChanged();"); radZipCodes.Attributes.Add("onchange", "TargetAreaTypeChanged();"); //Order Steps OrderSteps.numberOfSteps = 5; OrderSteps.step1Text = "1) Define Area"; OrderSteps.step1Url = "/Addressed/Step1-BuildYourList.aspx"; OrderSteps.step1State = "current"; OrderSteps.step1Icon = "fa-map-marker"; OrderSteps.step2Text = "2) Define Customers"; OrderSteps.step2Url = "/Addressed/Step1-BuildYourList.aspx"; OrderSteps.step2State = ""; OrderSteps.step2Icon = "fa-user"; OrderSteps.step3Text = "3) Choose Product"; OrderSteps.step3Url = ""; OrderSteps.step3State = ""; OrderSteps.step3Icon = "fa-folder"; OrderSteps.step4Text = "4) Define Delivery"; OrderSteps.step4Url = ""; OrderSteps.step4State = ""; OrderSteps.step4Icon = "fa-envelope"; OrderSteps.step5Text = "5) Check Out"; OrderSteps.step5Url = ""; OrderSteps.step5State = ""; OrderSteps.step5Icon = "fa-credit-card"; //SitePhoneNumber SitePhoneNumber.addCallUs = "true"; SitePhoneNumber.useIcon = "true"; SitePhoneNumber.makeHyperLink = "true"; //Page Header if (!siteDetails.UseRibbonBanners) { PageHeader.headerType = "simple"; PageHeader.simpleHeader = "Build Your List"; } else { PageHeader.headerType = "partial"; PageHeader.mainHeader = "Build Your List"; PageHeader.subHeader = "Start Here"; } //Preload "List Name". txtListName.Text = "Addressed List " + DateTime.Today.ToShortDateString(); hypEmail.Text = "<span class=" + Convert.ToChar(34) + "fa fa-envelope" + Convert.ToChar(34) + "></span> " + siteDetails.SupportEmail; hypEmail.NavigateUrl = "mailto:" + siteDetails.SupportEmail; } if (siteDetails.TestMode) { ShowDebug(); txtAddress.Text = "4805 Lake Brooke Drive"; txtZipCode.Text = "2306"; } else { if (!String.IsNullOrEmpty(Request.QueryString["debug"])) { if (Request.QueryString["debug"] == "hodor") { ShowDebug(); } } } }
public static string GetOrderInfo(int orderid) { string orderData = ""; try { using (LinqToSqlDataContext db = new LinqToSqlDataContext()) { var orderItemsWithEM = db.USP_GetEmizonOrderItems(orderid); var data = orderItemsWithEM.Select(x => new { ProductCode = x.ProductCode, ProductDesc = x.ProductName, EMNO = string.IsNullOrEmpty(x.EM_No) ? "" : x.EM_No, InstallID = x.GPRSNo, //EMNo = "EMNo: " + x.EM_No + (string.IsNullOrEmpty(x.GPRSNo) ? "" : ", InstallID: " + x.GPRSNo), //only show installid if available as not all ARC's has this feature SerialNo = string.IsNullOrEmpty(x.EM_TCD_SerialNo) ? "N/A" : x.EM_TCD_SerialNo, EM_APIMsg = string.IsNullOrEmpty(x.EM_APIMsg) ? "" : x.EM_APIMsg, EM_APIStatusID = x.EM_APIStatusID.HasValue ? x.EM_APIStatusID.ToString() : "", OrderItemDetailId = x.OrderItemDetailId, } ).ToList(); Newtonsoft.Json.JsonSerializer jsr = new Newtonsoft.Json.JsonSerializer(); System.IO.StringWriter sw = new System.IO.StringWriter(); Newtonsoft.Json.JsonTextWriter jtw = new Newtonsoft.Json.JsonTextWriter(sw); jsr.Serialize(jtw, data.ToArray()); orderData = sw.ToString(); } } catch (Exception objException) { try { CSLOrderingARCBAL.LinqToSqlDataContext db; db = new CSLOrderingARCBAL.LinqToSqlDataContext(); db.USP_SaveErrorDetails("OrderconfirmationEmizon", "LoadEmizonOrderData", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, SiteUtility.GetUserName()); } catch { } } return(orderData); }
internal void SendRequest2() { try { if (AbstractRequest == null) { throw new ApiException("RequestType reference not set to an instance of an object.", new System.ArgumentNullException()); } if (ApiContext == null) { throw new ApiException("ApiContext reference not set to an instance of an object.", new System.ArgumentNullException()); } if (ApiContext.ApiCredential == null) { throw new ApiException("Credentials reference in ApiContext object not set to an instance of an object.", new System.ArgumentNullException()); } string apiName = AbstractRequest.GetType().Name.Replace("RequestType", ""); var requestName = Type.GetType("eBay.Service.Core.Soap." + apiName + "Request"); if (this.ApiContext.EnableMetrics) { mCallMetrics = this.ApiContext.CallMetricsTable.GetNewEntry(apiName); mCallMetrics.ApiCallStarted = System.DateTime.Now; } string url = ""; try { if (ApiContext.SoapApiServerUrl != null && ApiContext.SoapApiServerUrl.Length > 0) { url = String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}?callname={1}&siteid={2}&client=netsoap", ApiContext.SoapApiServerUrl, apiName, SiteUtility.GetSiteID(Site).ToString(System.Globalization.CultureInfo.InvariantCulture)); } else { url = "https://api.ebay.com/wsapi"; url = String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}?callname={1}&siteid={2}&client=netsoap", url, apiName, SiteUtility.GetSiteID(Site).ToString(System.Globalization.CultureInfo.InvariantCulture)); } } catch (Exception ex) { throw new ApiException(ex.Message, ex); } LogMessage(url, MessageType.Information, MessageSeverity.Informational); //mEnableCompression//数据压缩 //moAuthToken//moAuthToken授权// //mWebProxy//代理 //mCallMetrics速度监控 var eBayAPIInterfaceClient = eBayAPIInstance.Instance.GeteBayAPIClient(url, timeout: this.Timeout); //var 报文 = new 报文(); //eBayAPIInterfaceClient.Endpoint.EndpointBehaviors.Add(new ContextPropagationBehavior(报文)); //PropertyInfo pi; //pi = this.mServiceType.GetProperty("ApiLogManager"); //if (pi == null) // throw new SdkException("ApiLogManager was not found in InterfaceServiceType"); //pi.SetValue(svcInst, this.mApiContext.ApiLogManager, null); //pi = this.mServiceType.GetProperty("EnableComression"); //if (pi == null) // throw new SdkException("EnableComression was not found in InterfaceServiceType"); //pi.SetValue(svcInst, this.mEnableCompression, null); //Add oAuth //if (pi == null) // throw new SdkException("RequesterCredentials was not found in InterfaceServiceType"); //pi.SetValue(svcInst, this., null); //if (string.IsNullOrEmpty(this.ApiContext.ApiCredential.oAuthToken)) //{ // pi = this.mServiceType.GetProperty("RequesterCredentials"); // if (pi == null) // throw new SdkException("RequesterCredentials was not found in InterfaceServiceType"); // pi.SetValue(svcInst, secHdr, null); //} //pi = this.mServiceType.GetProperty("WebProxy"); //if (pi == null) // throw new SdkException("WebProxy was not found in InterfaceServiceType"); //pi.SetValue(svcInst, this.mApiContext.WebProxy, null); //if (this.mApiContext.WebProxy != null) //{ // LogMessage("Proxy Server is Set", MessageType.Information, MessageSeverity.Informational); //} //pi = this.mServiceType.GetProperty("CallMetricsEntry"); //if (pi == null) // throw new SdkException("CallMetricsEntry was not found in InterfaceServiceType"); //if (this.ApiContext.EnableMetrics) // pi.SetValue(svcInst, this.mCallMetrics, null); //else // pi.SetValue(svcInst, null, null); //pi = this.mServiceType.GetProperty("OAuthToken"); //if (!string.IsNullOrEmpty(this.ApiContext.ApiCredential.oAuthToken)) //{ // this.mOAuth = this.ApiContext.ApiCredential.oAuthToken; // pi.SetValue(svcInst, this.OAuth, null); //} ////svcCCTor.Timeout = Timeout; //this.mServiceType.GetProperty("Timeout").SetValue(svcInst, Timeout, null); AbstractRequest.Version = Version; if (!mDetailLevelOverride && AbstractRequest.DetailLevel == null) { AbstractRequest.DetailLevel = mDetailLevelList; } //Added OutputSelector to base call JIRA-SDK-561 AbstractRequest.OutputSelector = mOutputSelector; if (ApiContext.ErrorLanguage != ErrorLanguageCodeType.CustomCode) { AbstractRequest.ErrorLanguage = ApiContext.ErrorLanguage.ToString(); } //Populate the message AbstractRequest.MessageID = System.Guid.NewGuid().ToString(); //Type methodtype = svcInst.GetType(); //object[] reqparm = new object[] { AbstractRequest }; CustomSecurityHeaderType secHdr = this.GetSecurityHeader(); var request = System.Activator.CreateInstance(requestName); requestName.GetProperty("RequesterCredentials").SetValue(request, secHdr); requestName.GetProperty(apiName + "RequestType").SetValue(request, AbstractRequest); //, secHdr, this.AbstractRequest int retries = 0; int maxRetries = 0; bool doretry = false; CallRetry retry = null; if (mCallRetry != null) { retry = mCallRetry; maxRetries = retry.MaximumRetries; } else if (ApiContext.CallRetry != null) { retry = ApiContext.CallRetry; maxRetries = retry.MaximumRetries; } do { Exception callException = null; try { // mResponse = null; // mApiException = null; if (retries > 0) { LogMessage("Invoking Call Retry", MessageType.Information, MessageSeverity.Informational); System.Threading.Thread.Sleep(retry.DelayTime); } if (BeforeRequest != null) { BeforeRequest(this, new BeforeRequestEventArgs(AbstractRequest)); } //Invoke the Service DateTime start = DateTime.Now; //mResponse = (AbstractResponseType)methodtype.GetMethod(apiName).Invoke(svcInst, reqparm); if (mCallMetrics != null) { mCallMetrics.NetworkSendStarted = DateTime.Now; //request.Headers.Add("X-EBAY-API-METRICS", "true"); } var response = eBayAPIInterfaceClient.GetType().GetMethod(apiName).Invoke(eBayAPIInterfaceClient, new[] { request }); mResponse = (AbstractResponseType)response.GetType().GetProperty(apiName + "ResponseType").GetValue(response); if (mCallMetrics != null) { mCallMetrics.NetworkReceiveEnded = DateTime.Now; //mCallMetrics.ServerProcessingTime = convertProcessingTime(response.Headers.Get("X-EBAY-API-PROCESS-TIME")); } //validate(response.StatusCode); mResponseTime = DateTime.Now - start; if (AfterRequest != null) { AfterRequest(this, new AfterRequestEventArgs(mResponse)); } // Catch Token Expiration warning if (mResponse != null && secHdr.HardExpirationWarning != null) { ApiContext.ApiCredential.TokenHardExpirationWarning( System.Convert.ToDateTime(secHdr.HardExpirationWarning, System.Globalization.CultureInfo.CurrentUICulture)); } if (mResponse != null && mResponse.Errors != null && mResponse.Errors.Count > 0) { throw new ApiException(new List <ErrorType>(mResponse.Errors)); } } catch (Exception ex) { // this catches soap faults if (ex.GetType() == typeof(TargetInvocationException)) { // we never care about the outer exception Exception iex = ex.InnerException; //// Parse Soap Faults //if (iex.GetType() == typeof(SoapException)) //{ // ex = ApiException.FromSoapException((SoapException)iex); //} //else if (iex.GetType() == typeof(InvalidOperationException)) { // Go to innermost exception while (iex.InnerException != null) { iex = iex.InnerException; } ex = new ApiException(iex.Message, iex); } else if (iex.GetType() == typeof(HttpException)) { HttpException httpEx = (HttpException)iex; String str = "HTTP Error Code: " + httpEx.StatusCode; ex = new ApiException(str, iex); } else { ex = new ApiException(iex.Message, iex); } } callException = ex; // log the message - override current switches - *if* (a) we wouldn't normally log it, and (b) // the exception matches the exception filter. if (retry != null) { doretry = retry.ShouldRetry(ex); } if (!doretry || retries == maxRetries) { throw ex; } else { //string soapReq = 报文.发送.LastOrDefault();// (string)this.mServiceType.GetProperty("SoapRequest").GetValue(svcInst, null); //string soapResp = 报文.接收.LastOrDefault(); // (string)this.mServiceType.GetProperty("SoapResponse").GetValue(svcInst, null); //LogMessagePayload(soapReq + "\r\n\r\n" + soapResp, MessageSeverity.Informational, ex); MessageSeverity svr = ((ApiException)ex).SeverityErrorCount > 0 ? MessageSeverity.Error : MessageSeverity.Warning; LogMessage(ex.Message, MessageType.Exception, svr); } } finally { //string soapReq = 报文.发送.LastOrDefault();// (string)this.mServiceType.GetProperty("SoapRequest").GetValue(svcInst, null); //string soapResp = 报文.接收.LastOrDefault(); //(string)this.mServiceType.GetProperty("SoapResponse").GetValue(svcInst, null); //if (!doretry || retries == maxRetries) // LogMessagePayload(soapReq + "\r\n\r\n" + soapResp, MessageSeverity.Informational, callException); if (mResponse != null && mResponse.Timestamp.HasValue) { ApiContext.CallUpdate(mResponse.Timestamp.Value); } else { ApiContext.CallUpdate(new DateTime(0)); } //mSoapRequest = soapReq; //mSoapResponse = soapResp; retries++; //var ssss = System.Xml.Linq.XElement.Parse(soapResp); //var sdfsdfdsf = ssss.Elements().LastOrDefault().FirstNode.ToString(); //var ser = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(eBay.Service.Core.Soap.GetApiAccessRulesResponseType), "GetApiAccessRulesResponse"); //using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(sdfsdfdsf))) //{ // var jsonObject = ser.ReadObject(ms); //} } } while (doretry && retries <= maxRetries); } catch (Exception ex) { ApiException aex = ex as ApiException; if (aex != null) { mApiException = aex; } else { mApiException = new ApiException(ex.Message, ex); } MessageSeverity svr = mApiException.SeverityErrorCount > 0 ? MessageSeverity.Error : MessageSeverity.Warning; LogMessage(mApiException.Message, MessageType.Exception, svr); if (mApiException.SeverityErrorCount > 0) { throw mApiException; } } finally { if (this.ApiContext.EnableMetrics) { mCallMetrics.ApiCallEnded = DateTime.Now; } } }