Ejemplo n.º 1
0
 protected void rpItems_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Add")
     {
         TextBox txtReceiptDate   = e.Item.FindControl("txtReceiptDate") as TextBox;
         TextBox txtReceiptAmount = e.Item.FindControl("txtReceiptAmount") as TextBox;
         TextBox txtReceiptMan    = e.Item.FindControl("txtReceiptMan") as TextBox;
         TextBox txtRemark        = e.Item.FindControl("txtRemark") as TextBox;
         Receipt receipt          = new Receipt()
         {
             Man            = txtReceiptMan.Text,
             ReceivedAmount = !string.IsNullOrEmpty(txtReceiptAmount.Text) ? double.Parse(txtReceiptAmount.Text) : 0,
             ReceivedDate   = !string.IsNullOrEmpty(txtReceiptDate.Text) ? DateTime.Parse(txtReceiptDate.Text) : DateTime.Now,
             Remark         = txtRemark.Text,
             SourceNo       = SourceNo,
             SourceType     = SourceType
         };
         ReceiptDAL dal = new ReceiptDAL();
         dal.Add(receipt);
         dal.Save();
         BindControl();
         SetFocus(btnFocus);
     }
 }