Example #1
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="obj">对象</param>
 /// <returns>返回:该条数据的主键Id</returns>
 public int Insert(DDocInfo obj)
 {
     if (obj == null) throw new ArgumentNullException("obj");
     String stmtId = "DDocInfo.Insert";
     return SqlMapper.Instance().QueryForObject<int>(stmtId, obj);
 }
Example #2
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns>返回:ture 成功,false 失败</returns>
 public bool Update(DDocInfo obj)
 {
     if (obj == null) throw new ArgumentNullException("obj");
     String stmtId = "DDocInfo.Update";
     int result = SqlMapper.Instance().QueryForObject<int>(stmtId, obj);
     return result > 0 ? true : false;
 }
Example #3
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns>返回:ture 成功,false 失败</returns>
 public bool Update(DDocInfo obj)
 {
     return dal.Update(obj);
 }
Example #4
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="obj">对象</param>
 /// <returns>返回:该条数据的主键Id</returns>
 public int Insert(DDocInfo obj)
 {
     return dal.Insert(obj);
 }
Example #5
0
 public void DoUploadReplaceDoc(int originalId, HttpPostedFile fileData)
 {
     DocService ds = Context.GetService<DocService>();
     DDocInfo originalDoc = ds.DDocInfoBll.Get(originalId);
     if (originalDoc != null)
     {
         //上传新文档
         string ext = string.Empty;
         string savePath = Save(fileData, ref ext);
         DDocInfo newDoc = new DDocInfo()
         {
             UserId = ConfigHelper.AdminUserId,
             DocType = ext.ToLower(),
             FileId = Guid.NewGuid(),
             FileName = fileData.FileName.Replace("." + ext, ""),
             FileLength = fileData.ContentLength,
             CreateTime = DateTime.Now,
             PhysicalPath = savePath
         };
         int newDocId = ds.DDocInfoBll.Insert(newDoc);
         //更新原来的文档
         originalDoc.ReplaceDocId = newDocId;
         ds.DDocInfoBll.Update(originalDoc);
     }
     base.SuccessInfo();
     RedirectToReferrer();
 }
Example #6
0
        public void SaveFile(HttpPostedFile fileData)
        {
            CancelLayout();
            CancelView();
            try
            {
                //保存文件
                string ext = string.Empty;
                string savePath = Save(fileData, ref ext);
                UserService us = Context.GetService<UserService>();
                U_UserInfo u = base.GetUser();
                DDocInfo doc = new DDocInfo()
                {
                    UserId = u.UserId,
                    DocType = ext.ToLower(),
                    FileId = Guid.NewGuid(),
                    FileName = fileData.FileName.Replace("." + ext,""),
                    FileLength = fileData.ContentLength,
                    CreateTime = DateTime.Now,
                    PhysicalPath = savePath
                };
                if (ConfigHelper.NotConvertDocTypes.Contains(ext.ToLower())) {
                    doc.Wwk = 1;
                    doc.Wwk2 = 1;
                    doc.Txt = 1;
                }
                us.DocInfoBll.Insert(doc);

                Response.StatusCode = 200;
                Response.Write("{code:1,msg:'" + doc.FileId.Value.ToString() + "'}");
            }
            catch (TmmException te) {
                Response.StatusCode = 200;
                Response.Write("{code:0,msg:'" + te.Message + "'}");
            }
            catch (Exception ex)
            {
                Utils.Log4Net.Error("上传文档出错:" + ex.Message);
                Response.StatusCode = 500;
                Response.Write("{code:-1,msg:'" + ex.Message + "'}");
            }
        }
Example #7
0
        public void GotoPay(string PayWay, decimal total, string pname, int docId,int chargeType)
        {
            OrderService os = Context.GetService<OrderService>();
            AccountService accs = Context.GetService<AccountService>();
            U_UserInfo logonUser = base.GetUser();
            decimal orderId = Utils.TmmUtils.GenOrderId();

            DDocInfo doc = new DDocInfo();
            TOrder order = new TOrder();
            TOrderDetail detail = new TOrderDetail();

            int orderType = 0;  //订单类型

            if (chargeType == 1)
            {
                doc = os.DDocInfoBll.Get(docId);
                orderType = (int)OrderType.DownDocOrder;
            }
            else if (chargeType == 0) {
                //如果是直接充值,这里虚拟一个doc对象,来作为订单的商品
                doc = new DDocInfo() {
                    DocId = -1,
                    Title = "直接充值:" + total.ToString(),
                    Price = total
                };
                orderType = (int)OrderType.DirectCharge;
            }

            detail = new TOrderDetail()
            {
                DocId = doc.DocId,
                DocTitle = doc.Title,
                GoodsCount = 1,
                Price = doc.Price,
                OrderId = orderId
            };
            order = new TOrder()
            {
                OrderType = orderType,
                OrderId = orderId,
                UserId = logonUser.UserId,
                Email = logonUser.Email,
                Total = detail.Price * detail.GoodsCount,
                Ip = Context.Request.UserHostAddress,
                Status = (int)OrderStatus.NewOrder,
                CreateTime = DateTime.Now,
                PayWay = Helper.FormatHelper.GetPayWay(PayWay),
                OrderDetails = new List<TOrderDetail>() { detail }
            };
            os.TOrderBll.SaveOrder(order);

            TOrder o = os.TOrderBll.Get(orderId);

            decimal amount = 0;//除扣除账户余额外还需要支付金额
            amount = total;

            //if (total > minfo.Amount)
            //{
            //    amount = total - minfo.Amount;
            //}
            //else {
            //    //账户支付
            //}

            #region 转至支付接口
            if (PayWay.ToLower() == "tenpay")
            {
                TenPay pay = new TenPay();
                pay.UserId = logonUser.UserId;
                pay.Send(orderId.ToString(), amount.ToString(), pname);

            }

            if (PayWay.ToLower() == "chinabank")
            {
                ChinaBankPay pay = new ChinaBankPay();
                pay.Send(orderId.ToString(), amount.ToString(), pname);

                // Response.Write("ChinaBank");
            }
            if (PayWay.ToLower() == "alipay")
            {
                AliPay pay = new AliPay();
                pay.Send(orderId.ToString(), amount.ToString(), pname,logonUser.UserId);

                // Response.Write("ChinaBank");
            }
            if (PayWay.ToLower() == "useraccount")
            {
                MAccount minfo = accs.MAccountBll.GetByUserId(logonUser.UserId);    //账户

                if (o.Total <= minfo.Amount && (o.Status == (int)OrderStatus.NewOrder))
                {
                    //ms.MAccount.AccountExpend(o.OrderId);
                    ////ms.MOrder.UpdateOrder2Paid(o.OrderId, 0, "账户支付", (int)Models.MOrderStateInfo.己付款);
                    //Web.Common.OrderCallBack oCallBack = new MamShare.Mall.Web.Common.OrderCallBack(
                    //            o.UserId, o.OrderId, 0, (int)Models.MOrderStateInfo.己付款, "账户支付");
                    //oCallBack.Update2Paid();

                    //Hashtable p = new Hashtable();
                    //p.Add("OrderId", o.OrderId);
                    //RedirectToAction("payok.do", p);
                    os.MAccountBll.AccountExpend(o.OrderId, Utils.TmmUtils.IPAddress());    //账户花销
                    Common.OrderCallBack oCallBack = new TMM.Core.Common.OrderCallBack();
                    oCallBack.UserId = o.UserId;
                    oCallBack.OrderId = o.OrderId;
                    oCallBack.PayWay = 0;
                    oCallBack.Status = (int)OrderStatus.IsPaied;
                    oCallBack.PayDetail = "账户支付";
                    oCallBack.GotoUrl = "/my/purchase.do";

                    oCallBack.ExecAfterPaid();

                }
                else
                {

                    Redirect("NetPay.do?orderid=" + o.OrderId);
                }

            }
            #endregion
            RenderView("pay");
        }