public async Task <IActionResult> Create([Bind("Id,OrganisationId,Name,Description,Status,DateCreated,DateUpdated,DateModified,IsDeleted")] ContractType contractType)
        {
            if (ModelState.IsValid)
            {
                var          userId = Guid.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);
                Organisation org;
                var          otheruser = _context.OtherUsers.Where(x => x.UserId == userId).FirstOrDefault();
                if (otheruser == null)
                {
                    org = _context.Organisation.Where(m => m.ApplicationUserId == userId).FirstOrDefault();
                }
                else
                {
                    org = _context.Organisation.Where(m => m.ApplicationUserId == otheruser.HostId).FirstOrDefault();
                }

                contractType.OrganisationId = org.Id;
                contractType.Id             = Guid.NewGuid();
                _context.Add(contractType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(contractType));
        }
Ejemplo n.º 2
0
            /// <summary>
            /// Gets the metadata associated with a specific contract method
            /// </summary>
            public List <object> GetMetadata(MethodInfo method)
            {
                // consider the various possible sources of distinct metadata
                object[]
                contractType = ContractType.GetCustomAttributes(inherit: true),
                contractMethod = method.GetCustomAttributes(inherit: true),
                serviceType    = Array.Empty <object>(),
                serviceMethod  = Array.Empty <object>();
                if (ContractType != ServiceType & ContractType.IsInterface & ServiceType.IsClass)
                {
                    serviceType   = ServiceType.GetCustomAttributes(inherit: true);
                    serviceMethod = GetImplementation(method)?.GetCustomAttributes(inherit: true)
                                    ?? Array.Empty <object>();
                }

                // note: later is higher priority in the code that consumes this, but
                // GetAttributes() is "most derived to least derived", so: add everything
                // backwards, then reverse
                var metadata = new List <object>(
                    contractType.Length + contractMethod.Length +
                    serviceType.Length + serviceMethod.Length);

                metadata.AddRange(serviceMethod);
                metadata.AddRange(serviceType);
                metadata.AddRange(contractMethod);
                metadata.AddRange(contractType);
                metadata.Reverse();
                return(metadata);
            }
