欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

一:构建U8登陆对象

程序员文章站 2022-07-05 11:35:15
...

 一:引用U813.0的登陆dll

一:构建U8登陆对象

 二:编写获取登陆对象方法

 /// <summary>
        /// 构建登录对象
        /// </summary>
        /// <param name="sSubId">U8子模块</param>
        /// <param name="sAccId">账套ID</param>
        /// <param name="sYear">年份</param>
        /// <param name="sUserId">用户账号</param>
        /// <param name="sPassword">用户密码</param>
        /// <param name="sDate">登陆日期</param>
        /// <param name="sServer">登陆服务器地址</param>
        /// <param name="sSerial">默认空</param>
        /// <returns></returns>
        public static U8Login.clsLogin GetU8Login(String sSubId, String sAccId, String sYear, String sUserId, String sPassword, String sDate, String sServer, String sSerial)
        {
            U8Login.clsLogin U8Login = new U8Login.clsLogin();
            bool bSucess = false;
            try
            {
                bSucess = U8Login.Login(ref sSubId, ref sAccId, ref sYear, ref sUserId, ref sPassword, ref sDate, ref sServer, ref sSerial);
                if (bSucess == false)
                {
                    String errMsg = "登陆失败,原因:" + U8Login.ShareString;
                    throw new Exception(errMsg);
                }
                else
                {
                    return U8Login;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

三:登陆参数

   string sSubId = "ST";
            string sAccId = "001";
            string sYear = "2020";
            string sUserId = "wf";
            string sPassword = "";
            string sServer = "127.0.0.1";
            string sSerial = "";
            string Msg = "";
            string sDate = "2020-04-09";  
            U8Login.clsLogin u8login = GetU8Login(sSubId, sAccId, sYear, sUserId, sPassword, sDate, sServer, sSerial);
            string userToken = u8login.userToken;
            string cUserName = u8login.cUserName;