Exemplo n.º 1
0
    public static Tweener Move(this GameObject go, EquipTransInfo equipTransInfo, Ease ease, bool useRecord = false)
    {
        Tweener t;

        if (useRecord)
        {
            TransInfo transInfo = new TransInfo();
            t = go.transform.DOLocalMove(equipTransInfo.pos, equipTransInfo.time).SetDelay(equipTransInfo.delay).SetEase(ease);

            go.transform.DOLocalRotate(equipTransInfo.rot, equipTransInfo.time).SetDelay(equipTransInfo.delay).SetEase(ease);
            go.transform.DOScale(equipTransInfo.scale, equipTransInfo.time).SetDelay(equipTransInfo.delay).SetEase(ease);

            DOTween.To(() => go.transform.localScale, x =>
            {
                transInfo.positon     = go.transform.localPosition;
                transInfo.eulerAngles = go.transform.localEulerAngles;
                transInfo.localScale  = go.transform.localScale;
                ((TransformMoveDataEntity)go.GetComponent <TransformMoveDataModel>().DataEntity).transInfo = transInfo;
            }, Vector3.one, equipTransInfo.time).SetDelay(equipTransInfo.delay).SetEase(ease);
        }
        else
        {
            t = go.transform.DOLocalMove(equipTransInfo.pos, equipTransInfo.time).SetDelay(equipTransInfo.delay).SetEase(ease);

            go.transform.DOLocalRotate(equipTransInfo.rot, equipTransInfo.time).SetDelay(equipTransInfo.delay).SetEase(ease);
            go.transform.DOScale(equipTransInfo.scale, equipTransInfo.time).SetDelay(equipTransInfo.delay).SetEase(ease);
        }


        return(t);
    }
Exemplo n.º 2
0
 public int RemoveTrans(TransInfo transInfo)
 {
     using (var db = new EasyEsb())
     {
         return(db.Delete <TransInfo>(transInfo));
     }
 }
Exemplo n.º 3
0
 public int AddTrans(TransInfo transInfo)
 {
     using (var db = new EasyEsb())
     {
         return(db.Insert <TransInfo>(transInfo));
     }
 }
Exemplo n.º 4
0
        private List <TransInfo> GetData(SqlCommand cmd)
        {
            cmd.Connection.Open();

            SqlDataReader reader = cmd.ExecuteReader();
            var           list   = new List <TransInfo>();


            while (reader.Read())
            {
                var obj = new TransInfo
                {
                    Id     = reader.GetInt32(0),
                    Pname  = reader.GetString(1),
                    Quan   = reader.GetInt32(2),
                    Tprice = reader.GetFloat(3),
                    Date   = reader.GetString(4)
                };
                list.Add(obj);
            }
            reader.Close();

            cmd.Connection.Close();

            return(list);
        }
Exemplo n.º 5
0
 public void SaveStorageData()
 {
     foreach (Transform t in transformMoveObj)
     {
         TransInfo transInfo = new TransInfo();
         transInfo.positon     = t.localPosition;
         transInfo.eulerAngles = t.localEulerAngles;
         transInfo.localScale  = t.localScale;
         transInfo.isActive    = t.gameObject.activeSelf;
         ((SampleDataEntity)SampleDataModel.instance.DataEntity).gameObjectList.Add(transInfo);
     }
 }
Exemplo n.º 6
0
        public static void SaveTransBK(string OrderID, string tran_info, decimal Total, string redUrl)
        {
            TransInfo infTrans = new TransInfo();

            infTrans.Vpc_OrderInfo   = OrderID;
            infTrans.Vpc_MerchTxnRef = tran_info;
            infTrans.Vpc_Merchant    = BK.merchant_id;
            infTrans.Vpc_Amount      = CaculatorTransCost(Total, BankDeclare.Baokim);
            infTrans.Vpc_TicketNo    = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
            infTrans.Vpc_ReturnUrl   = redUrl;
            infTrans.Vpc_BankType    = BankDeclare.Baokim;

            if (!TransManager.Insert(infTrans))
            {
                throw new ApplicationException("Lỗi cập nhật Data!!!");
            }
        }
