Example #1
0
        public NotifyPage()
        {
            if (!EPayments.CheckPayment(DNTRequest.GetString("notify_id")))
            {
                HttpContext.Current.Response.Write("fail");
                return;
            }
            int    status     = EPayments.ConvertAlipayTradeStatus(DNTRequest.GetString("trade_status"));
            string outTradeNo = DNTRequest.GetString("out_trade_no", true);
            string tradeNo    = DNTRequest.GetString("trade_no", true);

            if (string.IsNullOrEmpty(outTradeNo) || string.IsNullOrEmpty(tradeNo) || status <= 0)
            {
                return;
            }
            //var ci = CreditOrders.GetCreditOrderInfoByOrderCode(outTradeNo);
            var ci = Order.FindByCode(outTradeNo);

            if (ci != null && ci.Status < 2)
            {
                float[] array = new float[8];
                array[ci.Credit - 1] = (float)ci.Amount;
                if (CreditsFacade.UpdateUserExtCredits(ci.Uid, array, true) != 1)
                {
                    status = 0;
                }
                //CreditsLogs.AddCreditsLog(ci.Uid, ci.Uid, ci.Credit, ci.Credit, 0f, (float)ci.Amount, Utils.GetDateTime(), 3);
                CreditsLog.Add(ci.Uid, ci.Uid, ci.Credit, ci.Credit, 0, ci.Amount, 3);
                var notice = new Notice
                {
                    PostDateTime = DateTime.Now,
                    Type         = (Int32)NoticeType.GoodsTradeNotice,
                    Poster       = "系统",
                    PosterID     = 0,
                    Uid          = ci.Uid,
                    Note         = string.Format("您购买的积分 {0} 已经成功充值,请<a href=\"usercpcreaditstransferlog.aspx\">查收</a>!(支付宝订单号:{1})", ForumUtils.ConvertCreditAndAmountToWord(ci.Credit, ci.Amount), tradeNo)
                };
                notice.Insert();

                //CreditOrders.UpdateCreditOrderInfo(ci.OrderId, tradeNo, num, Utils.GetDateTime());
                ci.TradeNo       = tradeNo;
                ci.Status        = status;
                ci.ConfirmedTime = DateTime.Now;
                ci.Update();
            }
            if (DNTRequest.IsPost())
            {
                HttpContext.Current.Response.Write("success");
                return;
            }
            HttpContext.Current.Response.Redirect("../usercpcreaditstransferlog.aspx?paysuccess=true");
        }
        private void SaveNotice(HttpContext context)
        {
            try
            {
                string Id             = context.Request.Form["ctl00$cphMain$hId"].Trim();
                string sContentTypeId = context.Request.Form["contentTypeId"].Trim();
                string title          = context.Request.Form["ctl00$cphMain$txtTitle"].Trim();
                string sDescr         = context.Request.Form["ctl00$cphMain$txtaDescr"].Trim();
                string content        = context.Request.Form["txtContent"].Trim();
                content = HttpUtility.HtmlDecode(content);
                Guid gId = Guid.Empty;
                if (Id != "")
                {
                    Guid.TryParse(Id, out gId);
                }
                Guid contentTypeId = Guid.Empty;
                Guid.TryParse(sContentTypeId, out contentTypeId);

                NoticeInfo model = new NoticeInfo();
                model.LastUpdatedDate = DateTime.Now;
                model.Title           = title;
                model.Descr           = sDescr;
                model.ContentText     = content;
                model.ContentTypeId   = contentTypeId;
                model.Id = gId;

                Notice bll = new Notice();

                int effect = -1;
                if (!gId.Equals(Guid.Empty))
                {
                    effect = bll.Update(model);
                }
                else
                {
                    effect = bll.Insert(model);
                }

                if (effect != 1)
                {
                    context.Response.Write("{\"success\": false,\"message\": \"操作失败,请正确输入\"}");
                    return;
                }

                context.Response.Write("{\"success\": true,\"message\": \"操作成功\"}");
            }
            catch (Exception ex)
            {
                context.Response.Write("{\"success\": false,\"message\": \"异常:" + ex.Message + "\"}");
            }
        }
        public ActionResult NoticeDetail(FormCollection collection)
        {
            Notice n = new Notice();

            n.NoticeID = Convert.ToInt32(collection["NoticeID"]);

            if (n.NoticeID > 0)
            {
                n.SelectByID();
                n.NoticeID   = Convert.ToInt32(collection["NoticeID"]);
                n.Title      = collection["Title"];
                n.Details    = collection["Details"];
                n.NoticeDate = DateTime.Now;
                if (Request.Files["Attachment"] != null)
                {
                    string path = "/uploads/" + DateTime.Now.Ticks.ToString() + "_" + Request.Files["Attachment"].FileName;
                    Request.Files["Attachment"].SaveAs(Server.MapPath(path));
                    n.Attachment = path;
                }
                else
                {
                    n.Attachment = "";
                }
                n.Update();
                return(RedirectToAction("NoticeList"));
            }
            else
            {
                n.Title      = collection["Title"];
                n.Details    = collection["Details"];
                n.NoticeDate = DateTime.Now;
                if (Request.Files["Attachment"] != null)
                {
                    string path = "/uploads/" + DateTime.Now.Ticks.ToString() + "_" + Request.Files["Attachment"].FileName;
                    Request.Files["Attachment"].SaveAs(Server.MapPath(path));
                    n.Attachment = path;
                }
                else
                {
                    n.Attachment = "";
                }
                n.Insert();
                return(RedirectToAction("NoticeList"));
            }
        }
Example #4
0
        public static void UpdateBanUser(int groupid, string groupexpiry, int uid)
        {
            //BBX.Data.Users.UpdateBanUser(groupid, groupexpiry, uid);
            var user = User.FindByID(uid);

            if (user != null)
            {
                user.GroupID     = groupid;
                user.GroupExpiry = groupexpiry.ToInt();
                user.Save();
            }
            var online = Online.FindByUserID(uid);

            if (online != null)
            {
                online.GroupID = groupid;
                online.Update();
            }

            var notice = new Notice();

            notice.New = 1;
            if (groupid == 4)
            {
                notice.Type = (Int32)NoticeType.BanPostNotice;
            }
            if (groupid == 5)
            {
                notice.Type = (Int32)NoticeType.BanVisitNotice;
            }

            notice.PostDateTime = DateTime.Now;
            notice.Poster       = DNTRequest.GetFormString("uname");
            notice.PosterID     = uid;
            notice.Uid          = uid;
            notice.Note         = DNTRequest.GetFormString("reason") + "截至到" + groupexpiry + "到期";
            //Notices.CreateNoticeInfo(noticeInfo);
            notice.Insert();
        }
Example #5
0
        public JsonResult Add(Notice notice)
        {
            notice.Insert();

            return(Json(ArtDialogResponseResult.SuccessResult));
        }