private void btnSearch_Click(object sender, EventArgs e) { ExpenseReport objrep = new ExpenseReport(); rptViewer objView = new rptViewer(); objrep.SetParameterValue("@mindate", txtMinDate.Value); objrep.SetParameterValue("@maxdate", txtmaxdate.Value); ExpenseBL objBL = new ExpenseBL() { mindate = Convert.ToDateTime(txtMinDate.Text), maxdate = Convert.ToDateTime(txtmaxdate.Text) }; var dt = objBL.SelectByDateDiff(); if (dt != null) { objrep.SetDataSource(dt); objView.crptViewer.ReportSource = objrep; objView.WindowState = FormWindowState.Maximized; objView.ShowDialog(); } else { MessageBox.Show("No Record Found"); } //crptViewerExpense.ReportSource = objrep; }
private void btnSave_Click(object sender, EventArgs e) { try { if(FormValidate() ==true) { ExpenseBL objExp = new ExpenseBL() { ExType = txtExPType.SelectedText, ExName = txtExpName.Text, Description = txtDescription.Text, Date = Convert.ToDateTime(txtDate.Text), Amount = Convert.ToDecimal(txtAmount.Text) }; objExp.Save(); MessageBox.Show("Saved Successfull"); ClearForm(); formDisable(); btnAddnew.Enabled = true; } } catch(Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public ExpenseController(ExpenseTrackerContext context) { try { expenseBL = new ExpenseBL(context); } catch (Exception e) { Console.WriteLine("Exception in getting Context object", e); } }
public HttpResponseMessage GetUserExpenses(int id) { try { var data = new ExpenseBL().GetUserExpenses(id); return(Request.CreateResponse(HttpStatusCode.OK, data)); } catch (Exception ex) { LogManager.Instance.Error(ex); return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }
public HttpResponseMessage GetExpenses(string query) { try { var userId = AuthHelper.GetUserIdFromClaims(User.Identity as ClaimsIdentity); var cmd = JsonConvert.DeserializeObject <PaginationDTO>(query); int pagesCount = 0; var data = new ExpenseBL().GetExpenses(cmd, userId, ref pagesCount); var result = Request.CreateResponse(HttpStatusCode.OK, data); result.Headers.Add(Consts.PAGES_COUNT, pagesCount.ToString()); return(result); } catch (Exception ex) { LogManager.Instance.Error(ex); return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }