当前位置: 首页>>代码示例>>C#>>正文


C# SharedDbConnectionScope.Dispose方法代码示例

本文整理汇总了C#中SharedDbConnectionScope.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# SharedDbConnectionScope.Dispose方法的具体用法?C# SharedDbConnectionScope.Dispose怎么用?C# SharedDbConnectionScope.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SharedDbConnectionScope的用法示例。


在下文中一共展示了SharedDbConnectionScope.Dispose方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: On_ActionDelete

 protected override void On_ActionDelete(object sender, EventArgs e)
 {
     TransactionScope ts = new TransactionScope( );
     SharedDbConnectionScope ss = new SharedDbConnectionScope( );
     try
     {
         int cashID = Utilities.ToInt(EVENTARGUMENT);
         string message;
         if (OrderBLL.DeleteMemberCash(cashID, AppContext.Context.Company, out message))
         {
             OrderBLL.UpdateBalance( );
             ts.Complete( );
         }
         txtMessage.InnerHtml = message;
     }
     catch (Exception ex)
     {
         Logging.Log("FinanceList->On_ActionDelete", ex, true);
         txtMessage.InnerHtml = ex.Message;
     }
     finally
     {
         ss.Dispose( );
         ts.Dispose( );
     }
     On_ActionQuery(sender, e);
 }
开发者ID:eleooo,项目名称:App,代码行数:27,代码来源:FinanceList.aspx.cs

示例2: Import

        void Import( )
        {
            DataTable dt = CacheTable(null);
            if (dt == null)
            {
                lblErrorInfo2.Text = "导入数据不存在!";
                return;
            }
            DataColumn cCol = dt.Columns[CHECK_COL];
            string strCheck;
            TransactionScope ts = new TransactionScope( );
            SharedDbConnectionScope ss = new SharedDbConnectionScope( );
            try
            {
                foreach (DataRow row in dt.Rows)
                {
                    strCheck = Utilities.ToString(row[cCol]);
                    if (strCheck == string.Empty || strCheck == "-1")
                        continue;
                    SysMember user = SaveMemberData(row);
                    SaveMemberCash(row, user);
                    SaveMemberCompany(row, user);

                }
                AppContext.Context.Company.MarkClean( );
                AppContext.Context.Company.MarkOld( );
                AppContext.Context.Company.IsUseFinger = false;
                AppContext.Context.Company.Save( );
                OrderBLL.UpdateBalance( );
                ts.Complete( );
                lblErrorInfo2.Text = "导入成功!";
                btnPost.Enabled = false;
            }
            catch (Exception ex)
            {
                Logging.Log("MemberExportIn->Import", ex,true);
                lblErrorInfo2.Text = ex.Message + Environment.NewLine + ex.StackTrace;
            }
            finally
            {
                ss.Dispose( );
                ts.Dispose( );
                tbPost.Visible = true;
                btnPost.Enabled = false;
                btnCheck.Enabled = false;
            }
        }
开发者ID:eleooo,项目名称:App,代码行数:47,代码来源:MemberExportIn.aspx.cs

示例3: ConfirmOrder


