Beispiel #1
0
        public T Charge <T>(ICharge charge) where T : IPayment
        {
            var url = _context.Url + "/quickbooks/v4/payments/charges";

            var payment = new Model.Gateway.Payment();

            payment.Amount   = charge.Amount;
            payment.Currency = _context.Currency;

            var address = new Model.Gateway.Address();

            address.City          = charge.Customer.City;
            address.Country       = charge.Customer.Country;
            address.PostalCode    = charge.Customer.Zipcode;
            address.Region        = charge.Customer.StateOrProvince;
            address.StreetAddress = charge.Customer.Address;

            var creditCard = new Model.Gateway.CreditCard();

            creditCard.Name     = charge.Customer.FirstName + " " + charge.Customer.LastName;
            creditCard.Address  = address;
            creditCard.Number   = charge.CreditCard.CardNumber;
            creditCard.ExpMonth = charge.CreditCard.ExpirationMonth;
            creditCard.ExpYear  = charge.CreditCard.ExpirationYear;
            creditCard.CVC      = charge.CreditCard.CVV;
            payment.Card        = creditCard;

            var body     = JsonConvert.SerializeObject(payment);
            var response = _context.SendRequest(url, "POST", body, new Dictionary <string, string>(), null);

            return(JsonConvert.DeserializeObject <T>(response.Body.ToString()));
        }
Beispiel #2
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            if (!(pawn is ICharge))
            {
                return(null);
            }
            ICharge chargee = (ICharge)pawn;
            Droid   droid   = (Droid)pawn;

            if (droid != null && !droid.Active)
            {
                return(null);
            }

            float chargeThreshold;
            float distance;

            switch (stage)
            {
            case 1:
            {
                chargeThreshold = chargee.PowerSafeThreshold;
                distance        = 20f;
                break;
            }

            case 2:
            {
                chargeThreshold = chargee.PowerLowThreshold;
                distance        = 50f;
                break;
            }

            case 3:
            {
                chargeThreshold = chargee.PowerCriticalThreshold;
                distance        = 9999f;
                break;
            }

            default:
            {
                chargeThreshold = chargee.PowerLowThreshold;
                distance        = 50f;
                break;
            }
            }
            if (chargee.TotalCharge <= chargee.MaxEnergy * chargeThreshold)
            {
                Thing target = DroidManager.Instance.ClosestChargerFor(chargee, droid.Map, distance);
                if (target != null)
                {
                    if (droid.CanReserve(target, 1, -1, null, false))
                    {
                        return(new Job(DefDatabase <JobDef> .GetNamed("MD3_ChargeDroidJob"), new LocalTargetInfo(target)));
                    }
                }
            }
            return(null);
        }
Beispiel #3
0
        /// <summary>
        /// 调用接口前需初始化参数;
        /// 从数据库或配置文件中加载配置
        /// </summary>
        /// <returns></returns>
        private static bool InitConfig()
        {
            try
            {
                loadalready();
                IsOtherLabel = dbHelp.GetPivasAllSet("第三方瓶签");//获取第三方瓶签的设置

                if (IsOtherLabel == "1")
                {
                    LabelLength = int.Parse(dbHelp.GetPivasAllSetValue2("第三方瓶签")); //获取瓶签长度
                    LabelBS     = dbHelp.GetPivasAllSetValue3("第三方瓶签");            //获取瓶签标识
                    InternalLogger.Log.Debug("LabelLength" + LabelLength.ToString() + "LabelBS" + LabelBS.ToString());
                }

                //读取计费配置值并获取接口对象
                IsCharge = dbHelp.IniReadValuePivas("Charge", "PZ") == "1";
                #region 测试
                charge = ChargeFactory.GetCharge(HOSPITAL_TYPE);
                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                InternalLogger.Log.Error("初始化发生错误,请检查配置;" + ex.Message);
            }
            return(false);
        }