Exemplo n.º 7
0
            public static TransInfo Get(MethodBase methodBase)
            {
                return(cached.GetOrAdd(methodBase, (method) =>
                {
                    TransInfo info;

                    var transAttr = method.GetCustomAttribute <TransactionAttribute>(true);
                    if (transAttr != null)
                    {
                        info = new TransInfo();
                        info.Usage = transAttr.Usage;
                    }
                    else
                    {
                        info = null;
                    }

                    return info;
                }));
            }
Exemplo n.º 8
0
        public bool Insert(TransInfo obj)
        {
            var        da  = new SqlDbDataAccess();
            SqlCommand cmd =
                da.GetCommand(
                    "INSERT INTO [dbo].[Trans] ([Pname],[quan],[tprice],[date]) VALUES (@pname, @quan,@price, @date)");

            var p1 = new SqlParameter("@Pname", SqlDbType.VarChar, 50)
            {
                Value = obj.Pname
            };

            var p2 = new SqlParameter("@quan", SqlDbType.Int)
            {
                Value = obj.Quan
            };

            var p3 = new SqlParameter("@price", SqlDbType.Float)
            {
                Value = obj.Tprice
            };

            var p4 = new SqlParameter("@date", SqlDbType.VarChar, 50)
            {
                Value = obj.Date
            };


            cmd.Parameters.Add(p1);
            cmd.Parameters.Add(p2);
            cmd.Parameters.Add(p3);
            cmd.Parameters.Add(p4);

            cmd.Connection.Open();

            int val = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(val > 0);
        }
Exemplo n.º 9
0
        public static List <TransInfo> ReadFileEJDATA(string fileName)
        {
            Boolean bCheck = false;

            string[]         lines         = System.IO.File.ReadAllLines(fileName);
            TransInfo        transInfo     = new TransInfo();
            List <TransInfo> listTransInfo = new List <TransInfo>();

            foreach (var line in lines)
            {
                if (line.Trim() == Constants.TRANSACTION_START)
                {
                    transInfo = new TransInfo();
                    bCheck    = true;
                }
                if (bCheck)
                {
                    if (line.Contains(Constants.CARD_INSERTED))
                    {
                        transInfo.CARD_INSERTED = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.CARD_NUMBER))
                    {
                        transInfo.CARD_NUMBER = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.CUSTOMER_NAME))
                    {
                        transInfo.CUSTOMER_NAME = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.PIN_ENTERED))
                    {
                        transInfo.PIN_ENTERED = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.TRANSACTION_TYPE))
                    {
                        transInfo.TRANSACTION_TYPE = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.AMOUNT))
                    {
                        transInfo.AMOUNT = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.CARD_TAKEN))
                    {
                        transInfo.CARD_TAKEN = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.NOTES_PRESENTED))
                    {
                        transInfo.NOTES_PRESENTED = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.NOTES_RETRACTED))
                    {
                        transInfo.NOTES_RETRACTED = Constants.YES;
                    }
                    else
                    {
                        transInfo.NOTES_RETRACTED = Constants.NO;
                    }

                    if (line.Contains(Constants.NOTES_TAKEN))
                    {
                        transInfo.NOTES_TAKEN = CommonUtils.ProcessString(line);
                    }

                    if (line.Contains(Constants.TRANSACTION_END))
                    {
                        transInfo.TRANSACTION_END = CommonUtils.ProcessString(line);
                        listTransInfo.Add(transInfo);
                        bCheck = false;
                    }
                }
            }

            List <string> values = new List <string>();

            return(listTransInfo);
        }