//.........这里部分代码省略.........
                    isChanged = false;

                    SysMember user = SysMember.FetchByID(order.OrderMemberID);
                    if (msnType == 1 || hasChangePrice) //某菜单缺货或价格更改
                    {
                        isChanged = true;
                        order.OrderSum = dSum;
                        order.OrderSumOk = order.ServiceSum.HasValue ? (order.ServiceSum.Value + dSum) : dSum;
                        order.OrderPay = order.ServiceSum.HasValue ? (order.ServiceSum.Value + dSum) : dSum;
                        order.OrderPrePoint = (RewardBLL.OrderMealRewardRate(company) / 100M) * dSum; //赠送积分
                        order.OrderRate = RewardBLL.OrderMealRewardRate(company) / 100M;  //赠送比例
                    }

                    if (msnType == 2 || msnType == 4) //商家不外送,订单取消
                    {
                        isChanged = true;
                        if (msnType == 2)
                            order.IsNonOut = true;
                        order.OrderStatus = (int)OrderStatus.Canceled;
                        order.OrderUpdateOn = DateTime.Now;
                        if (!CompanyItemBLL.CancelMemberMealItem(order, out msg))
                            goto lbl_return;
                        RewardBLL.CancelRewardMemberPointForOrderMeal(order);
                    }
                    else //if (msnType != 3)  //自定义回复
                    {
                        if (msnType != 3 ||
                            (msnType == 3 && (oldStatus == (int)OrderStatus.NotStart || oldStatus == (int)OrderStatus.Modified)))
                            order.OrderStatus = (int)OrderStatus.InProgress;
                        order.OrderUpdateOn = DateTime.Now;
                        order.MsnType = msnType == 3 && oldStatus == (int)OrderStatus.InProgress ? 0 : msnType;
                        order.ModifiedOn = DateTime.Now;
                        isChanged = true;
                    }
                    //if (msnType == 0 || (msnType == 1 && !order.HasOutOfStock.Value))
                    //{
                    //    order.OrderPoint = order.OrderPrePoint;
                    //}

                    if (!order.OrderOper.HasValue || order.OrderOper.Value == 0)
                        order.OrderOper = AppContextBase.Context.User.Id;
                    order.Save( );

                    if (msnType == 0 || (msnType == 1 && !order.HasOutOfStock.Value))
                    {
                        RewardBLL.RewardMemberPointForOrderMeal(user, company, order);
                        //OrderBLL.UpdateBalance( );
                    }
                    RemoveLockScopeAction(orderId);
                    ts.Complete( );
                    ss.Dispose( );
                    ss = null;
                    ts.Dispose( );
                    ts = null;
                    OrderProgressBLL.AddOrderConfirmLog(order, company, msnType, hasChangePrice, message);
                    string msnContent = string.Empty;
                    if (msnType == 0)
                    {
                        if (UserIsFirstOrder(order.OrderMemberID))
                        {
                            msnContent = string.Format("亲爱的用户:{0}已经收到您的订单,餐厅正在备餐。您本次订单总计{1}元。预计{2}分钟左右为您送达(仅供参考,高峰时段以实际送达时间为准)。",
                                                        company.CompanyName, order.OrderSumOk, company.OrderElapsed);

                        }
                    }
                    else if (msnType == 1 && order.HasOutOfStock.HasValue && order.HasOutOfStock.Value)
                        msnContent = "亲爱的用户:" + message;
                    else if (msnType == 2)
                        msnContent = "亲爱的用户:很抱歉," + company.CompanyName + "表示,当前暂不提供外送,请选择其他餐厅。";
                    else if (msnType == 3)
                        msnContent = "亲爱的用户:" + message;
                    if (!string.IsNullOrEmpty(msnContent))
                    {
                        int logId;
                        string phone = string.IsNullOrEmpty(user.MemberMsnPhone) ? user.MemberPhoneNumber : user.MemberMsnPhone;
                        if (!MsnBLL.SendMessage(phone, msnContent, order.Id, out msg, out logId))
                            goto lbl_return;
                    }
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                Logging.Log("OrderMealBLL->ConfirmOrder", ex, true);
                goto lbl_return;
            }
            finally
            {
                if (ss != null)
                    ss.Dispose( );
                if (ts != null)
                    ts.Dispose( );
            }
            msg = "发送成功";
            nResult = 0;
            orderSessionVal = GetOrderUpdateOn(orderId).Ticks;
            lbl_return:
            RemoveLockScopeAction(orderId);
            return nResult;
        }
开发者ID:eleooo,项目名称:App,代码行数:101,代码来源:OrderMealBLL.cs

