Ejemplo n.º 1
0
        public void SetPayItem(PayMode mode)
        {
            IEnumerable <PayItem> pays = this.itemsPay.ItemsSource as IEnumerable <PayItem>;
            var payItem = pays.FirstOrDefault(o => o.Mode == mode);

            if (payItem != null)
            {
                switch (PayAction)
                {
                case Models.PosModels.PayAction.RefundAll:
                case Models.PosModels.PayAction.Refund:
                case Models.PosModels.PayAction.Change:
                    if (payItem.Mode != PayMode.CashPay)
                    {
                        Toast.ShowMessage("退换货当前只允许现金支付!", this);
                        return;
                    }
                    break;
                }
                PayItem           = payItem;
                txtChoosePay.Text = "已选择" + PayItem.Title;
            }
            //Task.Factory.StartNew(() =>
            //{
            //    Thread.Sleep(300);
            //    this.Dispatcher.Invoke(new Action(() =>
            //    {
            //        txtAmount.Focus();
            //    }));
            //});
        }
        public string EditPayment(PayMode Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedPaymentValue = new LMS_Datas.PayMode
                    {
                        Active    = true,
                        PayModeId = Model.PayModeId,
                        PayMode1  = Model.PayMode1
                    };

                    entity.PayModes.Attach(enditedPaymentValue);
                    entity.Entry(enditedPaymentValue).Property(x => x.PayMode1).IsModified = true;
                    entity.Entry(enditedPaymentValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 统一下单接口
        /// </summary>
        /// <param name="payMode">参数</param>
        /// <returns></returns>
        public ReturnModels <xml> Unifiedorder(string key, PayMode payMode)
        {
            var result = new ReturnModels <xml>();

            if (payMode != null)
            {
                try
                {
                    payMode.sign = CommTool.MD5MakeSigne(payMode.ToDictionary(), key);
                    var parmxml = payMode.ToDictionary();
                    var rdata   = HttpSendResult.SendRequest(this.url, parmxml.ToXML(), "POST", "text/xml");
                    result.RetrnData = rdata.Deserialize <xml>();
                }
                catch (Exception ex)
                {
                    result.HasError = true;
                    result.Message  = ex.Message;
                }
            }
            else
            {
                result.HasError = true;
                result.Message  = "支付参数为空对象。";
            }
            return(result);
        }
Ejemplo n.º 4
0
 private void UpdateInAmount(eStoreDbContext db, decimal Amount, PayMode PayMode, DateTime PaymentDate, bool IsEdit)
 {
     if (IsEdit)
     {
         if (PayMode == PayMode.Cash)
         {
             CashTrigger.UpdateCashInHand(db, PaymentDate, 0 - Amount);
         }
         //TODO: in future make it more robust
         if (PayMode != PayMode.Cash && PayMode != PayMode.Coupons && PayMode != PayMode.Points)
         {
             CashTrigger.UpdateCashInBank(db, PaymentDate, 0 - (Amount - Amount));
         }
     }
     else
     {
         if (PayMode == PayMode.Cash)
         {
             CashTrigger.UpdateCashInHand(db, PaymentDate, Amount);
         }
         //TODO: in future make it more robust
         if (PayMode != PayMode.Cash && PayMode != PayMode.Coupons && PayMode != PayMode.Points)
         {
             CashTrigger.UpdateCashInBank(db, PaymentDate, Amount - Amount);
         }
     }
 }
 public ActionResult Index(PayMode model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (var context = new LoyaltyManagementSystemEntities())
             {
                 var payMode = new LMS_Datas.PayMode()
                 {
                     PayMode1 = model.PayMode1,
                     Active   = true
                 };
                 context.PayModes.Add(payMode);
                 context.SaveChanges();
             }
         }
         ViewBag.alert = "Success";
         return(View());
     }
     catch (Exception e1)
     {
         ViewBag.alert = "Error";
         return(View());
     }
 }