Exemplo n.º 10
0
        public static List <TransInfo> ReadFileJRN(string fileName)
        {
            Boolean bCheck = false;

            string[] lines = System.IO.File.ReadAllLines(fileName);

            string fileNameresult = Path.GetFileNameWithoutExtension(fileName);

            TransInfo        transInfo     = new TransInfo();
            List <TransInfo> listTransInfo = new List <TransInfo>();

            foreach (var line in lines)
            {
                if (line.Contains(Constants.TRANSACTION_START_JRN))
                {
                    transInfo = new TransInfo();
                    transInfo.TRANSACTION_START = CommonUtils.ProcessString(line).Substring(0, CommonUtils.ProcessString(line).Length - 3);
                    transInfo.TRANSACTION_DATE  = fileNameresult;
                    transInfo.CASH_RETRACTED    = "N";
                    bCheck = true;
                }
                if (bCheck)
                {
                    if (line.Contains(Constants.TRACK_2_DATA) == true)
                    {
                        transInfo.CARD_NUMBER = CommonUtils.ProcessString(line).Substring(CommonUtils.ProcessString(line).Length - 16, 16);
                    }

                    //if (line.Contains(Constants.CARD_TAKEN)) transInfo.CARD_TAKEN = CommonUtils.ProcessString(line);
                    if (line.Contains(Constants.CASH_REQUEST) == true)
                    {
                        transInfo.CASH_REQUEST = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.CASH) && !line.Contains(Constants.CASH_PRESENTED) && !line.Contains(Constants.CASH_TAKEN) && !line.Contains(Constants.CASH_REQUEST))
                    {
                        transInfo.CASH = CommonUtils.ProcessString(line).Substring(8, CommonUtils.ProcessString(line).Length - 8).Trim();
                    }
                    ;
                    if (line.Contains(Constants.CASH_PRESENTED))
                    {
                        transInfo.CASH_PRESENTED = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.CASH_TAKEN))
                    {
                        transInfo.CASH_TAKEN = CommonUtils.ProcessString(line);
                    }
                    if (line.Contains(Constants.AMOUNT))
                    {
                        transInfo.AMOUNT = CommonUtils.ProcessString(line);
                    }

                    if (line.Contains(Constants.TRANSACTION_STOP_JRN))
                    {
                        transInfo.TRANSACTION_END = CommonUtils.ProcessString(line).Substring(0, CommonUtils.ProcessString(line).Length - 3);
                        listTransInfo.Add(transInfo);
                        bCheck = false;
                    }
                    if (line.Contains(Constants.CASH_RETRACTED))
                    {
                        transInfo.CASH_RETRACTED = Constants.YES;
                    }

                    transInfo.TRANSACTION_DATE = fileNameresult;
                }
            }

            List <string> values = new List <string>();

            return(listTransInfo);
        }
    void OnEnable()
    {
        for (int i = 0; i < transform.childCount; i++)
        {
            Destroy(transform.GetChild(i).gameObject);
        }

        transactionList = new List <TransInfo>();
        Dictionary <int, VirtualCurrencyModel> dictVirtual = CartManager.Instance.GetVirtualCart();

        foreach (KeyValuePair <int, VirtualCurrencyModel> pair in dictVirtual)
        {
            TransInfo temp = new TransInfo();
            temp.ItemName        = pair.Value.name;
            temp.Price           = pair.Value.price;
            temp.Quantity        = pair.Value.quantity;
            temp.TotalPrice      = 0;
            temp.DiscountPercent = 0;
//			if(pair.Value.isSaleOff) {
//				double finalPrice = pair.Value.Price - (pair.Value.Price/100 * pair.Value.PercentSale);
//				temp.TotalPrice = finalPrice * temp.Quantity;
//				temp.DiscountPrice = temp.Price * temp.Quantity;
//				temp.DiscountPercent = pair.Value.PercentSale;
//			} else {
            temp.TotalPrice = temp.Price * temp.Quantity;
//			}
            transactionList.Add(temp);
        }
        Dictionary <int, SubscriptionModel> dictSub = CartManager.Instance.GetSubscriptionCart();

        foreach (KeyValuePair <int, SubscriptionModel> pair in dictSub)
        {
            TransInfo temp = new TransInfo();
            temp.ItemName        = pair.Value.name;
            temp.Price           = pair.Value.price;
            temp.Quantity        = pair.Value.quantity;
            temp.TotalPrice      = 0;
            temp.DiscountPercent = 0;
            //			if(pair.Value.isSaleOff) {
            //				double finalPrice = pair.Value.Price - (pair.Value.Price/100 * pair.Value.PercentSale);
            //				temp.TotalPrice = finalPrice * temp.Quantity;
            //				temp.DiscountPrice = temp.Price * temp.Quantity;
            //				temp.DiscountPercent = pair.Value.PercentSale;
            //			} else {
            temp.TotalPrice = temp.Price * temp.Quantity;
            //			}
            transactionList.Add(temp);
        }

        CartManager.Instance.ClearCart();

        foreach (TransInfo item in transactionList)
        {
            GameObject cNode     = Instantiate(Resources.Load("Prefabs/Items/TransItem")) as GameObject;
            Transform  transCart = cNode.transform;
            transCart.SetParent(transform);
            transCart.localScale = Vector3.one;

            transCart.Find("TextName").GetComponent <Text>().text       = item.ItemName;
            transCart.Find("TextPrice").GetComponent <Text>().text      = item.Price.ToString("C2") + " USD";
            transCart.Find("TextQuantity").GetComponent <Text>().text   = item.Quantity.ToString();
            transCart.Find("TextTotalPrice").GetComponent <Text>().text = item.TotalPrice.ToString("C2") + " USD";
            if (item.DiscountPrice != 0)
            {
                transCart.Find("TextTotalPrice/TextSaleValue").gameObject.SetActive(true);
                transCart.Find("TextTotalPrice/TextSaleValue").GetComponent <Text>().text = item.DiscountPrice.ToString("C2") + " USD";
                transCart.Find("TextName/TextSalePercent").gameObject.SetActive(true);
                transCart.Find("TextName/TextSalePercent").GetComponent <Text>().text = "SALE! " + item.DiscountPercent + "% Off";
            }
        }
    }