示例4: On_ActionAdd

 protected override void On_ActionAdd(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtMoveMember.Value))
     {
         lblPhoneInfo.InnerHtml = "请输入会员账号";
         goto lbl_return;
     }
     if (string.IsNullOrEmpty(txtMoveSum.Value))
     {
         lblPointInfo.InnerHtml = "请输入整数";
         goto lbl_return;
     }
     int dMoveSum;
     if (!int.TryParse(txtMoveSum.Value, out dMoveSum) || dMoveSum <= 0)
     {
         lblPointInfo.InnerHtml = "请输入大于零整数";
         goto lbl_return;
     }
     SysMember toUser = UserBLL.GetUserByPhoneNum(txtMoveMember.Value);
     if (toUser == null)
     {
         lblPhoneInfo.InnerHtml = "输入的会员账号不存在.";
         goto lbl_return;
     }
     SysMember user = SysMember.FetchByID(CurrentUser.Id);
     if (dMoveSum > user.MemberBalance)
     {
         lblMessage.InnerHtml = string.Format("你的余额为:{0},本次需要转移:{1},余额不足以支付本次转移.", user.MemberBalance, dMoveSum);
         goto lbl_return;
     }
     if (toUser.Id == user.Id)
     {
         lblMessage.InnerHtml = "你不能将积分转移给自己,请输入其他会员的账号!";
         goto lbl_return;
     }
     TransactionScope ts = new TransactionScope( );
     SharedDbConnectionScope ss = new SharedDbConnectionScope( );
     try
     {
         SysMemberMove m = new SysMemberMove
         {
             MoverMemberIDOld = user.Id,
             MoverMemberIDNew = toUser.Id,
             MoverDate = DateTime.Now,
             MoverMemberIDPoint = dMoveSum
         };
         m.Save( );
         string memo = string.Format("已转出{1}个积分给{0}", toUser.MemberPhoneNumber, dMoveSum);
         new Payment
         {
             PaymentDate = DateTime.Now,
             PaymentCode = string.Empty,
             PaymentEmail = string.Empty,
             PaymentCompanyID = 0,
             PaymentMemberID = user.Id,
             PaymentMemo = memo,
             PaymentStatus = 1,
             PaymentSum = -dMoveSum,
             PaymentType = (int)PaymentType.Move,
             PaymentOrderID = m.MoveID
         }.Save( );
         new Payment
         {
             PaymentDate = DateTime.Now,
             PaymentCompanyID = 0,
             PaymentCode = string.Empty,
             PaymentEmail = string.Empty,
             PaymentMemberID = toUser.Id,
             PaymentMemo = string.Format("已收到{0}转入的{1:0.00}个积分", user.MemberPhoneNumber, dMoveSum),
             PaymentStatus = 1,
             PaymentSum = dMoveSum,
             PaymentType = (int)PaymentType.Move,
             PaymentOrderID = m.MoveID
         }.Save( );
         OrderBLL.UpdateBalance( );
         ts.Complete( );
         txtMoveMember.Value = "";
         txtMoveSum.Value = "";
         lblMessage.InnerHtml = "积分转账成功";
     }
     catch (Exception ex)
     {
         Logging.Log("MyBalanceMove->On_ActionAdd", ex, true);
         lblMessage.InnerHtml = ex.Message;
     }
     finally
     {
         ss.Dispose( );
         ts.Dispose( );
     }
     lbl_return:
     On_ActionQuery(sender, e);
 }
开发者ID:eleooo,项目名称:App,代码行数:93,代码来源:MyBalanceMove.aspx.cs

示例5: SaveOrder

 private static bool SaveOrder(SysCompany company, SysMemberItem mItem, SysCompanyItem cItem, SysMember user, out string message)
 {
     message = string.Empty;
     //Order order = new Order
     //{
     //    OrderCode = OrderBLL.GetOrderCode(company),
     //    OrderCard = string.Empty,
     //    OrderDate = DateTime.Now,
     //    OrderDateDeliver = DateTime.Now,
     //    OrderDateUpload = DateTime.Now,
     //    OrderMemberID = user.Id,
     //    OrderMemo = string.Empty,
     //    OrderProduct = "优惠消费",
     //    OrderQty = 0,
     //    OrderRateSale = 0,
     //    OrderRate = 0,
     //    OrderPoint = 0,
     //    OrderSellerID = company.Id,
     //    OrderStatus = 1,
     //    OrderSum = cItem.ItemSum,
     //    OrderSumOk = cItem.ItemSum,
     //    OrderPay = 0,
     //    OrderPayCash = 0,
     //    OrderPayPoint = mItem.ItemPoint,
     //    OrderType = (int)OrderType.CompanyItem
     //};
     TransactionScope ts = new TransactionScope( );
     SharedDbConnectionScope ss = new SharedDbConnectionScope( );
     try
     {
         //order.Save( );
         //if (mItem.ItemPoint.HasValue && mItem.ItemPoint.Value > 0)
         //{
         //    new Payment
         //    {
         //        PaymentCode = order.OrderCode,
         //        PaymentCompanyID = company.Id,
         //        PaymentDate = order.OrderDate,
         //        PaymentEmail = string.Empty,
         //        PaymentMemberID = user.Id,
         //        PaymentMemo = string.Format("{0}抢购{1}的优惠项目,并且使用{2}个积分抵扣", user.MemberPhoneNumber, company.CompanyName, -mItem.ItemPoint.Value),
         //        PaymentOrderID = order.Id,
         //        PaymentStatus = 1,
         //        PaymentSum = -mItem.ItemPoint.Value,
         //        PaymentType = (int)PaymentType.CompanyItem
         //    }.Save( );
         //}
         //如果是联盟商家则更新积分状态
         CompanyType companyType = Formatter.ToEnum<CompanyType>(company.CompanyType);
         Payment p = Payment.FetchByID(mItem.PaymentID.Value);
         if (p != null)
         {
             p.PaymentStatus = 1;
             p.Save( );
         }
         mItem.ItemStatus = (int)MemberCompanyItemStatus.Completed;
         mItem.SetDate = DateTime.Now;
         mItem.Save( );
         cItem.ItemUsed = Utilities.ToInt(cItem.ItemUsed) + 1;
         cItem.Save( );
         OrderBLL.UpdateBalance( );
         ts.Complete( );
         message = string.Format("结算成功,{0}使用{1}个积分购得{2}", user.MemberFullname, mItem.ItemPoint, cItem.ItemTitle);
         return true;
     }
     catch (Exception ex)
     {
         message = ex.Message;
         return false;
     }
     finally
     {
         ss.Dispose( );
         ts.Dispose( );
     }
 }
