protected ClientCredentials(ClientCredentials other) { if (other == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other"); } if (other._userName != null) { _userName = new UserNamePasswordClientCredential(other._userName); } if (other._clientCertificate != null) { _clientCertificate = new X509CertificateInitiatorClientCredential(other._clientCertificate); } if (other._serviceCertificate != null) { _serviceCertificate = new X509CertificateRecipientClientCredential(other._serviceCertificate); } if (other._windows != null) { _windows = new WindowsClientCredential(other._windows); } if (other._httpDigest != null) { _httpDigest = new HttpDigestClientCredential(other._httpDigest); } _isReadOnly = other._isReadOnly; }
static void Main(string[] args) { using (ChannelFactory <ICalculator> channelFactory = new ChannelFactory <ICalculator>("calculatorService")) { UserNamePasswordClientCredential credential = channelFactory.Credentials.UserName; credential.UserName = "******"; credential.Password = "******"; ICalculator calculator = channelFactory.CreateChannel(); calculator.Add(1, 2); Console.WriteLine("服务调用成功..."); } using (ChannelFactory <ICalculator> channelFactory = new ChannelFactory <ICalculator>("calculatorService")) { UserNamePasswordClientCredential credential = channelFactory.Credentials.UserName; credential.UserName = "******"; credential.Password = "******"; ICalculator calculator = channelFactory.CreateChannel(); try { calculator.Add(1, 2); } catch { Console.WriteLine("服务调用失败..."); } } }
static void Main(string[] args) { using (GithubServiceClient clientGithub = new GithubServiceClient()) { try { Console.WriteLine(clientGithub.Hello()); clientGithub.Close(); } catch (Exception exception) { clientGithub.Abort(); Console.WriteLine(exception.Message); } } using (CSharpDemoServiceClient clientCSharpDemo = new CSharpDemoServiceClient()) { try { Console.WriteLine(clientCSharpDemo.Hello()); clientCSharpDemo.Close(); } catch (Exception exception) { clientCSharpDemo.Abort(); Console.WriteLine(exception.Message); } } using (CustomValidatorServiceClient clientCustomValidatorService = new CustomValidatorServiceClient()) { try { UserNamePasswordClientCredential credential = clientCustomValidatorService.ClientCredentials.UserName; credential.UserName = "******"; //用户名 credential.Password = "******"; //密码 Console.WriteLine(clientCustomValidatorService.Hello()); clientCustomValidatorService.Close(); } catch (Exception exception) { clientCustomValidatorService.Abort(); Console.WriteLine(exception.Message); } } Console.ReadLine(); }
UserNameSecurityTokenProvider CreateUserNameProvider( SecurityTokenRequirement requirement) { UserNamePasswordClientCredential c = credentials.UserName; if (c.UserName == null) { throw new InvalidOperationException("User name is not specified in ClientCredentials."); } UserNameSecurityTokenProvider p = new UserNameSecurityTokenProvider(c.UserName, c.Password); return(p); }
protected ClientCredentials(ClientCredentials other) { if (other == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other"); } if (other._userName != null) { _userName = new UserNamePasswordClientCredential(other._userName); } if (other._httpDigest != null) { _httpDigest = new HttpDigestClientCredential(other._httpDigest); } _isReadOnly = other._isReadOnly; }
public void SetClientCredentials(ClientCredentials credentials) { if (credentials != null) { if (credentials.UserName.UserName != null) { UserNamePasswordClientCredential cred = this.proxy.ClientCredentials.UserName; cred.UserName = credentials.UserName.UserName; cred.Password = credentials.UserName.Password; } else { WindowsClientCredential cred = this.proxy.ClientCredentials.Windows; cred.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; } } }
protected ClientCredentials(ClientCredentials other) { if (other == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other"); } if (other.userName != null) { this.userName = new UserNamePasswordClientCredential(other.userName); } if (other.clientCertificate != null) { this.clientCertificate = new X509CertificateInitiatorClientCredential(other.clientCertificate); } if (other.serviceCertificate != null) { this.serviceCertificate = new X509CertificateRecipientClientCredential(other.serviceCertificate); } if (other.windows != null) { this.windows = new WindowsClientCredential(other.windows); } if (other.httpDigest != null) { this.httpDigest = new HttpDigestClientCredential(other.httpDigest); } if (other.issuedToken != null) { this.issuedToken = new IssuedTokenClientCredential(other.issuedToken); } if (other.peer != null) { this.peer = new PeerCredential(other.peer); } this.getInfoCardTokenCallback = other.getInfoCardTokenCallback; this.supportInteractive = other.supportInteractive; this.securityTokenHandlerCollectionManager = other.securityTokenHandlerCollectionManager; this.useIdentityConfiguration = other.useIdentityConfiguration; this.isReadOnly = other.isReadOnly; }
/// <summary> /// 登陆按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BT_Login_Click(object sender, EventArgs e) { UserSummery_Client = new UserSummeryClient(); UNPCC_UserSummery = UserSummery_Client.ClientCredentials.UserName; UNPCC_UserSummery.UserName = TB_UserName.Text; UNPCC_UserSummery.Password = TB_Password.Text; try { GlobalParams.UserID = Guid.Parse(UserSummery_Client.UserLogOn(TB_UserName.Text, TB_Password.Text)); GlobalParams.UserName = TB_UserName.Text; GlobalParams.Password = TB_Password.Text; } catch (Exception) { MessageBox.Show("账号或密码错误,请检查拼写"); return; } UserManager_Client = new UserManagerClient(); UNPCC_UserManager = UserManager_Client.ClientCredentials.UserName; UNPCC_UserManager.UserName = GlobalParams.UserName; UNPCC_UserManager.Password = GlobalParams.Password; ClientFactory.AddClient <UserManagerClient>(ClientType.Type.UserManager, UserManager_Client); List <String> List_Role = UserManager_Client.RoleSelect_UserName(GlobalParams.UserName).ToList(); GlobalParams.ShopID = UserManager_Client.SelectShopID_UserID(GlobalParams.UserID); if (List_Role.Count != 0) { bool mark = false; foreach (String rolename in List_Role) { if (rolename == "普通员工" || rolename == "管理员" || rolename == "超级管理员") { mark = true; continue; } } if (mark) { Form_LoginRole form = new Form_LoginRole(List_Role); form.Owner = this; form.OnSave += new Form_LoginRole.Save(Show_Work); form.ShowDialog(); } else { MessageBox.Show("您的账号不适用于操作本系统!!!", "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); this.Close(); } } else { Show_Work(List_Role.First()); } //UserSummery_Client.UserReg( //new User_ViewModel() //{ UserName = "******", // UserPassword="******", // Question="what's my name?", // Answer="dutianhang", // Email="*****@*****.**" //}, //new aspnet_UsersEX() //{User_RealName="杜天行", // User_Validation="51390119900410021x", // User_Phone="13882821913", // User_Adress="no have" }); }
internal UserNamePasswordClientCredential(UserNamePasswordClientCredential other) { _userName = other._userName; _password = other._password; _isReadOnly = other._isReadOnly; }
protected SecureClientBase(UserNamePasswordClientCredential credentials, Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { this.SecureProxy(credentials.UserName, credentials.Password); }
protected SecureClientBase(UserNamePasswordClientCredential credentials, string endpointName) : base(endpointName) { this.SecureProxy(credentials.UserName, credentials.Password); }
internal UserNamePasswordClientCredential(UserNamePasswordClientCredential other) { _userName = other._userName; _password = other._password; _isReadOnly = other._isReadOnly; }
/// <summary> /// 客户端服务实例产生器 /// </summary> /// <param name="type">产生的服务类型</param> /// <returns></returns> private static object build(ClientType.Type type) { switch (type) { case ClientType.Type.Account: { AccountClient temp = new AccountClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <AccountClient>(type, temp); return(temp); } case ClientType.Type.Action: { ActionClient temp = new ActionClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <ActionClient>(type, temp); return(temp); } case ClientType.Type.Brand: { BrandClient temp = new BrandClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <BrandClient>(type, temp); return(temp); } case ClientType.Type.CarSummery: { CarSummeryClient temp = new CarSummeryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <CarSummeryClient>(type, temp); return(temp); } case ClientType.Type.Checkout: { CheckoutClient temp = new CheckoutClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <CheckoutClient>(type, temp); return(temp); } case ClientType.Type.City: { CityClient temp = new CityClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <CityClient>(type, temp); return(temp); } case ClientType.Type.Order: { OrderClient temp = new OrderClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <OrderClient>(type, temp); return(temp); } case ClientType.Type.OrderSummery: { OrderSummeryClient temp = new OrderSummeryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <OrderSummeryClient>(type, temp); return(temp); } case ClientType.Type.Province: { ProvinceClient temp = new ProvinceClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <ProvinceClient>(type, temp); return(temp); } case ClientType.Type.RAP: { RAPClient temp = new RAPClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <RAPClient>(type, temp); return(temp); } case ClientType.Type.Salary: { SalaryClient temp = new SalaryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <SalaryClient>(type, temp); return(temp); } case ClientType.Type.SalaryAppend: { SalaryAppendClient temp = new SalaryAppendClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <SalaryAppendClient>(type, temp); return(temp); } case ClientType.Type.SalaryInfoSummery: { SalaryInfoSummeryClient temp = new SalaryInfoSummeryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <SalaryInfoSummeryClient>(type, temp); return(temp); } case ClientType.Type.SalaryLog: { SalaryLogClient temp = new SalaryLogClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <SalaryLogClient>(type, temp); return(temp); } case ClientType.Type.Shop: { ShopClient temp = new ShopClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <ShopClient>(type, temp); return(temp); } case ClientType.Type.Type: { TypeClient temp = new TypeClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <TypeClient>(type, temp); return(temp); } case ClientType.Type.Version: { VersionClient temp = new VersionClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <VersionClient>(type, temp); return(temp); } case ClientType.Type.WorkRAP: { WorkRAPClient temp = new WorkRAPClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <WorkRAPClient>(type, temp); return(temp); } case ClientType.Type.UserManager: { UserManagerClient temp = new UserManagerClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <UserManagerClient>(type, temp); return(temp); } case ClientType.Type.UserSummery: { UserSummeryClient temp = new UserSummeryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <UserSummeryClient>(type, temp); return(temp); } case ClientType.Type.GetCar: { GetCarClient temp = new GetCarClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <GetCarClient>(type, temp); return(temp); } } ; return(null); }
public void UserName() { ClientCredentials c = new ClientCredentials(); // FIXME: implement UserNamePasswordClientCredential userpass = c.UserName; }
public override Result AddOrderTrade(int orderSysno) { Result result = new Result(); var order = BLL.Order.SoOrderBo.Instance.GetEntity(orderSysno); CrCustomer customer = Hyt.BLL.CRM.CrCustomerBo.Instance.GetModel(order.CustomerSysNo); WhWarehouse warehouseMod = Hyt.BLL.Warehouse.WhWarehouseBo.Instance.GetWarehouse(order.DefaultWarehouseSysNo); BsArea wareDistrictEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(warehouseMod.AreaSysNo); BsArea wareCityEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(wareDistrictEntity.ParentSysNo); BsArea wareProvinceEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(wareDistrictEntity.ParentSysNo); SoReceiveAddress srenity = Hyt.BLL.Order.OutboundReturnBo.Instance.GetSoReceiveAddressBysoOrderSysNo(order.SysNo); BsArea DistrictEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(srenity.AreaSysNo); BsArea CityEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(DistrictEntity.ParentSysNo); BsArea ProvinceEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(CityEntity.ParentSysNo); var kuaidi = Hyt.BLL.Logistics.DeliveryTypeBo.Instance.GetKuaidi(orderSysno); IList <CBSoOrderItem> datao = SoOrderBo.Instance.GetCBOrderItemsByOrderId(order.SysNo); order.OrderItemList = new List <SoOrderItem>(); int ParcelNo = 0; string GoodsName = ""; foreach (CBSoOrderItem item in datao) { ParcelNo += item.Quantity; GoodsName = item.EasName; order.OrderItemList.Add(item); } CrossBorderParam cp = new CrossBorderParam(); cp.Cost = order.FreightAmount; cp.OrderDateTime = order.CreateDate; cp.OrderNo = order.SysNo.ToString().Trim(); cp.CustomerID = 689; cp.S_Address = warehouseMod.BackWarehouseName.Trim(); cp.S_Province = wareProvinceEntity.AreaName.Trim(); cp.S_City = wareCityEntity.AreaName.Trim(); cp.S_County = wareDistrictEntity.AreaName.Trim(); cp.S_Name = warehouseMod.WarehouseName.Trim(); cp.S_Phone = warehouseMod.Phone.Trim(); if (!string.IsNullOrEmpty(srenity.IDCardNo)) { cp.R_IDNo = srenity.IDCardNo.Trim().ToUpper(); } cp.R_Name = srenity.Name.Trim(); cp.R_Phone = srenity.MobilePhoneNumber.Trim(); cp.R_Address = srenity.StreetAddress.Trim(); cp.R_Province = ProvinceEntity.AreaName.Trim(); cp.R_City = CityEntity.AreaName.Trim(); cp.R_County = DistrictEntity.AreaName.Trim(); cp.Type = "4"; cp.ParcelNo = ParcelNo; cp.GoodsName = GoodsName; cp.Mark = "300-012-005"; cp.Batch = "114批"; cp.DeliveryType = -1; cp.PrintSenderMsg = warehouseMod.WarehouseName.Trim(); cp.PayType = -1; cp.Company = kuaidi.Company; cp.Date = kuaidi.Date; cp.TrackingNo = kuaidi.TrackingNo; using (ChannelFactory <IExpress> channelFactory = new ChannelFactory <IExpress>("WSHttpBinding_IExpress")) { UserNamePasswordClientCredential credential = channelFactory.Credentials.UserName; credential.UserName = UserName; credential.Password = Password; IExpress calculator = channelFactory.CreateChannel(); #region 参数 T_Express express = new T_Express { PicLocalNo = cp.PicLocalNo, Batch = cp.Batch, Type = cp.Type, S_Name = cp.S_Name, S_Phone = cp.S_Phone, S_Province = cp.S_Province, S_City = cp.S_City, S_County = cp.S_County, S_Address = cp.S_Address, R_Name = cp.R_Name, R_Phone = cp.R_Phone, R_Province = cp.R_Province, R_City = cp.R_City, R_County = cp.R_County, R_Address = cp.R_Address, R_IDNo = cp.R_IDNo, OrderNo = cp.OrderNo, GoodsName = cp.GoodsName, CollectionPayment = cp.CollectionPayment, Cost = cp.Cost, OrderDateTime = cp.OrderDateTime, Account = cp.Account, BankAccount = cp.BankAccount, PayType = cp.PayType, DeliveryType = cp.DeliveryType, Mark = cp.Mark, PrintSenderMsg = cp.PrintSenderMsg, ParcelNo = cp.ParcelNo.ToString(), Date = DateTime.Parse(cp.Date), Company = cp.Company, TrackingNo = cp.TrackingNo, CustomerID = cp.CustomerID #region 测试数据 // //预留溯源码 //Batch = "114批", ////已下订单,未受理 //Type = "4", //S_Name = "货之家", //S_Phone = "15802026993", //S_Province = "广东省", //S_City = "广州市", //S_County = "南沙区", //S_Address = "货之家保税仓", //R_Name = "周恒", //R_Phone = "13662656512", //R_Province = "四川省", //R_City = "达州市", //R_County = "开江县", //R_Address = "新宁镇接龙桥惠民社区5号楼三楼八号", //R_IDNo = "440103698954523618", //OrderNo = "Test_70151538959", ////快递面单,底部信息 //GoodsName = "日用品", //Company = "圆通", //TrackingNo = "81257111826892", //Cost = 0, ////订单日期 //OrderDateTime = DateTime.Parse("2018-01-08 09:48:23"), //PayType = -1, //DeliveryType = -1, ////三段码、大头笔 //Mark = "300-012-005", ////覆盖详细的发件信息 //PrintSenderMsg = "货之家南沙保税仓", //ParcelNo = "1", ////快递单日期 //Date = DateTime.Parse("2018-01-08 09:48:23"), ////新绕城,固定为689 //CustomerID = 689, //PicLocalNo = null, //CollectionPayment = null, //可空 = null, //BankAccount = null, #endregion }; #endregion result.Status = calculator.ExpressSaveOrUpdate(express); } return(result); }