Ejemplo n.º 3
0
        public void Sort(ContractType contract)
        {
            if (contract == ContractType.AllTrumps)
            {
                this.cards = this.OrderBy(x => x, CardComparer.AllTrumps).ToList();
            }

            if (contract == ContractType.NoTrumps)
            {
                this.cards = this.OrderBy(x => x, CardComparer.NoTrumps).ToList();
            }

            if (contract == ContractType.Spades)
            {
                this.cards = this.OrderBy(x => x, CardComparer.Spades).ToList();
            }

            if (contract == ContractType.Hearts)
            {
                this.cards = this.OrderBy(x => x, CardComparer.Hearts).ToList();
            }

            if (contract == ContractType.Diamonds)
            {
                this.cards = this.OrderBy(x => x, CardComparer.Diamonds).ToList();
            }

            if (contract == ContractType.Clubs)
            {
                this.cards = this.OrderBy(x => x, CardComparer.Clubs).ToList();
            }
        }
 public AirportContract(
     Airline airline,
     Airport airport,
     ContractType type,
     Terminal.TerminalType terminaltype,
     DateTime date,
     int numberOfGates,
     int length,
     double yearlyPayment,
     bool autorenew,
     bool payFull = false,
     bool isExclusiveDeal = false,
     Terminal terminal = null)
 {
     Type = type;
     PayFull = payFull;
     Airline = airline;
     Airport = airport;
     ContractDate = date;
     Length = length;
     YearlyPayment = yearlyPayment;
     NumberOfGates = numberOfGates;
     IsExclusiveDeal = isExclusiveDeal;
     Terminal = terminal;
     ExpireDate = ContractDate.AddYears(Length);
     AutoRenew = autorenew;
     TerminalType = terminaltype;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets and instanciates all types which are implementing the given contract.
        /// </summary>
        /// <typeparam name="ContractType">The implemented contract.</typeparam>
        public List <ContractType> GetAndInstanciateByContract <ContractType>()
            where ContractType : class
        {
            Type        contractType    = typeof(ContractType);
            List <Type> typesByContract = null;

            m_typesByContract.TryGetValue(contractType, out typesByContract);
            if (typesByContract != null)
            {
                List <ContractType> result = new List <ContractType>(typesByContract.Count);
                foreach (Type actType in typesByContract)
                {
                    ContractType actObject = Activator.CreateInstance(actType) as ContractType;
                    if (actObject != null)
                    {
                        result.Add(actObject);
                    }
                }
                return(result);
            }
            else
            {
                return(new List <ContractType>());
            }
        }
Ejemplo n.º 6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = ContractID;
         hashCode = (hashCode * 397) ^ (ContractName != null ? ContractName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomerID;
         hashCode = (hashCode * 397) ^ (CustomerName != null ? CustomerName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ContractType != null ? ContractType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Active.GetHashCode();
         hashCode = (hashCode * 397) ^ Default.GetHashCode();
         hashCode = (hashCode * 397) ^ Taxable.GetHashCode();
         hashCode = (hashCode * 397) ^ StartDate.GetHashCode();
         hashCode = (hashCode * 397) ^ EndDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (RetainerFlatFeeContract != null ? RetainerFlatFeeContract.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HourlyContract != null ? HourlyContract.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BlockHoursContract != null ? BlockHoursContract.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BlockMoneyContract != null ? BlockMoneyContract.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RemoteMonitoringContract != null ? RemoteMonitoringContract.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OnlineBackupContract != null ? OnlineBackupContract.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ProjectOneTimeFeeContract != null ? ProjectOneTimeFeeContract.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ProjectHourlyRateContract != null ? ProjectHourlyRateContract.GetHashCode() : 0);
         return(hashCode);
     }
 }
 public Employee(string firstName, string lastName) : base(firstName, lastName)
 {
     this.salary.SetBasic(0f);
     this.salary.SetBonus(0f);
     this.salary.SetOther(0f);
     this.contractType = ContractType.FullTime;
 }
Ejemplo n.º 8
0
        public async Task <Response> AddContractType(ContractTypeVM contracttype)
        {
            var Dto = Mapper.Map <ContractTypeVM, ContractType>(contracttype);

            ContractType Exist = await _db.ContractTypes.Where(x => x.Type.Trim() == contracttype.Type.Trim()).FirstOrDefaultAsync();

            if (Exist != null)
            {
                return(GenericResponses <int> .ResponseStatus(true, Constant.MDGNoAlreadyExist, (int)Constant.httpStatus.NoContent, 0));
            }

            _db.ContractTypes.Add(Dto);

            int result = await _db.SaveChangesAsync();

            if (result == 1)
            {
                // Mapper.Initialize(cfg => cfg.CreateMap<User, UserVM>());

                return(GenericResponses <int> .ResponseStatus(false, Constant.MSGRecordFound, (int)Constant.httpStatus.Ok, result));
            }
            else
            {
                return(GenericResponses <int> .ResponseStatus(true, Constant.MDGNoLoginFailed, (int)Constant.httpStatus.NoContent, result));
            }
        }
Ejemplo n.º 9
0
        public ActionResult RestoreSave(ContractType record, string returnUrl = "Index")
        {
            ViewBag.Path1 = "参数设置";
            //检查记录在权限范围内
            var result = Common.GetHRAdminContractTypeQuery(db, WebSecurity.CurrentUserId, true).Where(a => a.IsDeleted == true).Where(a => a.Id == record.Id).SingleOrDefault();

            if (result == null)
            {
                Common.RMError(this);
                return(Redirect(Url.Content(returnUrl)));
            }
            //end

            try
            {
                result.IsDeleted = false;
                db.PPSave();
                Common.RMOk(this, "记录:" + result + "恢复成功!");
                return(Redirect(Url.Content(returnUrl)));
            }
            catch (Exception e)
            {
                Common.RMOk(this, "记录" + result + "恢复失败!" + e.ToString());
            }
            return(Redirect(Url.Content(returnUrl)));
        }
Ejemplo n.º 10
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((ContractType.GetHashCode() * 397) ^ (ConfigurationName?.GetHashCode() ?? 0));
     }
 }
Ejemplo n.º 11
0
        public ActionResult CreateSave(ContractType model, string returnUrl = "Index")
        {
            ViewBag.Path1 = "参数设置";
            if (ModelState.IsValid)
            {
                try
                {
                    db.ContractType.Add(model);
                    db.PPSave();
                    Common.RMOk(this, "记录:'" + model.Name + "'新建成功!");
                    return(Redirect(Url.Content(returnUrl)));
                }
                catch (Exception e)
                {
                    if (e.InnerException.Message.Contains("Cannot insert duplicate key row"))
                    {
                        ModelState.AddModelError(string.Empty, "相同名称的记录已存在,保存失败!");
                    }
                }
            }

            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            ViewBag.ReturnUrl = returnUrl;
            return(View("Create", model));
        }
Ejemplo n.º 12
0
        public ActionResult EditSave(ContractType model, string returnUrl = "Index")
        {
            ViewBag.Path1 = "参数设置";
            //检查记录在权限范围内
            var result = Common.GetHRAdminContractTypeQuery(db, WebSecurity.CurrentUserId).Where(a => a.Id == model.Id).SingleOrDefault();

            if (result == null)
            {
                Common.RMError(this);
                return(Redirect(Url.Content(returnUrl)));
            }
            //end

            if (ModelState.IsValid)
            {
                try
                {
                    result.Name = model.Name;
                    db.PPSave();
                    Common.RMOk(this, "记录:" + model + "保存成功!");
                    return(Redirect(Url.Content(returnUrl)));
                }
                catch (Exception e)
                {
                    if (e.InnerException.Message.Contains("Cannot insert duplicate key row"))
                    {
                        ModelState.AddModelError(string.Empty, "相同名称的记录已存在,保存失败!");
                    }
                }
            }
            ViewBag.ReturnUrl = returnUrl;

            return(View("Edit", model));
        }
Ejemplo n.º 13
0
 public Contract(ContractType type, bool isDoubled = false, bool isReDoubled = false)
     : this()
 {
     this.Type = type;
     this.IsDoubled = isDoubled;
     this.IsReDoubled = isReDoubled;
 }
Ejemplo n.º 14
0
 public Employee(string name, string NIF, ContractType numberOfHours)
 {
     this.Name          = name;
     this.NumberOfHours = numberOfHours;
     this.NIF           = NIF;
     this.Comments      = "";
 }
 public async Task <List <PaymentModel> > GetReadOnlyLearnerPaymentHistory(
     long ukprn,
     ContractType contractType,
     string learnerReferenceNumber,
     string learningAimReference,
     int frameworkCode,
     int pathwayCode,
     int programmeType,
     int standardCode,
     short academicYear,
     byte collectionPeriod,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     //Please DO NOT Remove AsNoTracking and Clone as this list is converted to new payments, again to be stored into DB so we don't want to update existing Payments
     return((await dataContext.Payment
             .Where(payment =>
                    payment.Ukprn == ukprn &&
                    payment.ContractType == contractType &&
                    payment.LearnerReferenceNumber == learnerReferenceNumber &&
                    payment.LearningAimReference == learningAimReference &&
                    payment.LearningAimFrameworkCode == frameworkCode &&
                    payment.LearningAimPathwayCode == pathwayCode &&
                    payment.LearningAimProgrammeType == (int)programmeType &&
                    payment.LearningAimStandardCode == standardCode &&
                    payment.CollectionPeriod.AcademicYear == academicYear &&
                    payment.CollectionPeriod.Period < collectionPeriod)
             .AsNoTracking()
             .ToListAsync(cancellationToken))
            .Select(p => p.Clone())
            .ToList());
 }
Ejemplo n.º 16
0
        //数据持久化
        internal static void  SaveToDb(ContractTypeInfo pContractTypeInfo, ContractType pContractType, bool pIsNew)
        {
            pContractType.ContractTypeId   = pContractTypeInfo.contractTypeId;
            pContractType.ContractTypeName = pContractTypeInfo.contractTypeName;
            pContractType.IsNew            = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pContractType.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ContractTypeInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pContractTypeInfo.contractTypeId = pContractType.ContractTypeId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ContractTypeInfo)))
            {
                ResetCache();
            }
        }
Ejemplo n.º 17
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 22, Configuration.FieldSeparator),
                       Id,
                       ContractIdentifier?.ToDelimitedString(),
                       ContractDescription,
                       ContractStatus?.ToDelimitedString(),
                       EffectiveDate.HasValue ? EffectiveDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ExpirationDate.HasValue ? ExpirationDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ContractOwnerName?.ToDelimitedString(),
                       ContractOriginatorName?.ToDelimitedString(),
                       SupplierType?.ToDelimitedString(),
                       ContractType?.ToDelimitedString(),
                       FreeOnBoardFreightTerms?.ToDelimitedString(),
                       PriceProtectionDate.HasValue ? PriceProtectionDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       FixedPriceContractIndicator?.ToDelimitedString(),
                       GroupPurchasingOrganization?.ToDelimitedString(),
                       MaximumMarkup?.ToDelimitedString(),
                       ActualMarkup?.ToDelimitedString(),
                       Corporation != null ? string.Join(Configuration.FieldRepeatSeparator, Corporation.Select(x => x.ToDelimitedString())) : null,
                       ParentOfCorporation?.ToDelimitedString(),
                       PricingTierLevel?.ToDelimitedString(),
                       ContractPriority,
                       ClassOfTrade?.ToDelimitedString(),
                       AssociatedContractId?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <ContractTypeInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <ContractTypeInfo> list = new List <ContractTypeInfo>();

            Query q = ContractType.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            ContractTypeCollection collection = new  ContractTypeCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (ContractType contractType  in collection)
            {
                ContractTypeInfo contractTypeInfo = new ContractTypeInfo();
                LoadFromDAL(contractTypeInfo, contractType);
                list.Add(contractTypeInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
Ejemplo n.º 19
0
    public void UpdateContract(ContractType type)
    {
        switch (type)
        {
        case ContractType.banzai:
            contractName.text = "Banzaï";
            return;

        case ContractType.bateaux:
            contractName.text = "Réseau maritime";
            return;

        case ContractType.couverture:
            contractName.text = "Couverture privilégiée";
            return;

        case ContractType.danger:
            contractName.text = "Vents solaires";
            return;

        case ContractType.espionnage:
            contractName.text = "Espionnage";
            return;

        case ContractType.social:
            contractName.text = "Plan social";
            return;

        case ContractType.urbanisme:
            contractName.text = "Urbanisme";
            return;
        }
    }
        /// <summary>
        /// Инициализация справочника типов договоров
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static async Task CreateContractTypes(IServiceProvider serviceProvider, IConfiguration configuration)
        {
            using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>();

                #region Инициализация таблицы "Типы договоров"
                if (!await context.ContractTypes.AnyAsync())
                {
                    var Row01 = new ContractType
                    {
                        ContractTypeId   = (int)ContractTypesEnum.ContractTargetTraining,
                        ContractTypeName = "Договор о целевом обучении"
                    };

                    var Row02 = new ContractType
                    {
                        ContractTypeId   = (int)ContractTypesEnum.ContractPaidTraining,
                        ContractTypeName = "Договор об оказании платных образовательных услуг"
                    };

                    await context.ContractTypes.AddRangeAsync(
                        Row01, Row02
                        );

                    await context.SaveChangesAsync();
                }
                #endregion
            }
        }
Ejemplo n.º 21
0
        private RunTime(Transaction tx, BlockCapsule block, Deposit deposit, IProgramInvokeFactory invoke_factory)
        {
            this.transaction      = tx;
            this.deposit          = deposit;
            this.invoke_factory   = invoke_factory;
            this.executor_type    = ExecutorType.ET_PRE_TYPE;
            this.block            = block;
            this.energy_processor = new EnergyProcessor(deposit.DBManager);
            ContractType contract_type = tx.RawData.Contract[0].Type;

            switch (contract_type)
            {
            case ContractType.TriggerSmartContract:
            {
                this.transaction_type = TransactionType.TX_CONTRACT_CALL_TYPE;
            }
            break;

            case ContractType.CreateSmartContract:
            {
                this.transaction_type = TransactionType.TX_CONTRACT_CREATION_TYPE;
            }
            break;

            default:
            {
                this.transaction_type = TransactionType.TX_PRECOMPILED_TYPE;
            }
            break;
            }
        }
        public static List <ContractType> GetContracts()
        {
            List <ContractType> contracts = new List <ContractType>();

            using (IDbConnection connection = new SqlConnection(LUDBcononnectionString))
            {
                IDataReader dataReader;
                using (IDbCommand command = new SqlCommand())
                {
                    connection.Open();


                    command.CommandText = "[SP_GetContracts]";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Connection  = connection;
                    dataReader          = command.ExecuteReader();

                    ContractType contract;

                    while (dataReader.Read())
                    {
                        contract            = new ContractType();
                        contract.Id         = dataReader.GetInt32(0);
                        contract.Label      = dataReader.GetString(1);
                        contract.ShortLabel = dataReader.GetString(2);


                        contracts.Add(contract);
                    }
                }
            }
            return(contracts);
        }
Ejemplo n.º 23
0
        public void AddContractType(ContractType contractType)
        {
            contractType.AddDate = contractType.ChgDate = DateTime.Now;

            _context.ContractTypes.Add(contractType);
            _context.SaveChanges();
        }
Ejemplo n.º 24
0
        public static bool IsContractType(this VmDataDto data, ContractType type)
        {
            var logs = data.Logs.FirstOrDefault();

            if (logs == null)
            {
                throw new Exception("ContractParser:IsContractType error: logs are empty");
            }

            var eventCreate = type switch
            {
                ContractType.Erc20 => Erc20.FirstEvent,
                ContractType.Unknown => throw new Exception("ContractParser:Is err: unknown type"),
                      _ => throw new Exception("ContractParser:Is err: invalid type")
            };

            var firstTopic = logs.Topics.FirstOrDefault();

            if (firstTopic == null)
            {
                throw new Exception("ContractParser:IsContractType error: topics are empty");
            }

            return(firstTopic == eventCreate.Hex);
        }
Ejemplo n.º 25
0
        public static bool IsTrump(this ContractType contractType)
        {
            switch (contractType)
            {
            case ContractType.Clubs:
                return(true);

            case ContractType.Diamonds:
                return(true);

            case ContractType.Hearts:
                return(true);

            case ContractType.Spades:
                return(true);

            case ContractType.NoTrumps:
                return(false);

            case ContractType.AllTrumps:
                return(false);

            default:
                throw new ArgumentOutOfRangeException("contractType");
            }
        }
Ejemplo n.º 26
0
        public Employee(string firstName,
                        string lastName,
                        string egn,
                        Position position,
                        ContractType type,
                        int id,
                        decimal salary,
                        int rating)
            : base(firstName, lastName, egn)
        {
            if (id < 0)
            {
                throw new ArgumentException("Identification number cannot be negative");
            }

            if (salary < 0)
            {
                throw new ArgumentException("Salary cannot be negative");
            }

            this.Position     = position;
            this.ContractType = type;
            this.Id           = id;
            this.Salary       = salary;
            this._rating      = rating;
        }
Ejemplo n.º 27
0
        public override string Print()
        {
            string result = base.Print();

            result += $"Ticker: {Ticker}\n";
            result += $"DomainName: {DomainName}\n";
            result += $"ContractType: {ContractType.ToString()}\n";
            result += $"RenewalDate: {DateTimeToString(RenewalDate)}\n";
            result += $"Edition: {Edition.ToString()}\n";
            result += $"Description: {Description}\n";
            result += $"Precision: {Precision.ToString()}\n";
            result += $"IsFinalSupply: {IsFinalSupply.ToString()}\n";
            result += $"IsNonFungible: {IsNonFungible.ToString()}\n";
            result += $"NonFungibleType: {NonFungibleType.ToString()}\n";
            result += $"NonFungibleKey: {NonFungibleKey}\n";
            result += $"Owner: {Owner}\n";
            result += $"Address: {Address}\n";
            result += $"Currency: {Currency}\n";
            result += $"Icon: {Icon}\n";
            result += $"Image: {Image}\n";
            result += $"Custom1: {Custom1}\n";
            result += $"Custom2: {Custom2}\n";
            result += $"Custom3: {Custom3}\n";
            return(result);
        }
Ejemplo n.º 28
0
        public void UpdateContractType(ContractType contractType)
        {
            contractType.ChgDate = DateTime.Now;

            _context.Entry(contractType).State = EntityState.Modified;
            _context.SaveChanges();
        }
        public static ContractType[] GetContractTypesForLearningDeliveries(this LearningDelivery learningDelivery)
        {
            if (learningDelivery.LearningDeliveryPeriodisedTextValues == null)
            {
                return(new ContractType[0]);
            }

            var periodisedTextValues = learningDelivery
                                       .LearningDeliveryPeriodisedTextValues
                                       .Where(l => l.AttributeName == "LearnDelContType").ToList();

            if (!periodisedTextValues.Any())
            {
                return(new ContractType[0]);
            }

            const byte earningPeriods = 12;

            var contractTypes = new ContractType[earningPeriods];

            for (byte i = 1; i <= earningPeriods; i++)
            {
                var periodValues = periodisedTextValues.Select(p => p.GetPeriodTextValue(i)).ToArray();
                var periodValue  = GetContractType(periodValues[0]);

                contractTypes[i - 1] = periodValue;
            }

            return(contractTypes);
        }
 public Employee(string firstName, string lastName, float basic, float bonus, float other) : base(firstName, lastName)
 {
     this.salary.SetBasic(basic);
     this.salary.SetBonus(bonus);
     this.salary.SetOther(other);
     this.contractType = ContractType.FullTime;
 }
Ejemplo n.º 31
0
        public int AddContractType(ContractType ContractType)
        {
            _context.ContractTypes.Add(ContractType);
            _context.SaveChanges();

            return(ContractType.Id);
        }
Ejemplo n.º 32
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label   lblContractTypeID = GridView1.Rows[e.RowIndex].FindControl("lblContractTypeID") as Label;
        TextBox txtTitle          = GridView1.Rows[e.RowIndex].FindControl("txtTitle") as TextBox;


        if (lblContractTypeID != null && txtTitle != null)
        {
            ContractType contractType = new ContractType();

            contractType.ContractTypeID = Convert.ToInt32(lblContractTypeID.Text.Trim());
            contractType.Title          = txtTitle.Text;

            //Let us now update the database
            if (contractTypeHandler.Update(contractType) == true)
            {
                lblResult.Text = "Record Updated Successfully";
            }
            else
            {
                lblResult.Text = "Failed to Update record";
            }

            //end the editing and bind with updated records.
            GridView1.EditIndex = -1;
            BindData();
        }
    }
Ejemplo n.º 33
0
 public ContractHome(ContractType contractType)
     : base(PageMode.ViewMode)
 {
     InitializeComponent();
     ModuleName = ContractHomeVM.GetModuleNameByContractType(contractType);
     VM = new ContractHomeVM(contractType);
     InitPage();
     BindData();
 }
Ejemplo n.º 34
0
        public AlterContract( ContractType type, Mobile crafter )
            : base(0x14F0)
        {
            m_CrafterName = crafter.Name;
            Type = type;

            Hue = 0x1BC;
            Weight = 1.0;
        }
Ejemplo n.º 35
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            /*int version = */
            reader.ReadInt();

            m_Type = (ContractType) reader.ReadInt();
            m_CrafterName = (string) reader.ReadString();
        }
Ejemplo n.º 36
0
 public Contract(PlayerPosition playerPosition, ContractType type, bool isDoubled = false, bool isReDoubled = false)
     : this()
 {
     this.IsAvailable = true;
     this.Type = type;
     this.PlayerPosition = playerPosition;
     this.OriginalBidder = playerPosition;
     this.IsDoubled = isDoubled;
     this.IsReDoubled = isReDoubled;
 }
        public ShortContractDetail(TradeType tradeType, ContractType contractType, PageMode pageMode, string pageName)
            : base(pageMode, pageName)
        {
            InitializeComponent();
            ModuleName = ContractHomeVM.GetModuleNameByContractType(contractType);

            TradeType = tradeType;
            ContractType = contractType;
            VM = new ShortContractDetailVM(tradeType, contractType);
            InitPage();
            BindData();
        }
