public CartCheckedOut(Guid customerId, Guid? voucherId, DeliveryAddress address, Phone phone) { CustomerId = customerId; VoucherId = voucherId; Address = address; Phone = phone; }
/// <summary> /// Creates a new call /// </summary> /// <param name="number"></param> /// <param name="period"></param> /// <param name="action"></param> public Call(Phone.Number number, ITimePeriod period, Action action) { this.Number = number; this.Period = period; _result = action; }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<Phone> TableToList(DataTable table){ List<Phone> retVal=new List<Phone>(); Phone phone; for(int i=0;i<table.Rows.Count;i++) { phone=new Phone(); phone.PhoneNum = PIn.Long (table.Rows[i]["PhoneNum"].ToString()); phone.Extension = PIn.Int (table.Rows[i]["Extension"].ToString()); phone.EmployeeName = PIn.String(table.Rows[i]["EmployeeName"].ToString()); string clockStatus=table.Rows[i]["ClockStatus"].ToString(); if(clockStatus==""){ phone.ClockStatus =(ClockStatusEnum)0; } else try{ phone.ClockStatus =(ClockStatusEnum)Enum.Parse(typeof(ClockStatusEnum),clockStatus); } catch{ phone.ClockStatus =(ClockStatusEnum)0; } phone.Description = PIn.String(table.Rows[i]["Description"].ToString()); phone.ColorBar = Color.FromArgb(PIn.Int(table.Rows[i]["ColorBar"].ToString())); phone.ColorText = Color.FromArgb(PIn.Int(table.Rows[i]["ColorText"].ToString())); phone.EmployeeNum = PIn.Long (table.Rows[i]["EmployeeNum"].ToString()); phone.CustomerNumber = PIn.String(table.Rows[i]["CustomerNumber"].ToString()); phone.InOrOut = PIn.String(table.Rows[i]["InOrOut"].ToString()); phone.PatNum = PIn.Long (table.Rows[i]["PatNum"].ToString()); phone.DateTimeStart = PIn.DateT (table.Rows[i]["DateTimeStart"].ToString()); phone.WebCamImage = PIn.String(table.Rows[i]["WebCamImage"].ToString()); phone.ScreenshotPath = PIn.String(table.Rows[i]["ScreenshotPath"].ToString()); phone.ScreenshotImage = PIn.String(table.Rows[i]["ScreenshotImage"].ToString()); phone.CustomerNumberRaw= PIn.String(table.Rows[i]["CustomerNumberRaw"].ToString()); phone.LastCallTimeStart= PIn.DateT (table.Rows[i]["LastCallTimeStart"].ToString()); retVal.Add(phone); } return retVal; }
public Phone CreateValidFaxPhone() { Phone phone = new Phone(); phone.Number = "212-555-1214"; phone.Type = PhoneType.Fax; return phone; }
public Phone CreateValidHomePhone() { Phone phone = new Phone(); phone.Number = "212-555-1212"; phone.Type = PhoneType.Home; return phone; }
public Phone CreateValidMobilePhone() { Phone phone = new Phone(); phone.Number = "212-555-1215"; phone.Type = PhoneType.Mobile; return phone; }
///<summary>Inserts one Phone into the database. Returns the new priKey.</summary> internal static long Insert(Phone phone) { if(DataConnection.DBtype==DatabaseType.Oracle) { phone.PhoneNum=DbHelper.GetNextOracleKey("phone","PhoneNum"); int loopcount=0; while(loopcount<100){ try { return Insert(phone,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ phone.PhoneNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(phone,false); } }
public void Phone_SimpleInit() { string number = "+333-72-73"; var phone = new Phone(number); Assert.AreEqual(phone.Department, null, "Department isn't null"); Assert.AreEqual(phone.Owner, null, "Owner isn't null"); Assert.AreEqual(phone.PhoneNumber, number.Clone(), "Number isn't the passed"); }
String Command.execute(String instruction) { //Call number Phone call = new Phone(); call.Talk( number ); return ";"; }
public void GetHashCodeTest() { var phone1 = new Phone("12345"); var phone2 = new Phone("12345"); var phone3 = new Phone("54321"); Assert.IsTrue(phone1.GetHashCode() == phone2.GetHashCode()); Assert.IsFalse(phone3.GetHashCode() == phone1.GetHashCode()); }
/// <summary> /// Initializes a new instance of the <see cref="LocationPhone"/> class. /// </summary> /// <param name="locationPhoneType"> /// The location phone type. /// </param> /// <param name="phone"> /// The phone. /// </param> public LocationPhone(LocationPhoneType locationPhoneType, Phone phone) { Check.IsNotNull(locationPhoneType, () => LocationPhoneType); Check.IsNotNull(phone, () => Phone); _locationPhoneType = locationPhoneType; _phone = phone; }
public Phone CreateValidWorkPhone() { Phone phone = new Phone(); phone.Number = "212-555-1000"; phone.Extension = "121"; phone.Type = PhoneType.Work; return phone; }
/// <summary> /// Initializes a new instance of the <see cref="AgencyPhone"/> class. /// </summary> /// <param name="agencyPhoneType"> /// The agency phone type. /// </param> /// <param name="phone"> /// The phone. /// </param> protected internal AgencyPhone(AgencyPhoneType agencyPhoneType, Phone phone) { Check.IsNotNull(agencyPhoneType, () => AgencyPhoneType); Check.IsNotNull(phone, () => Phone); _agencyPhoneType = agencyPhoneType; _phone = phone; }
/// <summary> /// Initializes a new instance of the <see cref="StaffPhone"/> class. /// </summary> /// <param name="staffPhoneType"> /// Type of the staff phone. /// </param> /// <param name="phone"> /// The phone. /// </param> /// <param name="confidentialIndicator"> /// If set to <c>true</c> [confidential indicator]. /// </param> public StaffPhone( StaffPhoneType staffPhoneType, Phone phone, bool confidentialIndicator ) { Check.IsNotNull ( staffPhoneType, () => StaffPhoneType ); Check.IsNotNull ( phone, () => Phone ); _staffPhoneType = staffPhoneType; _phone = phone; _confidentialIndicator = confidentialIndicator; }
public bool UpdatePhone(Phone phone) { bool canUpdate = (_fileRepository.GetById(phone.Id) != null); if (canUpdate) { _fileRepository.Upsert(phone); } return canUpdate; }
public override bool Test(Sim a, Phone target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (!target.IsUsableBy(a)) { greyedOutTooltipCallback = Common.DebugTooltip("Not Usable"); return false; } return Helpers.TravelUtilEx.CanSimTriggerTravelToHomeWorld(a, ref greyedOutTooltipCallback); }
public override string GetInteractionName(Sim actor, Phone target, InteractionObjectPair iop) { bool isFemale = false; if (mSimToCall != null) { isFemale = mSimToCall.IsFemale; } return Common.LocalizeEAString(isFemale, "Gameplay/Objects/Electronics/Phone/CallInviteOverForeignVisitors:InteractionName"); }
public void EqualsTest() { var phone1 = new Phone("12345"); var phone2 = new Phone("12345"); var phone3 = new Phone("54321"); var flag1 = phone1.Equals(phone2); Assert.IsTrue(flag1); var flag2 = phone3.Equals(phone1); Assert.IsFalse(flag2); }
/// <summary> /// Initializes a new instance of the <see cref="BillingOfficePhone"/> class. /// </summary> /// <param name="billingOfficePhoneType">Type of the billing office phone.</param> /// <param name="phone">The phone number.</param> public BillingOfficePhone( BillingOfficePhoneType billingOfficePhoneType, Phone phone ) { Check.IsNotNull ( billingOfficePhoneType, "Billing office phone type is required." ); Check.IsNotNull ( phone, "Phone number is required." ); _billingOfficePhoneType = billingOfficePhoneType; _phone = phone; }
public void TestEquals_ShouldBeTrue() { var phoneToCompare = new Phone(_country, _area, _number); Assert.IsTrue( _phone.Equals( phoneToCompare ) ); }
public void TestEquals_ShouldBeFalse() { var phoneToCompare = new Phone(_country, _area, "7654321"); Assert.IsFalse( _phone.Equals( phoneToCompare ) ); }
public void AddRemovePhoneByIdTest() { const string userName = "******"; var id = _ravenRepository.GetId("TestPhones"); var phone = new Phone("+375444444444"); _ravenRepository.AddPhone(id, phone); var phones = _ravenRepository.GetPhone(userName); _ravenRepository.RemovePhone(id, phone); Assert.IsTrue(phones.Contains(phone)); }
public Phone Create(CreatePhoneCommand command) { var phone = new Phone(command.DDD, command.Number, command.Description); phone.Validate(); _repository.Create(phone); if (Commit()) return phone; return null; }
public void Setup() { dbConnStr = buildConnectionString(CustomerManagementTest.Properties.Settings.Default.TestDb, () => DateTimeOffset.UtcNow.ToString("yyyy-MM-dd_hh:mm:ssZ")); using (var db = new CustomerContext(dbConnStr)) { var phone = new Phone {Number="123-456-7899", PhoneType=Phone.Type.Work, CountryCallingCode="Code" }; db.Save(phone); db.SaveChanges(); id = phone.Id; } }
public JsonResult CreatePhone(Phone phone) { try { _phoneService.CreatePhone(phone); return Json(new { Result = "OK", Record = phone }); } catch (Exception ex) { return Json(new { Result = "ERROR", Message = ex.Message }); } }
public void Initialize() { _country = "48"; _area = "22"; _number = "1234567"; _phone = new Phone( _country, _area, _number ); }
internal static void Write(XmlWriter writer, Phone phone) { if (writer == null) throw new ArgumentNullException("writer"); if (phone == null) throw new ArgumentNullException("phone"); writer.WriteStartElement(PhoneSerializer.Phone); SerializationHelper.WriteElementStringNotNull(writer, PhoneSerializer.AreaCode, phone.AreaCode); SerializationHelper.WriteElementStringNotNull(writer, PhoneSerializer.Number, phone.Number); writer.WriteEndElement(); }
public Phone viewModelToPhone(PhoneVM model) { Phone phone = new Phone { Id = model.Id, PhoneType = model.PhoneType, PhoneNumber = model.PhoneNumber, DateCreated = model.DateCreated, DateModified = model.DateModified }; return phone; }
public PhoneVM phoneToViewModel(Phone phone) { PhoneVM model = new PhoneVM { Id = phone.Id, PhoneType = phone.PhoneType, PhoneNumber = phone.PhoneNumber, DateCreated = phone.DateCreated, DateModified = phone.DateModified }; return model; }
public override bool Test(Sim a, Phone target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { if (!GameUtils.IsOnVacation()) return false; return base.Test(a, target, isAutonomous, ref greyedOutTooltipCallback); } catch (Exception e) { Common.Exception(a, target, e); return false; } }
public void PurchaseRocketWithLogs() { App.Navigation.Navigate("http://demos.bellatrix.solutions/"); // As mentioned before BELLATRIX searches for elements not immediately but after you perform an action or assert. // This is why we can place all elements and later perform actions on them. It is possible at the moment of declaring them, // not to be yet present on the page. // Home page elements Select sortDropDown = App.Components.CreateByNameEndingWith <Select>("orderby"); Anchor protonMReadMoreButton = App.Components.CreateByInnerTextContaining <Anchor>("Read more"); Anchor addToCartFalcon9 = App.Components.CreateByAttributesContaining <Anchor>("data-product_id", "28").ToBeClickable(); Anchor viewCartButton = App.Components.CreateByClassContaining <Anchor>("added_to_cart wc-forward").ToBeClickable(); // Home Page actions sortDropDown.SelectByText("Sort by price: low to high"); protonMReadMoreButton.Hover(); addToCartFalcon9.Focus(); addToCartFalcon9.Click(); viewCartButton.Click(); // Cart page elements TextField couponCodeTextField = App.Components.CreateById <TextField>("coupon_code"); Button applyCouponButton = App.Components.CreateByValueContaining <Button>("Apply coupon"); Div messageAlert = App.Components.CreateByClassContaining <Div>("woocommerce-message"); Number quantityBox = App.Components.CreateByClassContaining <Number>("input-text qty text"); Button updateCart = App.Components.CreateByValueContaining <Button>("Update cart").ToBeClickable(); Span totalSpan = App.Components.CreateByXpath <Span>("//*[@class='order-total']//span"); Anchor proceedToCheckout = App.Components.CreateByClassContaining <Anchor>("checkout-button button alt wc-forward"); // Cart page actions couponCodeTextField.SetText("happybirthday"); applyCouponButton.Click(); messageAlert.ToHasContent().ToBeVisible().WaitToBe(); messageAlert.ValidateInnerTextIs("Coupon code applied successfully."); App.Browser.WaitForAjax(); totalSpan.ValidateInnerTextIs("54.00€"); proceedToCheckout.Click(); // Checkout page elements Heading billingDetailsHeading = App.Components.CreateByInnerTextContaining <Heading>("Billing details"); Anchor showLogin = App.Components.CreateByInnerTextContaining <Anchor>("Click here to login"); TextArea orderCommentsTextArea = App.Components.CreateById <TextArea>("order_comments"); TextField billingFirstName = App.Components.CreateById <TextField>("billing_first_name"); TextField billingLastName = App.Components.CreateById <TextField>("billing_last_name"); TextField billingCompany = App.Components.CreateById <TextField>("billing_company"); Select billingCountry = App.Components.CreateById <Select>("billing_country"); TextField billingAddress1 = App.Components.CreateById <TextField>("billing_address_1"); TextField billingAddress2 = App.Components.CreateById <TextField>("billing_address_2"); TextField billingCity = App.Components.CreateById <TextField>("billing_city"); Select billingState = App.Components.CreateById <Select>("billing_state").ToBeVisible().ToBeClickable(); TextField billingZip = App.Components.CreateById <TextField>("billing_postcode"); Phone billingPhone = App.Components.CreateById <Phone>("billing_phone"); Email billingEmail = App.Components.CreateById <Email>("billing_email"); CheckBox createAccountCheckBox = App.Components.CreateById <CheckBox>("createaccount"); // Checkout page actions billingDetailsHeading.ToBeVisible().WaitToBe(); showLogin.ValidateHrefIs("http://demos.bellatrix.solutions/checkout/#"); showLogin.ValidateCssClassIs("showlogin"); orderCommentsTextArea.ScrollToVisible(); orderCommentsTextArea.SetText("Please send the rocket to my door step! And don't use the elevator, they don't like when it is not clean..."); billingFirstName.SetText("In"); billingLastName.SetText("Deepthought"); billingCompany.SetText("Automate The Planet Ltd."); billingCountry.SelectByText("Bulgaria"); billingAddress1.ValidatePlaceholderIs("House number and street name"); billingAddress1.SetText("bul. Yerusalim 5"); billingAddress2.SetText("bul. Yerusalim 6"); billingCity.SetText("Sofia"); billingState.SelectByText("Sofia-Grad"); billingZip.SetText("1000"); billingPhone.SetPhone("+00359894646464"); billingEmail.SetEmail("*****@*****.**"); createAccountCheckBox.Check(); // 4. After the test is executed the following log is created: // // #### Start Chrome on PORT = 34079 // Start Test // Class = BDDLoggingTests Name = PurchaseRocketWithLogs // Select 'Sort by price: low to high' from control (Name ending with orderby) // Hover control (InnerText containing Read more) // Focus control (data-product_id = 28) // Click control (data-product_id = 28) // Click control (Class = added_to_cart wc-forward) // Type 'happybirthday' into control (ID = coupon_code) // Click control (Value containing Apply coupon) // Validate control (Class = woocommerce-message) inner text is 'Coupon code applied successfully.' // Set '0' into control (Class = input-text qty text) // Set '2' into control (Class = input-text qty text) // Click control (Value containing Update cart) // Validate control (XPath = //*[@class='order-total']//span) inner text is '95.00€' // Click control (Class = checkout-button button alt wc-forward) // Validate control (InnerText containing Click here to login) href is 'http://demos.bellatrix.solutions/checkout/#' // Validate control (InnerText containing Click here to login) CSS class is 'showlogin' // Scroll to visible control (ID = order_comments) // Type 'Please send the rocket to my door step! And don't use the elevator, they don't like when it is not clean...' into control (ID = order_comments) // Type 'In' into control (ID = billing_first_name) // Type 'Deepthought' into control (ID = billing_last_name) // Type 'Automate The Planet Ltd.' into control (ID = billing_company) // Select 'Bulgaria' from control (ID = billing_country) // Validate control (ID = billing_address_1) placeholder is 'House number and street name' // Type 'bul. Yerusalim 5' into control (ID = billing_address_1) // Type 'bul. Yerusalim 6' into control (ID = billing_address_2) // Type 'Sofia' into control (ID = billing_city) // Select 'Sofia-Grad' from control (ID = billing_state) // Type '1000' into control (ID = billing_postcode) // Type '+00359894646464' into control (ID = billing_phone) // Type '*****@*****.**' into control (ID = billing_email) // Check control (ID = createaccount) // Click control (for = payment_method_cheque) // 5. You can notice that since we use Validate assertions not the regular one they also present in the log: // Validate control (XPath = //*[@class='order-total']//span) inner text is '95.00€' // 6. There are two specifics about the generation of the logs. If page objects are used, which are discussed in next chapters. // Two things change. // 1. Instead of locators, the exact names of the element properties are printed. // 2. Instead of page URL, the name of the page is displayed. }
public JsonResult CreateAJAX(Phone phone) { _phoneService.Add(phone); return(Json(new { data = phone })); }
public static bool isBusyDevice(string user, Phone device, Host host) { return(execute(ReqType.checkdevice, user, device, host).Contains("</userID>")); }
private static string encodeReq(ReqType reqType, string user, Phone device, Host host) { var encodedReq = ""; switch (reqType) { case ReqType.login: XElement xmlLogIn = new XElement("request", new XElement("appInfo", new XElement("appID", host.AppID), new XElement("appCertificate", host.AppCert) ), new XElement("login", new XElement("deviceName", device.ID), new XElement("userID", user), new XElement("deviceProfile", device.Profile), new XElement("exclusiveDuration", new XElement("indefinite", null) ) ) ); encodedReq = WebUtility.UrlEncode(xmlLogIn.ToString()); //Console.WriteLine(encodedReq); break; case ReqType.logout: XElement xmlLogOut = new XElement("request", new XElement("appInfo", new XElement("appID", host.AppID), new XElement("appCertificate", host.AppCert) ), new XElement("logout", new XElement("deviceName", device.ID) ) ); encodedReq = WebUtility.UrlEncode(xmlLogOut.ToString()); break; case ReqType.checklogin: XElement xmlDeviceQuery = new XElement("query", new XElement("appInfo", new XElement("appID", host.AppID), new XElement("appCertificate", host.AppCert) ), new XElement("userDevicesQuery", new XElement("userID", user) ) ); //Console.WriteLine(xmlDeviceQuery); encodedReq = WebUtility.UrlEncode(xmlDeviceQuery.ToString()); break; case ReqType.checkdevice: XElement xmlUserQuery = new XElement("query", new XElement("appInfo", new XElement("appID", host.AppID), new XElement("appCertificate", host.AppCert) ), new XElement("deviceUserQuery", new XElement("deviceName", device.ID) ) ); //Console.WriteLine(xmlUserQuery); encodedReq = WebUtility.UrlEncode(xmlUserQuery.ToString()); break; } return("xml=" + encodedReq); }
public void SetUp() { this.phone = new Phone("iPhone", "X"); }
public void MakePropertyThrowsException() { Assert.Throws <ArgumentException>(() => phone = new Phone("", "X")); }
public void ModelPropertyThrowsException() { Assert.Throws <ArgumentException>(() => phone = new Phone("iPhone", "")); }
public void Dispose() { phone = null; }
public bool AbonentIsAvalible(Phone abonent) { return(_abonentAvalibleCheck(abonent)); }
public record UpdateContactDto([Required] string first, string middle, [Required] string last, Address address, [Required] Phone phone, string email);
public void PurchaseRocketWithoutPageObjects20() { App.TestCases.AddPrecondition($"Navigate to http://demos.bellatrix.solutions/"); App.Navigation.Navigate("http://demos.bellatrix.solutions/"); Select sortDropDown = App.Components.CreateByNameEndingWith <Select>("orderby"); Anchor protonMReadMoreButton = App.Components.CreateByInnerTextContaining <Anchor>("Read more"); Anchor addToCartFalcon9 = App.Components.CreateByAttributesContaining <Anchor>("data-product_id", "28").ToBeClickable(); Anchor viewCartButton = App.Components.CreateByClassContaining <Anchor>("added_to_cart wc-forward").ToBeClickable(); sortDropDown.SelectByText("Sort by price: low to high"); protonMReadMoreButton.Hover(); addToCartFalcon9.Focus(); addToCartFalcon9.Click(); viewCartButton.Click(); TextField couponCodeTextField = App.Components.CreateById <TextField>("coupon_code"); Button applyCouponButton = App.Components.CreateByValueContaining <Button>("Apply coupon"); Div messageAlert = App.Components.CreateByClassContaining <Div>("woocommerce-message"); Anchor proceedToCheckout = App.Components.CreateByClassContaining <Anchor>("checkout-button button alt wc-forward"); couponCodeTextField.SetText("happybirthday"); applyCouponButton.Click(); messageAlert.ToHasContent().ToBeVisible().WaitToBe(); messageAlert.ValidateInnerTextIs("Coupon code applied successfully."); App.Browser.WaitForAjax(); proceedToCheckout.Click(); Heading billingDetailsHeading = App.Components.CreateByInnerTextContaining <Heading>("Billing details"); Anchor showLogin = App.Components.CreateByInnerTextContaining <Anchor>("Click here to login"); TextArea orderCommentsTextArea = App.Components.CreateById <TextArea>("order_comments"); TextField billingFirstName = App.Components.CreateById <TextField>("billing_first_name"); TextField billingLastName = App.Components.CreateById <TextField>("billing_last_name"); TextField billingCompany = App.Components.CreateById <TextField>("billing_company"); Select billingCountry = App.Components.CreateById <Select>("billing_country"); TextField billingAddress1 = App.Components.CreateById <TextField>("billing_address_1"); TextField billingAddress2 = App.Components.CreateById <TextField>("billing_address_2"); TextField billingCity = App.Components.CreateById <TextField>("billing_city"); Select billingState = App.Components.CreateById <Select>("billing_state").ToBeVisible().ToBeClickable(); TextField billingZip = App.Components.CreateById <TextField>("billing_postcode"); Phone billingPhone = App.Components.CreateById <Phone>("billing_phone"); Email billingEmail = App.Components.CreateById <Email>("billing_email"); CheckBox createAccountCheckBox = App.Components.CreateById <CheckBox>("createaccount"); RadioButton checkPaymentsRadioButton = App.Components.CreateByAttributesContaining <RadioButton>("for", "payment_method_cheque"); billingDetailsHeading.ToBeVisible().WaitToBe(); showLogin.ValidateHrefIs("http://demos.bellatrix.solutions/checkout/#"); showLogin.ValidateCssClassIs("showlogin"); orderCommentsTextArea.ScrollToVisible(); orderCommentsTextArea.SetText("Please send the rocket to my door step! And don't use the elevator, they don't like when it is not clean..."); billingFirstName.SetText("In"); billingLastName.SetText("Deepthought"); billingCompany.SetText("Automate The Planet Ltd."); billingCountry.SelectByText("Bulgaria"); billingAddress1.ValidatePlaceholderIs("House number and street name"); billingAddress1.SetText("bul. Yerusalim 5"); billingAddress2.SetText("bul. Yerusalim 6"); billingCity.SetText("Sofia"); billingState.SelectByText("Sofia-Grad"); billingZip.SetText("1000"); billingPhone.SetPhone("+00359894646464"); billingEmail.SetEmail("*****@*****.**"); createAccountCheckBox.Check(); checkPaymentsRadioButton.Click(); ////Assert.Fail("Ops"); }
private void Button_Click(object sender, RoutedEventArgs e) { Label lb = (Label)FindName("alert"); lb.Foreground = Brushes.Red; //select brand ComboBox cb = (ComboBox)FindName("Brand"); if (cb.SelectedItem == null) { lb.Content = "Wybierz markę"; return; } ComboBoxItem cbi = (ComboBoxItem)cb.SelectedItem; Brand brand = (Brand)cbi.Tag; Phone phone = new Phone(); phone.Brand = brand; TextBox modelTB, processorTB, ramTB, memoryTB, graphicTB, descriptionTB, priceTB; //string model, processor, ram, memory, graphic, description; double price; modelTB = (TextBox)FindName("model"); if (String.IsNullOrEmpty(modelTB.Text) || modelTB.Text.Equals("Podaj model")) { lb.Content = "Podaj nazwę modelu"; return; } phone.Model = modelTB.Text; processorTB = (TextBox)FindName("processor"); if (String.IsNullOrEmpty(processorTB.Text) || processorTB.Text.Equals("Podaj procesor")) { lb.Content = "Podaj dane procesora"; return; } phone.Processor = processorTB.Text; ramTB = (TextBox)FindName("ram"); if (String.IsNullOrEmpty(ramTB.Text) || ramTB.Text.Equals("Podaj ram")) { lb.Content = "Podaj dane pamięci ram"; return; } phone.Ram = ramTB.Text; memoryTB = (TextBox)FindName("memory"); if (String.IsNullOrEmpty(memoryTB.Text) || memoryTB.Text.Equals("Podaj pamięć wbudowaną")) { lb.Content = "Podaj ilość pamięci wbudowanej"; return; } phone.Memory = memoryTB.Text; graphicTB = (TextBox)FindName("graphic"); if (graphicTB.Text.Equals("Podaj karte graficzną")) { graphicTB.Text = ""; } phone.Graphic = graphicTB.Text; descriptionTB = (TextBox)FindName("description"); if (String.IsNullOrEmpty(descriptionTB.Text) || descriptionTB.Text.Equals("Podaj opis")) { lb.Content = "Podaj opis urządzenia"; return; } phone.Description = descriptionTB.Text; priceTB = (TextBox)FindName("price"); if (Double.TryParse(priceTB.Text, NumberStyles.Currency, CultureInfo.CreateSpecificCulture("pl-PL"), out price)) { phone.Price = price; lb.Content = phone.Price; } else { lb.Content = "Podaj cenę w formacie zł,gr"; return; } DatePicker premiereDP = (DatePicker)FindName("premiere"); if (string.IsNullOrEmpty(premiereDP.Text) || premiereDP.SelectedDate.Value > DateTime.Now) { lb.Content = "Podaj prawidłową datę premiery"; premiereDP.Focus(); return; } phone.Premiere = premiereDP.SelectedDate.Value; Uri adres = new Uri("http://localhost:2222/Test"); using (var c = new ChannelFactory <IContract>(new BasicHttpBinding(), new EndpointAddress(adres))) { var s = c.CreateChannel(); var results = s.AddPhone(phone); string result; if (results) { lb.Foreground = Brushes.Green; result = "Zapisano telfon!"; } else { result = "Coś poszło nie tak!"; } lb.Content = result; } }
public override void HandelDisconnected(Phone context) { context.SetState(Idle.Instance); }
public override void Bind(Entity entity, Main main, bool creating = false) { Main.Config settings = main.Settings; Transform transform = entity.GetOrCreate <Transform>("Transform"); entity.CannotSuspend = true; PlayerFactory.Instance = entity; this.SetMain(entity, main); FPSInput input = new FPSInput(); input.EnabledWhenPaused = false; entity.Add("Input", input); Updater parkour = entity.Create <Updater>(); Updater jumper = entity.Create <Updater>(); Player player = entity.GetOrCreate <Player>("Player"); AnimatedModel firstPersonModel = entity.GetOrCreate <AnimatedModel>("FirstPersonModel"); firstPersonModel.MapContent = false; firstPersonModel.Serialize = false; firstPersonModel.Filename.Value = "Models\\joan-firstperson"; firstPersonModel.CullBoundingBox.Value = false; AnimatedModel model = entity.GetOrCreate <AnimatedModel>("Model"); model.MapContent = false; model.Serialize = false; model.Filename.Value = "Models\\joan"; model.CullBoundingBox.Value = false; AnimationController anim = entity.GetOrCreate <AnimationController>("AnimationController"); RotationController rotation = entity.GetOrCreate <RotationController>("Rotation"); BlockPredictor predictor = entity.GetOrCreate <BlockPredictor>("BlockPredictor"); Jump jump = entity.GetOrCreate <Jump>("Jump"); RollKickSlide rollKickSlide = entity.GetOrCreate <RollKickSlide>("RollKickSlide"); Vault vault = entity.GetOrCreate <Vault>("Vault"); WallRun wallRun = entity.GetOrCreate <WallRun>("WallRun"); VoxelTools voxelTools = entity.GetOrCreate <VoxelTools>("VoxelTools"); Footsteps footsteps = entity.GetOrCreate <Footsteps>("Footsteps"); FallDamage fallDamage = entity.GetOrCreate <FallDamage>("FallDamage"); FPSCamera fpsCamera = entity.GetOrCreate <FPSCamera>("FPSCamera"); fpsCamera.Enabled.Value = false; Rumble rumble = entity.GetOrCreate <Rumble>("Rumble"); CameraController cameraControl = entity.GetOrCreate <CameraController>("CameraControl"); Property <Vector3> floor = new Property <Vector3>(); transform.Add(new Binding <Vector3>(floor, () => transform.Position + new Vector3(0, player.Character.Height * -0.5f, 0), transform.Position, player.Character.Height)); Sound.AttachTracker(entity, floor); predictor.Add(new Binding <Vector3>(predictor.FootPosition, floor)); predictor.Add(new Binding <Vector3>(predictor.LinearVelocity, player.Character.LinearVelocity)); predictor.Add(new Binding <float>(predictor.Rotation, rotation.Rotation)); predictor.Add(new Binding <float>(predictor.MaxSpeed, player.Character.MaxSpeed)); predictor.Add(new Binding <float>(predictor.JumpSpeed, player.Character.JumpSpeed)); predictor.Add(new Binding <bool>(predictor.IsSupported, player.Character.IsSupported)); jump.Add(new Binding <bool>(jump.Crouched, player.Character.Crouched)); jump.Add(new TwoWayBinding <bool>(player.Character.IsSupported, jump.IsSupported)); jump.Add(new TwoWayBinding <bool>(player.Character.HasTraction, jump.HasTraction)); jump.Add(new TwoWayBinding <Vector3>(player.Character.LinearVelocity, jump.LinearVelocity)); jump.Add(new TwoWayBinding <BEPUphysics.Entities.Entity>(jump.SupportEntity, player.Character.SupportEntity)); jump.Add(new TwoWayBinding <Vector3>(jump.SupportVelocity, player.Character.SupportVelocity)); jump.Add(new Binding <Vector2>(jump.AbsoluteMovementDirection, player.Character.MovementDirection)); jump.Add(new Binding <WallRun.State>(jump.WallRunState, wallRun.CurrentState)); jump.Add(new Binding <float>(jump.Rotation, rotation.Rotation)); jump.Add(new Binding <Vector3>(jump.Position, transform.Position)); jump.Add(new Binding <Vector3>(jump.FloorPosition, floor)); jump.Add(new Binding <float>(jump.MaxSpeed, player.Character.MaxSpeed)); jump.Add(new Binding <float>(jump.JumpSpeed, player.Character.JumpSpeed)); jump.Add(new Binding <float>(jump.Mass, player.Character.Mass)); jump.Add(new Binding <float>(jump.LastRollKickEnded, rollKickSlide.LastRollKickEnded)); jump.Add(new Binding <Voxel>(jump.WallRunMap, wallRun.WallRunVoxel)); jump.Add(new Binding <Direction>(jump.WallDirection, wallRun.WallDirection)); jump.Add(new CommandBinding <Voxel, Voxel.Coord, Direction>(jump.WalkedOn, footsteps.WalkedOn)); jump.Add(new CommandBinding(jump.DeactivateWallRun, (Action)wallRun.Deactivate)); jump.FallDamage = fallDamage; jump.Predictor = predictor; jump.Bind(model); jump.Add(new TwoWayBinding <Voxel>(wallRun.LastWallRunMap, jump.LastWallRunMap)); jump.Add(new TwoWayBinding <Direction>(wallRun.LastWallDirection, jump.LastWallDirection)); jump.Add(new TwoWayBinding <bool>(rollKickSlide.CanKick, jump.CanKick)); jump.Add(new TwoWayBinding <float>(player.Character.LastSupportedSpeed, jump.LastSupportedSpeed)); wallRun.Add(new Binding <bool>(wallRun.IsSwimming, player.Character.IsSwimming)); wallRun.Add(new TwoWayBinding <Vector3>(player.Character.LinearVelocity, wallRun.LinearVelocity)); wallRun.Add(new TwoWayBinding <Vector3>(transform.Position, wallRun.Position)); wallRun.Add(new TwoWayBinding <bool>(player.Character.IsSupported, wallRun.IsSupported)); wallRun.Add(new CommandBinding(wallRun.LockRotation, (Action)rotation.Lock)); wallRun.Add(new CommandBinding <float>(wallRun.UpdateLockedRotation, rotation.UpdateLockedRotation)); vault.Add(new CommandBinding(wallRun.Vault, delegate() { vault.Go(true); })); wallRun.Predictor = predictor; wallRun.Add(new Binding <float>(wallRun.Height, player.Character.Height)); wallRun.Add(new Binding <float>(wallRun.JumpSpeed, player.Character.JumpSpeed)); wallRun.Add(new Binding <float>(wallRun.MaxSpeed, player.Character.MaxSpeed)); wallRun.Add(new TwoWayBinding <float>(rotation.Rotation, wallRun.Rotation)); wallRun.Add(new TwoWayBinding <bool>(player.Character.AllowUncrouch, wallRun.AllowUncrouch)); wallRun.Add(new TwoWayBinding <bool>(player.Character.HasTraction, wallRun.HasTraction)); wallRun.Add(new Binding <float>(wallRun.LastWallJump, jump.LastWallJump)); wallRun.Add(new Binding <float>(player.Character.LastSupportedSpeed, wallRun.LastSupportedSpeed)); player.Add(new Binding <WallRun.State>(player.Character.WallRunState, wallRun.CurrentState)); input.Bind(rollKickSlide.RollKickButton, settings.RollKick); rollKickSlide.Add(new Binding <bool>(rollKickSlide.EnableCrouch, player.EnableCrouch)); rollKickSlide.Add(new Binding <float>(rollKickSlide.Rotation, rotation.Rotation)); rollKickSlide.Add(new Binding <bool>(rollKickSlide.IsSwimming, player.Character.IsSwimming)); rollKickSlide.Add(new Binding <bool>(rollKickSlide.IsSupported, player.Character.IsSupported)); rollKickSlide.Add(new Binding <Vector3>(rollKickSlide.FloorPosition, floor)); rollKickSlide.Add(new Binding <float>(rollKickSlide.Height, player.Character.Height)); rollKickSlide.Add(new Binding <float>(rollKickSlide.MaxSpeed, player.Character.MaxSpeed)); rollKickSlide.Add(new Binding <float>(rollKickSlide.JumpSpeed, player.Character.JumpSpeed)); rollKickSlide.Add(new Binding <Vector3>(rollKickSlide.SupportVelocity, player.Character.SupportVelocity)); rollKickSlide.Add(new TwoWayBinding <bool>(wallRun.EnableEnhancedWallRun, rollKickSlide.EnableEnhancedRollSlide)); rollKickSlide.Add(new TwoWayBinding <bool>(player.Character.AllowUncrouch, rollKickSlide.AllowUncrouch)); rollKickSlide.Add(new TwoWayBinding <bool>(player.Character.Crouched, rollKickSlide.Crouched)); rollKickSlide.Add(new TwoWayBinding <bool>(player.Character.EnableWalking, rollKickSlide.EnableWalking)); rollKickSlide.Add(new TwoWayBinding <Vector3>(player.Character.LinearVelocity, rollKickSlide.LinearVelocity)); rollKickSlide.Add(new TwoWayBinding <Vector3>(transform.Position, rollKickSlide.Position)); rollKickSlide.Predictor = predictor; rollKickSlide.Bind(model); rollKickSlide.VoxelTools = voxelTools; rollKickSlide.Add(new CommandBinding(rollKickSlide.DeactivateWallRun, (Action)wallRun.Deactivate)); rollKickSlide.Add(new CommandBinding(rollKickSlide.Footstep, footsteps.Footstep)); rollKickSlide.Add(new CommandBinding(rollKickSlide.LockRotation, (Action)rotation.Lock)); SoundKiller.Add(entity, AK.EVENTS.STOP_PLAYER_SLIDE_LOOP); vault.Add(new Binding <Vector3>(vault.Position, transform.Position)); vault.Add(new Binding <Vector3>(vault.FloorPosition, floor)); vault.Add(new Binding <float>(vault.MaxSpeed, player.Character.MaxSpeed)); vault.Add(new Binding <WallRun.State>(vault.WallRunState, wallRun.CurrentState)); vault.Add(new CommandBinding(vault.LockRotation, (Action)rotation.Lock)); vault.Add(new CommandBinding(vault.DeactivateWallRun, (Action)wallRun.Deactivate)); vault.Add(new TwoWayBinding <float>(player.Character.LastSupportedSpeed, vault.LastSupportedSpeed)); vault.Add(new CommandBinding <float>(vault.FallDamage, fallDamage.Apply)); vault.Bind(model); vault.Predictor = predictor; vault.Add(new TwoWayBinding <float>(rotation.Rotation, vault.Rotation)); vault.Add(new TwoWayBinding <bool>(player.Character.IsSupported, vault.IsSupported)); vault.Add(new TwoWayBinding <bool>(player.Character.HasTraction, vault.HasTraction)); vault.Add(new TwoWayBinding <Vector3>(player.Character.LinearVelocity, vault.LinearVelocity)); vault.Add(new TwoWayBinding <bool>(player.Character.EnableWalking, vault.EnableWalking)); vault.Add(new TwoWayBinding <bool>(player.Character.AllowUncrouch, vault.AllowUncrouch)); vault.Add(new TwoWayBinding <bool>(player.Character.Crouched, vault.Crouched)); vault.Add(new Binding <float>(vault.Radius, player.Character.Radius)); rotation.Add(new TwoWayBinding <Vector2>(rotation.Mouse, input.Mouse)); rotation.Add(new Binding <bool>(rotation.Rolling, rollKickSlide.Rolling)); rotation.Add(new Binding <bool>(rotation.Kicking, rollKickSlide.Kicking)); rotation.Add(new Binding <Vault.State>(rotation.VaultState, vault.CurrentState)); rotation.Add(new Binding <WallRun.State>(rotation.WallRunState, wallRun.CurrentState)); voxelTools.Add(new Binding <float>(voxelTools.Height, player.Character.Height)); voxelTools.Add(new Binding <float>(voxelTools.SupportHeight, player.Character.SupportHeight)); voxelTools.Add(new Binding <Vector3>(voxelTools.Position, transform.Position)); anim.Add(new Binding <bool>(anim.IsSupported, player.Character.IsSupported)); anim.Add(new Binding <WallRun.State>(anim.WallRunState, wallRun.CurrentState)); anim.Add(new Binding <bool>(anim.EnableWalking, player.Character.EnableWalking)); anim.Add(new Binding <bool>(anim.Crouched, player.Character.Crouched)); anim.Add(new Binding <Vector3>(anim.LinearVelocity, player.Character.LinearVelocity)); anim.Add(new Binding <Vector2>(anim.Movement, input.Movement)); anim.Add(new Binding <Vector2>(anim.Mouse, input.Mouse)); anim.Add(new Binding <float>(anim.Rotation, rotation.Rotation)); anim.Add(new Binding <Voxel>(anim.WallRunMap, wallRun.WallRunVoxel)); anim.Add(new Binding <Direction>(anim.WallDirection, wallRun.WallDirection)); anim.Add(new Binding <bool>(anim.IsSwimming, player.Character.IsSwimming)); anim.Add(new Binding <bool>(anim.Kicking, rollKickSlide.Kicking)); anim.Add(new Binding <Vector3>(anim.SupportVelocity, player.Character.SupportVelocity)); anim.Add ( new Binding <bool> ( anim.EnableLean, () => player.Character.EnableWalking.Value && player.Character.IsSupported.Value && input.Movement.Value.Y > 0.5f, player.Character.EnableWalking, player.Character.IsSupported, input.Movement ) ); anim.Bind(model); // Camera control model.UpdateWorldTransforms(); cameraControl.Add(new Binding <Vector2>(cameraControl.Mouse, input.Mouse)); cameraControl.Add(new Binding <float>(cameraControl.Lean, x => x * (float)Math.PI * 0.05f, anim.Lean)); cameraControl.Add(new Binding <Vector3>(cameraControl.LinearVelocity, player.Character.LinearVelocity)); cameraControl.Add(new Binding <float>(cameraControl.MaxSpeed, player.Character.MaxSpeed)); cameraControl.Add(new Binding <Matrix>(cameraControl.CameraBone, model.GetBoneTransform("Camera"))); cameraControl.Add(new Binding <Matrix>(cameraControl.HeadBone, model.GetBoneTransform("ORG-head"))); cameraControl.Add(new Binding <Matrix>(cameraControl.ModelTransform, model.Transform)); cameraControl.Add(new Binding <float>(cameraControl.BaseCameraShakeAmount, () => MathHelper.Clamp((player.Character.LinearVelocity.Value.Length() - (player.Character.MaxSpeed * 2.5f)) / (player.Character.MaxSpeed * 4.0f), 0, 1), player.Character.LinearVelocity, player.Character.MaxSpeed)); cameraControl.Offset = model.GetBoneTransform("Camera").Value.Translation - model.GetBoneTransform("ORG-head").Value.Translation; float heightOffset = 0.1f; #if VR if (main.VR) { heightOffset = 0.4f; } #endif cameraControl.Offset += new Vector3(0, heightOffset, 0); rumble.Add(new Binding <float>(rumble.CameraShake, cameraControl.TotalCameraShake)); rumble.Add(new CommandBinding <float>(fallDamage.Rumble, rumble.Go)); rumble.Add(new CommandBinding <float>(player.Rumble, rumble.Go)); rumble.Add(new CommandBinding <float>(rollKickSlide.Rumble, rumble.Go)); firstPersonModel.Add(new Binding <bool>(firstPersonModel.Enabled, x => !x, cameraControl.ThirdPerson)); model.Add(new ChangeBinding <bool>(cameraControl.ThirdPerson, delegate(bool old, bool value) { if (value && !old) { model.UnsupportedTechniques.Remove(Technique.Clip); model.UnsupportedTechniques.Remove(Technique.Render); } else if (old && !value) { model.UnsupportedTechniques.Add(Technique.Clip); model.UnsupportedTechniques.Add(Technique.Render); } })); Lemma.Console.Console.AddConCommand(new Console.ConCommand("third_person", "Toggle third-person view (warning: janky)", delegate(Console.ConCommand.ArgCollection args) { cameraControl.ThirdPerson.Value = !cameraControl.ThirdPerson; })); Lemma.Console.Console.AddConCommand(new Console.ConCommand("velocity", "Toggle debug velocity display", delegate(Console.ConCommand.ArgCollection args) { PlayerData data = PlayerDataFactory.Instance.Get <PlayerData>(); data.DebugVelocity.Value = !data.DebugVelocity.Value; })); entity.Add(new CommandBinding(entity.Delete, delegate() { Lemma.Console.Console.RemoveConCommand("third_person"); Lemma.Console.Console.RemoveConCommand("velocity"); })); // When rotation is locked, we want to make sure the player can't turn their head // 180 degrees from the direction they're facing #if VR if (main.VR) { input.MaxY.Value = input.MinY.Value = 0; } else #endif input.Add(new Binding <float>(input.MaxY, () => rotation.Locked ? (float)Math.PI * 0.3f : (float)Math.PI * 0.4f, rotation.Locked)); input.Add(new Binding <float>(input.MinX, () => rotation.Locked ? rotation.Rotation + ((float)Math.PI * -0.4f) : 0.0f, rotation.Rotation, rotation.Locked)); input.Add(new Binding <float>(input.MaxX, () => rotation.Locked ? rotation.Rotation + ((float)Math.PI * 0.4f) : 0.0f, rotation.Rotation, rotation.Locked)); input.Add(new NotifyBinding(delegate() { input.Mouse.Changed(); }, rotation.Locked)); // Make sure the rotation locking takes effect even if the player doesn't move the mouse // Setup rendering properties model.Materials = firstPersonModel.Materials = new Model.Material[3]; // Hoodie and shoes model.Materials[0] = new Model.Material { SpecularIntensity = 0.0f, SpecularPower = 1.0f, }; // Hands model.Materials[1] = new Model.Material { SpecularIntensity = 0.3f, SpecularPower = 2.0f, }; // Pants and skin model.Materials[2] = new Model.Material { SpecularIntensity = 0.5f, SpecularPower = 20.0f, }; firstPersonModel.Bind(model); // Third person model only gets rendered for shadows. No regular rendering or reflections. model.UnsupportedTechniques.Add(Technique.Clip); model.UnsupportedTechniques.Add(Technique.Render); // First-person model only used for regular rendering. No shadows or reflections. firstPersonModel.UnsupportedTechniques.Add(Technique.Shadow); firstPersonModel.UnsupportedTechniques.Add(Technique.Clip); // Build UI UIRenderer ui = new UIRenderer(); ui.DrawOrder.Value = -1; ui.EnabledWhenPaused = true; ui.EnabledInEditMode = false; entity.Add("UI", ui); input.Add(new Binding <float>(input.MouseSensitivity, settings.MouseSensitivity)); input.Add(new Binding <bool>(input.InvertMouseX, settings.InvertMouseX)); input.Add(new Binding <bool>(input.InvertMouseY, settings.InvertMouseY)); input.Add(new Binding <PCInput.PCInputBinding>(input.LeftKey, settings.Left)); input.Add(new Binding <PCInput.PCInputBinding>(input.RightKey, settings.Right)); input.Add(new Binding <PCInput.PCInputBinding>(input.BackwardKey, settings.Backward)); input.Add(new Binding <PCInput.PCInputBinding>(input.ForwardKey, settings.Forward)); model.StartClip("Idle", 0, true, AnimatedModel.DefaultBlendTime); // Set up AI agent Agent agent = entity.GetOrCreate <Agent>(); agent.Add(new TwoWayBinding <float>(player.Health, agent.Health)); agent.Add(new Binding <Vector3>(agent.Position, () => transform.Position.Value + new Vector3(0, player.Character.Height * -0.5f, 0), transform.Position, player.Character.Height)); agent.Add(new Binding <bool>(agent.Loud, () => player.Character.MovementDirection.Value.LengthSquared() > 0 && !player.Character.Crouched, player.Character.Crouched)); // Blocks BlockCloud blockCloud = entity.GetOrCreate <BlockCloud>("BlockCloud"); blockCloud.Scale.Value = 0.5f; blockCloud.Add(new Binding <Vector3>(blockCloud.Position, () => transform.Position.Value + new Vector3(0, player.Character.Height * 0.5f + player.Character.LinearVelocity.Value.Y, 0), transform.Position, player.Character.Height, player.Character.LinearVelocity)); blockCloud.Blocks.ItemAdded += delegate(int index, Entity.Handle block) { Entity e = block.Target; if (e != null) { e.Serialize = false; PhysicsBlock.CancelPlayerCollisions(e.Get <PhysicsBlock>()); } }; predictor.Add(new Binding <Voxel.t>(predictor.BlockType, blockCloud.Type)); PointLight blockLight = entity.Create <PointLight>(); blockLight.Add(new Binding <Vector3>(blockLight.Position, blockCloud.AveragePosition)); blockLight.Add(new Binding <bool, int>(blockLight.Enabled, x => x > 0, blockCloud.Blocks.Length)); blockLight.Attenuation.Value = 30.0f; blockLight.Add(new Binding <Vector3, Voxel.t>(blockLight.Color, delegate(Voxel.t t) { switch (t) { case Voxel.t.GlowBlue: return(new Vector3(0.7f, 0.7f, 0.9f)); case Voxel.t.GlowYellow: return(new Vector3(0.9f, 0.9f, 0.7f)); default: return(new Vector3(0.8f, 0.8f, 0.8f)); } }, blockCloud.Type)); blockLight.Add(new ChangeBinding <bool>(blockLight.Enabled, delegate(bool old, bool value) { if (!old && value) { AkSoundEngine.PostEvent(AK.EVENTS.PLAY_MAGIC_CUBE_LOOP, entity); } else if (old && !value) { AkSoundEngine.PostEvent(AK.EVENTS.STOP_MAGIC_CUBE_LOOP, entity); } })); if (blockLight.Enabled) { AkSoundEngine.PostEvent(AK.EVENTS.PLAY_MAGIC_CUBE_LOOP, entity); } // Death entity.Add(new CommandBinding(player.Die, blockCloud.Clear)); entity.Add(new CommandBinding(player.Die, delegate() { Session.Recorder.Event(main, "Die"); if (agent.Killed || Agent.Query(transform.Position, 0.0f, 10.0f, x => x != agent) != null) { Session.Recorder.Event(main, "Killed"); AkSoundEngine.PostEvent(AK.EVENTS.PLAY_PLAYER_DEATH, entity); main.Spawner.RespawnDistance = Spawner.KilledRespawnDistance; main.Spawner.RespawnInterval = Spawner.KilledRespawnInterval; } else { main.Spawner.RespawnDistance = Spawner.DefaultRespawnDistance; main.Spawner.RespawnInterval = Spawner.DefaultRespawnInterval; } entity.Add(new Animation(new Animation.Execute(entity.Delete))); })); player.EnabledInEditMode = false; player.Add(new TwoWayBinding <Matrix>(transform.Matrix, player.Character.Transform)); model.Add(new Binding <Matrix>(model.Transform, delegate() { const float leanAmount = (float)Math.PI * 0.1f; return(Matrix.CreateTranslation(0, (player.Character.Height * -0.5f) - player.Character.SupportHeight, 0) * Matrix.CreateRotationZ(anim.Lean * leanAmount) * Matrix.CreateRotationY(rotation.Rotation) * transform.Matrix); }, transform.Matrix, rotation.Rotation, player.Character.Height, player.Character.SupportHeight, anim.Lean)); firstPersonModel.Add(new Binding <Matrix>(firstPersonModel.Transform, model.Transform)); firstPersonModel.Add(new Binding <Vector3>(firstPersonModel.Scale, model.Scale)); WallRun.State[] footstepWallrunStates = new[] { WallRun.State.Left, WallRun.State.Right, WallRun.State.Straight, WallRun.State.None, }; footsteps.Add(new Binding <bool>(footsteps.SoundEnabled, () => !player.Character.Crouched && footstepWallrunStates.Contains(wallRun.CurrentState) || (player.Character.IsSupported && player.Character.EnableWalking), player.Character.IsSupported, player.Character.EnableWalking, wallRun.CurrentState, player.Character.Crouched)); footsteps.Add(new Binding <Vector3>(footsteps.Position, transform.Position)); footsteps.Add(new Binding <float>(footsteps.Rotation, rotation.Rotation)); footsteps.Add(new Binding <float>(footsteps.CharacterHeight, player.Character.Height)); footsteps.Add(new Binding <float>(footsteps.SupportHeight, player.Character.SupportHeight)); footsteps.Add(new Binding <bool>(footsteps.IsSupported, player.Character.IsSupported)); footsteps.Add(new Binding <bool>(footsteps.IsSwimming, player.Character.IsSwimming)); footsteps.Add(new CommandBinding <float>(footsteps.Damage, agent.Damage)); footsteps.Add(new CommandBinding <Voxel, Voxel.Coord, Direction>(wallRun.WalkedOn, footsteps.WalkedOn)); model.Trigger("Run", 0.16f, footsteps.Footstep); model.Trigger("Run", 0.58f, footsteps.Footstep); model.Trigger("WallRunLeft", 0.16f, footsteps.Footstep); model.Trigger("WallRunLeft", 0.58f, footsteps.Footstep); model.Trigger("WallRunRight", 0.16f, footsteps.Footstep); model.Trigger("WallRunRight", 0.58f, footsteps.Footstep); model.Trigger("WallRunStraight", 0.16f, footsteps.Footstep); model.Trigger("WallRunStraight", 0.58f, footsteps.Footstep); model.Trigger("TurnLeft", 0.15f, footsteps.Footstep); model.Trigger("TurnRight", 0.15f, footsteps.Footstep); model.Trigger("TopOut", 1.0f, new Command { Action = delegate() { AkSoundEngine.PostEvent(AK.EVENTS.PLAY_PLAYER_GRUNT, entity); } }); main.UI.IsMouseVisible.Value = false; SkinnedModel.Clip sprintAnimation = model["Sprint"], runAnimation = model["Run"]; // Movement binding player.Add(new Binding <Vector2>(player.Character.MovementDirection, delegate() { Vector2 movement = input.Movement; if (movement.LengthSquared() == 0.0f) { return(Vector2.Zero); } Matrix matrix = Matrix.CreateRotationY(rotation.Rotation); Vector2 forwardDir = new Vector2(matrix.Forward.X, matrix.Forward.Z); Vector2 rightDir = new Vector2(matrix.Right.X, matrix.Right.Z); return(-(forwardDir * movement.Y) - (rightDir * movement.X)); }, input.Movement, rotation.Rotation)); player.Character.Crouched.Value = true; player.Character.AllowUncrouch.Value = true; // Fall damage fallDamage.Add(new Binding <bool>(fallDamage.IsSupported, player.Character.IsSupported)); fallDamage.Add(new TwoWayBinding <Vector3>(player.Character.LinearVelocity, fallDamage.LinearVelocity)); fallDamage.Add(new TwoWayBinding <float>(player.Health, fallDamage.Health)); fallDamage.Add(new CommandBinding <BEPUphysics.BroadPhaseEntries.Collidable, ContactCollection>(player.Character.Collided, fallDamage.Collided)); fallDamage.Add(new TwoWayBinding <bool>(player.Character.EnableWalking, fallDamage.EnableWalking)); fallDamage.Add(new TwoWayBinding <bool>(player.TemporaryEnableMoves, fallDamage.EnableMoves)); fallDamage.Add(new TwoWayBinding <bool>(fallDamage.Landing, rotation.Landing)); fallDamage.Add(new CommandBinding(fallDamage.LockRotation, (Action)rotation.Lock)); fallDamage.Add(new CommandBinding <float>(fallDamage.PhysicsDamage, agent.Damage)); fallDamage.Bind(model); // Swim up input.Bind(player.Character.SwimUp, settings.Jump); float parkourTime = 0; float jumpTime = 0; jumper.Action = delegate(float dt) { if (player.PermanentEnableMoves && player.TemporaryEnableMoves && player.Character.EnableWalking && vault.CurrentState.Value == Vault.State.None && !rollKickSlide.Rolling && !rollKickSlide.Kicking && jumpTime < Player.SlowmoTime) { if (jump.Go()) { parkour.Enabled.Value = false; jumper.Enabled.Value = false; } jumpTime += dt; } else { jumper.Enabled.Value = false; } }; jumper.Add(new CommandBinding(jumper.Enable, delegate() { jumpTime = 0; })); jumper.Enabled.Value = false; entity.Add(jumper); // Jumping input.Bind(settings.Jump, PCInput.InputState.Down, delegate() { jumper.Enabled.Value = true; }); input.Bind(settings.Jump, PCInput.InputState.Up, delegate() { jumper.Enabled.Value = false; }); // Wall-run, vault, predictive parkour.Action = delegate(float dt) { if (player.PermanentEnableMoves && player.TemporaryEnableMoves && player.Character.EnableWalking && !(player.Character.Crouched && player.Character.IsSupported) && vault.CurrentState.Value == Vault.State.None && !rollKickSlide.Kicking && !rollKickSlide.Rolling && wallRun.CurrentState.Value == WallRun.State.None && parkourTime < Player.SlowmoTime) { bool didSomething = false; bool parkourBeganThisFrame = parkourTime == 0; if (predictor.PossibilityCount > 0) { // In slow motion, prefer left and right wall-running if (!(didSomething = wallRun.Activate(WallRun.State.Left, parkourBeganThisFrame))) { if (!(didSomething = wallRun.Activate(WallRun.State.Right, parkourBeganThisFrame))) { if (!(didSomething = vault.Go(parkourBeganThisFrame))) { didSomething = wallRun.Activate(WallRun.State.Straight, parkourBeganThisFrame); } } } } else { // In normal mode, prefer straight wall-running if (!(didSomething = vault.Go(parkourBeganThisFrame))) { if (!(didSomething = wallRun.Activate(WallRun.State.Straight, parkourBeganThisFrame))) { if (!(didSomething = wallRun.Activate(WallRun.State.Left, parkourBeganThisFrame))) { didSomething = wallRun.Activate(WallRun.State.Right, parkourBeganThisFrame); } } } } if (didSomething) { jumper.Enabled.Value = false; player.SlowMotion.Value = false; parkour.Enabled.Value = false; } else if (parkourBeganThisFrame && player.Character.LinearVelocity.Value.Y > FallDamage.RollingDeathVelocity) { if (blockCloud.Blocks.Length > 0) { player.SlowMotion.Value = true; predictor.ClearPossibilities(); predictor.PredictPlatforms(); predictor.PredictWalls(); } else if (player.EnableSlowMotion) { player.SlowMotion.Value = true; } } parkourTime += dt; } else { parkour.Enabled.Value = false; } }; parkour.Add(new CommandBinding(parkour.Enable, delegate() { parkourTime = 0; })); entity.Add(parkour); parkour.Enabled.Value = false; input.Bind(settings.Parkour, PCInput.InputState.Down, delegate() { parkour.Enabled.Value = true; }); input.Bind(settings.Parkour, PCInput.InputState.Up, delegate() { parkour.Enabled.Value = false; wallRun.Deactivate(); if (player.SlowMotion) { player.SlowMotion.Value = false; } }); input.Bind(settings.RollKick, PCInput.InputState.Down, delegate() { if (player.PermanentEnableMoves && player.TemporaryEnableMoves && player.Character.EnableWalking) { rollKickSlide.Go(); parkour.Enabled.Value = false; jumper.Enabled.Value = false; } }); input.Bind(settings.RollKick, PCInput.InputState.Up, delegate() { if (!rollKickSlide.Rolling && !rollKickSlide.Kicking) { player.Character.AllowUncrouch.Value = true; } }); // Player data bindings entity.Add(new PostInitialization(delegate() { Entity dataEntity = PlayerDataFactory.Instance; PlayerData playerData = dataEntity.Get <PlayerData>(); // HACK. Overwriting the property rather than binding the two together. Oh well. // This is because I haven't written a two-way list binding. footsteps.RespawnLocations = playerData.RespawnLocations; // Bind player data properties entity.Add(new TwoWayBinding <float>(WorldFactory.Instance.Get <World>().CameraShakeAmount, cameraControl.CameraShakeAmount)); entity.Add(new TwoWayBinding <bool>(playerData.EnableRoll, rollKickSlide.EnableRoll)); entity.Add(new TwoWayBinding <bool>(playerData.EnableCrouch, player.EnableCrouch)); entity.Add(new TwoWayBinding <bool>(playerData.EnableKick, rollKickSlide.EnableKick)); entity.Add(new TwoWayBinding <bool>(playerData.EnableWallRun, wallRun.EnableWallRun)); entity.Add(new TwoWayBinding <bool>(playerData.EnableWallRunHorizontal, wallRun.EnableWallRunHorizontal)); entity.Add(new TwoWayBinding <bool>(playerData.EnableEnhancedWallRun, wallRun.EnableEnhancedWallRun)); entity.Add(new TwoWayBinding <bool>(playerData.EnableMoves, player.PermanentEnableMoves)); entity.Add(new TwoWayBinding <float>(playerData.MaxSpeed, player.Character.MaxSpeed)); entity.Add(new Binding <bool>(fallDamage.PhoneOrNoteActive, () => playerData.PhoneActive || playerData.NoteActive, playerData.PhoneActive, playerData.NoteActive)); if (playerData.CloudType.Value == Voxel.t.Empty) // This makes everything work if we spawn next to a power block socket { entity.Add(new TwoWayBinding <Voxel.t>(blockCloud.Type, playerData.CloudType)); } else { entity.Add(new TwoWayBinding <Voxel.t>(playerData.CloudType, blockCloud.Type)); } entity.Add(new TwoWayBinding <bool>(playerData.ThirdPerson, cameraControl.ThirdPerson)); entity.Add(new TwoWayBinding <bool>(playerData.EnableSlowMotion, player.EnableSlowMotion)); Phone phone = dataEntity.GetOrCreate <Phone>("Phone"); entity.Add ( new Binding <bool> ( phone.CanReceiveMessages, () => player.Character.IsSupported && !player.Character.IsSwimming && !player.Character.Crouched, player.Character.IsSupported, player.Character.IsSwimming, player.Character.Crouched ) ); PhoneNote.Attach(main, entity, player, model, input, phone, player.Character.EnableWalking, playerData.PhoneActive, playerData.NoteActive); PlayerUI.Attach(main, entity, ui, player.Health, rotation.Rotation, playerData.NoteActive, playerData.PhoneActive, player.Character.LinearVelocity, playerData.DebugVelocity); })); fpsCamera.Add(new Binding <Vector2>(fpsCamera.Mouse, input.Mouse)); fpsCamera.Add(new Binding <Vector2>(fpsCamera.Movement, input.Movement)); input.Bind(fpsCamera.SpeedMode, settings.Parkour); input.Bind(fpsCamera.Up, settings.Jump); fpsCamera.Add(new Binding <bool>(fpsCamera.Down, input.GetKey(Keys.LeftControl))); Lemma.Console.Console.AddConCommand(new ConCommand("noclip", "Toggle free camera mode", delegate(ConCommand.ArgCollection args) { bool freeCameraMode = !fpsCamera.Enabled; fpsCamera.Enabled.Value = freeCameraMode; cameraControl.Enabled.Value = !freeCameraMode; firstPersonModel.Enabled.Value = !freeCameraMode; model.Enabled.Value = !freeCameraMode; ui.Enabled.Value = !freeCameraMode; player.Character.EnableWalking.Value = !freeCameraMode; player.TemporaryEnableMoves.Value = !freeCameraMode; player.Character.Body.IsAffectedByGravity = !freeCameraMode; if (freeCameraMode) { AkSoundEngine.PostEvent(AK.EVENTS.STOP_PLAYER_BREATHING_SOFT, entity); } else { transform.Position.Value = main.Camera.Position; } })); entity.Add(new CommandBinding(entity.Delete, delegate() { Lemma.Console.Console.RemoveConCommand("noclip"); if (fpsCamera.Enabled) // Movement is disabled. Re-enable it. { player.Character.EnableWalking.Value = true; player.TemporaryEnableMoves.Value = true; } PlayerFactory.Instance = null; })); }
public static string logOut(string user, Phone device, Host host) { return(execute(ReqType.logout, user, device, host)); }
public void Should_validate_input_correctly_with_number_of_9_digits() { var phone = new Phone(_valid_ddd, _valid_number2); Assert.True(phone.Valid); }
public static bool isLoggedIn(string user, Phone device, Host host) { return(execute(ReqType.checklogin, user, device, host).Contains(device.ID)); }
public void StartUp() { this.phone = new Phone("HUA", "5s"); }
private List <SingleStone.ContactModel> GetTestContacts() { //create the list to hold the test contacts var testContacts = new List <ContactModel>(); //create the test contacts and add them to the list Phone newPhone = new Phone { number = "6018261234", type = "home" }; ContactModel newContact = new ContactModel { id = 1, address = new Address { city = "Hattiesburg", state = "Mississippi", street = "123 foot road", zip = "39208" }, email = "*****@*****.**", name = new Name { first = "Bob", middle = "Andy", last = "hungry" }, phone = new List <Phone>(), }; newContact.phone.Add(newPhone); testContacts.Add(newContact); newContact = new ContactModel { id = 2, address = new Address { city = "Brandon", state = "Mississippi", street = "123 3333 road", zip = "39207" }, email = "*****@*****.**", name = new Name { first = "terry", middle = "the", last = "crews" }, phone = new List <Phone>(), }; newPhone = new Phone(); newPhone.type = "mobile"; newPhone.number = "6019876541"; newContact.phone.Add(newPhone); newPhone = new Phone(); newPhone.type = "work"; newPhone.number = "6018527412"; newContact.phone.Add(newPhone); newPhone = new Phone(); newPhone.type = "home"; newPhone.number = "6019638523"; newContact.phone.Add(newPhone); testContacts.Add(newContact); newContact = new ContactModel { id = 3, address = new Address { city = "Pearl", state = "Mississippi", street = "67 street", zip = "39201" }, email = "*****@*****.**", name = new Name { first = "Bob", middle = "Bobber", last = "Bobbest" }, phone = new List <Phone>(), }; newPhone = new Phone(); newPhone.type = "home"; newPhone.number = "6017418965"; newContact.phone.Add(newPhone); testContacts.Add(newContact); newContact = new ContactModel { id = 4, address = new Address { city = "jackson", state = "Mississippi", street = "12 front street", zip = "39201" }, email = "*****@*****.**", name = new Name { first = "Andy", middle = "Nitro", last = "Cortez" }, phone = new List <Phone>(), }; newPhone = new Phone(); newPhone.type = "mobile"; newPhone.number = "6018749654"; newContact.phone.Add(newPhone); newPhone = new Phone(); newPhone.type = "mobile"; newPhone.number = "6019867412"; newContact.phone.Add(newPhone); testContacts.Add(newContact); return(testContacts); }
public IActionResult Edit(Phone phone) { db.Phones.Update(phone); db.SaveChanges(); return(RedirectToAction("Index")); }
///<summary>Updates one Phone in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> internal static void Update(Phone phone, Phone oldPhone) { string command = ""; if (phone.Extension != oldPhone.Extension) { if (command != "") { command += ","; } command += "Extension = " + POut.Int(phone.Extension) + ""; } if (phone.EmployeeName != oldPhone.EmployeeName) { if (command != "") { command += ","; } command += "EmployeeName = '" + POut.String(phone.EmployeeName) + "'"; } if (phone.ClockStatus != oldPhone.ClockStatus) { if (command != "") { command += ","; } command += "ClockStatus = " + POut.String(phone.ClockStatus.ToString()) + ""; } if (phone.Description != oldPhone.Description) { if (command != "") { command += ","; } command += "Description = '" + POut.String(phone.Description) + "'"; } if (phone.ColorBar != oldPhone.ColorBar) { if (command != "") { command += ","; } command += "ColorBar = " + POut.Int(phone.ColorBar.ToArgb()) + ""; } if (phone.ColorText != oldPhone.ColorText) { if (command != "") { command += ","; } command += "ColorText = " + POut.Int(phone.ColorText.ToArgb()) + ""; } if (phone.EmployeeNum != oldPhone.EmployeeNum) { if (command != "") { command += ","; } command += "EmployeeNum = " + POut.Long(phone.EmployeeNum) + ""; } if (phone.CustomerNumber != oldPhone.CustomerNumber) { if (command != "") { command += ","; } command += "CustomerNumber = '" + POut.String(phone.CustomerNumber) + "'"; } if (phone.InOrOut != oldPhone.InOrOut) { if (command != "") { command += ","; } command += "InOrOut = '" + POut.String(phone.InOrOut) + "'"; } if (phone.PatNum != oldPhone.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(phone.PatNum) + ""; } if (phone.DateTimeStart != oldPhone.DateTimeStart) { if (command != "") { command += ","; } command += "DateTimeStart = " + POut.DateT(phone.DateTimeStart) + ""; } if (phone.WebCamImage != oldPhone.WebCamImage) { if (command != "") { command += ","; } command += "WebCamImage = '" + POut.String(phone.WebCamImage) + "'"; } if (phone.ScreenshotPath != oldPhone.ScreenshotPath) { if (command != "") { command += ","; } command += "ScreenshotPath = '" + POut.String(phone.ScreenshotPath) + "'"; } if (phone.ScreenshotImage != oldPhone.ScreenshotImage) { if (command != "") { command += ","; } command += "ScreenshotImage = '" + POut.String(phone.ScreenshotImage) + "'"; } if (command == "") { return; } command = "UPDATE phone SET " + command + " WHERE PhoneNum = " + POut.Long(phone.PhoneNum); Db.NonQ(command); }
public ShipRequestModel PopulateRequestData(CustomSettings customSettings, AddRmaResult result, IUnitOfWork unitOfWork) { // UPS Security UsernameToken usernameToken = new UsernameToken(); usernameToken.Username = customSettings.UPSSecurity_UserToken_Username; usernameToken.Password = customSettings.UPSSecurity_UserToken_Password; ServiceAccessToken serviceAccessToken = new ServiceAccessToken(); serviceAccessToken.AccessLicenseNumber = customSettings.UPSSecurity_ServiceAccessToken_AccessLicenseNumber; UPSSecurity UPSSecurity = new UPSSecurity(); UPSSecurity.UsernameToken = usernameToken; UPSSecurity.ServiceAccessToken = serviceAccessToken; // UPS Security -END // Request Object TransactionReference transactionReference = new TransactionReference(); transactionReference.CustomerContext = result.OrderHistory.ErpOrderNumber; Request request = new Request(); request.RequestOption = "nonvalidate"; request.TransactionReference = transactionReference; // Request Object -END // Shipper Object Shipper shipper = new Shipper(); shipper.Name = string.IsNullOrEmpty(result.OrderHistory.STCompanyName) ? result.OrderHistory.BTCompanyName : result.OrderHistory.STCompanyName; shipper.ShipperNumber = customSettings.Shipper_ShipperNumber; Address shipToAddress = new Address(); shipToAddress.AddressLine = string.IsNullOrEmpty(result.OrderHistory.STAddress1) ? result.OrderHistory.BTAddress1 : result.OrderHistory.STAddress1; shipToAddress.City = string.IsNullOrEmpty(result.OrderHistory.STCity) ? result.OrderHistory.BTCity : result.OrderHistory.STCity; shipToAddress.StateProvinceCode = GetStateCode(result.OrderHistory, unitOfWork); shipToAddress.PostalCode = string.IsNullOrEmpty(result.OrderHistory.STPostalCode) ? result.OrderHistory.BTPostalCode : result.OrderHistory.STPostalCode; var country = result.OrderHistory.CustomerNumber.ElementAt(0) == '1' ? "US": "CA"; shipToAddress.CountryCode = country; shipper.Address = shipToAddress; // Shipper Object - END // Website address same for both US and CA Ship shipTo = new Ship(); shipTo.Name = "Brasseler USA"; shipTo.AttentionName = "RETURNS DEPT"; Phone shipTophone = new Phone(); shipTophone.Number = "9129258525"; shipTo.Phone = shipTophone; Address websiteAddress = new Address(); websiteAddress.AddressLine = "1 Brasseler Blvd"; websiteAddress.City = "Savannah"; websiteAddress.StateProvinceCode = "GA"; websiteAddress.PostalCode = "31419"; websiteAddress.CountryCode = "US"; shipTo.Address = websiteAddress; // Website address same for both US and CA - END // Ship From Addresses Ship shipFrom = new Ship(); shipFrom.Name = string.IsNullOrEmpty(result.OrderHistory.STCompanyName) ? result.OrderHistory.BTCompanyName : result.OrderHistory.STCompanyName; Phone shipFromphone = new Phone(); shipFromphone.Number = "9129258525"; shipFrom.Phone = shipFromphone; Address shipFromAddress = new Address(); shipFromAddress.AddressLine = string.IsNullOrEmpty(result.OrderHistory.STAddress1) ? result.OrderHistory.BTAddress1 : result.OrderHistory.STAddress1; shipFromAddress.City = string.IsNullOrEmpty(result.OrderHistory.STCity) ? result.OrderHistory.BTCity : result.OrderHistory.STCity; shipFromAddress.StateProvinceCode = GetStateCode(result.OrderHistory, unitOfWork); shipFromAddress.PostalCode = string.IsNullOrEmpty(result.OrderHistory.STPostalCode) ? result.OrderHistory.BTPostalCode : result.OrderHistory.STPostalCode; shipFromAddress.CountryCode = country; shipFrom.Address = shipFromAddress; // Ship From Addresses - END // Payment Information BillShipper billShipper = new BillShipper(); billShipper.AccountNumber = customSettings.PaymentInformation_ShipmentCharge_AccountNumber; ShipmentCharge shipmentCharge = new ShipmentCharge(); shipmentCharge.Type = "01"; shipmentCharge.BillShipper = billShipper; PaymentInformation paymentInformation = new PaymentInformation(); paymentInformation.ShipmentCharge = shipmentCharge; // Payment Information - END // Service Object LabelImageFormat service = new LabelImageFormat(); service.Code = "03"; service.Description = "Ground"; // Service Object - END // Return Service Object LabelImageFormat retrunService = new LabelImageFormat(); retrunService.Code = "9"; retrunService.Description = "Print Return Label"; // Return Service Object - END // Package Object Package package = new Package(); List <ReferenceNumber> referenceNumber = new List <ReferenceNumber>(); ReferenceNumber erpReferenceNumber = new ReferenceNumber(); erpReferenceNumber.Code = "01"; erpReferenceNumber.Value = "Customer #: " + (string.IsNullOrEmpty(result.OrderHistory.CustomerSequence) ? result.OrderHistory.CustomerNumber : result.OrderHistory.CustomerSequence); referenceNumber.Add(erpReferenceNumber); ReferenceNumber invoiceRefNumber = new ReferenceNumber(); invoiceRefNumber.Code = "02"; invoiceRefNumber.Value = "Invoice #: " + GetInvoiceNumber(result.OrderHistory.ErpOrderNumber, unitOfWork); referenceNumber.Add(invoiceRefNumber); LabelImageFormat packaging = new LabelImageFormat(); packaging.Code = "02"; packaging.Description = "Description"; LabelImageFormat unitOfMeasurement = new LabelImageFormat(); unitOfMeasurement.Code = "LBS"; unitOfMeasurement.Description = "Pounds"; PackageWeight packageWeight = new PackageWeight(); packageWeight.UnitOfMeasurement = unitOfMeasurement; packageWeight.Weight = "1"; package.ReferenceNumber = referenceNumber; package.Description = "Dental instruments/equipment"; package.Packaging = packaging; package.PackageWeight = packageWeight; // Package Object - END // Shipment Object Shipment shipment = new Shipment(); shipment.Description = "Return Label"; shipment.Shipper = shipper; shipment.ShipTo = shipTo; shipment.ShipFrom = shipFrom; shipment.PaymentInformation = paymentInformation; shipment.Service = service; shipment.ReturnService = retrunService; shipment.Package = package; // Shipment Object - END // Label Specification LabelImageFormat labelImageFormat = new LabelImageFormat(); labelImageFormat.Code = "GIF"; labelImageFormat.Description = "GIF"; LabelSpecification labelSpecification = new LabelSpecification(); labelSpecification.LabelImageFormat = labelImageFormat; labelSpecification.HttpUserAgent = "Mozilla/4.5"; // Label Specification - END // Shipment Request ShipmentRequest shipmentRequest = new ShipmentRequest(); shipmentRequest.Request = request; shipmentRequest.Shipment = shipment; shipmentRequest.LabelSpecification = labelSpecification; // Shipment Request - END // RMA Model ShipRequestModel shipRequestModel = new ShipRequestModel(); shipRequestModel.UPSSecurity = UPSSecurity; shipRequestModel.ShipmentRequest = shipmentRequest; // RMA Model - END return(shipRequestModel); }
private IEnumerable <PromosetDuplicateInfoNode> GetPhonesResult(IUnitOfWork uow, IEnumerable <Phone> phones) { Domain.Orders.Order orderAlias = null; Domain.Orders.OrderItem orderItemAlias = null; Counterparty counterpartyAlias = null; DeliveryPoint deliveryPointAlias = null; Phone counterpartyPhoneAlias = null; Phone deliveryPointPhoneAlias = null; PromosetDuplicateInfoNode resultAlias = null; var phonesArray = phones.Select(x => x.DigitsNumber).ToArray(); var nullProjection = Projections.SqlFunction( new SQLFunctionTemplate(NHibernateUtil.String, "NULLIF(1,1)"), NHibernateUtil.String ); var counterpartyPhoneProjection = Projections.Conditional( Restrictions.In(Projections.Property(() => counterpartyPhoneAlias.DigitsNumber), phonesArray), Projections.Property(() => counterpartyPhoneAlias.DigitsNumber), nullProjection ); var deliveryPointPhoneProjection = Projections.Conditional( Restrictions.In(Projections.Property(() => deliveryPointPhoneAlias.DigitsNumber), phonesArray), Projections.Property(() => deliveryPointPhoneAlias.DigitsNumber), nullProjection ); var counterpartyConcatPhoneProjection = Projections.SqlFunction( new SQLFunctionTemplate(NHibernateUtil.String, "GROUP_CONCAT(DISTINCT ?1 SEPARATOR ?2)"), NHibernateUtil.String, counterpartyPhoneProjection, Projections.Constant(", ") ); var deliveryPointConcatPhoneProjection = Projections.SqlFunction( new SQLFunctionTemplate(NHibernateUtil.String, "GROUP_CONCAT(DISTINCT ?1 SEPARATOR ?2)"), NHibernateUtil.String, deliveryPointPhoneProjection, Projections.Constant(", ") ); var concatPhoneProjection = Projections.SqlFunction( new SQLFunctionTemplate(NHibernateUtil.String, "CONCAT_WS(', ', ?1, ?2)"), NHibernateUtil.String, counterpartyConcatPhoneProjection, deliveryPointConcatPhoneProjection ); var phoneResult = uow.Session.QueryOver(() => orderAlias) .Left.JoinAlias(() => orderAlias.OrderItems, () => orderItemAlias) .Left.JoinAlias(() => orderAlias.Client, () => counterpartyAlias) .Left.JoinAlias(() => orderAlias.DeliveryPoint, () => deliveryPointAlias) .Left.JoinAlias(() => counterpartyAlias.Phones, () => counterpartyPhoneAlias) .Left.JoinAlias(() => deliveryPointAlias.Phones, () => deliveryPointPhoneAlias) .Where( Restrictions.Or( Restrictions.In(Projections.Property(() => counterpartyPhoneAlias.DigitsNumber), phonesArray), Restrictions.In(Projections.Property(() => deliveryPointPhoneAlias.DigitsNumber), phonesArray) ) ) .Where(Restrictions.IsNotNull(Projections.Property(() => orderItemAlias.PromoSet))) .SelectList(list => list .SelectGroup(() => orderAlias.Id) .Select(() => orderAlias.DeliveryDate).WithAlias(() => resultAlias.Date) .Select(() => counterpartyAlias.Name).WithAlias(() => resultAlias.Client) .Select(() => deliveryPointAlias.CompiledAddress).WithAlias(() => resultAlias.Address) .Select(concatPhoneProjection).WithAlias(() => resultAlias.Phone) ).TransformUsing(Transformers.AliasToBean <PromosetDuplicateInfoNode>()) .List <PromosetDuplicateInfoNode>(); return(phoneResult); }
public PhoneViewModel(Phone phone) { Id = phone.Id; Name = phone.Name; }
internal void AddPhone(Phone phone) { _recievers.Add(phone.recieverA); _recievers.Add(phone.recieverB); }
public override void OnExit(Phone context) { context.ClearNumber(); }
public PhoneAccessories(Phone phone) : base(phone) { int l = 1; }
public override void OnEnter(Phone context) { context.TurnMicOff(); context.Disconnect(); }
public void StartUp() { phone = new Phone("Huawei", "Hero"); }
private void btnSavePage_Click(object sender, EventArgs e) { btnSavePage.Enabled = false; #region 儲存鈕 if (comboBoxEx1.SelectedIndex == 0) { #region 地址資料 Dictionary <string, AddressRecord> dic2 = new Dictionary <string, AddressRecord>(); foreach (DataGridViewRow each in dataGridViewX1.Rows) { bool CHeng = (bool)each.Tag; if (CHeng) { each.Tag = false; if (Data.Address.ContainsKey("" + each.Cells[0].Value)) { AddressRecord address = Data.Address["" + each.Cells[ColumnIndex["ID"]].Value]; address.Mailing.ZipCode = "" + each.Cells[ColumnIndex["郵遞區號"]].Value; address.Mailing.County = "" + each.Cells[ColumnIndex["縣市"]].Value; address.Mailing.Town = "" + each.Cells[ColumnIndex["鄉鎮"]].Value; //address.Mailing.District = "" + each.Cells[ColumnIndex["村里"]].Value; //address.Mailing.Area = "" + each.Cells[ColumnIndex["鄰"]].Value; address.Mailing.Detail = "" + each.Cells[ColumnIndex["村里街號"]].Value; dic2.Add(address.RefStudentID, address); //修改後 } } } try { K12.Data.Address.Update(dic2.Values); } catch (Exception ex) { btnSavePage.Enabled = true; FISCA.Presentation.Controls.MsgBox.Show("儲存地址資料,發生錯誤" + ex.Message); return; } if (dic2.Values.Count != 0) { foreach (AddressRecord each in dic2.Values) { StringBuilder sb = new StringBuilder(); StudentRecord stud = each.Student; AddressRecord bef = dic1[each.RefStudentID]; sb.Append("學生「" + stud.Name + "」"); sb.AppendLine("地址資料已被修改。"); sb.AppendLine("郵遞區號「" + bef.Mailing.ZipCode + "」改為「" + each.Mailing.ZipCode + "」"); sb.AppendLine("縣 市「" + bef.Mailing.County + "」改為「" + each.Mailing.County + "」"); sb.AppendLine("鄉鎮市區「" + bef.Mailing.Town + "」改為「" + each.Mailing.Town + "」"); //sb.AppendLine("村 里「" + bef.Mailing.District + "」改為「" + each.Mailing.District + "」"); //sb.AppendLine("鄰 「" + bef.Mailing.Area + "」改為「" + each.Mailing.Area + "」"); sb.AppendLine("村里街號「" + bef.Mailing.Detail + "」改為「" + each.Mailing.Detail + "」"); ApplicationLog.Log("學務系統.聯絡資訊管理", "修改學生地址資料", "student", stud.ID, sb.ToString()); } } btnSavePage.Enabled = true; FISCA.Presentation.Controls.MsgBox.Show("地址資料,儲存成功"); #endregion } else { #region 電話資料 Dictionary <string, PhoneRecord> dic2 = new Dictionary <string, PhoneRecord>(); foreach (DataGridViewRow each in dataGridViewX1.Rows) { bool CHeng = (bool)each.Tag; if (CHeng) { each.Tag = false; if (Data.Address.ContainsKey("" + each.Cells[0].Value)) { PhoneRecord phone = Data.Phone["" + each.Cells[ColumnIndex["ID"]].Value]; phone.Contact = "" + each.Cells[ColumnIndex["聯絡電話"]].Value; phone.Phone1 = "" + each.Cells[ColumnIndex["其他1"]].Value; phone.Phone2 = "" + each.Cells[ColumnIndex["其他2"]].Value; phone.Phone3 = "" + each.Cells[ColumnIndex["其他3"]].Value; phone.Cell = "" + each.Cells[ColumnIndex["手機"]].Value; dic2.Add(phone.RefStudentID, phone); } } } try { Phone.Update(dic2.Values); } catch (Exception ex) { btnSavePage.Enabled = true; FISCA.Presentation.Controls.MsgBox.Show("儲存電話資料,發生錯誤" + ex.Message); return; } if (dic2.Values.Count != 0) { foreach (PhoneRecord each in dic2.Values) { StringBuilder sb = new StringBuilder(); StudentRecord stud = each.Student; PhoneRecord bef = dic3[each.RefStudentID]; sb.Append("學生「" + stud.Name + "」"); sb.AppendLine("電話資料已被修改。"); sb.AppendLine("聯絡電話 「" + bef.Contact + "」改為「" + each.Contact + "」"); sb.AppendLine("其他電話一「" + bef.Phone1 + "」改為「" + each.Phone1 + "」"); sb.AppendLine("其他電話二「" + bef.Phone2 + "」改為「" + each.Phone2 + "」"); sb.AppendLine("其他電話三「" + bef.Phone3 + "」改為「" + each.Phone3 + "」"); sb.AppendLine("手 機 「" + bef.Cell + "」改為「" + each.Cell + "」"); ApplicationLog.Log("學務系統.聯絡資訊管理", "修改學生電話資料", "student", stud.ID, sb.ToString()); } } btnSavePage.Enabled = true; FISCA.Presentation.Controls.MsgBox.Show("電話資料,儲存成功"); #endregion } #endregion DataGridViewDataInChange = false; }