开发者ID:eleooo,项目名称:App,代码行数:76,代码来源:CompanyItemBLL.cs

示例6: ClickCompanyItem

        public static bool ClickCompanyItem(SysCompany company, SysMember user, DateTime dtDate, SysCompanyItem item, out int memberItemID, out string message)
        {
            memberItemID = 0;
            if (item == null || user == null)
            {
                message = "参数错误!";
                goto lbl_end;
            }

            if (item.ItemClicked >= item.ItemAmount)
            {
                message = "已经达到了最大可{ItemType}的数量";
                goto lbl_end;
            }
            //check ItemLimitOnce
            if (CheckCompanyItemOnceLimit(company.Id, user.Id))
            {
                message = ItemCheckResult[-3];
                goto lbl_end;
            }
            decimal userLastOrderSum = UserBLL.GetUserLastMonthOrderSum(user.Id);
            int result = CompanyItemBLL.ExecuteCheckFunc(user.Id, item.ItemID, userLastOrderSum);
            if (result < 0)
            {
                message = ItemCheckResult.ContainsKey(result) ? ItemCheckResult[result] : "你无权{ItemType}此优惠项目!";
                goto lbl_end;
            }
            //判断会员积分是否足够
            decimal point = DB.Select(SysMember.Columns.MemberBalance).From<SysMember>( )
                              .Where(SysMember.IdColumn).IsEqualTo(user.Id)
                              .ExecuteScalar<decimal>( );
            if (item.ItemPoint.HasValue && point < item.ItemPoint.Value)
            {
                message = "您的账户积分余额不足,无法{ItemType}^_^";
                goto lbl_end;
            }
            SysMemberItem data = new SysMemberItem
            {
                CompanyID = item.CompanyID,
                CompanyItemID = item.ItemID,
                ItemDate = dtDate,
                OrderDate = DateTime.Now,
                MemberID = user.Id,
                OrderSum = userLastOrderSum,
                ItemPoint = item.ItemPoint,
                ItemStatus = (int)MemberCompanyItemStatus.InProgress,
                SetDate = null,
                IsCanModifiedDate = true,
                PaymentID = 0,
                OrderID = 0
            };
            TransactionScope ts = new TransactionScope( );
            SharedDbConnectionScope ss = new SharedDbConnectionScope( );
            try
            {
                if (item.ItemPoint.HasValue && item.ItemPoint.Value > 0)
                {
                    Payment p = new Payment
                    {
                        PaymentCode = string.Empty,
                        PaymentCompanyID = item.CompanyID,
                        PaymentDate = data.OrderDate.Value,
                        PaymentEmail = string.Empty,
                        PaymentMemberID = user.Id,
                        PaymentMemo = string.Format("抢购【{0}】的优惠项目,并使用{1:0.00}个积分消费", company.CompanyName, item.ItemPoint.Value),
                        PaymentOrderID = 0,
                        PaymentStatus = 2,
                        PaymentSum = -item.ItemPoint.Value,
                        PaymentType = (int)PaymentType.CompanyItem
                    };
                    p.Save( );
                    data.PaymentID = p.Id;
                }
                data.Save( );
                item.ItemClicked = Utilities.ToInt(item.ItemClicked) + 1;
                item.Save( );
                OrderBLL.UpdateBalance( );
                ts.Complete( );
                message = "{ItemType}成功";
                memberItemID = data.ItemID;
                return true;
            }
            catch (Exception ex)
            {
                message = "{ItemType}失败:" + ex.Message;
                Logging.Log("CompanyItemBLL->ClickCompanyItem", ex, true);
            }
            finally
            {
                ss.Dispose( );
                ts.Dispose( );
            }
            lbl_end:
            return false;
        }
