private void GetNum() { try { ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString(); var Rows = from a in mdb.DocumentHeaders where a.DocType == 1 orderby a.Id descending select a; if (Rows.Count() == 0) { txtDocNo.Text = "1"; } else { ADAM.DataBase.DocumentHeader dr = Rows.First(); txtDocNo.Text = (dr.DocNo + 1).ToString(); } } catch { } }
protected void btnShowReport_Click(object sender, ImageClickEventArgs e) { ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString(); var Rows = from a in db.DocumentHeaders where a.DocNo == long.Parse(txtDocumentCode.Text) && a.DocType == 2 select a; if (string.IsNullOrEmpty(txtDocumentCode.Text)) { txtDocumentCode.Text = "0"; ShowReport(0); } if (Rows.Count() > 0) { ADAM.DataBase.DocumentHeader dr = db.DocumentHeaders.Single(a => a.DocNo == long.Parse(txtDocumentCode.Text) && a.DocType == 2); ShowReport(dr.Id); } else { Response.Write("<script>alert('من فضلك تأكد من رقم سند الصرف')</script>"); return; } }