private void AC_ReceiveMsgCallBack(Result result)
        {
            if (!BlockKey.IsBlock(result.data))
            {
                LogUtil.DebugFormat("收到[{0}]:{1}", result.ipEndPoint, result.data);
            }

            OrderCode code = result.data.code;

            if (code == OrderCode.ClientRquest)
            {
                Data _data = new Data()
                {
                    code = OrderCode.ServerResponse,
                    msg  = "success",
                };
                _server.Send(_data, result.ipEndPoint);
                _server.Send(new Data(OrderCode.HeartBeat), result.ipEndPoint);

                addClient(result.ipEndPoint);
            }

            if (receiveMsgCallBack != null)
            {
                receiveMsgCallBack(result);
            }
        }
Example #2
0
        public void ValidFromData()
        {
            var orderId         = 12345;
            var containerNumber = 1;
            var divisionNumber  = 2;
            var year            = 2023;
            var code            = new OrderCode(orderId, containerNumber, divisionNumber, year);

            Assert.AreEqual("DZ0000123450010223", code.Code);
        }
Example #3
0
 public override void LoadData(string data)
 {
     if (OrderCode.TryParse(data, out OrderCode orderCode))
     {
         OrderId         = orderCode.OrderId;
         ContainerNumber = orderCode.ContainerNumber;
         DivisionNumber  = orderCode.DivisionNumber;
         Year            = orderCode.Year;
     }
 }
Example #4
0
 public ToServerBuffer(OrderCode orderCode, String userName, sbyte serverIndex, String serverDomain, short maxPing, ushort port)
 {
     this.orderCode         = orderCode;
     this.userNameTable     = new char[DataConst.userNameBufferSize];
     this.userName          = userName;
     this.serverIndex       = serverIndex;
     this.serverDomainTable = new char[DataConst.serverDomainBufferSize];
     this.serverDomain      = serverDomain;
     this.maxPing           = maxPing;
     this.port = port;
 }
Example #5
0
        public void ValidFromString()
        {
            var codeString = "DZ0000123450010223";
            var code       = new OrderCode(codeString);

            Assert.AreEqual(12345, code.OrderId);
            Assert.AreEqual(1, code.ContainerNumber);
            Assert.AreEqual(2, code.DivisionNumber);
            Assert.AreEqual(2023, code.Year);
            Assert.AreEqual(codeString, code.Code);
        }
Example #6
0
 public ResResultModel GetPanYingBarcode()
 {
     try
     {
         OrderCode o = new OrderCode();
         return(ResResult.Response(true, "", o.GetOrderCode(((int)EnumData.EnumOrderPrefix.盘盈).ToString())));
     }
     catch (Exception ex)
     {
         return(ResResult.Response(false, ex.Message, ""));
     }
 }
Example #7
0
        public void CreateOrderCode(string response, string hashKey, string request)
        {
            OrderCode oc = new OrderCode
            {
                Key        = hashKey,
                FinishTime = DateTime.UtcNow,
                Response   = response,
                Request    = request
            };

            _context.OrderCode.Add(oc);
            _context.SaveChanges();
        }
        /// <summary>
        /// 处理接收到的信息
        /// </summary>
        /// <param name="result"></param>
        /// <param name="udp"></param>
        private void AC_ReceiveMsgCallBack(Result result)
        {
            if (!BlockKey.IsBlock(result.data))
            {
                LogUtil.DebugFormat("收到[{0}]:{1}", result.ipEndPoint, result.data);
            }

            OrderCode code = result.data.code;

            if (code == OrderCode.ServerResponse)
            {
                conSuccess(result);
            }

            if (receiveMsgCallBack != null)
            {
                receiveMsgCallBack(result);
            }
        }
Example #9
0
        public override void UpdateData()
        {
            base.UpdateData();

            OrderBackround?.SetBackgroundColor(ColorConstants.BlackColor);

            if (OrderCode != null)
            {
                OrderCode.Text = ROrderBar.OrderCode;
                OrderCode.SetTextColor(ColorConstants.WhiteColor);
                OrderCode.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size18);
            }

            if (OrderCodeValue == null)
            {
                return;
            }
            OrderCodeValue.Text = OrderManager.Instance.OrderType == OrderVisibility.Local ?
                                  TableNumber :
                                  OrderManager.Instance.CurrentOrderServer.Id.ToString();

            OrderCodeValue.SetTextColor(ColorConstants.SelectorHome);
            OrderCodeValue.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size36);
        }