开发者ID:eleooo,项目名称:App,代码行数:95,代码来源:CompanyItemBLL.cs

示例7: CancelCompanyItem

        public static bool CancelCompanyItem(SysMember user, SysCompanyItem companyItem, SysMemberItem memberItem, out string message)
        {
            message = string.Empty;
            if (companyItem == null || user == null || memberItem == null)
            {
                message = "参数错误!";
                goto lbl_end;
            }
            if (companyItem.IsCanDel.HasValue && companyItem.IsCanDel.Value != 1)
            {
                message = "本单不支持退订";
                goto lbl_end; ;
            }
            if (memberItem.ItemStatus == (int)MemberCompanyItemStatus.Completed)
            {
                message = "此单你已经消费 ,不能再退订";
                goto lbl_end;
            }
            TransactionScope ts = null;
            SharedDbConnectionScope ss = null;
            try
            {
                ts = new TransactionScope( );
                ss = new SharedDbConnectionScope( );

                if (memberItem.PaymentID.HasValue)
                    Payment.Delete(memberItem.PaymentID.Value);
                SysMemberItem.Delete(memberItem.ItemID);
                companyItem.ItemClicked = companyItem.ItemClicked.Value - 1;
                companyItem.Save( );
                ts.Complete( );

                message = "退订成功";
                return true;
            }
            catch (Exception ex)
            {
                message = ex.Message;
                Logging.Log("CompanyItemBLL->CancelCompanyItem", ex, true);
            }
            finally
            {
                ss.Dispose( );
                ts.Dispose( );
            }
            lbl_end:
            return false;
        }
开发者ID:eleooo,项目名称:App,代码行数:48,代码来源:CompanyItemBLL.cs

示例8: On_ActionEdit

        protected override void On_ActionEdit(object sender, EventArgs e)
        {
            int companyID = Utilities.ToInt(EVENTARGUMENT);
            if (companyID <= 0)
            {
                txtMessage.InnerHtml = "结算商家参数错误!";
                goto lable_end;
            }
            string sPayInput = Params[string.Format("CompanyPay_{0}", companyID)];
            if (string.IsNullOrEmpty(sPayInput))
            {
                txtMessage.InnerHtml = "请输入结算金额!";
                goto lable_end;
            }
            decimal dPay = Math.Round(Utilities.ToDecimal(sPayInput));
            if (dPay == 0)
            {
                txtMessage.InnerHtml = "结算金额不能为零";
                goto lable_end;
            }

            SysCompany company = SysCompany.FetchByID(companyID);
            if (company == null)
            {
                txtMessage.InnerHtml = "结算商家参数错误!";
                goto lable_end;
            }
            if (Math.Abs(dPay) > Math.Abs(Utilities.ToDecimal(company.CompanyBalance)))
            {
                txtMessage.InnerHtml = "结算积分不能大于商家现有的积分余额!";
                goto lable_end;
            }
            string payMemo;
            //本次结算积分差额为{0}分,已向【{1}】支付{2}元
            //本次结算积分差额为{0}分,已向【{1}】收取{2}元
            if (dPay > 0)
                payMemo = string.Format("本次结算积分差额为{0}分,【{1}】已向【乐多分】收取{2}元", Math.Abs(dPay), company.CompanyName, Math.Abs(dPay));
            else
                payMemo = string.Format("本次结算积分差额为{0}分,【{1}】已向【乐多分】支付{2}元", Math.Abs(dPay), company.CompanyName, Math.Abs(dPay));
            TransactionScope ts = new TransactionScope( );
            SharedDbConnectionScope ss = new SharedDbConnectionScope( );
            try
            {
                SysMember mainAccount = UserBLL.MainAccount;
                new Payment
                {
                    PaymentCode = string.Empty,
                    PaymentDate = DateTime.Now,
                    PaymentCompanyID = companyID,
                    PaymentMemberID = mainAccount.Id,
                    PaymentSum = dPay,
                    PaymentStatus = 1,
                    PaymentType = (int)(PaymentType.SetMethod),
                    PaymentOrderID = 0,
                    PaymentEmail = string.Empty,
                    PaymentMemo = payMemo
                }.Save(AppContext.Context.User.Id);
                OrderBLL.UpdateBalance( );
                ts.Complete( );
            }
            catch (Exception ex)
            {
                txtMessage.InnerHtml = ex.Message;
                Logging.Log("FinancePayPoint->On_ActionEdit", ex, true);
                goto lable_end;
            }
            finally
            {
                ss.Dispose( );
                ts.Dispose( );
            }
            txtMessage.InnerHtml = payMemo;
            lable_end:
            this.On_ActionQuery(sender, e);
        }
开发者ID:eleooo,项目名称:App,代码行数:75,代码来源:FinancePayPoint.aspx.cs

示例9: On_ActionEdit

 protected override void On_ActionEdit(object sender, EventArgs e)
 {
     string argment = Utilities.FromBase64String(EVENTARGUMENT);
     string[] argArr = argment.Split(new char[] { '|' });
     int companyID = Utilities.ToInt(argArr[0]);
     if (companyID <= 0)
     {
         txtInfo.InnerText = "结算参数错误 companyID = 0,请重试!";
         goto lable_end;
     }
     SysCompany company = SysCompany.FetchByID(companyID);
     if (company == null)
     {
         txtInfo.InnerText = "结算参数错误 company = null,请重试!";
         goto lable_end;
     }
     string sPayRateInput = Params[string.Format("CompanyPayRate_{0}", companyID)];
     if (string.IsNullOrEmpty(sPayRateInput))
     {
         txtInfo.InnerText = "结算金额不能为零或佣金比例不能小于等于零!";
         goto lable_end;
     }
     decimal dPayRate = Convert.ToDecimal(sPayRateInput);
     if (dPayRate == 0)
     {
         txtInfo.InnerText = "结算金额不能为零或佣金比例不能小于等于零!";
         goto lable_end;
     }
     DateTime dtPayDate = Convert.ToDateTime(txtPayDate.Value);
     if (dtPayDate >= DateTime.Today)
     {
         txtInfo.InnerText = "不能结算当天之后的日期!";
         goto lable_end;
     }
     //dtPayDate = dtPayDate.AddDays(1);
     decimal dMemberCashSum = Convert.ToDecimal(argArr[1]);
     decimal dMemberPaySum = Convert.ToDecimal(argArr[2]);
     DateTime dt = GetMinOrderDate(company.Id);
     DateTime dtBegin = Utilities.ToDateTime(argArr[3]);
     if (dtBegin < dt)
         dtBegin = dt;
     decimal dSum = dMemberCashSum + dMemberPaySum;
     if (dPayRate <= 0 || dSum <= 0)
     {
         txtInfo.InnerText = "结算金额不能为零或佣金比例不能小于等于零!";
         goto lable_end;
     }
     decimal dRate = dPayRate / 100M;
     decimal dPaySum = dSum * dRate;
     string payMemo = string.Format(ResBLL.GetRes("FinancePayRate_PayMemo", "乐多分向{0}收取了佣金{1}元;", "商家佣金结算描述信息"), company.CompanyName, dPaySum);
     TransactionScope ts = new TransactionScope( );
     SharedDbConnectionScope ss = new SharedDbConnectionScope( );
     try
     {
         new PaymentRate
         {
             PaymentRateCompanyID = company.Id,
             PaymentRateDate = DateTime.Now,
             PaymentRateDateStart = dtBegin,
             PaymentRateDateEnd = dtPayDate,
             PaymentRateMemo = payMemo,
             PaymentRateRate = dRate, //佣金比例
             PaymentRateStatus = 1,
             PaymentRateCash = dMemberCashSum, //储值金额
             PaymentRateSale = dMemberPaySum,  //销售金额
             PaymentRateSum = dPaySum          //佣金金额
         }.Save( );
         OrderBLL.UpdateBalance( );
         ts.Complete( );
     }
     catch (Exception ex)
     {
         txtInfo.InnerHtml = ex.Message;
         Logging.Log("FinancePay->On_ActionEdit", ex, true);
         goto lable_end;
     }
     finally
     {
         ss.Dispose( );
         ts.Dispose( );
     }
     txtInfo.InnerText = payMemo;
     lable_end:
     this.On_ActionQuery(sender, e);
 }
