Beispiel #1
0
 public Record Select(Key key)
 {
     if (Key == key)
     {
         return(this);
     }
     else
     {
         return(NextRecord.Select(key));
     }
 }
Beispiel #2
0
        private void LostCompentationControl(bool leave)
        {
            string newValue = compensatePayText.Text.Trim();
            string oldValue = m_currentRecord.Compensation.ToString();

            if (String.Compare(newValue, oldValue) != 0)
            {
                float newVal;
                if (!float.TryParse(newValue, out newVal))
                {
                    if (!string.IsNullOrEmpty(nameText.Text.Trim()))
                    {
                        ShowMesage(@"总费用应该是数字");
                    }
                    compensatePayText.Text = m_currentRecord.Compensation.ToString("F2");
                    if (!leave)
                    {
                        compensatePayText.Focus();
                    }
                    return;
                }

                if (!ValidateMorethanZero(newVal))
                {
                    if (!string.IsNullOrEmpty(nameText.Text.Trim()))
                    {
                        ShowMesage(@"补偿费应该大于0");
                    }
                    compensatePayText.Text = m_currentRecord.Compensation.ToString("F2");
                    if (!leave)
                    {
                        compensatePayText.Focus();
                    }
                    return;
                }

                if (newVal - m_currentRecord.AllCost > 0)
                {
                    ShowMesage("补偿费(" + newVal.ToString("F2") + ")不能大于总费用(" + m_currentRecord.AllCost.ToString("F2") + ")!");
                    compensatePayText.Text = m_currentRecord.Compensation.ToString("F2");
                    if (!leave)
                    {
                        compensatePayText.Focus();
                    }
                    return;
                }

                m_currentRecord.Compensation = newVal;
                compensatePayText.Text       = m_currentRecord.Compensation.ToString("F2");
                selfPayText.Text             = m_currentRecord.SelfPay.ToString("F2");
            }

            NextRecord.Focus();
        }
Beispiel #3
0
        private void LostSelfpayControl(bool leave)
        {
            float  selfPay;
            string newValue = selfPayText.Text.Trim();
            string oldValue = m_currentRecord.SelfPay.ToString();

            if (String.Compare(newValue, oldValue) != 0)
            {
                if (!float.TryParse(selfPayText.Text.Trim(), out selfPay))
                {
                    ShowMesage(@"总费用应该是数字");
                    selfPayText.Text = m_currentRecord.SelfPay.ToString("F2");
                    if (!leave)
                    {
                        selfPayText.Focus();
                    }
                    return;
                }

                if (!ValidateMorethanZero(selfPay))
                {
                    ShowMesage(@"自付费用不能小于0!");
                    selfPayText.Text = m_currentRecord.SelfPay.ToString("F2");
                    if (!leave)
                    {
                        selfPayText.Focus();
                    }
                    return;
                }

                if (selfPay > m_currentRecord.AllCost)
                {
                    ShowMesage(@"自付费" + selfPay.ToString("F2") + "用不能大于总费用" + m_currentRecord.AllCost.ToString("F2") +
                               ")!");
                    selfPayText.Text = m_currentRecord.SelfPay.ToString("F2");
                    if (!leave)
                    {
                        selfPayText.Focus();
                    }
                    return;
                }


                m_currentRecord.Compensation = m_currentRecord.AllCost - selfPay;

                compensatePayText.Text = m_currentRecord.Compensation.ToString("F2");
                selfPayText.Text       = selfPay.ToString("F2");
            }

            NextRecord.Focus();
        }
Beispiel #4
0
 public void Insert(Record record)
 {
     if (NextRecord == null)
     {
         NextRecord = record;
     }
     else
     {
         if (record.Key == Key)
         {
             Value = record.Value;
         }
         else
         {
             NextRecord.Insert(record);
         }
     }
 }