public static void Main() { delegatewithLamdaStatement dlwithLamdastateme = (int x) => { Console.WriteLine(x); }; dlwithLamdastateme(10); delegatewithLamdaExpression dlwithLambdaexpression = (x) => (null); int?y = dlwithLambdaexpression(10) ?? -1; Console.WriteLine(y); delegatewithAnonymous getAnonymous = delegate(int x) { Console.WriteLine(x); }; getAnonymous(510); //singlecast GetDetails callfuncwithDelegatesinglecast = new GetDetails(new Program().Show1); callfuncwithDelegatesinglecast(); //multicaste delegates GetDetails callfuncwithDelegate = new GetDetails(new Program().Show1); callfuncwithDelegate += new GetDetails(new Program().Show2); callfuncwithDelegate(); Console.ReadKey(); }
private void btn_check_in_out_click(object sender, EventArgs e) { room_id = ((BunifuFlatButton)sender).Name; room_no = ((BunifuFlatButton)sender).AccessibleName; buttonText = ((BunifuFlatButton)sender).Text; if (room_no != "") { if (buttonText == "Check In") { GetDetails hko = new GetDetails(); Control crl = this.Parent; hko.room_id = room_id; hko.lbl_room_no.Text = room_no; crl.Controls.Clear(); crl.Controls.Add(hko); } else if (buttonText == "Check Out") { HotelBilling hko = new HotelBilling(room_no, room_id); Control crl = this.Parent; crl.Controls.Clear(); crl.Controls.Add(hko); } else { MessageBox.Show("May be in renovation"); } } }
public async Task GetDetailsAysnc() { var client = new HttpClient(); var request = new HttpRequestMessage { Method = HttpMethod.Get, RequestUri = new Uri("https://unogsng.p.rapidapi.com/title?netflixid=81043135"), Headers = { { "x-rapidapi-key", "44f2c854c9msh70052d5b0318de0p115f87jsna34187fcf3fb" }, { "x-rapidapi-host", "unogsng.p.rapidapi.com" }, }, }; using (var response = await client.SendAsync(request)) { response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); this.Details = JsonSerializer.Deserialize <GetDetails>(body, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); } // You can obviously pull more information from the response from below // this.Title = Details.Results[0].Title.ToString(); this.Plot = Details.Results[0].Imdbplot.ToString(); this.Year = Details.Results[0].Year.ToString(); this.RunTime = Details.Results[0].Imdbruntime.ToString(); this.MatLabel = Details.Results[0].Matlabel.ToString(); this.Img = Details.Results[0].Img.ToString(); this.Genre = Details.Results[0].Imdbgenre.ToString(); this.Synopsis = Details.Results[0].Synopsis.ToString(); }
public async Task <IList <Alarm> > Get(DateTime?fromDate, DateTime?toDate, List <string> cameraName, List <string> sourceLocation, string licensePlateNumber) { var retResults = MapReduceAlarm(fromDate, toDate); CombineClass combineClass = new CombineClass(); combineClass = GetDetails.Alarm(); List <string> lstJunctionId = new List <string>(); //if (sourceLocation.Count > 0) // lstJunctionId = from o in sourceLocation where sourceLocation == o.lstJunctionId select o; //lstJunctionId = sourceLocation.Contains(p=>p).Select(Int32.Parse).ToList(); //string[] arrSourceLocation = (from a in lstJunctionMaster // where lstJunctionId.Contains(a.JunctionID) // select a.SourceLocation).ToArray<string>(); //string[] arrPoleIds = { }; //string[] arrCameraGuids = { }; //if (poleIds.Length > 0) // arrPoleIds = poleIds.Split(','); //if (cameraGuids.Length > 0) // arrCameraGuids = cameraGuids.Split(','); //var glstTraffic = (from a in retResults // join polecameraMapping in lstPoleCameraMapping on a._id.CamGUID equals polecameraMapping.CameraGUID // join polemaster in lstPolemaster on polecameraMapping.PoleCameraMappingID equals polemaster.Id // join junctionmaster in lstJunctionMaster on polemaster.JunctionID equals junctionmaster.JunctionID // where (arrSourceLocation.Length > 0 ? arrSourceLocation.Contains(junctionmaster.SourceLocation) : true) // && (arrPoleIds.Length > 0 ? arrPoleIds.Contains(polemaster.Id.ToString()) : true) // && (arrCameraGuids.Length > 0 ? arrCameraGuids.Contains(polecameraMapping.CameraGUID) : true) // select new TrafficListModel // { // JunctionId = junctionmaster.JunctionID, // JunctionName = junctionmaster.JunctionName, // Id = polemaster.Id, // PoleName = polemaster.Name, // CameraName = polecameraMapping.CameraName, // TrafficCount = a.value.TrafficCount, // ViolationOverallCount = a.value.ViolationOverallCount, // ViolationHighConfidenceCount = a.value.ViolationHighConfidenceCount, // SuccessCount = a.value.SuccessCount, // FailureCount = a.value.FailureCount, // VehicleNotFoundCount = a.value.VehicleNotFoundCount, // InvalidRegNoCount = a.value.InvalidRegNoCount, // SevenDaysCount = a.value.SevenDaysCount, // MoreOfficeCount = a.value.MoreOfficeCount, // ImgNotFoundCount = a.value.ImgNotFoundCount, // ExclusiveCount = a.value.ExclusiveCount, // NullCountHighConfidence = a.value.NullCountHighConfidence // }); //return glstTraffic; return(null); }
public async Task <List <FriendListModel> > getFriendsDetails() { friendList = new List <FriendListModel>(); try { friendList = await GetDetails.GetAll <FriendListModel>("Friend/GetFriendList"); lvFriend.Adapter = new FriendsAdapter(friendList, this); return(friendList); } catch (System.Exception ex) { new CrashReportAsync("InviteFriends", "getFriendsDetails", ex.StackTrace + ex.Message).Execute(); return(friendList); } }
InventoryItemDetails Handle(GetDetails query) { return new InventoryItemDetails(name, total, active); }
/// <summary> /// CreatedBy:Piyumi /// CreatedDate:2016/1/13 /// /// Get user details of a given user /// /// EditedBy: Kanishka /// EditedDate:2016/2/26 /// /// Add user company code and branch code /// /// </summary> /// <param name="user_id"></param> /// <returns>GetDetails Object</returns> public GetDetails getUserById(int user_id) { DataHandler dataHandler = new DataHandler(); List <object[]> paramertList = new List <object[]>(); paramertList.Add(new object[] { "@user_id", user_id }); //Company company = new Company(); try { DataSet dsCompany = dataHandler.GetDataSet("spGetUserDetailsById", paramertList); if (dsCompany != null && dsCompany.Tables.Count != 0) { GetDetails dtl = new GetDetails(); //company.CompanyId = int.Parse(dsCompany.Tables[0].Rows[0]["company_Id"].ToString()); //company.CompanyName = dsCompany.Tables[0].Rows[0]["company_name"].ToString(); //company.CompanyCode = dsCompany.Tables[0].Rows[0]["company_code"].ToString(); //company.CompanyAddress1 = dsCompany.Tables[0].Rows[0]["company_address_1"].ToString(); //company.CompanyAddress2 = dsCompany.Tables[0].Rows[0]["company_address_2"].ToString(); //company.StateId = int.Parse(dsCompany.Tables[0].Rows[0]["stateId"].ToString()); //company.City = dsCompany.Tables[0].Rows[0]["city"].ToString(); //company.Zip = dsCompany.Tables[0].Rows[0]["zip"].ToString(); //string[] zipWithExtention = company.Zip.Split('-'); //if (zipWithExtention[0] != null) company.ZipPre = zipWithExtention[0]; //if (zipWithExtention.Count() >= 2 && zipWithExtention[1] != null) company.Extension = zipWithExtention[1]; //company.Email = dsCompany.Tables[0].Rows[0]["email"].ToString(); //company.PhoneNum1 = dsCompany.Tables[0].Rows[0]["phone_num_1"].ToString(); //company.PhoneNum2 = dsCompany.Tables[0].Rows[0]["phone_num_2"].ToString(); //company.PhoneNum3 = dsCompany.Tables[0].Rows[0]["phone_num_3"].ToString(); //company.Fax = dsCompany.Tables[0].Rows[0]["fax"].ToString(); //company.WebsiteUrl = dsCompany.Tables[0].Rows[0]["website_url"].ToString(); //company.TypeId = int.Parse(dsCompany.Tables[0].Rows[0]["company_type"].ToString()); dtl.userId = int.Parse(dsCompany.Tables[0].Rows[0]["user_id"].ToString()); dtl.firstName = dsCompany.Tables[0].Rows[0]["first_name"].ToString(); dtl.lastName = dsCompany.Tables[0].Rows[0]["last_name"].ToString(); dtl.email = dsCompany.Tables[0].Rows[0]["email"].ToString(); dtl.phoneNo = dsCompany.Tables[0].Rows[0]["phone_no"].ToString(); if (bool.Parse(dsCompany.Tables[0].Rows[0]["status"].ToString())) { dtl.status = "Active"; } else { dtl.status = "Not Active"; } DateTime day = DateTime.Parse(dsCompany.Tables[0].Rows[0]["created_date"].ToString()); dtl.createdDate = day.ToShortDateString(); dtl.roleName = dsCompany.Tables[0].Rows[0]["role_name"].ToString(); if (dsCompany.Tables[0].Rows[0]["branch_name"].ToString() != "") { dtl.branchName = dsCompany.Tables[0].Rows[0]["branch_name"].ToString(); dtl.BranchId = Convert.ToInt32(dsCompany.Tables[0].Rows[0]["branch_id"]); dtl.BranchCode = dsCompany.Tables[0].Rows[0]["BranchCode"].ToString(); } else { dtl.branchName = ""; dtl.BranchId = 0; dtl.BranchCode = ""; } dtl.CompanyCode = dsCompany.Tables[0].Rows[0]["CompanyCode"].ToString(); return(dtl); } else { return(null); } } catch (Exception ex) { throw ex; } }
private bool ClientMessageReceivedHandler(byte[] Data, List <Action> Callbacks = null) { MessageType Type = GetMessageType(Data); if (Type == MessageType.Invalid) { Disconnect(false); return(false); } switch (Type) { case MessageType.Multi: { Message <Multi> Message = new Message <Multi>(Data); byte[] Payload = Message.Body.MessageBody; if ((Message.Body.UncompressedSize ?? 0) > 0) { byte[] DecompressedPayload; int UncompressedSize = Message.Body.UncompressedSize.Value; try { using (MemoryStream Stream = new MemoryStream(Payload)) using (GZipStream Decompressor = new GZipStream(Stream, CompressionMode.Decompress)) Decompressor.Read(DecompressedPayload = new byte[UncompressedSize], 0, UncompressedSize); Payload = DecompressedPayload; } catch { break; } } List <Action> CallbacksList = new List <Action>(); using (MemoryStream Stream = new MemoryStream(Payload)) using (BinaryReader Reader = new BinaryReader(Stream)) while (Stream.Position != Stream.Length) { byte[] Buffer = new byte[4]; Stream.Read(Buffer, 0, 4); int PacketSize = ToInt32(Buffer, 0); Buffer = new byte[PacketSize]; Stream.Read(Buffer, 0, PacketSize); if (!ClientMessageReceivedHandler(Buffer, CallbacksList)) { break; } } foreach (Action Callback in CallbacksList) { Callback(); } break; } case MessageType.LogOnResponse: { Message <LogOn> Message = new Message <LogOn>(Data); int Result = Message.Body.Result; Log($"Received log on response, result code: {Result}"); if (Result == 1) { IsLogged = true; SessionID = Message.Header.SessionID; SteamID = Message.Header.SteamID; HeartbeatTimer.Change(0, Message.Body.HeartbeatDelay * 1000); Log($"Log on succeeded, initiating heartbeat with {Message.Body.HeartbeatDelay} seconds delay"); } if (Callbacks is null) { LoggedOn?.Invoke(); } else { Callbacks.Add(() => LoggedOn?.Invoke()); } break; } case MessageType.ServiceMethodResponse: { byte[] SerializedMethod = new Message <ServiceMethod>(Data).Body.SerializedMethod; switch (ExpectedServiceMethod) { case 0: { ItemInfo Info = new ItemInfo(); Info.Deserialize(SerializedMethod); WorkshopItem Item = Info.Item; ulong ManifestID = Item.ManifestID; Log($"Received latest manifest ID for mod {Item.ItemID}: {ManifestID}"); if (Callbacks is null) { ModInfoReceived(ManifestID); } else { Callbacks.Add(() => ModInfoReceived(ManifestID)); } break; } case 1: { GetDetails Details = new GetDetails(); Details.Deserialize(SerializedMethod); Log("Received mods details"); if (Callbacks is null) { ModsDetailsReceived(Details.Details); } else { Callbacks.Add(() => ModsDetailsReceived(Details.Details)); } break; } case 2: { QueryFiles Query = new QueryFiles(); Query.Deserialize(SerializedMethod); Log($"Received {Query.Details.Count} queried items details"); if (Callbacks is null) { QueryReceived(Query.Details, Query.Total); } else { Callbacks.Add(() => QueryReceived(Query.Details, Query.Total)); } break; } } break; } case MessageType.ProductInfoResponse: { Message <ProductInfo> Message = new Message <ProductInfo>(Data); if (Message.Body.App is null) { break; } Log("Received product info for app 346110"); VDFStruct AppInfo; using (MemoryStream Stream = new MemoryStream(Message.Body.App.Buffer)) using (StreamReader Reader = new StreamReader(Stream)) AppInfo = new VDFStruct(Reader); if (Callbacks is null) { AppInfoReceived(AppInfo); } else { Callbacks.Add(() => AppInfoReceived(AppInfo)); } break; } } return(true); }
public GetCompositeBOEByBarcodeResponse(GetDetails GetCompositeBOEByBarcodeResult) { this.GetCompositeBOEByBarcodeResult = GetCompositeBOEByBarcodeResult; }
private GetDetails _details; // don't name your type "Get..." ;-) public GetDetails GetInfo() { // save result into local variable return(_details = new GetDetails("john", 47)); }