开发者ID:eleooo,项目名称:App,代码行数:85,代码来源:FinancePay.aspx.cs

示例10: SaveCompanyAdForClient

 public bool SaveCompanyAdForClient(DataTable dtCompanyAd, DataTable dtPointSetting, byte[] fileData, string fileName, out int adsID, out string message)
 {
     message = string.Empty;
     adsID = 0;
     TransactionScope ts = new TransactionScope();
     SharedDbConnectionScope ss = new SharedDbConnectionScope();
     try
     {
         SysCompanyAd ad = SubSonic.Utilities.EntityFormat.TableToEntity<SysCompanyAd>(dtCompanyAd);
         //SysCompanyAdsPointSetting point = SubSonic.Utilities.EntityFormat.TableToEntity<SysCompanyAdsPointSetting>(dtPointSetting);
         //SysCompanyAdsClickSetting click = SubSonic.Utilities.EntityFormat.TableToEntity<SysCompanyAdsClickSetting>(dtClickSetting);
         if (ad == null || dtPointSetting == null)
         {
             message = "参数异常";
             return false;
         }
         if (dtPointSetting.Rows.Count == 0)
         {
             message = "奖励设置的行数为零";
             return false;
         }
         ad.ValidateWhenSaving = false;
         ad.AdsDate = DateTime.Now;
         ad.AdsPic = null;
         ad.MarkNew();
         ad.Save();
         adsID = ad.AdsID;
         if (fileData != null && fileData.Length > 0 && !string.IsNullOrEmpty(fileName))
         {
             var result = FileUpload.SaveUploadFile(fileData, FileType.Image, SaveType.CompanyAds, fileName, out message, true, adsID.ToString( ));
             ad.AdsPic = result != null ? result.RelPath : string.Empty;
             ad.Save();
         }
         foreach (DataRow row in dtPointSetting.Rows)
         {
             SysCompanyAdsPointSetting p = new SysCompanyAdsPointSetting();
             p.AdsID = ad.AdsID;
             p.OrderSumLimit = Utilities.ToDecimal(row[0]);
             p.AdsPoint = Utilities.ToDecimal(row[1]);
             p.ValidateWhenSaving = false;
             p.Save();
         }
         ts.Complete();
         message = "保存成功";
         return true;
     }
     catch (Exception ex)
     {
         Logging.Log("WebRestService->SaveCompanyAdForClient", ex, true);
         message = ex.Message;
         return false;
     }
     finally
     {
         ss.Dispose();
         ts.Dispose();
     }
 }
开发者ID:eleooo,项目名称:App,代码行数:58,代码来源:WebRestService.asmx.cs

示例11: On_ActionAdd

        protected override void On_ActionAdd(object sender, EventArgs e)
        {
            if (Utilities.IsNull(txtSupportSubject.Text))
            {
                txtMessage.InnerHtml = "请输入咨询的标题!";
                return;
            }

            SysSupport support = SysSupport.FetchByID(Id);
            if (support == null)
            {
                support = new SysSupport( );
                support.SupportIsRead = false;
                support.SupportItem = 1;
                support.SupportProductID = 0;
                support.SupportFid = CurrentUser.Id;
                support.SupportPhoto = string.Empty;
                support.SupportRating = 1;
                support.SupportRatingReason = string.Empty;
                support.SupportStatus = 1;
                support.SupportTid = 0;
                support.SupportType = 1;
                support.SupportDate = DateTime.Now;
                support.SupportDateFinish = DateTime.MinValue.AddYears(0x76c);
                support.SupportDateReply = DateTime.MinValue.AddYears(0x76c);
                support.SupportAttach = string.Empty;
            }
            TransactionScope ts = new TransactionScope( );
            SharedDbConnectionScope ss = new SharedDbConnectionScope( );
            try
            {
                if (!Utilities.IsNull(txtSupportPhoto.Value) && !string.IsNullOrEmpty(txtSupportPhoto.PostedFile.FileName))
                {
                    string message;
                    var result = Eleooo.Common.FileUpload.SaveUploadFile(txtSupportPhoto.PostedFile, FileType.Image | FileType.Zip | FileType.Zip, SaveType.Support, out message, true);
                    if (result == null)
                    {
                        txtMessage.InnerHtml = message;
                        return;
                    }
                    support.SupportPhoto = result.PhyPath;
                }
                support.SupportSubject = txtSupportSubject.Text;
                support.SupportContent = HttpUtility.HtmlEncode(txtSupportContent.Text);
                support.Save( );
                _id = support.SupportId;
                new SysSupportMessage
                {
                    SupportMsgSid = _id,
                    SupportMsgDate = DateTime.Now,
                    SupportMsgFid = support.SupportFid,
                    SupportMsgTid = 0,
                    SupportMsgIsAsk = false,
                    SupportMsgIsRead = false,
                    SupportMsgPhoto = support.SupportPhoto,
                    SupportMsgMemo = string.IsNullOrEmpty(support.SupportContent) ? support.SupportSubject : support.SupportContent
                }.Save( );
                ts.Complete( );
                txtMessage.InnerHtml = "保存成功!";
            }
            catch (Exception ex)
            {
                Logging.Log("Company.SupportEdit->On_ActionAdd", ex, true);
                txtMessage.InnerHtml = ex.Message;
            }
            finally
            {
                ss.Dispose( );
                ts.Dispose( );
            }
            On_ActionQuery(sender, e);
        }
