public virtual void PrintAnnualPaySlip(addressType typeOfAddress) { //create folder and file string fileName = this.firstName + this.lastName + this.empId + ".txt"; string pathString = System.IO.Path.Combine(@"C:\Users\hopdizzle\Documents\Jaya\ProfessionalGuru\EmpAnnualPayStubs", fileName); Address employeeAddress = new Address(); //prepate text to write into file List <string> lines = new List <string>(); lines.Add("***********************************************************"); lines.Add("Employee Details"); lines.Add("Employee First Name: " + this.firstName); lines.Add("Employee Last Name: " + this.lastName); if (this.address.TryGetValue(typeOfAddress, out employeeAddress)) { lines.Add("Employee " + typeOfAddress + " Address: " + employeeAddress.street + ", " + employeeAddress.houseNumber); lines.Add(" " + employeeAddress.city + ", " + employeeAddress.zipcode + ", " + employeeAddress.country); } else { lines.Add("No Address on record"); } lines.Add("Employee ID: " + this.empId); lines.Add("***********************************************************"); lines.Add("***********************************************************"); lines.Add("Salary Details"); File.WriteAllLines(pathString, lines); }
public void Evaluate_ProducerHasOverseasContactInFrance_Passes() { // Arrange EnsureAnOverseasProducerIsNotBasedInTheUK rule = new EnsureAnOverseasProducerIsNotBasedInTheUK(); addressType address = new addressType(); address.country = countryType.FRANCE; contactDetailsType overseasContact = new contactDetailsType(); overseasContact.address = address; overseasProducerType overseasProducer = new overseasProducerType(); overseasProducer.overseasContact = overseasContact; authorisedRepresentativeType authorisedRepresentative = new authorisedRepresentativeType(); authorisedRepresentative.overseasProducer = overseasProducer; producerType producer = new producerType(); producer.authorisedRepresentative = authorisedRepresentative; // Act RuleResult result = rule.Evaluate(producer); // Assert Assert.Equal(true, result.IsValid); }
public override void PrintAnnualPaySlip(addressType typeOfAddress) { base.PrintAnnualPaySlip(typeOfAddress); string fileName = this.firstName + this.lastName + this.empId + ".txt"; string pathString = System.IO.Path.Combine(@"C:\Users\hopdizzle\Documents\Jaya\ProfessionalGuru\EmpAnnualPayStubs", fileName); decimal annualCommission = 0; decimal annualSalary = 0; using (StreamWriter sw = File.AppendText(pathString)) { foreach (month mn in Enum.GetValues(typeof(month))) { decimal monthlySalary = CalculateSalary((month)mn); sw.WriteLine((month)mn + ": " + monthlySalary); annualSalary += monthlySalary; } sw.WriteLine("Annual Salary: " + annualSalary); //print commission for each month sw.WriteLine("***********************************************************"); sw.WriteLine("***********************************************************"); sw.WriteLine("Commission Details"); foreach (month mn in Enum.GetValues(typeof(month))) { decimal monthlyCommission = CalculateCommission((month)mn); sw.WriteLine((month)mn + ": " + monthlyCommission); annualCommission += monthlyCommission; } sw.WriteLine("Annual Commission: " + annualCommission); } }
public override void PrintAnnualPaySlip(addressType typeOfAddress) { base.PrintAnnualPaySlip(typeOfAddress); string fileName = this.firstName + this.lastName + this.empId + ".txt"; string pathString = System.IO.Path.Combine(@"C:\Users\hopdizzle\Documents\Jaya\ProfessionalGuru\EmpAnnualPayStubs", fileName); decimal annualCommission = 0; decimal annualSalary = 0; using (StreamWriter sw = File.AppendText(pathString)) { //print salary for each month foreach (KeyValuePair <month, int> kvp in WORKING_DAYS_FORMONTH) { decimal monthlySalary = CalculateSalary(kvp.Key); sw.WriteLine(kvp.Key + ": " + monthlySalary); annualSalary += monthlySalary; } sw.WriteLine("Annual Salary: " + annualSalary); //print commission for each month sw.WriteLine("***********************************************************"); sw.WriteLine("***********************************************************"); sw.WriteLine("Commission Details"); foreach (KeyValuePair <month, int> kvp in WORKING_DAYS_FORMONTH) { decimal monthlyCommission = CalculateCommission(kvp.Key); sw.WriteLine(kvp.Key + ": " + monthlyCommission); annualCommission += monthlyCommission; } sw.WriteLine("Annual Commission: " + annualCommission); } }
public void Evaluate_ProducerHasOverseaseContactInEngland_FailsWithError() { // Arrange EnsureAnOverseasProducerIsNotBasedInTheUK rule = new EnsureAnOverseasProducerIsNotBasedInTheUK(); addressType address = new addressType(); address.country = countryType.UKENGLAND; contactDetailsType overseasContact = new contactDetailsType(); overseasContact.address = address; overseasProducerType overseasProducer = new overseasProducerType(); overseasProducer.overseasContact = overseasContact; authorisedRepresentativeType authorisedRepresentative = new authorisedRepresentativeType(); authorisedRepresentative.overseasProducer = overseasProducer; producerType producer = new producerType(); producer.authorisedRepresentative = authorisedRepresentative; // Act RuleResult result = rule.Evaluate(producer); // Assert Assert.Equal(false, result.IsValid); Assert.Equal(ErrorLevel.Error, result.ErrorLevel); }
private void SetSettingValue(string settingKey, addressType value) { try { App.AppSettingsProvider[settingKey].AddressType = value; App.AppSettingsProvider.SaveSettings(); } catch (KeyNotFoundException e) { throw e; } }
/// <summary> /// Depending on the mail address type, add each mail address from the collection to the mail message /// </summary> /// <param name="mail">This is the MailMessage object from the main form</param> /// <param name="mailAddrCol">This is the Collection of addresses that need to be added</param> /// <param name="mailAddressType">type of mail address to be added</param> public static void AddSmtpToMailAddressCollection(MailMessage mail, MailAddressCollection mailAddrCol, addressType mailAddressType) { foreach (MailAddress ma in mailAddrCol) { if (mailAddressType == addressType.To) { mail.To.Add(ma.Address); } else if (mailAddressType == addressType.Cc) { mail.CC.Add(ma.Address); } else { mail.Bcc.Add(ma.Address); } } }
public KmehrHealthCarePartyBuilder AddAddress(KmehrAddressTypes addressType, string country, string zipCode = null, string city = null, string street = null, string houseNumber = null, string postboxNumber = null) { var newAddressType = new addressType { cd = new CDADDRESS[1] { new CDADDRESS { S = CDADDRESSschemes.CDADDRESS, SV = KmehrConstant.ReferenceVersion.CD_ADDRESS_VERSION, Value = addressType.Code } }, country = new countryType { cd = new CDCOUNTRY { S = CDCOUNTRYschemes.CDFEDCOUNTRY, SV = KmehrConstant.ReferenceVersion.CD_FEDICT_COUNTRY_CODE_VERSION, Value = country } }, zip = zipCode, city = city, street = street, housenumber = houseNumber, postboxnumber = postboxNumber }; if (_hcParty.address == null) { _hcParty.address = new addressType[0]; } var addresses = _hcParty.address.ToList(); addresses.Add(newAddressType); _hcParty.address = addresses.ToArray(); return(this); }
public static void addAddress(bool student, addressType type, string address1, string city, string state, string pincode, string country = "Algeria") { if (student) { Navigate.RandomStudent(); Wait.ImplicitWait(5); CustomControls.click("//*[@id=\"tab-profile\"]/div[2]/div/ul/li[2]/a", propertytype.XPath); } else { Navigate.RandomEmployee(); CustomControls.click("//*[@id=\"li-addresss\"]", propertytype.XPath); } CustomControls.click("//*[@id=\"btn-address\"]", propertytype.XPath); Wait.ImplicitWait(5); CustomControls.click("//select[@id=\"address-type\"]", propertytype.XPath); Wait.ImplicitWait(5); CustomControls.Selectdropdown("//select[@id=\"address-type\"]", Enum.GetName(typeof(addressType), type), propertytype.XPath); Wait.ImplicitWait(5); CustomControls.Entertext("//*[@id=\"address-line1\"]", address1, propertytype.XPath); Wait.ImplicitWait(5); CustomControls.Entertext("//input[@id='city']", city, propertytype.XPath); Wait.ImplicitWait(5); CustomControls.Entertext("//input[@id='state']", state, propertytype.XPath); Wait.ImplicitWait(5); CustomControls.Entertext("//input[@id='pin']", pincode, propertytype.XPath); Wait.ImplicitWait(5); CustomControls.Entertext("//select[@id='country']", country, propertytype.XPath); Wait.ImplicitWait(5); CustomControls.click("//*[@id=\"save-close-button\"]", propertytype.XPath); delayfor.delay(); //WHAT IS THE ALTERNATIVE HERE, THE ELEMENT IS PRESENT BUT ITS NOT DOING THE JOB ??????? CustomControls.click("//*[@id=\"appbody\"]/div[6]/div[7]/button[2]", propertytype.XPath); if (student) { CustomControls.click("//*[@id=\"tab-profile\"]/div[2]/div/ul/li[2]/a", propertytype.XPath); } }
public void ReplyLocation(SUTIMsg msgFrom, float gpsLat, float gpsLon) { SUTI rmsg = new SUTI(); SUTIMsg msgResponse = new SUTIMsg(); SUTIMsg msgReceived = this.inSUTImsg; orgType sender = this.inSUTI.orgReceiver; orgType receiver = this.inSUTI.orgSender; rmsg.orgReceiver = receiver; rmsg.orgSender = sender; rmsg.msg = new List <SUTIMsg>(); idType id = new idType(); id.src = "104:TaxiPak_HTD_002:MSGID"; id.id = System.DateTime.Now.Ticks.ToString(); msgResponse.idMsg = id; msgResponse.msgName = "Requested Location"; msgResponse.msgType = "5021"; List <timesTypeTime> lt = new List <timesTypeTime>(); timesTypeTime msgtimestamp = new timesTypeTime(); msgtimestamp.time1 = System.DateTime.Now; lt.Add(msgtimestamp); msgResponse.msgTimeStamp = lt; List <timesTypeTime> ltinfo = new List <timesTypeTime>(); timesTypeTime infotimestamp = new timesTypeTime(); infotimestamp.time1 = System.DateTime.Now; ltinfo.Add(infotimestamp); msgResponse.infoTimeStamp = ltinfo; idType idVehicle = this.inSUTImsg.referencesTo.idVehicle; msgResponse.referencesTo = new msgReferencesTo(); msgResponse.referencesTo.idVehicle = idVehicle; addressType al = new addressType(); geographicLocation gl = new geographicLocation(); gl.lat = gpsLat; gl.@long = gpsLon; gl.typeOfCoordinate = "WGS-84"; gl.precision = "0"; al.geographicLocation = gl; msgResponse.Item = al; rmsg.msg.Add(msgResponse); try { //log.InfoFormat("HTD->HUT " + rmsg.Serialize().ToString()); string response = "<SOAP-ENV:Envelope xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ZSI='http://www.zolera.com/schemas/ZSI/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body xmlns:ns1='http://tempuri.org/'><ns1:ReceiveSutiMsg><ns1:xmlstring>" + System.Web.HttpUtility.HtmlEncode(rmsg.Serialize().ToString()) + "</ns1:xmlstring></ns1:ReceiveSutiMsg></SOAP-ENV:Body></SOAP-ENV:Envelope>"; byte[] buffer = Encoding.UTF8.GetBytes(response); WebRequest request = WebRequest.Create(ConfigurationManager.AppSettings.Get("VPUendpoint")); request.Credentials = CredentialCache.DefaultCredentials; ((HttpWebRequest)request).UserAgent = "ASP.NET from HTD KELA SVC"; ((HttpWebRequest)request).KeepAlive = false; ((HttpWebRequest)request).Timeout = System.Threading.Timeout.Infinite; ((HttpWebRequest)request).ReadWriteTimeout = System.Threading.Timeout.Infinite; ((HttpWebRequest)request).ProtocolVersion = HttpVersion.Version10; ((HttpWebRequest)request).AllowWriteStreamBuffering = false; ((HttpWebRequest)request).ContentLength = buffer.Length; request.Method = "POST"; request.ContentType = "application/xml"; Stream writer = request.GetRequestStream(); //log.InfoFormat("HTD->HUT " + response); writer.Write(buffer, 0, buffer.Length); writer.Close(); // Response WebResponse resp = request.GetResponse(); writer = resp.GetResponseStream(); StreamReader rdr = new StreamReader(writer); //log.InfoFormat("HUT->HTD " + rdr.ReadToEnd()); rdr.Close(); writer.Close(); resp.Close(); } catch (WebException exc) { log.InfoFormat("Error with Location Response - {0}", exc.Message); } catch (ProtocolViolationException exc) { log.InfoFormat("Error with ORDER CONFIRMATION - {0}" + exc.Message); } // Reject orders during TEST //OrderKELAReject okr = new OrderKELAReject(this.inSUTI, this.inSUTImsg, sID, msgCount); //okr.SendOrderKELAReject(this.inSUTImsg); return; }