Ejemplo n.º 38
0
        public CourierCalc(long ownerID, ContractType type)
        {
            InitializeComponent();

            lblProfit.Text = "";
            lblProfitPerc.Text = "";
            _contract = new Contract(ownerID, 5);
            if (type != ContractType.Any) { _contract.Type = type; }
            InitGUI();
            InitVariables();
            UserAccount.Settings.GetFormSizeLoc(this);
        }
 public decimal Calculate(ContractType contractType, int experience, decimal minWage)
 {
     switch (contractType)
     {
         case ContractType.Developer:
             return minWage + (experience * 125);
         case ContractType.Tester:
             return minWage + (experience * 100 + minWage / 4);
         default:
             throw new ArgumentException("The contract type in unknown.", "contractType");
     }
 }
 public ShortContractDetail(TradeType tradeType, ContractType contractType, int id, PageMode pageMode,
                           string pageName,bool isSplit)
     : base(pageMode, pageName)
 {
     InitializeComponent();
     IsSpilt = isSplit;
     ModuleName = ContractHomeVM.GetModuleNameByContractType(contractType);
     TradeType = tradeType;
     ContractType = contractType;
     IsEdit = true;
     VM = new ShortContractDetailVM(tradeType, contractType, id, isSplit);
     InitPage();
     BindData();
 }
Ejemplo n.º 41
0
 public Contract(long ownerID, short statusID)
 {
     _ownerID = ownerID;
     _statusID = statusID;
     _pickupStationID = 0;
     _destinationStationID = 0;
     _collateral = 0;
     _reward = 0;
     _expectedProfit = 0;
     _totalVolume = 0;
     _issueDate = DateTime.Now;
     _items = new ContractItemList();
     _type = ContractType.Courier;
 }
Ejemplo n.º 42
0
        public RepairContract( ContractType m_type, double m_level, string m_Crafter )
            : base(0x14F0)
        {
            Crafter = m_Crafter;

            Hue = 0x1BC;

            Level = m_level;

            LootType = LootType.Blessed;

            Type = m_type;

            Weight = 1.0;
        }
Ejemplo n.º 43
0
 public AirportContract(Airline airline, Airport airport, ContractType type, DateTime date, int numberOfGates, int length, double yearlyPayment,Boolean autorenew, Boolean payFull = false, Boolean isExclusiveDeal = false, Terminal terminal = null)
 {
     this.Type = type;
     this.PayFull = payFull;
     this.Airline = airline;
     this.Airport = airport;
     this.ContractDate = date;
     this.Length = length;
     this.YearlyPayment = yearlyPayment;
     this.NumberOfGates = numberOfGates;
     this.IsExclusiveDeal = isExclusiveDeal;
     this.Terminal = terminal;
     this.ExpireDate = this.ContractDate.AddYears(this.Length);
     this.AutoRenew = autorenew;
 }
Ejemplo n.º 44
0
 public Contract(long ownerID, short statusID, long pickupStationID, long destinationStationID,
     decimal collateral, decimal reward, decimal expectedProfit, DateTime issueDate, ContractItemList items,
     ContractType type)
 {
     _ownerID = ownerID;
     _statusID = statusID;
     _pickupStationID = pickupStationID;
     _destinationStationID = destinationStationID;
     _collateral = collateral;
     _reward = reward;
     _expectedProfit = expectedProfit;
     _issueDate = issueDate;
     _items = items;
     _type = type;
 }
Ejemplo n.º 45
0
        public ContractList(ContractSearchConditions conditions, ContractType contractType)
        {
            InitializeComponent();
            ContractType = contractType;

            VM = new ContractListVM(conditions);
            ModuleName = ContractHomeVM.GetModuleNameByContractType(contractType);

            _canEdit = CheckPerm(PageMode.EditMode);
            _canDelete = CheckPerm(PageMode.DeleteMode);
            _canView = CheckPerm(PageMode.ViewMode);

            pagerContract.OnNewPage += pagerContract_OnNewPage;
            pagerContract.Init(VM.QuotaTotalCount, RecPerPage);
            BindData();
        }
Ejemplo n.º 46
0
 public void ShouldBeAbleToCacheContractTypes()
 {
     ContractType original = new ContractType { Id = 123, Name = "abc" }, clone;
     using (var client = new MemcachedClient())
     {
         client.Store(StoreMode.Set, "ShouldBeAbleToCacheBasicTypes", original);
     }
     using (var client = new MemcachedClient())
     {
         clone = client.Get<ContractType>("ShouldBeAbleToCacheBasicTypes");
     }
     Assert.IsNotNull(clone);
     Assert.AreNotSame(original, clone);
     Assert.AreEqual(original.Id, clone.Id);
     Assert.AreEqual(original.Name, clone.Name);
 }
Ejemplo n.º 47
0
        public async Task<JsonResult> Calculate(ContractType contractType, int experience)
        {
            var client = new SalaryServiceClient();
            try
            {
                var salary = await client.CalculateSalaryAsync(contractType, experience);
                client.Close();

                return this.Json(salary, JsonRequestBehavior.AllowGet);
            }
            catch (FaultException)
            {
                client.Abort();
                throw;
            }
        }
