protected void UpdateTrackingStatus(string trackingNum) { try { TrackingEvent[] tEvent; Swsim.SwsimV6 swsimobj = new SwsimV6(); swsimobj.TrackShipment((object)getCredentialObj(), (object)trackingNum, out tEvent); string status = tEvent[0].Event.ToString(); } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } }
protected void btnTest_Click(object sender, EventArgs e) { try { Address toAddress = new Address(); toAddress.Address1 = txtToAddress1.Text; toAddress.Address2 = txtToAddress2.Text; toAddress.City = txtToCity.Text; toAddress.FirstName = lblPatientFName.Text; toAddress.LastName = lblPatientLName.Text; toAddress.MiddleName = lblPatientMName.Text; toAddress.State = txtToState.Text; toAddress.ZIPCode = txtToZip.Text; if (checkAddress(ref toAddress)) { Swsim.SwsimV6 swsimobj = new SwsimV6(); Address fromAddress = new Address(); fromAddress.Address1 = txtFromAddress1.Text; fromAddress.Address2 = txtFromAddress2.Text; fromAddress.City = txtFromCity.Text; fromAddress.FirstName = txtFromFName.Text; fromAddress.LastName = txtFromLName.Text; fromAddress.MiddleName = txtFromMName.Text; fromAddress.State = txtFromState.Text; fromAddress.ZIPCode = txtFromZip.Text; string URL; RateV3 rate = getRateobj(); swsimobj.CreateTestIndicium((object)getCredentialObj(), ref rate, fromAddress, toAddress, null, image_type.jpg, EltronPrinterDPIType.Default, out URL); string str = "window.open('" + URL + "','SampleStamp');"; ScriptManager.RegisterStartupScript(btnTest, typeof(UpdatePanel), "alert", str, true); } else { string str = "alert('Address InValid! Please Check..');"; ScriptManager.RegisterStartupScript(imgBtnChkAddr, typeof(UpdatePanel), "alert", str, true); } } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } }
private void GetStampRate() { RateV3 rate = getRateobj(); RateV3[] Rate; Swsim.SwsimV6 swsimobj = new SwsimV6(); swsimobj.GetRates((object)getCredentialObj(), rate, out Rate); if (Rate.Length > 0) { txtRate.Text = String.Format("{0:c}", double.Parse(Rate[0].Amount.ToString())); } }
protected double getPostalBalance() { try { Swsim.SwsimV6 swsimobj = new SwsimV6(); AccountInfo accInfo; swsimobj.GetAccountInfo((object) getCredentialObj(),out accInfo); return double.Parse(accInfo.PostageBalance.AvailablePostage.ToString()); } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } return 0.0d; }
protected void btnGenerate_Click(object sender, EventArgs e) { try { hplStamp.NavigateUrl = ""; Address toAddress = new Address(); toAddress.Address1 = txtToAddress1.Text; toAddress.Address2 = txtToAddress2.Text; toAddress.City = txtToCity.Text; toAddress.FirstName = lblPatientFName.Text; toAddress.LastName = lblPatientLName.Text; toAddress.MiddleName = lblPatientMName.Text; toAddress.State = txtToState.Text; toAddress.ZIPCode = txtToZip.Text; if (checkAddress(ref toAddress)) { Swsim.SwsimV6 swsimobj = new SwsimV6(); Address fromAddress = new Address(); fromAddress.Address1 = txtFromAddress1.Text; fromAddress.Address2 = txtFromAddress2.Text; fromAddress.City = txtFromCity.Text; fromAddress.FirstName = txtFromFName.Text; fromAddress.LastName = txtFromLName.Text; fromAddress.MiddleName = txtFromMName.Text; fromAddress.State = txtFromState.Text; fromAddress.ZIPCode = txtFromZip.Text; string intgrtxID = ConfigurationManager.AppSettings["stampsIntegrationID"].ToString(), URL, trackNum = ""; Swsim.PostageBalance postageBalance; Guid stampsTxID; RateV3 rate = getRateobj(); swsimobj.CreateIndicium((object)getCredentialObj(), ref intgrtxID, ref trackNum, ref rate, fromAddress, toAddress, ConfigurationManager.AppSettings["stampsIntegrationID"].ToString(), null, true, image_type.jpg, EltronPrinterDPIType.Default, txtMessage.Text, out stampsTxID, out URL, out postageBalance); hplStamp.NavigateUrl = URL; lblPostalBalance1.Text =String.Format("{0:c}",double.Parse( postageBalance.AvailablePostage.ToString())); txtRate.Text = String.Format("{0:c}", double.Parse(rate.Amount.ToString())); updateTracking(trackNum, URL, txtToAddress.Text, rate.ShipDate.ToString()); string str = "alert('Stamp Generated Successfully...');" + "ClientSidePrint('" + URL + "'); "; ScriptManager.RegisterStartupScript(btnGenerate , typeof(UpdatePanel), "alert", str, true); getDrugList(""); FillGrid(); RefreshControls(); } else { string str = "alert('InValid Address..! Please Check..');"; ScriptManager.RegisterStartupScript(imgBtnChkAddr , typeof(UpdatePanel), "alert", str, true); } } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); string str = "alert('Error occured..! Please Check Address/Stamp Options.');"; ScriptManager.RegisterStartupScript(imgBtnChkAddr, typeof(UpdatePanel), "alert", str, true); } }
protected Boolean checkAddress(ref Address toAddress) { try { Address address = toAddress; Boolean AddressMatch, CItyZipOK; Swsim.SwsimV6 swsimobj = new SwsimV6(); swsimobj.CleanseAddress((object)getCredentialObj(), ref address, out AddressMatch, out CItyZipOK); if (AddressMatch) { toAddress.CleanseHash = address.CleanseHash; toAddress.OverrideHash = address.OverrideHash; } else if (CItyZipOK) { toAddress.OverrideHash = address.OverrideHash; } if (!CItyZipOK) { return false; } } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); return false ; } return true; }