예제 #1
0
        protected void detailChanged(object sender, EventArgs e)
        {
            string id = gvVoucherDetails.SelectedDataKey?.Value.ToString();
            var    vd = VouchersRepository.GetVoucherDetail(new Guid(id));

            if (vd != null)
            {
                txtVDText.Text          = vd.Text;
                txtVDAmount.Text        = vd.Amount.ToString();
                txtComment.Text         = vd.Comment;
                ddAccount.SelectedValue = vd.AccountID.ToString();
            }
        }
예제 #2
0
        protected void lbAdd_Click(object sender, EventArgs e)
        {
            VoucherDetail vd = new VoucherDetail
            {
                ID     = Guid.NewGuid(),
                Text   = txtVDText.Text,
                Amount = string.IsNullOrEmpty(txtVDAmount.Text) == false?decimal.Parse(txtVDAmount.Text) : 0,
                             AccountID = new Guid(ddAccount.SelectedValue),
                             Comment   = txtComment.Text,
                             VoucherID = new Guid(Request.QueryString["ID"])
            };

            VouchersRepository.AddDetail(vd);
            gvVoucherDetails.DataBind();
        }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack == false)
     {
         if (Request.QueryString["ID"] != null)
         {
             currentVoucherID = new Guid(Request.QueryString["ID"]);
             var v = VouchersRepository.GetVoucher(currentVoucherID);
             if (v != null)
             {
                 txtVoucherText.Text   = v.Text;
                 txtDate.Text          = v.Date.ToString("dd.MM.yyyy");
                 rblType.SelectedIndex = v.Type;
                 chkPaid.Checked       = v.Paid;
             }
         }
     }
 }