/// <summary>
 /// 构造函数
 /// </summary>
 public DkdzxxffMsgModel()
 {
     BasicOperation.InitializeByteArray(this.Length, 4);
     BasicOperation.InitializeByteArray(this.Jym, 4);
     BasicOperation.InitializeByteArray(this.Fhz, 4);
     BasicOperation.InitializeByteArray(this.Mxwj, 60);
 }
Exemplo n.º 2
0
 private void Solve(string subOperation)
 {
     if (subOperation.Split(PL.sysOperators, StringSplitOptions.RemoveEmptyEntries).Length <= 2)
     {
         BasicOperation basicOp = new BasicOperation(TruthTable, subOperation);
         if (basicOp.Label == '\0')
         {
             InputStatement = InputStatement.Replace("(" + subOperation + ")", subOperation);
             return;
         }
         InputStatement = InputStatement.Replace("(" + subOperation + ")", basicOp.Label.ToString());
         InputStatement = InputStatement.Replace(subOperation, basicOp.Label.ToString());
         while (InputStatement.Contains("(" + basicOp.Label + ")"))
         {
             InputStatement = InputStatement.Replace("(" + basicOp.Label + ")", basicOp.Label.ToString());
         }
         InputStatement = InputStatement.Replace("¬" + basicOp.Label.ToString(), "(¬" + basicOp.Label.ToString() + ")");
         if (InputStatement.Length > 1 && !InputStatement.Contains('('))
         {
             InputStatement = "(" + InputStatement + ")";
         }
         TruthTable.InsertOpIntoTruthTable(basicOp);
     }
     else
     {
         RefineSubOp(subOperation);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 解析报文
 /// </summary>
 /// <param name="recvBytes"></param>
 public void GetValue(byte[] recvBytes)
 {
     this.Jym  = BasicOperation.GetStringFromRequestMsg(recvBytes, 0, 4);
     this.Sfz  = BasicOperation.GetStringFromRequestMsg(recvBytes, 4, 18);
     this.Zh   = BasicOperation.GetStringFromRequestMsg(recvBytes, 22, 30);
     this.Zhmc = BasicOperation.GetStringFromRequestMsg(recvBytes, 52, 60);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public DkplshfqMsgModel()
 {
     BasicOperation.InitializeByteArray(this.Length, 4);
     BasicOperation.InitializeByteArray(this.Jym, 4);
     BasicOperation.InitializeByteArray(this.Fhz, 4);
     BasicOperation.InitializeByteArray(this.Pch, 20);
 }
        /// <summary>
        /// 设置响应报文
        /// </summary>
        /// <param name="model">请求报文信息实体</param>
        public void SetValue(YhjzrzdzModel model, string fileName)
        {
            ResRtnValueModel modelRtn = new ResRtnValueModel();

            modelRtn.RtnCodeArray = new int[] { 1, 2, 4, 24, 27, 28, 32 };//返回值可能情况
            string fhz = modelRtn.GetRtnValueOnline();

            BasicOperation.SetByteArray(this.Length, "0250");
            BasicOperation.SetByteArray(this.Jym, model.Jym);
            BasicOperation.SetByteArray(this.Fhz, fhz);
            BasicOperation.SetByteArray(this.Dzdmc, "山东路分行对账单");
            BasicOperation.SetByteArray(this.Zhmc, "杭州住房公积金管理中心萧山分中心");
            BasicOperation.SetByteArray(this.Yhzh, "37546458677");
            BasicOperation.SetByteArray(this.Qsrq, model.Qsrq);
            BasicOperation.SetByteArray(this.Zzrq, model.Zzrq);
            BasicOperation.SetByteArray(this.Hzjls, "5");
            BasicOperation.SetByteArray(this.Hzjfbs, "2");
            BasicOperation.SetByteArray(this.Hzjffsz, "1000000");
            BasicOperation.SetByteArray(this.Hzdfbs, "3");
            BasicOperation.SetByteArray(this.Hzdffse, "1000000");

            DateTime dt      = DateTime.Now;
            string   strDate = dt.ToString("yyyyMMdd");

            BasicOperation.SetByteArray(this.Dzrq, strDate);
            BasicOperation.SetByteArray(this.Dzwjmc, fileName);
        }
Exemplo n.º 6
0
        public void Test_Add_OK()
        {
            var basicOperation = new BasicOperation();
            var resuts         = basicOperation.Add(5, 5);

            Assert.AreEqual(10, resuts);
        }
Exemplo n.º 7
0
        public void Test_Substraction_OK()
        {
            var basicOperation = new BasicOperation();
            var resuts         = basicOperation.Subtraction(6, 2);

            Assert.AreEqual(4, resuts);
        }
        /// <summary>
        /// 更新账表分户账和账表明细账
        /// </summary>
        private void UpdateZbInfo(bool execPermission, string[] lineArray)
        {
            if (execPermission)
            {
                ZbfhzModel zbfhz = new ZbfhzModel();
                ZbmxzModel zbmxz = new ZbmxzModel();

                zbmxz.Zh = lineArray[5];
                int iBs = db2Operation.GetCountByZh(zbmxz);
                zbmxz.Bc  = (iBs + 1).ToString();
                zbmxz.Fse = lineArray[3];

                Random radom = new Random();
                zbmxz.Yhls = BasicOperation.GenerateLongBankSerialNum(radom.Next(99));

                zbmxz.Yhls  = model.Pch;
                zbmxz.Pjhm  = lineArray[10];
                zbmxz.Jdbz  = "2";
                zbmxz.Ywlx  = "1";
                zbmxz.Dfzh  = lineArray[2];
                zbmxz.Dfhm  = lineArray[3];
                zbmxz.Zxjsh = lineArray[1];
                zbmxz.Rqrq  = db2Operation.GetDjrqrq();

                zbfhz.Yhzh = zbmxz.Zh;
                zbfhz.Bs   = zbmxz.Bc;
                zbfhz.Hm   = lineArray[6];

                db2Operation.UpateZbfhzAndZbmxz(zbmxz, zbfhz);
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// 解析报文
 /// </summary>
 /// <param name="recvBytes"></param>
 public void GetValue(byte[] recvBytes)
 {
     this.Jym  = BasicOperation.GetStringFromRequestMsg(recvBytes, 0, 4);
     this.Xm   = BasicOperation.GetStringFromRequestMsg(recvBytes, 4, 20);
     this.Kzh  = BasicOperation.GetStringFromRequestMsg(recvBytes, 24, 30);
     this.Kkje = BasicOperation.GetStringFromRequestMsg(recvBytes, 54, 12);
 }
Exemplo n.º 10
0
        /// <summary>
        /// 设置响应报文
        /// </summary>
        /// <param name="model">请求报文信息实体</param>
        public void SetValue(ZqKhsszfModel model)
        {
            ResRtnValueModel modelRtn = new ResRtnValueModel();

            modelRtn.RtnCodeArray = new int[] { 1, 2, 4, 24, 27, 28, 32 };//返回值可能情况
            string fhz = modelRtn.GetRtnValueOnline();

            BasicOperation.SetByteArray(this.Length, "0420");
            BasicOperation.SetByteArray(this.Jym, model.Jym);
            BasicOperation.SetByteArray(this.ReturnCode, fhz);
            BasicOperation.SetByteArray(this.Pch, model.Pch);

            //银行流水
            Random radom = new Random();

            BasicOperation.SetByteArray(this.Yhls, BasicOperation.GenerateLongBankSerialNum(radom.Next(99)));

            BasicOperation.SetByteArray(this.Fkrzh, model.Fkrzh);
            BasicOperation.SetByteArray(this.Fkrmc, model.Fkrmc);
            BasicOperation.SetByteArray(this.Fkyhmc, model.Fkyhmc);
            BasicOperation.SetByteArray(this.Skrzh, model.Skrzh);
            BasicOperation.SetByteArray(this.Skrmc, model.Skrmc);
            BasicOperation.SetByteArray(this.Skyhmc, model.Skyhmc);
            BasicOperation.SetByteArray(this.Je, model.Je);
            BasicOperation.SetByteArray(this.Beiz, model.Beiz);
        }
Exemplo n.º 11
0
 /// <summary>
 /// 解析报文
 /// </summary>
 /// <param name="recvBytes"></param>
 public void GetValue(byte[] recvBytes)
 {
     this.Jym  = BasicOperation.GetStringFromRequestMsg(recvBytes, 0, 4);
     this.Yhzh = BasicOperation.GetStringFromRequestMsg(recvBytes, 4, 30);
     this.Qsrq = BasicOperation.GetStringFromRequestMsg(recvBytes, 34, 8);
     this.Zzrq = BasicOperation.GetStringFromRequestMsg(recvBytes, 42, 8);
 }
Exemplo n.º 12
0
        /// <summary>
        /// 设置响应报文
        /// </summary>
        /// <param name="model">请求报文信息实体</param>
        public void SetValue(DkdbkkModel model)
        {
            ResRtnValueModel modelRtn = new ResRtnValueModel();

            modelRtn.RtnCodeArray = new int[] { 1, 2, 4, 24, 27, 28, 32 };//返回值可能情况
            string fhz  = modelRtn.GetRtnValueOnline();
            string fhxx = modelRtn.RtnInfo;

            BasicOperation.SetByteArray(this.Length, "0274");
            BasicOperation.SetByteArray(this.Jym, model.Jym);
            BasicOperation.SetByteArray(this.Fhz, fhz);
            BasicOperation.SetByteArray(this.Fhxx, fhxx);
            BasicOperation.SetByteArray(this.Lx, "22");
            BasicOperation.SetByteArray(this.Kh, model.Kh);
            BasicOperation.SetByteArray(this.Ykje, model.Ykje);
            BasicOperation.SetByteArray(this.Skje, model.Skje);
            BasicOperation.SetByteArray(this.Xm, model.Xm);
            BasicOperation.SetByteArray(this.Sfz, model.Sfz);
            BasicOperation.SetByteArray(this.Cebz, model.Cebz);
            BasicOperation.SetByteArray(this.Hkqc, model.Hkqc);
            BasicOperation.SetByteArray(this.Hth, model.Hth);
            BasicOperation.SetByteArray(this.Ykbj, model.Ykbj);
            BasicOperation.SetByteArray(this.Yklx, model.Yklx);
            //银行流水
            Random radom = new Random();

            BasicOperation.SetByteArray(this.Yhls, BasicOperation.GenerateLongBankSerialNum(radom.Next(99)));
            BasicOperation.SetByteArray(this.Yl, model.Yl);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 开始监听Tcp连接请求
        /// </summary>
        public void StartTcpListening()
        {
            TcpClient newClient = null;

            tcpEndPoint.myListener = new TcpListener(tcpEndPoint.ipAddress, tcpEndPoint.port);
            tcpEndPoint.myListener.Start(10);//最多监听10个连接请求
            LogHelper.WriteLogInfo("开始Tcp监听,时间", DateTime.Now.ToString());
            tcpRunningTimeInfo.Ht.Add("StartListening", string.Format(">>在端口{0}开始监听,等待公积金中心发起连接请求...", tcpEndPoint.port));
            BasicOperation.ShowInfo(tcpRunningTimeInfo.Ht["StartListening"].ToString());
            while (true)
            {
                try
                {
                    newClient = tcpEndPoint.myListener.AcceptTcpClient();//接收客户端的连接请求,创建一个连接通道;
                    LogHelper.WriteLogInfo("成功与客户端建立连接", newClient.Client.RemoteEndPoint);
                    tcpRunningTimeInfo.Ht.Add("ConnectSuccess", string.Format(">>与客户端{0}建立连接", newClient.Client.RemoteEndPoint));
                    BasicOperation.ShowInfo(tcpRunningTimeInfo.Ht["ConnectSuccess"].ToString());
                }
                catch (Exception ex)
                {
                    tcpRunningTimeInfo.Ht.Add("ConnectFail", "建立与客户端的连接错误");
                    BasicOperation.ShowInfo(tcpRunningTimeInfo.Ht["ConnectFail"].ToString());
                    LogHelper.WriteLogException("建立与客户端的连接错误", ex);
                    break;
                }

                //在新线程中打开与客户端的TCP连接通道,进行监听;
                tcpUserManager = new TcpUserManager(newClient);
                Thread newThread = new Thread(new ParameterizedThreadStart(StartListeningClient));
                newThread.Start(tcpUserManager);
            }
        }
Exemplo n.º 14
0
 private void InsertOpIntoTruthTable(BasicOperation op)
 {
     if (op.TruthValues != null)
     {
         truthTable.AddLast(op);
         Width++;
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// 解析报文
 /// </summary>
 /// <param name="recvBytes"></param>
 public void GetValue(byte[] recvBytes)
 {
     this.Jym  = BasicOperation.GetStringFromRequestMsg(recvBytes, 0, 4);
     this.Mxwj = BasicOperation.GetStringFromRequestMsg(recvBytes, 4, 60);
     this.Mxbs = BasicOperation.GetStringFromRequestMsg(recvBytes, 64, 4);
     this.Qsrq = BasicOperation.GetStringFromRequestMsg(recvBytes, 68, 8);
     this.Zzrq = BasicOperation.GetStringFromRequestMsg(recvBytes, 76, 8);
 }
Exemplo n.º 16
0
 /// <summary>
 /// 解析报文
 /// </summary>
 /// <param name="recvBytes"></param>
 public void GetValue(byte[] recvBytes)
 {
     this.Jym  = BasicOperation.GetStringFromRequestMsg(recvBytes, 0, 4);
     this.Pch  = BasicOperation.GetStringFromRequestMsg(recvBytes, 4, 20);
     this.Zbs  = BasicOperation.GetStringFromRequestMsg(recvBytes, 24, 6);
     this.Zje  = BasicOperation.GetStringFromRequestMsg(recvBytes, 30, 12);
     this.Wjmc = BasicOperation.GetStringFromRequestMsg(recvBytes, 42, 30);
 }
Exemplo n.º 17
0
 /// <summary>
 /// 构造函数,初始化
 /// </summary>
 public SkzhjyMsgModel()
 {
     BasicOperation.InitializeByteArray(this.Length, 4);
     BasicOperation.InitializeByteArray(this.Jym, 4);
     BasicOperation.InitializeByteArray(this.Fhz, 4);
     BasicOperation.InitializeByteArray(this.Fhxx, 60);
     BasicOperation.InitializeByteArray(this.Zh, 30);
     BasicOperation.InitializeByteArray(this.Zhmc, 60);
 }
Exemplo n.º 18
0
        static void Main(string[] args)
        {
            int            num1 = 2, num2 = 3;
            BasicOperation add = Add, mul = Mul;

            DoOperationAndPrint(num1, num2, mul);
            DoOperationAndPrint(num1, num2, add);
            Console.ReadKey();
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            BasicOperation mul = (int a, int b) => { return(a * b); };
            BasicOperation add = (int a, int b) => { return(a + b); };

            Console.WriteLine(add(1, 2));
            Console.WriteLine(mul(3, 4));
            Console.ReadKey();
        }
Exemplo n.º 20
0
 /// <summary>
 /// 解析报文
 /// </summary>
 /// <param name="recvBytes"></param>
 public void GetValue(byte[] recvBytes)
 {
     this.Jym   = BasicOperation.GetStringFromRequestMsg(recvBytes, 0, 4);
     this.Kspch = BasicOperation.GetStringFromRequestMsg(recvBytes, 4, 20);
     this.Jspch = BasicOperation.GetStringFromRequestMsg(recvBytes, 24, 20);
     this.Jgm   = BasicOperation.GetStringFromRequestMsg(recvBytes, 44, 2);
     this.Zbs   = BasicOperation.GetStringFromRequestMsg(recvBytes, 46, 6);
     this.Zje   = BasicOperation.GetStringFromRequestMsg(recvBytes, 52, 16);
 }
Exemplo n.º 21
0
 /// <summary>
 /// 构造函数,初始化
 /// </summary>
 public KyecxMsgModel()
 {
     BasicOperation.InitializeByteArray(this.Length, 4);
     BasicOperation.InitializeByteArray(this.Jym, 4);
     BasicOperation.InitializeByteArray(this.Fhz, 4);
     BasicOperation.InitializeByteArray(this.Xm, 20);
     BasicOperation.InitializeByteArray(this.Kzh, 30);
     BasicOperation.InitializeByteArray(this.Bz, 1);
     BasicOperation.InitializeByteArray(this.Kzt, 1);
 }
Exemplo n.º 22
0
 /// <summary>
 /// 解析报文
 /// </summary>
 /// <param name="recvBytes"></param>
 public void GetValue(byte[] recvBytes)
 {
     this.Jym  = BasicOperation.GetStringFromRequestMsg(recvBytes, 0, 4);
     this.Pch  = BasicOperation.GetStringFromRequestMsg(recvBytes, 4, 20);
     this.Wjmc = BasicOperation.GetStringFromRequestMsg(recvBytes, 24, 30);
     this.Fkzh = BasicOperation.GetStringFromRequestMsg(recvBytes, 54, 30);
     this.Bs   = BasicOperation.GetStringFromRequestMsg(recvBytes, 84, 6);
     this.Je   = BasicOperation.GetStringFromRequestMsg(recvBytes, 90, 12);
     this.Beiz = BasicOperation.GetStringFromRequestMsg(recvBytes, 106, 60);
 }
        public void Addition_Calculate_ReturnsSum()
        {
            // Arrange
            var additionOperation = new BasicOperation();

            // Act
            var result = additionOperation.Addition(5, 6);

            // Assert
            Assert.That(result, Is.EqualTo(11));
        }
Exemplo n.º 24
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public WtwyzzjcdzMsgModel()
 {
     BasicOperation.InitializeByteArray(this.Length, 4);
     BasicOperation.InitializeByteArray(this.Jym, 4);
     BasicOperation.InitializeByteArray(this.Fhz, 4);
     BasicOperation.InitializeByteArray(this.Fhxx, 60);
     BasicOperation.InitializeByteArray(this.Yhzh, 30);
     BasicOperation.InitializeByteArray(this.Wjmc, 30);
     BasicOperation.InitializeByteArray(this.Zbs, 6);
     BasicOperation.InitializeByteArray(this.Zje, 16);
 }
Exemplo n.º 25
0
 /// <summary>
 /// 构造函数,初始化
 /// </summary>
 public WtdkjsrzdzMsgModel()
 {
     BasicOperation.InitializeByteArray(this.Length, 4);
     BasicOperation.InitializeByteArray(this.Jym, 4);
     BasicOperation.InitializeByteArray(this.Fhz, 4);
     BasicOperation.InitializeByteArray(this.Fhxx, 60);
     BasicOperation.InitializeByteArray(this.Jgm, 2);
     BasicOperation.InitializeByteArray(this.Wjmc, 30);
     BasicOperation.InitializeByteArray(this.Zbs, 6);
     BasicOperation.InitializeByteArray(this.Zje, 16);
 }
Exemplo n.º 26
0
        public void Addition_Calculate_ReturnsSum()
        {
            // arrange
            var basicOperation = new BasicOperation();

            // act
            var result = basicOperation.Addition(2, 3);

            // assert
            Assert.That(result, Is.EqualTo(5));
        }
Exemplo n.º 27
0
        public void Subtraction_Calculate_ReturnsDifference()
        {
            // arrange
            var basicOperation = new BasicOperation();

            // act
            var result = basicOperation.Subtraction(20, 5);

            // assert
            Assert.That(result, Is.EqualTo(15));
        }
Exemplo n.º 28
0
        public void Multiplication_Calculate_ReturnsProduct()
        {
            // arrange
            var basicOperation = new BasicOperation();

            // act
            var result = basicOperation.Multiplication(100, 3);

            // assert
            Assert.That(result, Is.EqualTo(300));
        }
Exemplo n.º 29
0
        public void DivisionByZero_Calculate_ReturnsException()
        {
            // arrange
            var basicOperation = new BasicOperation();

            // act
            void Calculation() => basicOperation.Division(100, 0);

            // assert
            Assert.Throws <ZeroDivisorNotAllowedException>(Calculation, "Die Exception wird nicht ausgelöst!");
        }
Exemplo n.º 30
0
        public void Division_Calculate_ReturnsQuotient()
        {
            // arrange
            var basicOperation = new BasicOperation();

            // act
            var result = basicOperation.Division(100, 5);

            // assert
            Assert.That(result, Is.EqualTo(20));
        }