Exemplo n.º 1
0
        public static bool Insert(jz_userdetailEntity item)
        {
            bool rv = true;

            try
            {
                DataTable dt = DBAccess.DataAccess.Miou_GetDataSetBySql(DBAccess.LogUName, string.Format("select * from {0} where {1} = {2} ;", tableName, keyName, 0)).Tables[0];
                DataRow   dr = dt.NewRow();

                dr["zjuid"]      = item.zjuid;
                dr["uid"]        = item.uid;
                dr["fmoney"]     = item.fmoney;
                dr["fmoney"]     = item.fmoney;
                dr["remark"]     = item.remark;
                dr["createtime"] = DateTime.Now;

                dt.Rows.Add(dr);
                rv = DBAccess.DataAccess.Miou_UpdateDataSet(DBAccess.LogUName, tableName, "*", "1<>1", "", dt).StartsWith("000");
            }
            catch (Exception ex)
            {
                string ss = ex.ToString();
                rv = false;
            }
            return(rv);
        }
Exemplo n.º 2
0
        public ActionResult Startuserjz(int uid, double fmoney)
        {
            PostResponse _Respone = new PostResponse()
            {
                IsSuccess = false
            };

            if (LinkTokenSQ.MvcApplication.Syspar["OpeanLuckdraw"].keyvalue == "0")
            {
                _Respone.Message = LinkTokenSQ.MvcApplication.Syspar["OpeanLuckdraw"].keydes;
                return(Json(_Respone));
            }
            var uinfo = this.GetUser();

            try
            {
                if (fmoney <= 0)
                {
                    _Respone.Message = "捐赠数额要>0 ";
                    return(Json(_Respone));
                }
                if (uid == uinfo.uid)
                {
                    string info = "";
                    var    acc  = uaccountDal.GetByKeyId(uid, ref info);
                    if (acc.accountmony < fmoney)
                    {
                        _Respone.Message = "用户积分余额不足,谢谢支持.";
                        return(Json(_Respone));
                    }
                    acc.accountmony -= fmoney;
                    if (uaccountDal.Update(acc))
                    {
                        jz_userdetailEntity jzo = new jz_userdetailEntity();
                        jzo.createtime = DateTime.Now;
                        jzo.fmoney     = fmoney;
                        jzo.uid        = uid;
                        jzo.remark     = "用户捐赠";
                        jz_userdetailDal.Insert(jzo);
                        uchangedetailEntity ch = new uchangedetailEntity();
                        ch.remark = "用户捐赠";
                        ch.ftype  = 30;
                        ch.uid    = uid;
                        ch.fmoney = fmoney;
                        ch.datachange_lasttime = DateTime.Now;
                        uchangedetailDal.Inert(ch);
                        _Respone.IsSuccess = true;
                    }
                    else
                    {
                        _Respone.Message = "捐赠失败,请重试看看,谢谢支持.";
                    }
                }
            }
            catch (Exception ex)
            {
                _Respone.Message = ex.Message;
            }
            return(Json(_Respone));
        }