Ejemplo n.º 6
0
        public void SetPayItem(PayMode mode)
        {
            var payItem = MultiPayViewModel.PayItems.LastOrDefault(o => o.PayItem != null && o.PayItem.Mode == mode);

            if (payItem != null)
            {
                RemovePayItem(payItem);
            }
        }
Ejemplo n.º 7
0
        private DataReportConsumeGoods BuildSalesGoodsInfo(DataRow dr)
        {
            DataReportConsumeGoods goods = new DataReportConsumeGoods();

            goods.ID = (string)dr["order_id"];
            if (!string.IsNullOrEmpty(dr["code"].ToString()))
            {
                goods.GoodsID = (string)dr["code"];
            }
            if (!string.IsNullOrEmpty(dr["name"].ToString()))
            {
                goods.GoodsName = (string)dr["name"];
            }
            if (!string.IsNullOrEmpty(dr["ean"].ToString()))
            {
                goods.Ean = (string)dr["ean"];
            }
            if (!string.IsNullOrEmpty(dr["num"].ToString()))
            {
                goods.Num = Convert.ToInt32(dr["num"].ToString());
            }
            if (!string.IsNullOrEmpty(dr["total_amount"].ToString()))
            {
                goods.Amount = Convert.ToDecimal(dr["total_amount"].ToString());
            }
            if (!string.IsNullOrEmpty(dr["operator_id"].ToString()))
            {
                UserDAL dal = new UserDAL();
                goods.Opter = dal.QueryByOptrID((int)dr["operator_id"]).name;
            }
            if (!string.IsNullOrEmpty(dr["units"].ToString()))
            {
                goods.Units = dr["units"].ToString();
            }
            if (!string.IsNullOrEmpty(dr["dt"].ToString()))
            {
                goods.Date = ((DateTime)dr["dt"]).ToString();
            }

            int pay_mode = 0;

            if (!string.IsNullOrEmpty(dr["pay_mode"].ToString()))
            {
                pay_mode = Convert.ToInt32(dr["pay_mode"].ToString());
            }


            goods.PayType = PayMode.getStringbyMode(pay_mode);

            return(goods);
        }
Ejemplo n.º 8
0
        public IList <UserPayOrderInfo> GetNeedQueryOrderList(PayMode mobileWeb)
        {
            using (System.Data.Common.DbCommand cmd = Context.Database.Connection.CreateCommand())
            {
                try
                {
                    var orderList = new List <UserPayOrderInfo>();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "P_PAY_QueryUnclosedPayOrderInfos";
                    cmd.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@PayMode",
                        Value         = (int)mobileWeb
                    });
                    if (cmd.Connection.State != ConnectionState.Open)
                    {
                        cmd.Connection.Open();
                    }

                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var order = new UserPayOrderInfo();
                            order.CreateTime = Convert.ToDateTime(reader["CreateTime"]);
                            order.PayAppID   = reader["PayAppID"].ToString();
                            order.State      = Convert.ToInt32(reader["State"]);
                            order.UId        = Convert.ToInt32(reader["UID"]);
                            order.Id         = reader["ID"].ToString();
                            order.PayType    = Convert.ToInt32(reader["PayType"]);
                            orderList.Add(order);
                        }
                    }

                    return(orderList);
                }
                catch (Exception ex)
                {
                    LogHelper.Logger.Error(ex.Message);
                    return(null);
                }
            }
        }
