Exemple #1
0
 public ActionResult CreatePointAccount(PointAccount pointAccount)
 {
     System.Console.WriteLine(pointAccount.ownerId);
     if (_PointService.CreateAccount(pointAccount.ownerId) == true)
     {
         return(Ok());
     }
     else
     {
         return(StatusCode(500, "Account already exists"));
     }
 }
        /// <summary>
        /// 充值或扣费
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddMoney_Click(object sender, EventArgs e)
        {
            if (!Extend.LoginState.Admin.IsAdmin)
            {
                throw new Exception("非管理员无权此操作权限!");
            }
            Song.Entities.Accounts st = Business.Do <IAccounts>().AccountsSingle(id);
            if (st == null)
            {
                throw new Exception("当前信息不存在!");
            }
            //操作类型
            int type = 2;

            int.TryParse(rblOpera.SelectedItem.Value, out type);
            //操作积分数
            int point = 0;

            int.TryParse(tbPoint.Text, out point);
            //操作对象
            Song.Entities.PointAccount ma = new PointAccount();
            ma.Pa_Value  = point;
            ma.Pa_Remark = tbRemark.Text.Trim();
            ma.Ac_ID     = st.Ac_ID;
            ma.Pa_Source = "管理员操作";
            //充值方式,管理员充值
            ma.Pa_From = 1;
            //操作者
            Song.Entities.EmpAccount emp = Extend.LoginState.Admin.CurrentUser;
            try
            {
                string mobi = !string.IsNullOrWhiteSpace(emp.Acc_MobileTel) && emp.Acc_AccName != emp.Acc_MobileTel ? emp.Acc_MobileTel : "";
                //如果是充值
                if (type == 2)
                {
                    ma.Pa_Info = string.Format("管理员{0}({1}{2})向您充值{3}分", emp.Acc_Name, emp.Acc_AccName, mobi, point);
                    Business.Do <IAccounts>().PointAdd(ma);
                }
                //如果是转出
                if (type == 1)
                {
                    ma.Pa_Info = string.Format("管理员{0}({1}{2})扣除您{3}分", emp.Acc_Name, emp.Acc_AccName, mobi, point);
                    Business.Do <IAccounts>().PointPay(ma);
                }
                Extend.LoginState.Accounts.Refresh(st.Ac_ID);
                Master.AlertCloseAndRefresh("操作成功!");
            }
            catch (Exception ex)
            {
                this.Alert(ex.Message);
            }
        }
Exemple #3
0
        public ActionResult getPoint(string id)
        {
            PointAccount Point = _pointService.Get(id);

            if (Point != null)
            {
                return(Ok(Point));
            }
            else
            {
                return(NotFound("Point account Not Found"));
            }
        }
Exemple #4
0
        public bool CreateAccount(string customerId)
        {
            PointAccount pointAccount = new PointAccount(customerId, 0);

            if (_points.Find(pointAccount => pointAccount.ownerId == customerId).Any())
            {
                return(false);
            }
            else
            {
                _points.InsertOne(pointAccount);
                return(true);
            }
        }
 public static PointAccount CreatePointAccount(int pointAccountID)
 {
     PointAccount pointAccount = new PointAccount();
     pointAccount.PointAccountID = pointAccountID;
     return pointAccount;
 }
 public void AddToPointAccounts(PointAccount pointAccount)
 {
     base.AddObject("PointAccounts", pointAccount);
 }