Beispiel #4
0
        public void ResetPlayer()
        {
            PlayerInput.onDisableInput.Invoke();
            disableInvulnerability();

            rb.velocity = Vector2.zero;

            anim.SetBool("Death", false);
            anim.SetInteger("state", 0);

            foreach (Skill skill in skills)
            {
                skill.ResetCooldown();
                if (skill is ICharge)
                {
                    ICharge chargeSkill = skill as ICharge;
                    chargeSkill.RefillCharges();
                }
            }

            RefillCurrentHealth();
            combatState = CombatState.NonCombat;

            // Reset rotation and position
            transform.position = spawnPosition;
            transform.rotation = spawnRotation;
        }
        public ICharge SelectChargerComponent(ConsoleOutput consoleOutput)
        {
            Console.Clear();
            string chargeIndex = consoleOutput.GetChosenIndex(chargeComponent);

            switch (chargeIndex)
            {
            case "1":
                chargeComponent = new iPhoneCharger(consoleOutput);
                break;

            case "2":
                chargeComponent = new SamsungCharger(consoleOutput);
                break;

            case "3":
                chargeComponent = new UnofficialiPhoneCharger(consoleOutput);
                break;

            default:
                consoleOutput.WriteLine("Unknown charger component selected, please select component from the list.");
                consoleOutput.WriteLine("Press any key to continue...");
                Console.ReadKey();
                chargeComponent = SelectChargerComponent(consoleOutput);
                break;
            }
            return(chargeComponent);
        }
Beispiel #6
0
 public Information()
 {
     InitializeComponent();
     #region csw修改,需要此exe下配置文件IMEQPIVAs.ini
     bPre = ChargeFactory.GetCharge(dbHelp.IniReadValuePivas("Charge", "HospitalType"));
     #endregion
 }
Beispiel #7
0
        public string SelectChargeComponent(int index)
        {
            var selectionBuilder = new StringBuilder();

            switch (index)
            {
            case 1:
                ChargeComponent = new AppleCharger(110, Output);
                selectionBuilder.AppendLine(Output.WriteLine("Apple Charger playback selected"));
                break;

            case 2:
                ChargeComponent = new XiaomiCharger(220, Output);
                selectionBuilder.AppendLine(Output.WriteLine("Xiaomi Charger playback selected"));
                break;

            default:
                selectionBuilder.AppendLine(Output.WriteLine("No Charger selected"));
                break;
            }

            if (ChargeComponent != null)
            {
                selectionBuilder.AppendLine(Output.WriteLine($"Set charger to {nameof(Mobile)}..."));
            }

            return(selectionBuilder.ToString());
        }
Beispiel #8
0
        /// <summary>
        /// 使用反射获取计费接口
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static ICharge GetCharge(string type)
        {
            ICharge iCharge = null;

            try
            {
                switch (type)
                {
                case HospitalType_Const.ORIGIN:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeOrigin")) as ICharge;
                    break;

                case HospitalType_Const.QD:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeQD")) as ICharge;
                    break;

                case HospitalType_Const.BDGJ:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeBDGJ")) as ICharge;
                    break;

                case HospitalType_Const.SDFY:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeSDFY")) as ICharge;
                    break;

                case HospitalType_Const.HNZL:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeHNZL")) as ICharge;
                    break;

                case HospitalType_Const.TJXK:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeTJXKService.ChargeTJXK")) as ICharge;
                    break;

                case HospitalType_Const.NBDY:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeNBDYService.ChargeNBDY")) as ICharge;
                    break;

                case HospitalType_Const.SHLYD:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeSHLYDService.ChareSHLYD")) as ICharge;
                    break;

                case HospitalType_Const.GDHQ:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeGDHQService.ChargeGDHQ")) as ICharge;
                    break;

                case HospitalType_Const.CZ:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeCZService.ChargeCZ")) as ICharge;
                    break;

                default:
                    iCharge = Activator.CreateInstance(Type.GetType("ChargeInterface.ChargeOrigin")) as ICharge;
                    break;
                }
            }
            catch (Exception ex)
            {
                InternalLogger.Log.Error("通过反射获取计费接口对象出错:" + ex.Message);
            }
            return(iCharge);
        }
 public void EndCharge()
 {
     chargee = null;
     if (Power != null)
     {
         Power.powerOutputInt = -1f;
     }
 }
 public void BeginCharge(ICharge chargee)
 {
     this.chargee = chargee;
     if (Power != null)
     {
         Power.powerOutputInt = -Power.props.basePowerConsumption;
     }
 }
 public void EndCharge()
 {
     chargee = null;
     if (Power != null)
     {
         Power.powerOutputInt = -1f;
     }
 }
Beispiel #12
0
        static void Main(string[] args)
        {
            WindsorContainer container = WindsorInit.GetContainer();
            ICharge          charge    = container.Resolve <ICharge>();

            charge.ClinicChcarge();
            Console.ReadKey();
        }
 public void BeginCharge(ICharge chargee)
 {
     this.chargee = chargee;
     if (Power != null)
     {
         Power.powerOutputInt = -Power.props.basePowerConsumption;
     }
 }
Beispiel #14
0
 public void BeginCharge(ICharge d)
 {
     chargee = d;
     if (Power != null)
     {
         Power.powerOutputInt = -Power.Props.basePowerConsumption;
     }
 }
Beispiel #15
0
 /// <summary>
 /// Sales the specified card number.
 /// </summary>
 /// <param name="cardNumber">The card number.</param>
 /// <param name="expirationMonthAndYear">The expiration month and year.</param>
 /// <param name="cvv">The CVV.</param>
 /// <param name="amount">The amount.</param>
 /// <returns></returns>
 public override void Charge(ICharge charge)
 {
     SetApiAction(RequestAction.Charge);
     Queue(AuthorizeDotNetApi.CreditCardNumber, charge.CreditCard.CardNumber);
     Queue(AuthorizeDotNetApi.CreditCardExpiration, charge.CreditCard.ExpirationMonth + charge.CreditCard.ExpirationYear);
     Queue(AuthorizeDotNetApi.CreditCardCode, charge.CreditCard.CVV);
     Queue(AuthorizeDotNetApi.Amount, charge.Amount.ToString());
 }
        protected override Job TryGiveTerminalJob(Pawn pawn)
        {
            if (!(pawn is ICharge))
            {
                return(null);
            }
            ICharge chargee = (ICharge)pawn;
            Droid   droid   = (Droid)pawn;

            if (droid != null && !droid.Active)
            {
                return(null);
            }

            float chargeThreshold;
            float distance;

            switch (stage)
            {
            case 1:
            {
                chargeThreshold = chargee.PowerSafeThreshold;
                distance        = 20f;
                break;
            }

            case 2:
            {
                chargeThreshold = chargee.PowerLowThreshold;
                distance        = 50f;
                break;
            }

            case 3:
            {
                chargeThreshold = chargee.PowerCriticalThreshold;
                distance        = 9999f;
                break;
            }

            default:
            {
                chargeThreshold = chargee.PowerLowThreshold;
                distance        = 50f;
                break;
            }
            }
            if (chargee.TotalCharge <= chargee.MaxEnergy * chargeThreshold)
            {
                Thing target = ListerDroids.ClosestChargerFor(chargee, distance);
                if (target != null)
                {
                    return(new Job(DefDatabase <JobDef> .GetNamed("MD2ChargeDroid"), new TargetInfo(target)));
                }
            }
            return(null);
        }
        public T Charge <T>(ICharge charge) where T : IPayment
        {
            var request = _context.Create();

            request.ApiAction = RequestAction.Charge;
            request.AddCustomer(charge.Customer);
            request.AddShipping(charge.Shipping);
            request.AddCurrency(_context.Currency);
            request.Charge(charge);
            return((T)_context.Send(request));
        }
Beispiel #18
0
        public ChargeResult ImportResourceProducts(int resourceId, int operate_user)
        {
            ChargeResult result = new ChargeResult()
            {
                Status = ChargeStatus.SUCCEED
            };
            ICharge           chargeMgr = null;
            chargebitEntities db        = new chargebitEntities();

            try
            {
                KMBit.DAL.Resource resource = (from ri in db.Resource
                                               where ri.Id == resourceId
                                               select ri).FirstOrDefault <Resource>();

                if (resource == null)
                {
                    throw new KMBitException(string.Format("编号为{0}的资源不存在", resourceId));
                }
                if (!resource.Enabled)
                {
                    throw new KMBitException(string.Format("编号为{0}的资源没有启用,请先启用在进行资源产品导入", resourceId));
                }

                KMBit.DAL.Resrouce_interface rInterface = (from ri in db.Resrouce_interface where ri.Resource_id == resourceId select ri).FirstOrDefault <Resrouce_interface>();
                if (rInterface == null)
                {
                    throw new KMBitException(string.Format("编号为{0}的资源没有配置资源接口,请先配置资源接口,并配置产品导入接口URL,然后进行资源产品导入", resourceId));
                }
                object   o        = null;
                Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                Type     type     = assembly.GetType(rInterface.Interface_classname);
                o = Activator.CreateInstance(type);
                if (o != null)
                {
                    chargeMgr = (ICharge)o;
                    chargeMgr.ImportProducts(resourceId, operate_user);
                }
            }
            catch (Exception ex)
            {
                result.Status  = ChargeStatus.FAILED;
                result.Message = ex.Message;
            }finally
            {
                if (db != null)
                {
                    db.Dispose();
                }
            }

            return(result);
        }
Beispiel #19
0
        internal string GetChosenIndex(ICharge chargeComponent)
        {
            var text = new StringBuilder();

            text.Append("Select charger component (specify index): " + System.Environment.NewLine);
            text.Append("1 - iPhoneCharger" + System.Environment.NewLine);
            text.Append("2 - SamsungCharger" + System.Environment.NewLine);
            text.Append("3 - UnofficialiPhoneCharger");
            Console.WriteLine(text.ToString());
            string playbackIndex = Console.ReadLine();

            return(playbackIndex);
        }
Beispiel #20
0
        public string ChargeCallBack(SortedDictionary <string, string> paras, ResourceType type)
        {
            Logger.Info(this.GetType().ToString() + ".ChargeCallBack......................");
            ChargeResult result = new ChargeResult();

            if (paras == null)
            {
                Logger.Error("No parameters included in the callback request.");
                result.Status  = ChargeStatus.FAILED;
                result.Message = "回调参数错误";
                return(result.Status.ToString());
            }
            ICharge chargeMgr = null;

            try
            {
                switch (type)
                {
                case ResourceType.BeiBeiFlow:
                    Logger.Info("Beibeiflow callback");
                    chargeMgr = new BeiBeiFlowCharge();
                    break;
                }
                if (chargeMgr != null)
                {
                    List <WebRequestParameters> paramters = new List <WebRequestParameters>();
                    if (paras != null)
                    {
                        foreach (KeyValuePair <string, string> para in paras)
                        {
                            paramters.Add(new WebRequestParameters(para.Key, para.Value, false));
                        }
                    }
                    chargeMgr.CallBack(paramters);
                    Logger.Info("Beibeiflow callback is completed.");
                    result.Status  = ChargeStatus.SUCCEED;
                    result.Message = "回调成功";
                }
            }
            catch (KMBitException kex)
            {
                result.Status  = ChargeStatus.FAILED;
                result.Message = kex.Message;
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex);
            }
            Logger.Info(this.GetType().ToString() + ".ChargeCallBack done.");
            return(result.Status.ToString());
        }
Beispiel #21
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ITransaction paymentTransactionsCasted = item.As <ITransaction>();

                if ((paymentTransactionsCasted != null))
                {
                    this._parent.PaymentTransactions.Add(paymentTransactionsCasted);
                }
                if ((this._parent.Due == null))
                {
                    IDue dueCasted = item.As <IDue>();
                    if ((dueCasted != null))
                    {
                        this._parent.Due = dueCasted;
                        return;
                    }
                }
                if ((this._parent.LastCredit == null))
                {
                    IAccountMovement lastCreditCasted = item.As <IAccountMovement>();
                    if ((lastCreditCasted != null))
                    {
                        this._parent.LastCredit = lastCreditCasted;
                        return;
                    }
                }
                if ((this._parent.AuxiliaryAgreement == null))
                {
                    IAuxiliaryAgreement auxiliaryAgreementCasted = item.As <IAuxiliaryAgreement>();
                    if ((auxiliaryAgreementCasted != null))
                    {
                        this._parent.AuxiliaryAgreement = auxiliaryAgreementCasted;
                        return;
                    }
                }
                ICharge chargesCasted = item.As <ICharge>();

                if ((chargesCasted != null))
                {
                    this._parent.Charges.Add(chargesCasted);
                }
                if ((this._parent.LastDebit == null))
                {
                    IAccountMovement lastDebitCasted = item.As <IAccountMovement>();
                    if ((lastDebitCasted != null))
                    {
                        this._parent.LastDebit = lastDebitCasted;
                        return;
                    }
                }
            }
Beispiel #22
0
        public static int AddEditCharge(ICharge Charge)
        {
            string strExecution = "[mst].[spAddEditCharge]";
            int    Result       = 0;

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@ChargesID", Charge.ChargesID);
                oDq.AddIntegerParam("@CompanyID", Charge.CompanyID);
                oDq.AddVarcharParam("@ChargeDescr", 40, Charge.ChargeDescr);
                oDq.AddIntegerParam("@ChargeType", Charge.ChargeType);
                oDq.AddCharParam("@IEC", 1, Charge.IEC);
                oDq.AddIntegerParam("@NVOCCID", Charge.NVOCCID);
                oDq.AddIntegerParam("@Sequence", Charge.Sequence);
                oDq.AddBooleanParam("@RateChangeable", Charge.RateChangeable);
                oDq.AddBooleanParam("@ChargeActive", Charge.ChargeActive);
                oDq.AddBooleanParam("@IsFreightComponent", Charge.IsFreightComponent);
                oDq.AddDateTimeParam("@EffectDt", Charge.EffectDt);
                oDq.AddBooleanParam("@TerminalRequired", Charge.IsTerminal);
                oDq.AddBooleanParam("@IsWashing", Charge.IsWashing);
                oDq.AddBooleanParam("@PrincipleSharing", Charge.PrincipleSharing);
                oDq.AddIntegerParam("@Currency", Charge.Currency);
                oDq.AddBooleanParam("@ServiceTax", Charge.ServiceTax);
                oDq.AddIntegerParam("@LocationId", Charge.Location);
                oDq.AddBooleanParam("@IsSpecialRate", Charge.IsSpecialRate);
                oDq.AddCharParam("@DeliveryMode", 1, Charge.DeliveryMode);
                oDq.AddIntegerParam("@DocType", Charge.DocumentType);
                oDq.AddVarcharParam("@ChgAbbr", 40, Charge.ChgAbbr);
                oDq.AddIntegerParam("@Service", Charge.Service);
                oDq.AddBooleanParam("@DestinationCharge", Charge.DestinationCharge);
                oDq.AddVarcharParam("@FPOD", 5, Charge.FPOD);


                //oDq.AddNVarcharParam("@ChargeRate",8000,Charge.ConvertListToXML((List<IChargeRate>)Charge.ChargeRates));


                if (Charge.ChargesID <= 0)
                {
                    oDq.AddIntegerParam("@CreatedBy", Charge.CreatedBy);
                    oDq.AddDateTimeParam("@CreatedOn", Charge.CreatedOn);
                }
                oDq.AddIntegerParam("@ModifiedBy", Charge.ModifiedBy);
                oDq.AddDateTimeParam("@ModifiedOn", Charge.ModifiedOn);
                oDq.AddIntegerParam("@RESULT", Result, QueryParameterDirection.Output);
                oDq.RunActionQuery();
                Result = Convert.ToInt32(oDq.GetParaValue("@RESULT"));
            }
            return(Result);
        }
Beispiel #23
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ITariffProfile tariffProfilesCasted = item.As <ITariffProfile>();

                if ((tariffProfilesCasted != null))
                {
                    this._parent.TariffProfiles.Add(tariffProfilesCasted);
                }
                ICharge chargesCasted = item.As <ICharge>();

                if ((chargesCasted != null))
                {
                    this._parent.Charges.Add(chargesCasted);
                }
            }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedNullOrForbidden(TargetIndex.A);
            ICharge          chargee = (ICharge)pawn;
            CompDroidCharger charger = job.GetTarget(TargetIndex.A).Thing.TryGetComp <CompDroidCharger>();

            yield return(Toils_Reserve.Reserve(TargetIndex.A));

            Toil goToPad = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell);

            goToPad.AddFailCondition(() => { return(!charger.IsAvailable(chargee)); });
            yield return(goToPad);

            Toil charge = new Toil();

            charge.initAction = () =>
            {
                if (charger.parent.InteractionCell != chargee.Parent.Position)
                {
                    pawn.jobs.EndCurrentJob(JobCondition.Errored);
                }
                else
                {
                    charger.BeginCharge(chargee);
                    chargee.ShouldUsePower = false;
                }
            };
            charge.defaultCompleteMode = ToilCompleteMode.Never;
            charge.AddFailCondition(() =>
                                    { return(!charger.IsAvailable(chargee)); });
            charge.AddEndCondition(() =>
            {
                if (!chargee.DesiresCharge)
                {
                    return(JobCondition.Succeeded);
                }
                return(JobCondition.Ongoing);
            });
            charge.AddFinishAction(() =>
            {
                charger.EndCharge();
                chargee.ShouldUsePower = true;
            });
            yield return(charge);
        }
Beispiel #25
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IAuxiliaryAccount auxiliaryAccountsCasted = item.As <IAuxiliaryAccount>();

                if ((auxiliaryAccountsCasted != null))
                {
                    this._parent.AuxiliaryAccounts.Add(auxiliaryAccountsCasted);
                }
                if ((this._parent.ParentCharge == null))
                {
                    ICharge parentChargeCasted = item.As <ICharge>();
                    if ((parentChargeCasted != null))
                    {
                        this._parent.ParentCharge = parentChargeCasted;
                        return;
                    }
                }
                IConsumptionTariffInterval consumptionTariffIntervalsCasted = item.As <IConsumptionTariffInterval>();

                if ((consumptionTariffIntervalsCasted != null))
                {
                    this._parent.ConsumptionTariffIntervals.Add(consumptionTariffIntervalsCasted);
                }
                ICharge childChargesCasted = item.As <ICharge>();

                if ((childChargesCasted != null))
                {
                    this._parent.ChildCharges.Add(childChargesCasted);
                }
                ITimeTariffInterval timeTariffIntervalsCasted = item.As <ITimeTariffInterval>();

                if ((timeTariffIntervalsCasted != null))
                {
                    this._parent.TimeTariffIntervals.Add(timeTariffIntervalsCasted);
                }
                if ((this._parent.FixedPortion == null))
                {
                    IAccountingUnit fixedPortionCasted = item.As <IAccountingUnit>();
                    if ((fixedPortionCasted != null))
                    {
                        this._parent.FixedPortion = fixedPortionCasted;
                        return;
                    }
                }
            }
Beispiel #26
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                ITariffProfile tariffProfileItem = item.As <ITariffProfile>();

                if (((tariffProfileItem != null) &&
                     this._parent.TariffProfiles.Remove(tariffProfileItem)))
                {
                    return(true);
                }
                ICharge chargeItem = item.As <ICharge>();

                if (((chargeItem != null) &&
                     this._parent.Charges.Remove(chargeItem)))
                {
                    return(true);
                }
                return(false);
            }
Beispiel #27
0
 private void ToHIS_Load(object sender, EventArgs e)
 {
     try
     {
         Thread th = new Thread(() =>
         {
             #region csw修改,需要此exe下配置文件IMEQPIVAs.ini
             ICharge charge = ChargeFactory.GetCharge(dbHelp.IniReadValuePivas("Charge", "HospitalType"));
             #endregion
             ok = charge.PrintCharge(p, userID);
         });
         th.IsBackground = true;
         th.Start();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #28
0
        public static ICharge GetChargeDetails(int ChargesID)
        {
            string  strExecution = "[mst].[spGetChargeDetailsAndRate]";
            ICharge Chrg         = null;

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@ChargeId", ChargesID);
                oDq.AddIntegerParam("@Mode", 1); // @Mode = 1 to fetch ChargeDetails
                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    Chrg = new ChargeEntity(reader);
                }
                reader.Close();
            }
            return(Chrg);
        }
Beispiel #29
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                IAuxiliaryAccount auxiliaryAccountItem = item.As <IAuxiliaryAccount>();

                if (((auxiliaryAccountItem != null) &&
                     this._parent.AuxiliaryAccounts.Remove(auxiliaryAccountItem)))
                {
                    return(true);
                }
                if ((this._parent.ParentCharge == item))
                {
                    this._parent.ParentCharge = null;
                    return(true);
                }
                IConsumptionTariffInterval consumptionTariffIntervalItem = item.As <IConsumptionTariffInterval>();

                if (((consumptionTariffIntervalItem != null) &&
                     this._parent.ConsumptionTariffIntervals.Remove(consumptionTariffIntervalItem)))
                {
                    return(true);
                }
                ICharge chargeItem = item.As <ICharge>();

                if (((chargeItem != null) &&
                     this._parent.ChildCharges.Remove(chargeItem)))
                {
                    return(true);
                }
                ITimeTariffInterval timeTariffIntervalItem = item.As <ITimeTariffInterval>();

                if (((timeTariffIntervalItem != null) &&
                     this._parent.TimeTariffIntervals.Remove(timeTariffIntervalItem)))
                {
                    return(true);
                }
                if ((this._parent.FixedPortion == item))
                {
                    this._parent.FixedPortion = null;
                    return(true);
                }
                return(false);
            }
Beispiel #30
0
        private void SetChargeComponentToMobile(WinFormOuput winformOutput)
        {
            ICharge chargeComponent = null;

            if (radioButton1.Checked)
            {
                chargeComponent = new iPhoneCharger(winformOutput);
            }
            else if (radioButton2.Checked)
            {
                chargeComponent = new SamsungCharger(winformOutput);
            }
            else if (radioButton3.Checked)
            {
                chargeComponent = new UnofficialiPhoneCharger(winformOutput);
            }
            mobile.ChargerComponent = chargeComponent;
            winformOutput.WriteLine("Set charger to Mobile...");
            mobile.Charge();
        }
Beispiel #31
0
        public OrderPart CreateOrder(
            ICharge charge,
            IEnumerable <CheckoutItem> items,
            decimal subTotal,
            decimal total,
            TaxAmount taxes,
            ShippingOption shippingOption,
            Address shippingAddress,
            Address billingAddress,
            string customerEmail,
            string customerPhone,
            string specialInstructions,
            string status,
            string trackingUrl   = null,
            bool isTestOrder     = false,
            int userId           = -1,
            decimal amountPaid   = 0,
            string purchaseOrder = "",
            string currencyCode  = "")
        {
            var order = _contentManager.Create("Order", VersionOptions.DraftRequired).As <OrderPart>();

            order.Build(charge, items, subTotal, total, taxes,
                        shippingOption, shippingAddress, billingAddress, customerEmail,
                        customerPhone, specialInstructions,
                        string.IsNullOrWhiteSpace(currencyCode) ? _currencyProvider.CurrencyCode : currencyCode,
                        amountPaid, purchaseOrder);
            order.Status      = status;
            order.TrackingUrl = trackingUrl;
            order.IsTestOrder = isTestOrder;
            order.UserId      = userId;

            var random = new byte[8];

            RngCsp.GetBytes(random);
            order.Password = Convert.ToBase64String(random);

            _contentManager.Publish(order.ContentItem);

            return(order);
        }
Beispiel #32
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                ITransaction transactionItem = item.As <ITransaction>();

                if (((transactionItem != null) &&
                     this._parent.PaymentTransactions.Remove(transactionItem)))
                {
                    return(true);
                }
                if ((this._parent.Due == item))
                {
                    this._parent.Due = null;
                    return(true);
                }
                if ((this._parent.LastCredit == item))
                {
                    this._parent.LastCredit = null;
                    return(true);
                }
                if ((this._parent.AuxiliaryAgreement == item))
                {
                    this._parent.AuxiliaryAgreement = null;
                    return(true);
                }
                ICharge chargeItem = item.As <ICharge>();

                if (((chargeItem != null) &&
                     this._parent.Charges.Remove(chargeItem)))
                {
                    return(true);
                }
                if ((this._parent.LastDebit == item))
                {
                    this._parent.LastDebit = null;
                    return(true);
                }
                return(false);
            }
 public static Thing ClosestChargerFor(ICharge droid, float distance = 9999f)
 {
     Predicate<Thing> pred = (Thing thing) => { return thing.TryGetComp<CompDroidCharger>() != null && thing.TryGetComp<CompDroidCharger>().IsAvailable(droid); };
     return GenClosest.ClosestThing_Global_Reachable(droid.Parent.Position, ListerDroids.AllChargers.AsEnumerable(), PathEndMode.OnCell, TraverseParms.For(droid.Parent), distance, pred);
 }
 public bool IsAvailable(ICharge d)
 {
     return CanUse(d) && (Power == null || Power.PowerOn);
 }
 private bool CanUse(ICharge chargee)
 {
     return this.chargee == null || this.chargee == chargee;
 }
 public ICharge CreateCharge(int SubscriptionID, ICharge Charge)
 {
     throw new NotImplementedException();
 }