Exemple #1
0
 /// <summary>
 /// 绑定到经营方式到控件
 /// </summary>
 private void BindBusinessTypes()
 {
     try
     {
         if (BusinessTypes == null)
         {
             LoadBusinessTypes();
         }
         if (BusinessTypes != null)
         {
             this.comboBoxBusinessTypeId.DisplayMember = "Name";
             this.comboBoxBusinessTypeId.ValueMember   = "Id";
             var tempTypes = BusinessTypes.ToList();
             tempTypes.Insert(0, new BusinessType {
                 Id = Guid.Empty, Name = "请选择..."
             });
             this.comboBoxBusinessTypeId.DataSource = tempTypes;
             if (comboBoxBusinessTypeId.Items.Count > 0)
             {
                 comboBoxBusinessTypeId.SelectedIndex = 0;
             }
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex);
         //MessageBox.Show("绑定到经营方式到控件", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop);
         MessageBox.Show(this.Text + "绑定到经营方式到控件", "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
Exemple #2
0
        /// <summary>Call PROBA Business event</summary>

        public static void BusinessEvent(BusinessTypes businessType, double value = 0.0, string currency = "IRR", string itemName                  = "Item", int transactionCount = 1,
                                         string cartName         = "Main Cart", string extraDetails = "No Extra Details", PaymentTypes paymentType = PaymentTypes.Unkown, bool specialEvent = false,
                                         string specialEventName = "", double amount                = 0.0, bool virtualCurrency = false)
        {
            _ = new BusinessEventViewModel(businessType, value, currency, itemName, transactionCount, cartName, extraDetails,
                                           paymentType, specialEvent, specialEventName, amount, virtualCurrency);
        }
        /// <summary>
        /// Add/Update business type
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> AddBusinessType(int id)
        {
            var businessType = await _masterService.GetBusinessTypeById(id);

            if (businessType == null)
            {
                businessType = new BusinessTypes();
            }

            return(PartialView("_BusinessTypeWizard", businessType));
        }
Exemple #4
0
 internal BusinessEventViewModel(BusinessTypes businessType, double value, string currency, string itemName, int transactionCount,
                                 string cartName, string extraDetails, PaymentTypes paymentType, bool specialEvent, string specialEventName, double amount, bool virtualCurrency)
 {
     BusinessType     = businessType;
     Value            = value;
     Currency         = currency;
     ItemName         = itemName;
     TransactionCount = transactionCount;
     CartName         = cartName;
     ExtraDetails     = extraDetails;
     PaymentType      = paymentType;
     SpecialEvent     = specialEvent;
     SpecialEventName = specialEventName;
     Amount           = amount;
     VirtualCurrency  = virtualCurrency;
     DeviceInfo.WriteBaseEventDataViewModel(this.GetType().Name, this);
     Broker.BusinessEventCreated(this);
 }
Exemple #5
0
        /// <summary>
        /// Add update business types
        /// </summary>
        /// <param name="documentType"></param>
        /// <returns></returns>
        public async Task AddUpdateBusinessTypes(BusinessTypes businessTypes)
        {
            if (businessTypes.BusinessTypeId > 0)
            {
                var existingBusinessTypes = await _dbContext.BusinessTypes.FirstOrDefaultAsync(_ => _.BusinessTypeId == businessTypes.BusinessTypeId);

                existingBusinessTypes.Name     = businessTypes.Name;
                existingBusinessTypes.IsActive = businessTypes.IsActive;
            }
            else
            {
                var existingBusinessTypes = await _dbContext.BusinessTypes.FirstOrDefaultAsync(_ => _.Name == businessTypes.Name);

                if (existingBusinessTypes == null)
                {
                    _dbContext.BusinessTypes.Add(businessTypes);
                }
            }

            await _dbContext.SaveChangesAsync();
        }
        public virtual Lead Assemble(BusinessTypes type)
        {
            if (LeadFactory == null)
                throw new Exception("Internal server error, contact admin for more information");

            if (Contact == null)
                throw new Exception("Unable to generate lead from an empty contact");

            if (LeadPersonal == null)
                throw new Exception("Unable to generate lead because no QP has been assigned to it");

            if (Contact.Leads.Any(x=>x.LeadStatusId != (int) LeadStatusTypes.Cancelled))
                throw new Exception("Contact already has a lead");

            LeadFactory.Contact = Contact;
            var lead = LeadFactory.GetLead(type);
            lead.LeadPersonalId = LeadPersonal.Id;

            if (Telesale != null)
                lead.TelesaleId = Telesale.Id;

            return lead;
        }
Exemple #7
0
        public virtual Lead GetLead(BusinessTypes type)
        {
            if (Contact == null)
                throw new Exception("Can not generate lead from an empty contact");

            if (Contact.Site == null)
                throw new Exception("Can not generate lead without a valid site");

            var phone = Phone ?? GetPhoneNumber(Contact);

            if (phone == null)
                throw new Exception("Invalid phone number");

            var lead = new Lead
            {
                Address = new Address
                {
                    Number = Contact.Site.Number,
                    Street = Contact.Site.Street,
                    Suburb = Contact.Site.Suburb,
                    Unit = Contact.Site.Unit
                },

                ContactId = Contact.Id,
                Phone = phone,
                Postcode = Contact.Site.Postcode,
                State = Contact.Site.State,
                BusinessTypeId = (int)type,
                LeadStatusId = (int)LeadStatusTypes.New
            };

            var time = DateTime.Now;
            lead.CreatedDate = time;
            lead.LastUpdateDate = time;
            return lead;
        }
        public IHttpActionResult PutAssignContactPerson(int contactId, int contactPersonId, int targetContactId, BusinessTypes type)
        {
            var contact = _contactService.AssignContactperson(contactId, contactPersonId, targetContactId, type);

            return Ok(new
            {
                contact
            });
        }
        public async Task <ActionResult> AddBusinessTypes(BusinessTypes businessTypes)
        {
            await _masterService.AddUpdateBusinessTypes(businessTypes);

            return(Json(true, JsonRequestBehavior.AllowGet));
        }
        public static Func<Manager, Business, Business> CostDiscountPercentage(BusinessTypes businessType, double discountPercentage)
        {
            return new Func<Manager, Business, Business>((m, b) =>
            {
                if (b.Type == businessType)
                    if (m.IsActive)
                        b.Cost.Add(m.Name, (i) => i - (i * discountPercentage) / 100);
                    else
                        b.Cost.Remove(m.Name);

                return b;
            });
        }
        private static Func<double, double> SingleBusinessCooldownUnlock(BusinessTypes businessType, int applicableLevel)
        {
            return (i) =>
                {
                    Business business = Businesses.Find(b => b.Type == businessType);

                    if (business != null && business.TotalLevel >= applicableLevel)
                        i = i / 2;

                    return i;
                };
        }
        private static Func<double, double> BusinessProfitMultiplierUnlock(BusinessTypes businessType, int applicableLevel, double profitMultiplier)
        {
            return (i) =>
            {
                Business business = Businesses.Find(b => b.Type == businessType);

                if (business != null && business.TotalLevel >= applicableLevel)
                    i = i * profitMultiplier;

                return i;
            };
        }
        private static Func<double, double> BaseProfitMultiplier(BusinessTypes businessType)
        {
            return (i) =>
                {
                    Business business = Businesses.Find(b => b.Type == businessType);

                    if (business != null)
                        i = i * business.TotalLevel;

                    return i;
                };
        }
        private static Func<double, double> AngelInvestorProfitMultiplier(BusinessTypes businessType)
        {
            return (i) =>
                {
                    Business business = Businesses.Find(b => b.Type == businessType);

                    if (business != null && AngelInvestorController.AngelInvestors.Total > 0)
                        i = ((i * AngelInvestorController.AngelInvestors.Effectiveness) / 100) * AngelInvestorController.AngelInvestors.Total;

                    return i;
                };
        }
        private static Func<UpgradeObject<IAdVentureObject>, IAdVentureObject, IAdVentureObject> BusinessFreeLevel(BusinessTypes businessType, string affectName, int freeLevelUpgrade)
        {
            return new Func<UpgradeObject<IAdVentureObject>, IAdVentureObject, IAdVentureObject>((uo, o) =>
            {
                Business b = o as Business;

                if (b == null)
                    return o;

                if (b.Type == businessType || businessType == BusinessTypes.All)
                    if (uo.IsActive)
                        b.AddFreeLevel(affectName, (i) => i + freeLevelUpgrade);
                    else
                        b.RemoveFreeLevel(affectName);

                return b;
            });
        }
 public static BusinessType Get(this IQueryable<BusinessType> source, BusinessTypes type)
 {
     var str = type.GetDescription();
     return source.Single(x => x.Type == str);
 }
        private static Func<UpgradeObject<IAdVentureObject>, IAdVentureObject, IAdVentureObject> BusinessProfitMultiplier(BusinessTypes businessType, string affectName, double profitMultiplier)
        {
            return new Func<UpgradeObject<IAdVentureObject>, IAdVentureObject, IAdVentureObject>((uo, o) =>
            {
                Business b = o as Business;

                if (b == null)
                    return o;

                if (b.Type == businessType || businessType == BusinessTypes.All)
                    if (uo.IsActive)
                        b.Profit.Add(affectName, (i) => i * profitMultiplier);
                    else
                        b.Profit.Remove(affectName);

                return b;
            });
        }