Ejemplo n.º 9
0
        public static IPay Factory(int companyId, string storeId, string machineSn, string deviceSn, PayMode mode, List <PayDetails> details, decimal receivable, Action <IPay> callBack = null)
        {
            IPay pay;

            if (mode == PayMode.Multiply)
            {
                var tempPay = new MultiplyPay();
                tempPay.Init(companyId, storeId, machineSn, deviceSn);
                tempPay.AllPayDetails = details;
                var first = details.FirstOrDefault();
                tempPay.PayDetails = new PayDetails()
                {
                    Amount   = details.Sum(o => o.Amount),
                    CreateDt = first.CreateDt,
                    PaySn    = first.PaySn,
                    CardNo   = string.Empty,
                    WipeZero = details.Sum(o => o.WipeZero),
                    Change   = details.Sum(o => o.Change),
                    Receive  = details.Sum(o => o.Receive),
                    Mode     = PayMode.Multiply
                };
                pay = tempPay;
            }
            else
            {
                pay = Factory(companyId, storeId, machineSn, deviceSn, mode, details.FirstOrDefault(), receivable);
            }
            if (callBack != null)
            {
                pay.CallBack = callBack;
            }
            return(pay);
        }
Ejemplo n.º 10
0
        public static IPay Factory(int companyId, string storeId, string machineSn, string deviceSn, PayMode mode, PayDetails details, decimal receivable)
        {
            var pay = GetPays().FirstOrDefault(o => o.Mode == mode);

            if (pay == null)
            {
                throw new PosException("支付方式未授权或者未开启!");
            }
            pay.Init(companyId, storeId, machineSn, deviceSn);
            pay.PayDetails = details;
            return(pay);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Create a sub account under the master account.
        /// </summary>
        /// <param name="firstName">User's first name.</param>
        /// <param name="lastName">User's last name.</param>
        /// <param name="email">User's email address.</param>
        /// <param name="password">User's password.</param>
        /// <param name="useSharedVirtualRoomConnectors">Enable/disable the option for a sub account to use shared Virtual Room Connector(s).</param>
        /// <param name="roomConnectorsIpAddresses">The IP addresses of the Room Connectors that you would like to share with the sub account.</param>
        /// <param name="useSharedMeetingConnectors">Enable/disable the option for a sub account to use shared Meeting Connector(s).</param>
        /// <param name="meetingConnectorsIpAddresses">The IP addresses of the Meeting Connectors that you would like to share with the sub account.</param>
        /// <param name="payMode">Payee.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// An array of <see cref="Account">accounts</see>.
        /// </returns>
        public Task <Account> CreateAsync(string firstName, string lastName, string email, string password, bool useSharedVirtualRoomConnectors = false, IEnumerable <string> roomConnectorsIpAddresses = null, bool useSharedMeetingConnectors = false, IEnumerable <string> meetingConnectorsIpAddresses = null, PayMode payMode = PayMode.Master, CancellationToken cancellationToken = default)
        {
            var data = new JObject()
            {
                { "first_name", firstName },
                { "last_name", lastName },
                { "email", email },
                { "password", password }
            };

            data.AddPropertyIfValue("options/share_rc", useSharedVirtualRoomConnectors);
            data.AddPropertyIfValue("options/room_connectors", roomConnectorsIpAddresses, ipAddresses => JToken.Parse(string.Join(",", ipAddresses)));
            data.AddPropertyIfValue("options/share_mc", useSharedMeetingConnectors);
            data.AddPropertyIfValue("options/meeting_connectors", meetingConnectorsIpAddresses, ipAddresses => JToken.Parse(string.Join(",", ipAddresses)));
            data.AddPropertyIfValue("options/pay_mode", payMode);

            return(_client
                   .PostAsync($"accounts")
                   .WithJsonBody(data)
                   .WithCancellationToken(cancellationToken)
                   .AsObject <Account>());
        }
Ejemplo n.º 12
0
 public BasePay(int apiCode, PayMode mode)
 {
     ApiCode  = apiCode;
     ApiCodes = apiCode.ToString();
     Mode     = mode;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 获取交易类型字符串
 /// </summary>
 /// <param name="mode">支付模式</param>
 /// <returns></returns>
 public static string GetTradeType(PayMode mode)
 {
     return(_tradeType[mode]);
 }
Ejemplo n.º 14
0
 public IList <UserPayOrderInfo> GetNeedQueryOrderList(PayMode mobileWeb)
 {
     return(_purchaseServiceRepository.GetNeedQueryOrderList(mobileWeb));
 }