Exemplo n.º 12
0
        public string InvokeTrans(XmlDocument xdoc)
        {
            using (var db = new EasyEsb())
            {
                try
                {
                    UserService userService = new UserService();
                    string      userName    = xdoc.SelectSingleNode("request/header/userid").InnerText;
                    string      password    = xdoc.SelectSingleNode("request/header/password").InnerText;
                    string      transNo     = xdoc.SelectSingleNode("request/header/trans_no").InnerText;
                    if (userService.ValidateUser(userName, password, transNo))
                    {
                        TransInfo ti = GetTransInfo(transNo);
                        IEnumerable <TransFieldInfo> tfis = GetTransFieldInfo(transNo);

                        #region 执行配置语句
                        db.Command.CommandType = CommandType.Text;
                        db.Command.CommandText = ti.Sql;
                        var tfisIn = tfis.Where(tfi => tfi.FieldDirection == false);
                        foreach (TransFieldInfo tfi in tfisIn)
                        {
                            //TODO 后期提为通用版本
                            db.Command.Parameters.Add(new SqlParameter(tfi.DFieldName,
                                                                       xdoc.SelectSingleNode(string.Format("request/body/{0}", tfi.FieldName)).InnerText));
                        }

                        SqlDataAdapter sda = new SqlDataAdapter((SqlCommand)db.Command);
                        DataTable      dt  = new DataTable();
                        sda.Fill(dt);
                        var tfisOut = tfis.Where(tfi => tfi.FieldDirection == true);
                        foreach (TransFieldInfo tfi in tfisOut)
                        {
                            dt.Columns[tfi.DFieldName].ColumnName = tfi.FieldName;
                        }
                        DataSet ds = new DataSet();
                        ds.Tables.Add(dt);
                        return(ds.GetXml());

                        #region 模式1 要求配置顺序
                        //IDataReader sdr = db.Command.ExecuteReader();
                        //var tfisOut = tfis.Where(tfi => tfi.FieldDirection == true);

                        //DataTable dt = new DataTable();
                        //foreach (TransFieldInfo tfi in tfisOut)
                        //{
                        //    dt.Columns.Add(tfi.FieldName);
                        //}

                        //while (sdr.Read())
                        //{
                        //    DataRow dr = dt.NewRow();
                        //    int i = 0;
                        //    foreach (TransFieldInfo tfi in tfisOut)
                        //    {
                        //        dr[tfi.FieldName] = sdr.GetValue(i++);
                        //    }
                        //    dt.Rows.Add(dr);
                        //}
                        //DataSet ds = new DataSet();
                        //ds.Tables.Add(dt);
                        //return ds.GetXml();
                        #endregion
                        #endregion
                    }
                    return("error");
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }