コード例 #1
0
        public static bool Create(List <WX_Article> models)
        {
            if (models == null || models.Count == 0)
            {
                throw new ArgumentNullException("models");
            }

            IWXArticle factory = WXArticleFactory.GetFactory();

            using (DbOperator dbOperator = ConnectionManager.CreateConnection()) {
                try
                {
                    dbOperator.BeginTransaction();

                    factory.DeleteByGroupID(models.First().GroupID, dbOperator);
                    foreach (var item in models)
                    {
                        bool result = factory.Create(item, dbOperator);
                        if (!result)
                        {
                            throw new MyException("添加图文失败");
                        }
                        OperateLogServices.AddOperateLog <WX_Article>(item, OperateType.Add);
                    }

                    dbOperator.CommitTransaction();
                    return(true);
                }
                catch {
                    dbOperator.RollbackTransaction();
                    throw;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 车辆停用
        /// </summary>
        /// <param name="grantId"></param>
        /// <returns></returns>
        public static bool CarStopUse(string grantId)
        {
            IParkGrant factory = ParkGrantFactory.GetFactory();
            ParkGrant  grant   = factory.QueryByGrantId(grantId);

            if (grant == null)
            {
                throw new MyException("获取授权信息失败");
            }

            if (grant.State != ParkGrantState.Normal)
            {
                throw new MyException("状态不正确:只有正在使用状态才能停用");
            }

            using (DbOperator dbOperator = ConnectionManager.CreateConnection())
            {
                bool result = factory.Update(grantId, ParkGrantState.Stop, dbOperator);
                if (result)
                {
                    OperateLogServices.AddOperateLog(OperateType.Update, string.Format("grantId:{0},State:{1}", grantId, (int)ParkGrantState.Stop));
                }
                return(result);
            }
        }
コード例 #3
0
        public static bool AddByGateid(ParkCarlineInfo model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            IParkCarlineInfo factory = ParkCarlineInfoFactory.GetFactory();
            var  tempmode            = factory.QueryByGate(model.Gateid);
            bool result = false;

            if (tempmode == null)
            {
                result = factory.Add(model);
                if (result)
                {
                    OperateLogServices.AddOperateLog <ParkCarlineInfo>(model, OperateType.Add);
                }
            }
            else
            {
                result = factory.Update(model);
                if (result)
                {
                    OperateLogServices.AddOperateLog <ParkCarlineInfo>(model, OperateType.Update);
                }
            }
            return(result);
        }
コード例 #4
0
        /// <summary>
        /// 退款
        /// </summary>
        /// <param name="grantlist"></param>
        /// <param name="Amout"></param>
        /// <param name="EndTime"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool RefundCardAmout(ParkGrant grantmodel, DateTime EndTime, ParkOrder model)
        {
            if (grantmodel == null || model == null)
            {
                throw new ArgumentNullException("models");
            }
            model.RecordID = GuidGenerator.GetGuidString();
            IParkGrant       factory = ParkGrantFactory.GetFactory();
            List <ParkGrant> list    = new List <ParkGrant>();

            if (grantmodel.PKLot == null || grantmodel.PKLot.Trim() == "")
            {
                list.Add(grantmodel);
            }
            else
            {
                string mesg = "";
                list = factory.GetCardgrantsByLot(grantmodel.PKID, grantmodel.PKLot, out mesg);
            }

            bool result = factory.RefundCardAmout(list, EndTime, model);

            if (result)
            {
                foreach (var item in list)
                {
                    OperateLogServices.AddOperateLog <ParkGrant>(item, OperateType.Update);
                }
                OperateLogServices.AddOperateLog <ParkOrder>(model, OperateType.Add);
            }
            return(result);
        }
コード例 #5
0
        /// <summary>
        /// 手动退款(退款失败是调用)
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="certpath"></param>
        /// <returns></returns>
        public static bool ManualRefund(decimal orderId, string certpath)
        {
            TxtLogServices.WriteTxtLogEx("OnlineOrderServices", "方法名:{0},操作类型:{1},订单编号:{2},备注:{3}", "ManualRefund", "订单退款处理", orderId, "开始订单退款处理");

            bool refundResult = false;

            lock (order_lock)
            {
                try
                {
                    IOnlineOrder factory = OnlineOrderFactory.GetFactory();
                    OnlineOrder  order   = factory.QueryByOrderId(orderId);
                    if (order.Status == OnlineOrderStatus.RefundFail)
                    {
                        refundResult = Refund(order, certpath);
                    }
                    if (refundResult)
                    {
                        OperateLogServices.AddOperateLog(OperateType.Other, string.Format("手动执行退款操作,退款订单号:{0}", orderId));
                    }
                }
                catch (Exception ex)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("OnlineOrderServices", "手动执行退款操作失败", ex, LogFrom.WeiXin);
                }
            }
            return(refundResult);
        }
コード例 #6
0
        public static bool Update(ParkFeeRule model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            ParkArea parkArea = ParkAreaServices.QueryByRecordId(model.AreaID);

            if (parkArea == null)
            {
                throw new MyException("获取区域信息失败");
            }

            IParkFeeRule factory = ParkFeeRuleFactory.GetFactory();

            if (model.IsOffline)
            {
                List <ParkFeeRule> models = factory.QueryParkFeeRuleByParkingId(parkArea.PKID);
                if (models.Exists(p => p.IsOffline == true && p.FeeRuleID != model.FeeRuleID))
                {
                    throw new MyException("该车场已存在脱机收费规则了");
                }
            }
            model.ParkFeeRuleDetails.ForEach(p => { p.RuleDetailID = GuidGenerator.GetGuid().ToString(); p.RuleID = model.FeeRuleID; });
            bool result = factory.Update(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <ParkFeeRule>(model, OperateType.Update);
            }
            return(result);
        }
コード例 #7
0
        public static bool Add(ParkDerateConfig model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            model.RecordID = GuidGenerator.GetGuidString();
            IParkDerateConfig       factory = ParkDerateConfigFactory.GetFactory();
            List <ParkDerateConfig> configs = factory.QueryByParkingId(model.PKID);

            configs = configs.Where(p => (p.ConsumeStartAmount <= model.ConsumeStartAmount && p.ConsumeEndAmount >= model.ConsumeStartAmount) ||
                                    (p.ConsumeStartAmount <= model.ConsumeEndAmount && p.ConsumeEndAmount >= model.ConsumeEndAmount)).ToList();
            if (configs.Count > 0)
            {
                throw new MyException("消费金额重复");
            }
            bool result = factory.Add(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <ParkDerateConfig>(model, OperateType.Add);
            }
            return(result);
        }
コード例 #8
0
        /// <summary>
        /// 月租车恢复使用
        /// </summary>
        /// <param name="cardGrantId"></param>
        /// <returns></returns>
        public static bool CarRestoreUse(string grantId)
        {
            IParkGrant factory = ParkGrantFactory.GetFactory();
            ParkGrant  grant   = factory.QueryByGrantId(grantId);

            if (grant == null)
            {
                throw new MyException("获取授权信息失败");
            }
            if (grant.State == ParkGrantState.Normal)
            {
                return(true);
            }

            ParkCarType carType = ParkCarTypeServices.QueryParkCarTypeByRecordId(grant.CarTypeID);

            if (carType == null)
            {
                throw new MyException("获取车型类型失败");
            }

            IParkCardSuspendPlan planFactory = ParkCardSuspendPlanFactory.GetFactory();

            using (DbOperator dbOperator = ConnectionManager.CreateConnection())
            {
                try
                {
                    dbOperator.BeginTransaction();
                    ParkCardSuspendPlan plan       = planFactory.QueryByGrantId(grantId);
                    DateTime            newEndDate = ComputeParkGrantNewEndDate(grant, plan);
                    grant.BeginDate = grant.BeginDate == null ? DateTime.Now.Date : grant.BeginDate;
                    bool result = factory.RestoreUse(grantId, grant.BeginDate, newEndDate, dbOperator);
                    if (!result)
                    {
                        throw new MyException("恢复暂停失败");
                    }

                    result = planFactory.Delete(grantId, dbOperator);
                    if (!result)
                    {
                        throw new MyException("取消暂停计划失败");
                    }
                    dbOperator.CommitTransaction();

                    ParkGrant dbGrant = factory.QueryByGrantId(grantId);
                    if (dbGrant != null)
                    {
                        OperateLogServices.AddOperateLog <ParkGrant>(dbGrant, OperateType.Update);
                    }
                    OperateLogServices.AddOperateLog(OperateType.Update, string.Format("CarRestore.GrantID:{0}", grantId));
                    return(result);
                }
                catch (Exception ex)
                {
                    dbOperator.RollbackTransaction();
                    throw ex;
                }
            }
        }
コード例 #9
0
        public static bool SellerCharge(string sellerId, decimal balance, string operatorId)
        {
            if (sellerId.IsEmpty())
            {
                throw new ArgumentNullException("sellerId");
            }
            if (operatorId.IsEmpty())
            {
                throw new ArgumentNullException("operatorId");
            }
            if (balance <= 0)
            {
                throw new ArgumentNullException("balance");
            }

            IParkSeller factory = ParkSellerFactory.GetFactory();
            ParkSeller  model   = factory.QueryBySellerId(sellerId);

            if (model == null)
            {
                throw new MyException("商家不存在");
            }

            using (DbOperator dbOperator = ConnectionManager.CreateConnection())
            {
                try
                {
                    dbOperator.BeginTransaction();
                    ParkOrder order = ParkOrderServices.MarkSellerChargeOrder(model, balance, operatorId, OrderSource.ManageOffice, OrderPayWay.Cash, dbOperator);
                    if (order == null)
                    {
                        throw new MyException("创建充值订单失败");
                    }

                    bool result = factory.SellerRecharge(sellerId, balance, dbOperator);
                    if (!result)
                    {
                        throw new MyException("取消暂停计划失败");
                    }
                    dbOperator.CommitTransaction();

                    ParkSeller newSeller = factory.QueryBySellerId(sellerId);
                    if (newSeller != null)
                    {
                        OperateLogServices.AddOperateLog(OperateType.Update, string.Format("sellerId:{0},充值:{1},余额为:{2}", sellerId, balance, newSeller.Balance));
                    }
                    return(result);
                }
                catch (Exception ex)
                {
                    dbOperator.RollbackTransaction();
                    throw ex;
                }
            }
        }
コード例 #10
0
        public static bool Update(WX_Menu model)
        {
            IWXMenu factory = WXMenuFactory.GetFactory();
            bool    result  = factory.Update(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <WX_Menu>(model, OperateType.Update);
            }
            return(result);
        }
コード例 #11
0
        public static bool UpdatePerson(tgPerson modle)
        {
            ItgPerson factory = StatisticstgPerson.GetFactory();
            bool      result  = factory.Update(modle);

            if (result)
            {
                OperateLogServices.AddOperateLog(OperateType.Update, string.Format("personId:{0},personName:{1},parkingname:{2}", modle.id, modle.name, modle.PKName));
            }
            return(result);
        }
コード例 #12
0
        /// <summary>
        /// 添加推广人员成功订单记录
        /// </summary>
        /// <param name="modle"></param>
        /// <returns></returns>
        public static bool Addperson(TgOrder modle)
        {
            ITgOrder factory = TgOrderFactory.GetFactory();
            bool     result  = factory.addTgOrder(modle);

            if (result)
            {
                OperateLogServices.AddOperateLog(OperateType.Add, string.Format("orderId:{0},personName:{1},parkingname:{2}", modle.ID, modle.PersonName, modle.PKName));
            }
            return(result);
        }
コード例 #13
0
        public static bool DeletePerson(string tbName, string fild, string value)
        {
            ItgPerson factory = StatisticstgPerson.GetFactory();
            bool      result  = factory.Delete(tbName, fild, value);

            if (result)
            {
                OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("tablename:{0},personid:{1}", tbName, value));
            }
            return(result);
        }
コード例 #14
0
        public static bool Add(BaseEmployee employee, EmployeePlate plate, BaseCard card, ParkGrant parkGrant, DbOperator dbOperator)
        {
            if (employee == null)
            {
                throw new ArgumentNullException("employee");
            }
            if (plate == null)
            {
                throw new ArgumentNullException("plate");
            }
            if (card == null)
            {
                throw new ArgumentNullException("card");
            }
            if (parkGrant == null)
            {
                throw new ArgumentNullException("parkGrant");
            }

            bool result = BaseEmployeeServices.AddOrUpdateBaseEmployee(employee, dbOperator);

            if (!result)
            {
                throw new MyException("保存人员信息失败");
            }

            result = BaseCardServices.AddOrUpdateCard(card, dbOperator);
            if (!result)
            {
                throw new MyException("保存卡信息失败");
            }

            result = EmployeePlateServices.AddOrUpdateEmployeePlate(plate, dbOperator);
            if (!result)
            {
                throw new MyException("保存车牌信息失败");
            }

            parkGrant.PlateID = plate.PlateID;
            parkGrant.CardID  = card.CardID;
            result            = AddOrderUpdateParkGrant(parkGrant, dbOperator);
            if (!result)
            {
                throw new MyException("保存授权失败");
            }
            if (result)
            {
                OperateLogServices.AddOperateLog <BaseEmployee>(employee, OperateType.Add);
                OperateLogServices.AddOperateLog <EmployeePlate>(plate, OperateType.Add);
                OperateLogServices.AddOperateLog <BaseCard>(card, OperateType.Add);
                OperateLogServices.AddOperateLog <ParkGrant>(parkGrant, OperateType.Add);
            }
            return(result);
        }
コード例 #15
0
        public static bool UpdatePayConfig(WX_ApiConfig model)
        {
            IWXApiConfig factory = WXApiConfigFactory.GetFactory();
            bool         result  = factory.UpdatePayConfig(model);

            if (result)
            {
                RefreshCache();
                OperateLogServices.AddOperateLog <WX_ApiConfig>(model, OperateType.Update);
            }
            return(result);
        }
コード例 #16
0
        public static bool CancelParkGrant(string grantId)
        {
            if (grantId.IsEmpty())
            {
                throw new ArgumentNullException("grantId");
            }

            IParkGrant     factory      = ParkGrantFactory.GetFactory();
            IBaseCard      cardFactory  = BaseCardFactory.GetFactory();
            IEmployeePlate plateFactory = EmployeePlateFactory.GetFactory();

            using (DbOperator dbOperator = ConnectionManager.CreateConnection())
            {
                try
                {
                    ParkGrant grant = factory.QueryByGrantId(grantId);

                    dbOperator.BeginTransaction();
                    bool result = plateFactory.Delete(grant.PlateID, dbOperator);
                    if (!result)
                    {
                        throw new MyException("删除车牌失败");
                    }

                    result = cardFactory.Delete(grant.CardID, dbOperator);
                    if (!result)
                    {
                        throw new MyException("删除卡失败");
                    }

                    result = factory.Delete(grantId, dbOperator);
                    if (!result)
                    {
                        throw new MyException("删除授权失败");
                    }
                    dbOperator.CommitTransaction();
                    if (result)
                    {
                        OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("grantId:{0}", grantId));
                    }
                    return(result);
                }
                catch
                {
                    dbOperator.RollbackTransaction();
                    throw;
                }
            }
        }
コード例 #17
0
        public static bool Update(ParkCarTypeSingle model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            IParkCarTypeSingle factory = ParkCarTypeSingleFactory.GetFactory();
            bool result = factory.Update(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <ParkCarTypeSingle>(model, OperateType.Update);
            }
            return(result);
        }
コード例 #18
0
        public static bool Delete(string PlanID)
        {
            if (string.IsNullOrWhiteSpace(PlanID))
            {
                throw new ArgumentNullException("PlanID");
            }

            IParkLpPlan factory = ParkLpPlanFactory.GetFactory();
            bool        result  = factory.Delete(PlanID);

            if (result)
            {
                OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("recordId:{0}", PlanID));
            }
            return(result);
        }
コード例 #19
0
        public static bool DeleteByGroupID(string groupId)
        {
            if (groupId.IsEmpty())
            {
                throw new ArgumentNullException("groupId");
            }

            IWXArticle factory = WXArticleFactory.GetFactory();
            bool       result  = factory.DeleteByGroupID(groupId);

            if (result)
            {
                OperateLogServices.AddOperateLog("groupId:" + groupId, OperateType.Delete);
            }
            return(result);
        }
コード例 #20
0
        public static bool UpdateMenuKeyId(int menuId, int?keyId)
        {
            if (menuId < 1)
            {
                throw new ArgumentNullException("menuId");
            }

            IWXMenu factory = WXMenuFactory.GetFactory();
            bool    result  = factory.UpdateMenuKeyId(menuId, keyId);

            if (result)
            {
                OperateLogServices.AddOperateLog(string.Format("编号:{0},关键字为:{1}", menuId, keyId.HasValue ? keyId.Value.ToString() : string.Empty), OperateType.Update);
            }
            return(result);
        }
