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


C# Contract.CopyPropertiesFrom方法代码示例

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


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

示例1: btnSave_Click

    protected void btnSave_Click(object sender, EventArgs e)
    {
        Contract original_contract = new Contract();
        contractManager = new ContractManager(this);
        contract = new Contract();

        if (Page.ViewState["ContractId"] != null)
            original_contract = contractManager.GetContract(Company.CompanyId, Convert.ToInt32(Page.ViewState["ContractId"]));

        contract.CopyPropertiesFrom(original_contract);

        contract.CompanyId = Company.CompanyId;
        contract.CustomerId = Convert.ToInt32(Page.ViewState["CustomerId"]);
        contract.BeginDate = ucdtIntervalContract.DateInterval.BeginDate;
        contract.ExpiresDate = ucdtIntervalContract.DateInterval.EndDate;
        contract.Observation = txtObservation.Text;
        contract.ContractNumber = txtContractNumber.Text;
        contract.Periodicity = 30;

        contract.Penalty = ucPenalty.CurrencyValue;
        if (!String.IsNullOrEmpty(cboPaymentMethods.SelectedValue))
        {
            contract.FinancierOperationId = Convert.ToInt32(cboPaymentMethods.SelectedValue);
            contract.FinancierConditionId = Convert.ToInt32(cboParcels.SelectedValue);
        }

        if (!String.IsNullOrEmpty(cboContractType.SelectedValue))
            contract.ContractTypeId = Convert.ToInt32(cboContractType.SelectedValue);


        contract.RepresentantId = null;        
        if (!String.IsNullOrEmpty(cboRepresentants.SelectedValue))
            contract.RepresentantId = Convert.ToInt32(cboRepresentants.SelectedValue);

        contract.EmployeeId = null;
        if (!String.IsNullOrEmpty(cboVendors.SelectedValue))
            contract.EmployeeId = Convert.ToInt32(cboVendors.SelectedValue);
            

        if (!String.IsNullOrEmpty(cboContractStatus.SelectedValue))
            contract.ContractStatusId = Convert.ToInt32(cboContractStatus.SelectedValue);

        contract.HH = ucHH.CurrencyValue;
        if (!String.IsNullOrEmpty(txtInterestDeferredPayment.Text))
            contract.InterestDeferredPayment = Convert.ToDecimal(txtInterestDeferredPayment.Text.RemoveMask());

        if (ucContractValue.CurrencyValue.HasValue)
            contract.ContractValue = ucContractValue.CurrencyValue.Value;

        contract.AdditionalValue1 = ucContractAdditionalValue1.CurrencyValue;
        contract.AdditionalValue2 = ucContractAdditionalValue2.CurrencyValue;
        contract.AdditionalValue3 = ucContractAdditionalValue3.CurrencyValue;
        contract.AdditionalValue4 = ucContractAdditionalValue4.CurrencyValue;
        contract.AdditionalValue5 = ucContractAdditionalValue5.CurrencyValue;
        contract.MoneyReserves = ucMoneyReserves.CurrencyValue;
        contract.MonthlyFee = ucMonthlyFee.CurrencyValue;
        contract.Insurance = ucInsurance.CurrencyValue;

        if (!String.IsNullOrEmpty(cboParcels.SelectedValue))
            contract.Parcels = Convert.ToInt32(cboParcels.SelectedItem.Text);

        DateTime dueDate = DateTime.MinValue.Sql2005MinValue();

        if (ucParcelDueDate.DateTime.HasValue)
            contract.FirstParcelDueDate = ucParcelDueDate.DateTime.Value.Date;

        ContractManager.ContractValidationStatus contractValidationStatus = ContractManager.ContractValidationStatus.Valid;

        if (original_contract.ContractId != 0)
            contractValidationStatus = contractManager.UpdateContract(original_contract, contract, Convert.ToInt32(cboParcels.SelectedItem.Text), ContractsAssociated);
        else
            contractValidationStatus = contractManager.InsertContract(contract, Convert.ToInt32(cboParcels.SelectedItem.Text), ContractsAssociated);

        if (contractValidationStatus == ContractManager.ContractValidationStatus.Valid)
            Response.Redirect("~/InfoControl/Accounting/Contracts.aspx");

        if (contractValidationStatus == ContractManager.ContractValidationStatus.GeneratedAsPendent)
            ShowAlert(Resources.Exception.ContractGeneratedAsdepend);

        if (contractValidationStatus == ContractManager.ContractValidationStatus.Invalid)
            ShowError(Resources.Exception.CustomerCreditLimitInvalid);
    }
开发者ID:sidneylimafilho,项目名称:InfoControl,代码行数:82,代码来源:Contract.aspx.cs


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