Ejemplo n.º 48
0
 public Contract(EMMADataSet.ContractsRow data)
 {
     _id = data.ID;
     _ownerID = data.OwnerID;
     _statusID = data.Status;
     _pickupStationID = data.PickupStationID;
     _destinationStationID = data.DestinationStationID;
     _collateral = data.Collateral;
     _reward = data.Reward;
     _issueDate = data.DateTime;
     if (UserAccount.Settings.UseLocalTimezone)
     {
         _issueDate = _issueDate.AddHours(Globals.HoursOffset);
     }
     _type = (ContractType)data.Type;
     _expectedProfit = 0;
 }
Ejemplo n.º 49
0
        public Principal(string firstName,
            string lastName,
            string egn,
            ContractType contractType,
            int id,
            decimal salary,
            int rating)
            : base(firstName,
                lastName,
                egn,
                Position.Principal,
                contractType,
                id,
                salary,
                rating)
        {

        }
Ejemplo n.º 50
0
 public Administrator(string firstName, 
     string lastName, 
     string egn, 
     ContractType contractType, 
     int id,
     decimal salary,
     int rating)
         : base(firstName, 
             lastName, 
             egn, 
             Position.Administrator, 
             contractType, 
             id, 
             salary,
             rating)
 {
     
 }
Ejemplo n.º 51
0
 public Hygienist(string firstName, 
     string lastName, 
     string egn, 
     ContractType contractType, 
     int id,
     decimal salary,
     int rating)
         : base(firstName, 
             lastName, 
             egn, 
             Position.Hygienist, 
             contractType, 
             id, 
             salary,
             rating)      
 {
     
 }
Ejemplo n.º 52
0
 public Teacher(string firstName, 
     string lastName, 
     string egn, 
     ContractType contractType, 
     int id,
     decimal salary,
     int rating,
     TeacherRank rank=TeacherRank.Unknown)
         : base(firstName, 
             lastName, 
             egn, 
             Position.Teacher, 
             contractType, 
             id, 
             salary,
             rating)
 {
     this.CoursesList = new List<Course>();
     this.rank = Rank; //!
 }
        protected void MissionControlText(ContractType contractType)
        {
            string text = "<b><color=#DB8310>Briefing:</color></b>\n\n";

            // Special case for one-off contracts
            string description = contractType.genericDescription;
            if (contractType.maxCompletions == 1)
            {
                foreach (ConfiguredContract c in ConfiguredContract.CompletedContracts)
                {
                    if (c.contractType != null && c.contractType.name == contractType.name)
                    {
                        description = c.Description;
                        break;
                    }
                }
            }
            text += "<color=#CCCCCC>" + description + "</color>\n\n";

            text += "<b><color=#DB8310>Pre-Requisites:</color></b>\n\n";

            // Do text for funds
            if (contractType.advanceFunds < 0)
            {
                CurrencyModifierQuery q = new CurrencyModifierQuery(TransactionReasons.ContractAdvance, -contractType.advanceFunds, 0.0f, 0.0f);
                GameEvents.Modifiers.OnCurrencyModifierQuery.Fire(q);
                float fundsRequired = contractType.advanceFunds + q.GetEffectDelta(Currency.Funds);

                text += RequirementLine("Must have {0} funds for advance", Funding.CanAfford(fundsRequired));
            }

            // Do text for max completions
            if (contractType.maxCompletions != 0)
            {
                int completionCount = contractType.ActualCompletions();
                bool met = completionCount < contractType.maxCompletions;
                if (contractType.maxCompletions == 1)
                {
                    text += RequirementLine("Must not have been completed before", met);
                }
                else
                {
                    text += RequirementLine("May only be completed " + contractType.maxCompletions + " times", met,
                        "has been completed " + completionCount + " times");
                }
            }

            // Do check for group maxSimultaneous
            for (ContractGroup currentGroup = contractType.group; currentGroup != null; currentGroup = currentGroup.parent)
            {
                if (currentGroup.maxSimultaneous != 0)
                {
                    int count = currentGroup.CurrentContracts();
                    text += RequirementLine(string.Format("May only have {0} offered/active {1} contracts at a time",
                        currentGroup.maxSimultaneous, currentGroup.displayName, count), count < currentGroup.maxSimultaneous);
                }
            }

            // Do check of required values
            List<string> titles = new List<string>();
            Dictionary<string, bool> titlesMet = new Dictionary<string, bool>();
            foreach (KeyValuePair<string, ContractType.DataValueInfo> pair in contractType.dataValues)
            {
                string name = pair.Key;
                if (pair.Value.required && !contractType.dataNode.IsDeterministic(name) && !pair.Value.hidden && !pair.Value.IsIgnoredType())
                {
                    bool met = true;
                    try
                    {
                        contractType.CheckRequiredValue(name);
                    }
                    catch
                    {
                        met = false;
                    }

                    string title = string.IsNullOrEmpty(pair.Value.title) ? "Key " + name + " must have a value" : pair.Value.title;
                    if (titlesMet.ContainsKey(title))
                    {
                        titlesMet[title] &= met;
                    }
                    else
                    {
                        titlesMet[title] = met;
                        titles.Add(title);
                    }
                }
            }

            // Do the actual add
            foreach (string title in titles)
            {
                text += RequirementLine(title, titlesMet[title]);
            }

            // Force check requirements for this contract
            CheckRequirements(contractType.Requirements);

            // Do a Research Bodies check, if applicable
            if (Util.Version.VerifyResearchBodiesVersion() && contractType.targetBody != null)
            {
                text += ResearchBodyText(contractType);
            }

            text += ContractRequirementText(contractType.Requirements);

            MissionControl.Instance.contractText.text = text;
        }
 protected Contract.ContractPrestige? GetPrestige(ContractType contractType)
 {
     if (contractType.dataNode.IsDeterministic("prestige"))
     {
         if (contractType.prestige.Count == 1)
         {
             return contractType.prestige.First();
         }
     }
     return null;
 }
 public ContractContainer(ContractType contractType)
 {
     contract = null;
     this.contractType = contractType;
 }
