public void transferDevice(int reason183, int to_stockhandler_id, string sn) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl(var_auth.var_url_asm); var whService = AsmRepository.AllServices.GetLogisticsService(authHeader); var prodcService = AsmRepository.AllServices.GetProductCatalogConfigurationService(authHeader); var deviceService = AsmRepository.AllServices.GetDevicesService(authHeader); try { BuildList bl = new BuildList(); bl.TransactionType = BuildListTransactionType.TransferToAnotherStockHandler; bl.Reason = reason183; bl.StockHandlerId = to_stockhandler_id; // Create build list var nbl = deviceService.CreateBuildList(bl); // Add device to build list deviceService.AddDeviceToBuildListManually(nbl.Id.Value, sn); // Perform build list var bl1 = deviceService.PerformBuildListAction(nbl.Id.Value); } catch (Exception ex) { Console.WriteLine("Errors : " + ex.Message); Console.WriteLine("Stack : " + ex.StackTrace); } }
public void getWorkOrderByCustomerId() { #region Authenticate and create proxies Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var workforceService = AsmRepository.GetServiceProxyCachedOrDefault <IWorkforceService>(ah); #endregion //Instantiate the request object and define filter criteria //GetWorkOrdersRequest implements the BaseQueryRequest, so you can filter, sort, //and page the returned records. //You can use the properties of WorkOrder to filter and sort. GetWorkOrdersRequest request = new GetWorkOrdersRequest(); request.FilterCriteria.Add("CustomerId", 16190); request.FilterCriteria.Add("WorkOrderStatusId", 1); #region Get the customer's work orders and display the results. WorkOrderCollection coll = workforceService.GetWorkOrders(request); if (coll != null && coll.Items.Count > 0) { foreach (WorkOrder w in coll) { Console.WriteLine("Found Work Order ID = {0}; Create Date = {1}", w.Id, w.RegisteredDateTime); } } else { Console.WriteLine("Sorry--No work orders found."); } Console.ReadLine(); #endregion }
public CategoryProductPriceExCollection GetCommercialProductByCustomerId(String username_ad, String password_ad, int id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var agService = AsmRepository.AllServices.GetAgreementManagementService(ah); try { var agreements = agService.GetAgreements(new BaseQueryRequest() { FilterCriteria = Op.Eq("CustomerId", id) }); var map = agService.GetManageAgreementProductReference(agreements.Items[0].Id.Value); return(map.CategoryProductPriceExCollection); //foreach (var cp in map.CategoryProductPriceExCollection) //{ // Console.WriteLine("Allowed Product Category : " + cp.CommercialProductCategoryName + " | Product Name : " + cp.CommercialProductName + " Price : " + cp.ListPriceAmount); //} //Console.WriteLine("total product : {0}", map.CategoryProductPriceExCollection.Count()); } catch (Exception ex) { return(null); //Console.WriteLine("Errors : " + ex.Message); //Console.WriteLine("Stack : " + ex.StackTrace); } }
public ProvinceCollection GetAllProvinces(String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var custService = AsmRepository.AllServices.GetCustomersConfigurationService(authHeader); ProvinceCollection provinces = custService.GetProvinceByCountry(1); //IEnumerable<string> enumerable = (IEnumerable<string>)provinces; List <string> list = new List <string>(); //Provinces ok1 = new Provinces(); // Loop through List with foreach. foreach (var prime in provinces) { var a = prime.Id.ToString(); list.Add(a); var b = prime.Name.ToString(); list.Add(b); } //var provinces_listString = provinces.OrderBy(x => x.Id).Select(x => new Provinces { Id_nya = (int) x.Id, Name_nya = (string) x.Name }).ToList(); //var result = ((IEnumerable<string>)provinces).Cast<object>().ToList(); return(provinces); }
public HttpResponseMessage GetServiceTypeById(String username_ad, String password_ad, int id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var TSService = AsmRepository.GetServiceProxyCachedOrDefault <IWorkforceConfigurationService>(ah); BaseQueryRequest request = new BaseQueryRequest(); request.FilterCriteria = new CriteriaCollection(); request.FilterCriteria.Add(new Criteria("Id", id)); ServiceTypeCollection servicetype = TSService.GetServiceTypeList(request); if (servicetype != null) { return(Request.CreateResponse(HttpStatusCode.OK, servicetype)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public HttpResponseMessage CreateNote([FromBody] CreateNoteParams created_data) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(created_data.username_ad, created_data.password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var customersConfiguration = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(ah); //Instanstiate and initialize a ValidAddress object. //For a description of each property, see the API Reference Library CHM. Note new_note = new Note(); new_note.CategoryId = created_data.the_categoryId; //1 //new_note.CategoryKey = "ADMINPOS"; new_note.CompletionStageId = created_data.the_completionStageId; //1 //new_note.CompletionStageKey = NoteCompletionStage.ENTITY_ID.ToString(); new_note.Body = created_data.the_body_note; new_note.CustomerId = created_data.the_customerId; Note the_new_note = customersConfiguration.CreateNote(new_note, 0); if (the_new_note != null) { return(Request.CreateResponse(HttpStatusCode.OK, the_new_note)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
private static AuthenticationHeader GenerateEncryptedHeader(string username, string password) { try { // Prepare authentication data to send AuthenticationData authData = PrepareAuthenticationData(username, password); // Serialize data string serializedAuthData = Serializer.JsonSerializer <AuthenticationData>(authData); // Encrypt data string signature = Encryption.Encrypt(serializedAuthData, true); var encryptedHeader = new AuthenticationHeader { EncryptedSignature = signature }; return(encryptedHeader); } catch (Exception ex) { throw ex; } }
public WorkOrder CompleteWorkOrder(WorkOrder wo_param, int reason_param, string work_desc_param, string action_taken, int completion_reason_id_param) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl(var_auth.var_url_asm); WorkOrder ww = null; var woService = AsmRepository.AllServices.GetWorkforceService(authHeader); var wo = AsmRepository.AllServices.GetWorkforceService(authHeader).GetWorkOrder(wo_param.Id.Value); try { string temp_work_description = wo_param.ProblemDescription; string temp_action_taken = wo_param.ActionTaken; wo.ProblemDescription = temp_work_description + "#" + work_desc_param; wo.ActionTaken = temp_action_taken + "#" + action_taken; wo.CompletedDateTime = DateTime.Now; wo.ReasonKey = 99470; ww = woService.CompleteWorkOrder(wo, 99470); return(ww); } catch (Exception ex) { msg = "Exceptions : " + ex.Message + " Stack : " + ex.StackTrace; Console.WriteLine(msg); } // Console.WriteLine(msg); return(ww); }
public AuthenticationHeader getAuthentication_header() { //Create the authentication header, initialize with credentials, and //create the service proxy. //To avoid passing in a clear password, use Token Authentication. //For details, see the API Developer's Guide. //Pass in a value for ExternalAgent to track the external user who //accessed the API. For details, see the API Reference Library CHM. AuthenticationHeader ah = new AuthenticationHeader { //UserName = "******", //Proof = "api9hsn!", UserName = "******", Proof = "ICCMsky2016", Dsn = "MSKY-TRA" //UserName = "******", //Proof = "ap1msky!", //Dsn = "MSKY-PROD" }; return(ah); }
private AuthenticationHeader GetHeader() { //build authorization header - change as CreateAuthHeader() var authHeader = new AuthenticationHeader(); authHeader.LoginName = "Tra105"; authHeader.Password = "******"; return authHeader; }
public HttpResponseMessage GetDeviceById(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var devicesService = AsmRepository.GetServiceProxyCachedOrDefault <IDevicesService>(authHeader); //var provinces = devicesService.GetDeviceById(id); //parameter id Device devices = devicesService.GetDeviceById(id); //List<string> list = new List<string>(); //list.Add("deviceId"); list.Add(devices.Id.ToString()); //list.Add("SerialNumber"); list.Add(devices.SerialNumber); //list.Add("Shidate"); list.Add(devices.ShipDate.ToString()); //list.Add("StatusId"); list.Add(devices.StatusId.ToString()); //list.Add("ModelId"); list.Add(devices.ModelId.ToString()); //list.Add("BigCarReferenceNumber"); list.Add(devices.BigCAReferenceNumber); if (devices != null) { return(Request.CreateResponse(HttpStatusCode.OK, devices)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } //return devices; }
public HttpResponseMessage getDeviceinAgreementDetailByCustId(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah); var viewService = AsmRepository.GetServiceProxy <IViewFacadeService>(ah); var viewD = viewService.GetCustomerDeviceView(new BaseQueryRequest() { FilterCriteria = Op.Eq("CustomerId", id), PageCriteria = new PageCriteria() { Page = 0, PageSize = 100 }, DeepLoad = true }); if (viewD != null) { return(Request.CreateResponse(HttpStatusCode.OK, viewD)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
private Common.Tourflowsvc.AuthenticationHeader CreateSession() { Common.Tourflowsvc.AuthenticationHeader authentication = new AuthenticationHeader(); authentication.LoginName = "Tra105"; authentication.Password = "******"; return(authentication); }
public HttpResponseMessage SendCommandToDevice(string serial_number, int id_action, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var the_string = ""; var deviceService = AsmRepository.AllServices.GetDevicesService(authHeader); var viewfService = AsmRepository.AllServices.GetViewFacadeService(authHeader); //int pre_act_7 = 99177; // pre-activation for 7 days. var device = deviceService.GetDeviceBySerialNumber(serial_number); if (device != null) { deviceService.SendCommandToDevice(device.Id.Value, id_action); return(Request.CreateResponse(HttpStatusCode.OK, "SUCCESS")); } else { var message = string.Format("An Error Has Occured on serial number", serial_number); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.BadRequest, err)); //Console.WriteLine("Can't find device with SN :" + serial_number); } }
// Identify device to shipping order public ShippingOrder identifyDevice(String username_ad, String password_ad, ShippingOrder soc, string serial_number, int tp_id, int model_id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); //var docmService = AsmRepository.GetServiceProxy<IDocumentManagementService>(authHeader); var soService = AsmRepository.AllServices.GetOrderManagementService(authHeader); var faService = AsmRepository.AllServices.GetFinanceService(authHeader); var sbService = AsmRepository.AllServices.GetSandBoxManagerService(authHeader); var agService = AsmRepository.AllServices.GetAgreementManagementService(authHeader); var deviceService = AsmRepository.AllServices.GetDevicesService(authHeader); var viewfService = AsmRepository.AllServices.GetViewFacadeService(authHeader); try { var so_lineitem = soc.ShippingOrderLines.Items.Find(t => t.TechnicalProductId == tp_id); if (so_lineitem == null) { //Console.WriteLine("Can't find techinical product with id : " + tp_id + " in shipping order with id : " + soc.Id.Value); return(null); } var buildlist = new BuildList { OrderLineId = so_lineitem.Id, OrderId = soc.Id, ModelId = model_id, StockHandlerId = soc.ShipFromStockHandlerId, TransactionType = BuildListTransactionType.ShippingSerializedProducts }; var b_build_list = deviceService.CreateBuildList(buildlist); var d_a_list = deviceService.AddDeviceToBuildListManually(b_build_list.Id.Value, serial_number); if (d_a_list.Accepted.Value) { var dblist = deviceService.PerformBuildListAction(b_build_list.Id.Value); } else { //Console.WriteLine("Failed to attach decoder with SN : " + serial_number + " to Shipping Order : Error : " + d_a_list.Error); return(null); } return(soc); } catch (Exception ex) { //msg = "Errors : " + ex.Message + " ------ Exception Stack : " + ex.StackTrace; //Console.WriteLine("Errors : " + ex.Message); //Console.WriteLine("Stack : " + ex.StackTrace); //logger.Error(msg); return(null); } }
public HttpResponseMessage GetAgreementByTypeId(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); IViewFacadeService viewFacadeService = AsmRepository.GetServiceProxyCachedOrDefault <IViewFacadeService>(ah); BaseQueryRequest request = new BaseQueryRequest(); request.FilterCriteria = new CriteriaCollection(); //Agreement type is a user-configured property. The value in //this key-value pair is the agreement type ID. You can get this //value from the Configuration Module or from a call to //the AgreementManagementConfigurationService. request.FilterCriteria.Add(new Criteria("TypeId", id)); AgreementViewCollection coll = viewFacadeService.GetAgreementView(request); if (coll != null) { return(Request.CreateResponse(HttpStatusCode.OK, coll)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public HttpResponseMessage GetSoftwareProduct(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah); //This value is the customer's ID number. int customerId = id; //In ICC, a Page can hold up to 20 records. Page = 0 returns ALL records. int page = 0; //Call the method and display the results. var agreements = agreementManagementService.GetSoftwareForAgreementDetailById(2912043); if (agreements != null) { return(Request.CreateResponse(HttpStatusCode.OK, agreements)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public void updateDeviceStatus(string serial_number, int reason_id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl(var_auth.var_url_asm); var whService = AsmRepository.AllServices.GetLogisticsService(authHeader); var prodcService = AsmRepository.AllServices.GetProductCatalogConfigurationService(authHeader); IDevicesService deviceService = AsmRepository.AllServices.GetDevicesService(authHeader); int return_status = 0; try { Device device = deviceService.GetDeviceBySerialNumber(serial_number); if (device != null) { deviceService.UpdateDeviceStatus(device.Id.Value, reason_id); //return_status = 1; Console.WriteLine("device id = " + device.Id, "serial number = " + device.SerialNumber); } else { //return_status = 0; Console.WriteLine("Can't find device with serial number : " + serial_number); } } catch (Exception ex) { //return null; Console.WriteLine("Errors : " + ex.Message); Console.WriteLine("Stack : " + ex.StackTrace); } }
public OfferDefinitionCollection GetPromoNow(String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); IProductCatalogConfigurationService prodService = AsmRepository.AllServices.GetProductCatalogConfigurationService(authHeader); IOfferManagementConfigurationService offService = AsmRepository.AllServices.GetOfferManagementConfigurationService(authHeader); OfferDefinitionCollection offers = offService.GetOfferDefinitions(new BaseQueryRequest() { FilterCriteria = new CriteriaCollection() { new Criteria() { Key = "Active", Operator = Operator.Equal, Value = "1" } } }); return(offers); }
public bool Authenticate(System.ServiceModel.OperationContext operationContext) { //Extract the Authorization header, and parse out the credentials converting the Base64 string: var authHeader = WebOperationContext.Current.IncomingRequest.Headers["Authorization"]; AuthenticationHeader header; if (AuthenticationHeader.TryDecode(authHeader, out header)) { /* * This would be the place to inject the OAuth authentication manager. */ if ((header.Username == "user1" && header.Password == "test")) { //User is authrized and originating call will proceed return(true); } else { //not authorized return(false); } } else { //No authorization header was provided, so challenge the client to provide before proceeding: WebOperationContext.Current.OutgoingResponse.Headers.Add("WWW-Authenticate: Basic realm=\" WcfWebHttpIISHostingSample\""); throw new WebFaultException(HttpStatusCode.Unauthorized); } }
public static IList <PravnoLice> PretraziNbsKlijente(long?maticniBroj, string pib, long?banka, long?brojRacuna, int?kontrolniBroj, string naziv, string mesto) { using (var svc = new CompanyAccountXmlServiceSoapClient()) { var authHeader = new AuthenticationHeader { LicenceID = new Guid("57eadda1-7075-46c3-9b15-56c5430fd218"), UserName = @"ipsylon", Password = @"ipsy1302", }; var result = svc.GetCompanyAccount(authHeader, maticniBroj, pib, banka, brojRacuna, kontrolniBroj, naziv, mesto, null, null); var xml = XDocument.Parse(result); var pravnaLica = xml.Descendants("CompanyAccount").Select(x => new PravnoLice { TekuciRacun = x.Element("Account").Value, Banka = x.Element("BankCode").Value, BrojRacuna = x.Element("AccountNumber").Value, KontrolniBroj = x.Element("ControlNumber").Value, Naziv = x.Element("CompanyName").Value, MaticniBroj = x.Element("NationalIdentificationNumber").Value, PIB = x.Element("TaxIdentificationNumber").Value, Adresa = x.Element("Address").Value, Mesto = x.Element("City").Value }).ToList(); return(pravnaLica); } }
public void GetCustomerIdIfAuthorized() { ManagerSiteMgr.OpenLogin(); ManagerSiteMgr.Login(); ManagerSiteMgr.DeleteExpiredDuplicateEvents(EventName); if (!ManagerSiteMgr.EventExists(EventName)) { ManagerSiteMgr.ClickAddEvent(Managers.Manager.ManagerSiteManager.EventType.ProEvent); BuilderMgr.SetStartPage(Managers.Manager.ManagerSiteManager.EventType.ProEvent, EventName); this.eventId = BuilderMgr.GetEventId(); BuilderMgr.SaveAndClose(); } else { this.eventId = ManagerSiteMgr.GetFirstEventId(EventName); } AuthenticationHeader header = new AuthenticationHeader(); header.UserName = ConfigReader.DefaultProvider.AccountConfiguration.Login; header.Password = ConfigReader.DefaultProvider.AccountConfiguration.Password; RegOnlineResponseOfInt32 customerId = this.service.GetCustomerIdIfAuthorized(header, this.eventId); Assert.AreEqual(Convert.ToInt32(ConfigReader.DefaultProvider.AccountConfiguration.Id), customerId.Value); Assert.IsTrue(customerId.Status.Success); }
public void createNote() { int reasonkey = 1; //Create the authentication header, initialize with credentials, and //create the service proxy. For details, see the API Developer's //Guide and the Reference Library CHM. Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var customersConfiguration = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(ah); //Instanstiate and initialize a ValidAddress object. //For a description of each property, see the API Reference Library CHM. Note new_note = new Note(); new_note.CategoryId = 1; //new_note.CategoryKey = "ADMINPOS"; new_note.CompletionStageId = 1; //new_note.CompletionStageKey = NoteCompletionStage.ENTITY_ID.ToString(); new_note.Body = "tes notes dari huda"; new_note.CustomerId = 35153; Note the_new_note = customersConfiguration.CreateNote(new_note, 0); Console.WriteLine("note created. ID = {0}", the_new_note.Id); Console.ReadLine(); }
public HttpResponseMessage GetLedgerAccounts(String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var financeConfigurationService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceConfigurationService>(ah); //Instantiate a request object and its FilterCriteria LedgerAccountQueryRequest request = new LedgerAccountQueryRequest(); request.FilterCriteria = new CriteriaCollection(); //Populate the FilterCriteria, using In operator to perform an "Or" query. //request.FilterCriteria.Add(new Criteria("LedgerAccountCode", "U2001", Operator.In)); //request.FilterCriteria.Add(new Criteria("LedgerAccountCode", "RU2001", Operator.In)); //request.FilterCriteria.Add(new Criteria("LedgerAccountCode", "P9500", Operator.In)); //request.FilterCriteria.Add(new Criteria("LedgerAccountCode", "RP9500", Operator.In)); request.FilterCriteria.Add(new Criteria("IconId", "", Operator.Like)); //Call the method. LedgerAccountCollection collection = financeConfigurationService.GetLedgerAccounts(request); //Display the results. if (collection != null && collection.Items.Count > 0) { return(Request.CreateResponse(HttpStatusCode.OK, collection)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
//todo throw exception if setup is incorrect /// <summary> /// Set up Device42Interactor so you can send commands to it /// </summary> /// <param name="address">Address used to access Device42</param> /// <param name="port">Port used to access Device42</param> /// <param name="username">Username used to access Device42</param> /// <param name="password">Password used to access Device42</param> /// <exception cref="">Set up parameters were incorrect</exception> public static void Initialize(string address, string port, string username, string password) { D42Commands.address = address; D42Commands.port = port; D42Commands.username = username; D42Commands.password = password; string serverAddress = string.Empty; if (string.IsNullOrEmpty(port)) { serverAddress = string.Concat(address, ":", port); } else { serverAddress = address; } authHeader = new AuthenticationHeader(username, password); // Set Commands getAllDevices = new Command_GetAllDevices(serverAddress, authHeader); setPassword = new Command_SetPassword(serverAddress, authHeader); getPasswords = new Command_GetPassword(serverAddress, authHeader); }
private void MainWindow_Login_Btn_Click(object sender, RoutedEventArgs e) { try { _authenticationHeader = new AuthenticationHeader(); _authenticationHeader._login = MainWindow_Login_TBox.Text; _authenticationHeader._password = MainWindow_Password_PBox.Password; _authorisation.AuthenticationHeaderValue = _authenticationHeader; _loginUser = _authorisation.Login(); if (_loginUser != null) { new DailyWindow(_loginUser, _authorisation, _authenticationHeader).Show(); this.Close(); } else { MessageBox.Show("Niepoprawne dane! Spróbuj ponownie."); } } catch (Exception) { MessageBox.Show("Serwer nie odpowiada!"); } }
public ActionResult BookHotelFinal(FormCollection collection) { //AuthHeader Common.hotelflowSvc.AuthenticationHeader auth = new AuthenticationHeader(); auth.LoginName = "Tra105"; auth.Password = "******"; //SearchHotelRequest Common.hotelflowSvc.BookV3Request reqCriteria = new BookV3Request(); reqCriteria.RecordLocatorId = 0; reqCriteria.HotelId = Convert.ToInt32(collection["hotelCode"]); reqCriteria.HotelRoomTypeId = Convert.ToInt32(collection["hotelroomTypeId"]); reqCriteria.CheckIn = Convert.ToDateTime(collection["startDate"]); reqCriteria.CheckOut = Convert.ToDateTime(collection["endDate"]); reqCriteria.RoomsInfo = new RoomReserveInfo[] { new RoomReserveInfo { AdultNum = 1, ChildAges = new ChildAge[] { new ChildAge { age = 5 } }, ChildNum = 1, ContactPassenger = new ContactPassenger { FirstName = "Jack", LastName = "Rowling" } } }; reqCriteria.Currency = "CAD"; reqCriteria.PaymentType = PaymentTypes.Obligo; reqCriteria.RequestedPrice = ExtractDecimalFromString(collection["message"]); ViewBag.HotelId = reqCriteria.HotelId; ViewBag.HotelRoomTypeId = reqCriteria.HotelRoomTypeId; HotelFlowClient client = new HotelFlowClient(); RGInfoResults sreq; try { sreq = client.BookHotelV3(auth, reqCriteria, new Feature[] { new Feature { name = "OriginalImageSize", value = "true" } }); } catch (System.ServiceModel.FaultException ex) { return(View("PriceChange", ex)); } finally { client.Close(); } return(View("Confirmation", sreq.ResGroup)); }
private AuthenticationHeader GetHeader() { //build authorization header - change as CreateAuthHeader() var authHeader = new AuthenticationHeader(); authHeader.LoginName = "Tra105"; authHeader.Password = "******"; return(authHeader); }
public static AuthenticationHeader GetAuthHeader() { if (authHeader == null) { authHeader = new AuthenticationHeader(); } return(authHeader); }
private static AuthenticationHeader Authen() { AuthenticationHeader authInfo = new AuthenticationHeader(); authInfo.Username = Config.UserServices; authInfo.Password = Config.PassServices; return(authInfo); }
private void button2_Click(object sender, EventArgs e) { // SOAP Header var auth = new AuthenticationHeader { UserName = "******", Password = "******" }; this.service.AddUser(txtName.Text, int.Parse(txtGoal.Text)); users = service.ListUsers(auth); selectUser.DataSource = users; }
public QuoteInvoiceCollection GetQuoteByCustomerId(String username_ad, String password_ad, int id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var billingService = AsmRepository.GetServiceProxyCachedOrDefault <IBillingEngineService>(ah); var financeService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceService>(ah); var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah); #region Step 1 //First, get Pending quotes to check their QuoteDates. //Instantiate a class for the request. BaseQueryRequest req = new BaseQueryRequest(); req.FilterCriteria = new CriteriaCollection(); //Define the selection criteria. //Replace 73948 with the CustomerId of the customer you want. req.FilterCriteria.Add("CustomerId", id); //Get the customer's QuoteInvoices. QuoteInvoiceCollection qts = billingService.FindQuoteInvoices(req); if (qts != null && qts.Items.Count > 0) { return(qts); //foreach (var q in qts) //{ // Console.WriteLine("Customer ID {0}: QuoteDate = {1} QuoteInvoice ID = {2}", // q.CustomerId, q.QuoteDate, q.Id); // Console.WriteLine("Quote amount = {0} Quote type = {1}", // q.TotalAmount, q.QuoteType); // //If the QuoteDate < Today, then regenerate the quote. // if (q.QuoteDate < System.DateTime.Today) // { // QuoteInvoiceRequest request = new QuoteInvoiceRequest(); // request.QuoteId = q.Id; // //If Save = True, ICC saves the QuoteInvoice. // //To get the quote info but not commit it to the database, // //set the flag to False. This is useful when // //you only want to know what the customer would pay next // //period, but you don't want to create the quote. // request.Save = true; // //Regenerate the quote to save Today's quote info. // QuoteInvoiceResponse response = billingService.RegenerateQuoteInvoice(request); // Console.WriteLine("New quote generated. ID = {0}; Amount = {1}", // response.NewQuoteInvoice.Id, response.NewQuoteInvoice.TotalAmount); // } // else // { // Console.WriteLine("Customer's quotes are up-to-date."); // } //} } else { return(null); } #endregion step 1 }
protected override RequestMsg DoDecodeRequest(WireFrame frame, MemoryStream ms, ISerializer serializer) { var utf8 = ms.GetBuffer(); var json = Encoding.UTF8.GetString(utf8, (int)ms.Position, (int)ms.Length - (int)ms.Position); var data = JSONReader.DeserializeDataObject(json) as JSONDataMap; if (data == null) { throw new ProtocolException(StringConsts.GLUE_BINDING_REQUEST_ERROR.Args(nameof(AppTermBinding), "data==null")); } var reqID = new FID(data["request-id"].AsULong(handling: ConvertErrorHandling.Throw)); //kuda ego vstavit? var instance = data["instance"].AsNullableGUID(handling: ConvertErrorHandling.Throw); var oneWay = data["one-way"].AsBool(); var method = data["method"].AsString(); MethodSpec mspec; if (method.EqualsOrdIgnoreCase(nameof(Contracts.IRemoteTerminal.Connect))) { mspec = AppTermBinding.METHOD_CONNECT; } else if (method.EqualsOrdIgnoreCase(nameof(Contracts.IRemoteTerminal.Execute))) { mspec = AppTermBinding.METHOD_EXECUTE; } else if (method.EqualsOrdIgnoreCase(nameof(Contracts.IRemoteTerminal.Disconnect))) { mspec = AppTermBinding.METHOD_DISCONNECT; } else { throw new ProtocolException(StringConsts.GLUE_BINDING_REQUEST_ERROR.Args(nameof(AppTermBinding), "unknown method `{0}`".Args(method))); } var args = data["command"] == null ? new object[0] : new object[] { data["command"].AsString() }; var result = new RequestAnyMsg(AppTermBinding.TYPE_CONTRACT, mspec, oneWay, instance, args); var autht = data["auth-token"].AsString(); if (autht != null) { var hdr = new AuthenticationHeader(Security.SkyAuthenticationTokenSerializer.Deserialize(autht)); result.Headers.Add(hdr); } var authc = data["auth-cred"].AsString(); if (authc != null) { var hdr = new AuthenticationHeader(Azos.Security.IDPasswordCredentials.FromBasicAuth(authc)); result.Headers.Add(hdr); } return(result); }
private void Form1_Load(object sender, EventArgs e) { // SOAP Header var auth = new AuthenticationHeader { UserName = "******", Password = "******" }; this.users = this.service.ListUsers(auth); selectUser.DataSource = users; selectUser.DisplayMember = "Name"; selectUser.ValueMember = "UserId"; }
public void GetAuthenticationHeaderValue() { byte[] encodedValues = Encoding.ASCII.GetBytes(string.Concat("admin", ":", "password")); AuthenticationHeaderValue header = new AuthenticationHeaderValue("Authorization", Convert.ToBase64String(encodedValues)); AuthenticationHeader authToSend = new AuthenticationHeader("admin", "password"); Assert.IsNotNull(authToSend.GetHeader()); Assert.AreEqual(header, authToSend.GetHeader()); }
public ActionResult BookHotelFinal(FormCollection collection) { //AuthHeader Common.hotelflowSvc.AuthenticationHeader auth = new AuthenticationHeader(); auth.LoginName = "Tra105"; auth.Password = "******"; //SearchHotelRequest Common.hotelflowSvc.BookV3Request reqCriteria = new BookV3Request(); reqCriteria.RecordLocatorId = 0; reqCriteria.HotelId = Convert.ToInt32(collection["hotelCode"]); reqCriteria.HotelRoomTypeId = Convert.ToInt32(collection["hotelroomTypeId"]); reqCriteria.CheckIn = Convert.ToDateTime(collection["startDate"]); reqCriteria.CheckOut = Convert.ToDateTime(collection["endDate"]); reqCriteria.RoomsInfo = new RoomReserveInfo[] { new RoomReserveInfo { AdultNum = 1, ChildAges = new ChildAge[] { new ChildAge { age = 5 } }, ChildNum = 1 , ContactPassenger = new ContactPassenger { FirstName = "Jack", LastName = "Rowling" } } }; reqCriteria.Currency = "CAD"; reqCriteria.PaymentType = PaymentTypes.Obligo; reqCriteria.RequestedPrice = ExtractDecimalFromString(collection["message"]); ViewBag.HotelId = reqCriteria.HotelId; ViewBag.HotelRoomTypeId = reqCriteria.HotelRoomTypeId; HotelFlowClient client = new HotelFlowClient(); RGInfoResults sreq; try { sreq = client.BookHotelV3(auth, reqCriteria, new Feature[] { new Feature { name = "OriginalImageSize", value = "true" } }); } catch (System.ServiceModel.FaultException ex) { return View("PriceChange", ex); } finally { client.Close(); } return View("Confirmation", sreq.ResGroup); }
public RegistrationServiceFixture() : base(ConfigReader.WebServiceEnum.RegistrationService) { RequiresBrowser = true; this.service = new RegistrationServiceSoapClient( CurrentWebServiceConfig.EndpointConfigName, RemoteAddressUri.ToString()); header = new AuthenticationHeader(); header.UserName = ConfigReader.DefaultProvider.AccountConfiguration.Login; header.Password = ConfigReader.DefaultProvider.AccountConfiguration.Password; }
public SearchResult Execute(AuthenticationHeader authHeader, SearchHotelsByIdRequest sReq, Feature[] features) { //instantiate HotelFlowClient _hotelflowClient = new HotelFlowClient(); //search Hotels var sreq = _hotelflowClient.SearchHotelsById(authHeader, sReq, features); //close instance _hotelflowClient.Close(); return sreq; }
public DailyWindow(UserHelper me, DailyServer authorisation, AuthenticationHeader authenticationHeader) { InitializeComponent(); _me = me; _authorisation = authorisation; _authenticationHeader = authenticationHeader; DailyW_Login_Label.Content = _me.Login; TargetAndCaloriesNeedHelper targetHelper = _authorisation.GetTargetInfoAndCaloriesNeedInfo(Me.UserId); string _myCaloriesNeedString = targetHelper.TargetCaloriesNeed + "kcal (B: " + targetHelper.TargetProteins + "g, W: " + targetHelper.TargetCarbohydrates + "g, T: " + targetHelper.TargetFat + "g)"; string _myTargetString = targetHelper.TargetDate.ToShortDateString() + ", waga: " + targetHelper.TargetWeight + "kg, bf: " + targetHelper.TargetBodyFat + "%"; targetHelper = _authorisation.GetActualProgress(Me.UserId); string _myActualProgressString; if (targetHelper != null) { _myActualProgressString = targetHelper.TargetDate.ToShortDateString() + ", waga: " + targetHelper.TargetWeight + "kg, bf: " + targetHelper.TargetBodyFat + "%"; } else { _myActualProgressString = "brak informacji"; } DailyW_CaloriesNeed_Label.Content = (_myCaloriesNeedString); DailyW_MyTarget_Label.Content = (_myTargetString); DailyW_ActualProgress_Label.Content = (_myActualProgressString); DailyW_DailyCalendar_Calendar.SelectedDate = DateTime.Today; LoadDailyPhotosToListView(); LoadDailyTrainingToListView(); LoadDailyMealToListView(); LoadDailyMensurationToListView(); DailyW_NewMensurationResult_TBox.IsEnabled = false; DailyW_AddNewMensurationInscription_Btn.IsEnabled = false; DailyWindow_BFChoseHelper_Btn.Visibility = System.Windows.Visibility.Hidden; DailyWindow_BFCalculateHelper_Btn.Visibility = System.Windows.Visibility.Hidden; }
public bool IsHeaderValid(AuthenticationHeader sHeader, out string status, out string statusCode) { if (sHeader == null) { status = "ERROR: Please supply credentials"; statusCode = "001"; return false; } if (String.IsNullOrEmpty(sHeader.LoginId) || String.IsNullOrEmpty(sHeader.LoginPassword)) { status = "ERROR: Please supply credentials"; statusCode = "001"; return false; } bool isValid = true; StringBuilder sb = new StringBuilder(); status = "Valid Header Format"; statusCode = "000"; return isValid; }
public object BeforeSendRequest(ref Message request, IClientChannel channel) { DateTime now = DateTime.UtcNow; string timestamp = now.ToString("yyyy-MM-ddTHH:mm:ssZ", System.Globalization.CultureInfo.InvariantCulture); AuthenticationData authData = new AuthenticationData { Username = ClientAuthenticationHeaderContext.HeaderInformation.Username, Password = ClientAuthenticationHeaderContext.HeaderInformation.Password, Timespan = timestamp // This is the seed.. }; string serializedAuthData = Serializer.JsonSerializer<AuthenticationData>(authData); string signature = string.Empty; signature = Encryption.Encrypt(serializedAuthData, true); var encryptedHeader = new AuthenticationHeader { EncryptedSignature = signature }; var typedHeader = new MessageHeader<AuthenticationHeader>(encryptedHeader); var untypedHeader = typedHeader.GetUntypedHeader("authentication-header", "chsakell.com"); request.Headers.Add(untypedHeader); return null; }
// public ActionResult CheckAvailability(int hotelId) public ActionResult CheckAvailability(FormCollection collection) { //AuthHeader Common.hotelflowSvc.AuthenticationHeader auth = new AuthenticationHeader(); auth.LoginName = "Tra105"; auth.Password = "******"; //SearchHotelRequest Common.hotelflowSvc.SearchHotelsByIdRequest reqCriteria = new SearchHotelsByIdRequest(); reqCriteria.HotelIdsInfo = new HotelIdInfo[] { new HotelIdInfo { id = Convert.ToInt32(collection["hotelCode"]) } }; reqCriteria.CheckIn = Convert.ToDateTime(collection["startDate"]); reqCriteria.CheckOut = Convert.ToDateTime(collection["endDate"]); ViewBag.StartDate = reqCriteria.CheckIn; ViewBag.EndDate = reqCriteria.CheckOut; reqCriteria.RoomsInformation = new RoomInfo[] { new RoomInfo { AdultNum = 1, ChildAges = new ChildAge[] { new ChildAge { age = 5 } }, ChildNum = 1 }}; HotelFlowClient client = new HotelFlowClient(); SearchResult sreq = client.CheckAvailabilityAndPrices(auth, reqCriteria, new Feature[] { new Feature { name = "OriginalImageSize", value = "true" } }); client.Close(); return View("Available", sreq.HotelList); }
//public ActionResult SearchDestination() //{ // //Auth Header // Common.hotelDestSvc.LoginHeader loginHdr = new Common.hotelDestSvc.LoginHeader(); // loginHdr.username = "******"; // loginHdr.password = "******"; // loginHdr.culture = Common.hotelDestSvc.Culture.en_US; // loginHdr.version = "7.123"; // //DestinationRequest drq = new DestinationRequest(); // //drq.LoginHeader = loginHdr; // //drq.Destination = new Destination() { Continent = "North America" }; // //Search Destination Request // DestinationContractsClient dclient = new DestinationContractsClient(); // Destination dst = new Destination(); // dst.Continent = "North America"; // dst.Country = "United States"; // dst.State = "New York"; // dst.City = "New York City"; // try // { // DestinationResult destResult = dclient.GetDestination(loginHdr, dst); // dclient.Close(); // } // catch (Exception ex) // { // } // return View(); //} //NOTE: skipped using this method in POC - GetHotelDetailsV3 could be combined with CheckAvailabilityAndPrices to show more details public ActionResult GetHotelInfo(FormCollection collection) { //AuthHeader Common.hotelflowSvc.AuthenticationHeader auth = new AuthenticationHeader(); auth.LoginName = "Tra105"; auth.Password = "******"; var hotelIds = new HotelID[] { new HotelID { id = Convert.ToInt32(collection["hotelCode"]) } }; HotelFlowClient client = new HotelFlowClient(); TWS_HotelDetailsV3 sreq = client.GetHotelDetailsV3(auth, hotelIds, new Feature[] { new Feature { name = "OriginalImageSize", value = "true" } }); client.Close(); ViewBag.StartDate = collection["startDate"]; ViewBag.EndDate = collection["endDate"]; //return View("HotelInfo", sreq); return View("HotelDisplay", sreq); }
public ActionResult SearchTourico() { //AuthHeader Common.hotelflowSvc.AuthenticationHeader auth = new AuthenticationHeader(); auth.LoginName = "Tra105"; auth.Password = "******"; FormCollection collection = TempData["col"] as FormCollection; //SearchHotelRequest Common.hotelflowSvc.SearchRequest reqCriteria = new SearchRequest(); reqCriteria.CheckIn = Convert.ToDateTime(collection["checkIn"]); reqCriteria.CheckOut = Convert.ToDateTime(collection["checkOut"]); reqCriteria.Destination = "YTO";// collection["add"]; reqCriteria.RoomsInformation = new RoomInfo[] { new RoomInfo { AdultNum = Convert.ToInt16(collection["ddlTotalGuest"]), ChildAges = new ChildAge[] { new ChildAge { age = 5 } }, ChildNum = 1 }}; HotelFlowClient client = new HotelFlowClient(); SearchResult sreq = client.SearchHotels(auth, reqCriteria, new Feature[] { new Feature { name = "OriginalImageSize", value = "true" } }); client.Close(); ViewBag.StartDate = reqCriteria.CheckIn; ViewBag.EndDate = reqCriteria.CheckOut; ViewBag.Adults = Convert.ToInt16(collection["ddlTotalGuest"]); ViewBag.Lat = double.Parse(collection["lat"]); ViewBag.Lan = double.Parse(collection["lan"]); return View("SearchHotel", sreq.HotelList); }
private AuthenticationHeader CreateSecurity() { var authHeader = new AuthenticationHeader(); return authHeader; }
public static string CheckTypingNotification(string chatId) { if (!string.IsNullOrEmpty(chatId)) { OperatorWS ws = new OperatorWS(); AuthenticationHeader auth = new AuthenticationHeader(); if (ws.IsTyping(chatId, true)) return "�ͷ���������... "; else // no one typing... return ""; } else return string.Empty; }
private static void Main(string[] args) { TFCtvAPISoapClient client = new TFCtvAPISoapClient(); AuthenticationHeader header = new AuthenticationHeader() { Username = "******", Password = "******" }; //ReqCreateTFCtvEverywhereEntitlement req = new ReqCreateTFCtvEverywhereEntitlement() //{ // EmailAddress = "*****@*****.**", // GomsCustomerId = 1101294, // GomsProductId = 17112, // GomsProductQuantity = 1, // GomsTFCEverywhereStartDate = Convert.ToDateTime("2013/01/01"), // GomsTFCEverywhereEndDate = Convert.ToDateTime("2013/01/31"), // GomsTransactionDate = Convert.ToDateTime("2013/01/01"), // GomsTransactionId = 100000, // Reference = "TFC.tv Everywhere (GOMS)" //}; //var response = client.CreateTFCtvEverywhereEntitlement(header, req); ReqUnassociateTVEverywhere req = new ReqUnassociateTVEverywhere() { GomsCustomerId = 2520184, GomsTransactionDate = DateTime.Now, GomsTransactionId = 10515275, Reference = "UNCLAIMED", }; var response = client.UnassociateTVEverywhere(header, req); Console.WriteLine(String.Format("Code: {0}, Message: {1}", response.Code, response.Message)); //ReqActivatePpc req = new ReqActivatePpc() //{ // PpcStart = "MBAAD0000035", // PpcEnd = "MBAAD0000045", // ActivatedBy = "gomsuserid", // StatusId = 0 //}; //var resp = client.TogglePpc(header, req); //Console.WriteLine(String.Format("Code: {0}, Message: {1}", resp.Code, resp.Message)); Console.ReadLine(); //ReqReloadWalletViaSmartPit req2 = new ReqReloadWalletViaSmartPit() //{ // Amount = 1150, // GomsCustomerId = 1878159, // GomsTransactionDate = Convert.ToDateTime("2012/08/01"), // GomsTransactionId = 15141856, // GomsWalletId = 21148 //}; //var resp2 = client.ReloadWalletViaSmartPit(header, req2); //Console.WriteLine(String.Format("Code: {0}, Message: {1}", resp2.Code, resp2.Message)); //ReqUpdateSmartPit req3 = new ReqUpdateSmartPit() //{ // GomsCustomerId = 1100994, // SmartPitCardNo = null //}; //var resp3 = client.UpdateSmartPit(header, req3); //Console.WriteLine(String.Format("Code: {0}, Message: {1}", resp3.Code, resp3.Message)); }
public static string SetTypingNotification(string chatId, string msg) { OperatorWS ws = new OperatorWS(); AuthenticationHeader auth = new AuthenticationHeader(); //auth.userName = ConfigurationManager.AppSettings["WSUser"].ToString(); //ws.Authentication = auth; //ws.SetTyping(chatId, false, msg.Length > 0); return string.Empty; }