Esempio n. 1
0
    private ConConfigContract CreatModel(string contractId, bool isExist)
    {
        ConConfigContract conConfigContract = new ConConfigContract();
        string            id = isExist ? (
            from p in this.configSer
            where p.ContractId == contractId
            select p).FirstOrDefault <ConConfigContract>().Id : Guid.NewGuid().ToString();

        conConfigContract.Id                    = id;
        conConfigContract.ContractId            = contractId;
        conConfigContract.IsBalanceAlarm        = this.chkIsBalanceAlarm.Checked;
        conConfigContract.IsIncomeAlarm         = this.chkIncomePay.Checked;
        conConfigContract.IsPaymentAlarm        = this.chkIsPaymentAlarm.Checked;
        conConfigContract.IsPayoutAlarm         = this.chkPayoutPay.Checked;
        conConfigContract.HighPayAlarmLimit     = Common2.ConvertToDecimal(this.txtHighPayAlarmLimit.Text.Trim());
        conConfigContract.HighBalanceAlarmLimit = Common2.ConvertToDecimal(this.txtHighBalanceAlarmLimit.Text.Trim());
        if (string.IsNullOrEmpty(this.txtPayoutAlarmDays.Text.Trim()))
        {
            conConfigContract.PayoutAlarmDays = null;
        }
        else
        {
            conConfigContract.PayoutAlarmDays = new int?(Convert.ToInt32(this.txtPayoutAlarmDays.Text.Trim()));
        }
        if (string.IsNullOrEmpty(this.txtIncomeAlarmDays.Text.Trim()))
        {
            conConfigContract.IncomeAlarmDays = null;
        }
        else
        {
            conConfigContract.IncomeAlarmDays = new int?(Convert.ToInt32(this.txtIncomeAlarmDays.Text.Trim()));
        }
        conConfigContract.MidPayAlarmUpperLimit     = Common2.ConvertToDecimal(this.txtMidPayAlarmUpperLimit.Text.Trim());
        conConfigContract.MidPayAlarmLowerLimit     = Common2.ConvertToDecimal(this.txtMidPayAlarmLowerLimit.Text.Trim());
        conConfigContract.MidBalanceAlarmUpperLimit = Common2.ConvertToDecimal(this.txtMidBalanceAlarmUpperLimit.Text.Trim());
        conConfigContract.MidBalanceAlarmLowerLimit = Common2.ConvertToDecimal(this.txtMidBalanceAlarmLowerLimit.Text.Trim());
        conConfigContract.LowPayAlarmUpperLimit     = Common2.ConvertToDecimal(this.txtLowPayAlarmUpperLimit.Text.Trim());
        conConfigContract.LowPayAlarmLowerLimit     = Common2.ConvertToDecimal(this.txtLowPayAlarmLowerLimit.Text.Trim());
        conConfigContract.LowBalanceAlarmUpperLimit = Common2.ConvertToDecimal(this.txtLowBalanceAlarmUpperLimit.Text.Trim());
        conConfigContract.LowBalanceAlarmLowerLimit = Common2.ConvertToDecimal(this.txtLowBalanceAlarmLowerLimit.Text.Trim());
        return(conConfigContract);
    }