Ejemplo n.º 56
0
 public DeliveryHomeVM(ContractType contractType)
 {
     ContractType = contractType;
     StartDate = DateTime.Now.Date;
     EndDate = DateTime.Now.Date;
     GetTradeTypes();
     GetDlvIsVerifieds();
     //GetMetals();
     GetCommodityTypes();
 }
Ejemplo n.º 57
0
 public static ContractList GetContracts(List<long> ownerIDs, short status, long pickupStationID,
     long destinationStationID, ContractType contractType)
 {
     ContractList retVal = new ContractList();
     EMMADataSet.ContractsDataTable table = new EMMADataSet.ContractsDataTable();
     StringBuilder ownerIDString = new StringBuilder("");
     foreach (long ownerID in ownerIDs)
     {
         if (ownerIDString.Length != 0) { ownerIDString.Append(","); }
         ownerIDString.Append(ownerID);
     }
     contractsTableAdapter.FillByAny(table, ownerIDString.ToString(), pickupStationID,
         destinationStationID, status, (short)contractType);
     foreach (EMMADataSet.ContractsRow contract in table)
     {
         retVal.Add(new Contract(contract));
     }
     return retVal;
 }
Ejemplo n.º 58
0
        public Employee(string firstName, 
            string lastName, 
            string egn,
            Position position, 
            ContractType type,
            int id,
            decimal salary,
            int rating)
                :base(firstName,lastName,egn)
        {        
            if (id < 0)
            {
                throw new ArgumentException("Identification number cannot be negative");
            }

            if (salary < 0)
            {
                throw new ArgumentException("Salary cannot be negative");
            }

            this.Position = position;
            this.ContractType = type;
            this.Id = id;
            this.Salary = salary;
            this._rating = rating;
        }
Ejemplo n.º 59
0
 public static string GetDescription(ContractType type)
 {
     if (!_initalised) { Initalise(); }
     return _descriptions.Get((short)type);
 }
        internal ContractMethodInfo(ContractType declaringType, OperationInfo operationInfo)
        {
            if (declaringType == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("declaringType");
            }
            if (operationInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operationInfo");
            }
            if (string.IsNullOrEmpty(operationInfo.Name))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("operationInfo",
                    SR2.GetString(SR2.Error_OperationNameNotSpecified));
            }

            this.declaringType = declaringType;
            this.name = operationInfo.Name;
            this.methodAttributes = MethodAttributes.Public |
                MethodAttributes.Abstract |
                MethodAttributes.Virtual;

            SortedList<int, ContractMethodParameterInfo> localParameters =
                new SortedList<int, ContractMethodParameterInfo>();

            foreach (OperationParameterInfo operationParameterInfo in operationInfo.Parameters)
            {
                ContractMethodParameterInfo parameterInfo =
                    new ContractMethodParameterInfo(this, operationParameterInfo);
                if (parameterInfo.Position == -1)
                {
                    this.returnParam = parameterInfo;
                }
                else
                {
                    localParameters.Add(parameterInfo.Position, parameterInfo);
                }
            }

            this.parameters = new ParameterInfo[localParameters.Count];
            foreach (ContractMethodParameterInfo paramInfo in localParameters.Values)
            {
                this.parameters[paramInfo.Position] = paramInfo;
            }

            if (this.returnParam == null)
            {
                OperationParameterInfo returnParameterInfo = new OperationParameterInfo();
                returnParameterInfo.Position = -1;
                returnParameterInfo.ParameterType = typeof(void);

                this.returnParam = new ContractMethodParameterInfo(this, returnParameterInfo);
            }

            OperationContractAttribute operationContract = new OperationContractAttribute();
            if (operationInfo.HasProtectionLevel && operationInfo.ProtectionLevel != null)
            {
                operationContract.ProtectionLevel = (ProtectionLevel) operationInfo.ProtectionLevel;
            }
            operationContract.IsOneWay = operationInfo.IsOneWay;

            this.attributes = new Attribute[] { operationContract };

            declaringType.AddMethod(this);
        }