开发者ID:eleooo,项目名称:App,代码行数:72,代码来源:SupportEdit.aspx.cs

示例12: ClickCompanyAds

 public static bool ClickCompanyAds(SysMember user, int adsID, string answer, out string message)
 {
     SysCompanyAd item = SysCompanyAd.FetchByID(adsID);
     SysCompany company = SysCompany.FetchByID(item.AdsCompanyID);
     decimal userLastOrderSum = UserBLL.GetUserLastMonthOrderSum(user.Id);
     if (!CheckCompanyAdsCanClick(user, item, company, userLastOrderSum, out message))
         goto lbl_end;
     if (!string.IsNullOrEmpty(item.AdsQuestion) && item.AdsRightAnswer.HasValue &&
         Utilities.ToInt(answer) != item.AdsRightAnswer.Value)
     {
         message = "你的互动答题答案不正确!";
         goto lbl_end;
     }
     decimal point = CompanyAdsBLL.GetCompanyAdPoint(userLastOrderSum, item.AdsID);
     if (CompanyBLL.IsMaxPointLevel(company.Id, point))
     {
         message = "此广告主累计赠送的积分已经超过500,须进行积分结算后才能继续操作系统";
         goto lbl_end;
     }
     SysMemberAd ad = new SysMemberAd
     {
         AdsDate = DateTime.Now,
         AdsMemberID = user.Id,
         AdsPoint = point,
         CompanyID = item.AdsCompanyID,
         CompanyAdsID = item.AdsID,
         OrderSum = userLastOrderSum,
         PaymentID = 0
     };
     TransactionScope ts = new TransactionScope( );
     SharedDbConnectionScope ss = new SharedDbConnectionScope( );
     try
     {
         ad.Save( );
         item.AdsClicked = Utilities.ToInt(item.AdsClicked) + 1;
         item.AdsPointSum = Utilities.ToDecimal(item.AdsPointSum) + point;
         item.Save( );
         if (ad.AdsPoint.HasValue && ad.AdsPoint.Value > 0)
         {
             var p = new Payment
             {
                 PaymentDate = DateTime.Now,
                 PaymentCode = string.Empty,
                 PaymentCompanyID = item.AdsCompanyID,
                 PaymentEmail = string.Empty,
                 PaymentMemberID = user.Id,
                 PaymentMemo = string.Format("浏览【{0}】投放的广告,获得{1:0.00}个积分", company.CompanyName, ad.AdsPoint),
                 PaymentOrderID = ad.AdsID,
                 PaymentStatus = 1,
                 PaymentSum = ad.AdsPoint.Value,
                 PaymentType = (int)PaymentType.AdvsGive
             };
             p.Save( );
             ad.PaymentID = p.Id;
             ad.Save( );
             OrderBLL.UpdateBalance( );
         }
         ts.Complete( );
         message = string.Format("成功抢得{0}个积分", ad.AdsPoint);
         return true;
     }
     catch (Exception ex)
     {
         message = "抢积分失败:" + ex.Message;
         Logging.Log("CompanyAdsBLL->ClickCompanyAds", ex, true);
     }
     finally
     {
         ss.Dispose( );
         ts.Dispose( );
     }
     lbl_end:
     return false;
 }
开发者ID:eleooo,项目名称:App,代码行数:74,代码来源:CompanyAdsBLL.cs


注:本文中的SharedDbConnectionScope.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。