Good Day All
I have a strange situation here. When a user logs in i store the username or userid in the Cookie. So i have a generic method that retrieves that value and when i debug this, i can see that the value is retrieved nicely and i assign that value to a property like this
and after that Asynchronously i call the Business Layer WCF ServiceCode:ContactsModel model = new ContactsModel(); model.iUserid = Convert.ToInt32(GenericMethods.GenericMethods.GetCookie("UserID"));
like this
Code:business.AddContactNumberAsync(model); business.AddContactNumberCompleted += new EventHandler<AddContactNumberCompletedEventArgs>(business_AddContactNumberCompleted);
and the Completed Event like this
and in my Business Layer Service , i wanted to make if the value is corrupted in the Silverlight side or Business Layer side and i receive a call like this in the Business layere ServiceCode:void business_AddContactNumberCompleted(object sender, AddContactNumberCompletedEventArgs e) { if (e.Error == null) { if (e.Result.ToString() == "") { lblError.Visibility = System.Windows.Visibility.Visible; lblError.Content = "Successfully Added"; lblError.Background = new SolidColorBrush(Colors.Green); this.DialogResult = true; } else { lblError.Visibility = System.Windows.Visibility.Visible; lblError.Content = e.Result;//"Service not Available"; lblError.Background = new SolidColorBrush(Colors.Red); } } else { lblError.Visibility = System.Windows.Visibility.Visible; lblError.Content = e.Result; //"Service not Available"; lblError.Background = new SolidColorBrush(Colors.Red); } }
it always return "Invalid Userid" , i am not sure what is the problem because this has been working all along.Code:public string AddContactNumber(ContactsModel Model) { string Error = string.Empty; eCashDataLayer.IeCashDatalayerClient Datalayer = new IeCashDatalayerClient(); if (Model.iUserid != 0) { Error = Datalayer.AddContactNumber(Model); } else { Error = "Invalid Userid"; } return Error; }
Thanks




Reply With Quote