Example #10
0
 public int CompareTo(Order obj)
 {
     return(OrderCode.CompareTo(obj.OrderCode));
 }
Example #11
0
 public Data(OrderCode code, string msg)
 {
     this.code = code;
     this.msg  = msg;
 }
Example #12
0
 public Data(OrderCode code)
 {
     this.code = code;
 }
 public void SendToServer(OrderCode code, string msg = null)
 {
     SendToServer(new Data(code, msg));
 }
    protected void btnOnayla_Click(object sender, EventArgs e)
    {
        int paymentTypeId           = 0;
        List <GgDB.Product> urunler = new List <GgDB.Product>();

        urunler = Session["urunler"] as List <GgDB.Product>;
        GgDB.Product p = new GgDB.Product();
        string       fiyat;
        string       kilo;
        string       ad;
        int          i    = 0;
        string       body = txtAdres.Text.Trim();

        body += " adresine istenilen sipariş şu şekildedir: \n \n";
        while (i < urunler.Count)
        {
            p     = urunler[i];
            ad    = p.ProductName;
            fiyat = p.Price.ToString();
            kilo  = p.Quantity.ToString();
            body += "     " + ad + " ürününden ";
            body += kilo + " kg ";
            body += "(" + fiyat + " TL" + "),\n";
            ++i;
        }
        body += "\nEkli Notlar: " + txtNot.Text;
        body += "\nOrganic Online ekibi bol kazançlar diler.";
        string manavMail;

        manavMail = p.Supplier.User.E_mail;

        if (rb1.Checked)
        {
            paymentTypeId = 1;
        }
        if (rb2.Checked)
        {
            paymentTypeId = 2;
        }
        else if (rb3.Checked)
        {
            paymentTypeId = 3;
        }
        else
        {
            pBilgi.Visible   = true;
            pBilgi.InnerText = "Lütfen ödeme tipini belirtiniz.";
            return;
        }

        //try
        //{
        OrderCode code = new OrderCode();

        GgDbProvider.AddToOrderCode(code);
        GgDbProvider.SaveChanges();
        User customer = Session["Oturum"] as User;

        if (customer == default(User))
        {
            Response.Redirect("Login.aspx");
        }
        foreach (Product item in urunler)
        {
            GgDbProvider.AddOrder(customer.ObjectID, item.ObjectID, 1, paymentTypeId, item.Quantity, txtAdres.Text.Trim(), txtNot.Text.Trim(), code.ObjectId);
        }
        GgDbProvider.SaveChanges();


        MailMessage mail   = new MailMessage("*****@*****.**", manavMail);
        SmtpClient  client = new SmtpClient();

        client.Port                  = 587;
        client.DeliveryMethod        = SmtpDeliveryMethod.Network;
        client.EnableSsl             = true;
        client.UseDefaultCredentials = false;
        client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "ggdb1234");
        client.Host                  = "smtp.gmail.com";
        mail.Subject                 = "Ürün Siparişi";
        mail.Body = body;
        client.Send(mail);

        txtAdres.Text = "";
        txtNot.Text   = "";
        Session.Remove("Urunler");
        Session.Remove("urunler");
        Session.Remove("ToplamFiyat");
        pBilgi.Visible     = true;
        pBilgi.InnerText   = code.ObjectId + " numaralı siparişiniz başarıyla gönderilmiştir. En yakın sürede adresinize ulaşacaktır.";
        rptUrunler.Visible = false;
        txtNot.Visible     = false;
        txtAdres.Visible   = false;
        btnOnayla.Visible  = false;
        pnlPaymnet.Visible = false;



        //}
        //catch
        //{
        //    Response.Write("<script>alert('Sipariş gönderilirken bir hata oldu lütfen bir daha deneyiniz.');</script>");
        //    UrunleriGetir(urunler);
        //}
    }
 public void Send(OrderCode code, string msg, IPEndPoint ipEndPoint)
 {
     _server.Send(new Data(code, msg), ipEndPoint);
 }
 public void Send(OrderCode code, IPEndPoint ipEndPoint)
 {
     Send(code, null, ipEndPoint);
 }