コード例 #21
0
        public static bool DeleteByCardId(string cardId)
        {
            if (cardId.IsEmpty())
            {
                throw new ArgumentNullException("cardId");
            }

            IParkGrant factory = ParkGrantFactory.GetFactory();
            bool       result  = factory.DeleteByCardId(cardId);

            if (result)
            {
                OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("cardId:{0}", cardId));
            }
            return(result);
        }
コード例 #22
0
        public static bool UpdateReplyType(int id, ReplyType type)
        {
            if (id < 1)
            {
                throw new ArgumentNullException("id");
            }

            IWXKeyword factory = WXKeywordFactory.GetFactory();
            bool       result  = factory.UpdateReplyType(id, type);

            if (result)
            {
                OperateLogServices.AddOperateLog(string.Format("编号:{0},修改为:{1}", id, type.GetDescription()), OperateType.Update);
            }
            return(result);
        }
コード例 #23
0
        public static bool Delete(string sellerId)
        {
            if (sellerId.IsEmpty())
            {
                throw new ArgumentNullException("sellerId");
            }

            IParkSeller factory = ParkSellerFactory.GetFactory();
            bool        result  = factory.Delete(sellerId);

            if (result)
            {
                OperateLogServices.AddOperateLog(OperateType.Update, string.Format("sellerId:{0}", sellerId));
            }
            return(result);
        }
コード例 #24
0
        public static bool Delete(string feeRuleId)
        {
            if (string.IsNullOrWhiteSpace(feeRuleId))
            {
                throw new ArgumentNullException("feeRuleId");
            }

            IParkFeeRule factory = ParkFeeRuleFactory.GetFactory();
            bool         result  = factory.Delete(feeRuleId);

            if (result)
            {
                OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("feeRuleId:{0}", feeRuleId));
            }
            return(result);
        }
コード例 #25
0
        public static bool Add(ParkGrant model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            model.GID = GuidGenerator.GetGuidString();
            IParkGrant factory = ParkGrantFactory.GetFactory();
            bool       result  = factory.Add(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <ParkGrant>(model, OperateType.Add);
            }
            return(result);
        }
コード例 #26
0
        public static bool Delete(string recordId)
        {
            if (recordId.IsEmpty())
            {
                throw new ArgumentNullException("recordId");
            }

            IParkBlacklist factory = ParkBlacklistFactory.GetFactory();
            bool           result  = factory.Delete(recordId);

            if (result)
            {
                OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("recordId:{0}", recordId));
            }
            return(result);
        }
コード例 #27
0
        public static bool Delete(int id)
        {
            if (id < 1)
            {
                throw new ArgumentNullException("id");
            }

            IWXArticle factory = WXArticleFactory.GetFactory();
            bool       result  = factory.Delete(id);

            if (result)
            {
                OperateLogServices.AddOperateLog("删除编号:" + id, OperateType.Delete);
            }
            return(result);
        }
コード例 #28
0
        public static bool Update(PGArea model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            IPGArea factory = PGAreaFactory.GetFactory();
            bool    result  = factory.Update(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <PGArea>(model, OperateType.Update);
            }
            return(result);
        }
コード例 #29
0
        public static bool AuditingDiffOrder(ParkOrder model, decimal Amount, decimal PayAmount, out string ErrorMessage)
        {
            if (model.RecordID.IsEmpty())
            {
                throw new ArgumentNullException("recordID");
            }

            IParkOrder factory = ParkOrderFactory.GetFactory();
            bool       result  = factory.AuditingDiffOrder(model.RecordID, Amount, PayAmount, out ErrorMessage);

            if (result)
            {
                OperateLogServices.AddOperateLog <ParkOrder>(model, OperateType.Update);
            }
            return(result);
        }
コード例 #30
0
        public static bool Add(PGArea model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            model.AreaID = GuidGenerator.GetGuid().ToString();
            IPGArea factory = PGAreaFactory.GetFactory();
            bool    result  = factory.Add(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <PGArea>(model, OperateType.Add);
            }
            return(result);
        }