protected void Button1_Click(object sender, EventArgs e) { EmpBusiness ebb = new EmpBusiness(); int l =ebb.getEmpLeave(Convert.ToInt32(Session["username"])); EmpBusiness ebbb = new EmpBusiness(); Employee p = ebbb.getEmpOnId(Convert.ToInt32(Session["username"])); TimeSpan ts = Calendar2.SelectedDate-Calendar1.SelectedDate; int leavLeft = p.Leaves - l - ts.Days; if (leavLeft>0) { EmpLeave el = new EmpLeave(); el.EmpId = Convert.ToInt32(Session["username"]); el.FromDate = Calendar1.SelectedDate; el.ToDate = Calendar2.SelectedDate; el.Descr = TextBox1.Text; ebb.insertEmpLeave(el); string body = "Emp Id with" + el.EmpId + "has applied leave from " + el.FromDate + " to " + el.ToDate + " for the particular reason " + el.Descr; Email s = new Email(); s.SendEmail(body); Response.Redirect(Request.Url.AbsoluteUri); } else Label1.Visible = true; }
public bool insertEmpLeave(EmpLeave ee) { ed = new EmpDalLayer(); ed.insertLeave(ee); return true; }
public List<EmpLeave> getLeavesTaken(int id) { eDataContext = new EmpDalDataContext(); List<EmpLeave> eList = new List<EmpLeave>(); var w= eDataContext.getLeaves(id); foreach (var item in w) { EmpLeave ea = new EmpLeave(); ea.EmpId = Convert.ToInt32(item.EmpId); ea.FromDate =Convert.ToDateTime( item.FromDate); ea.ToDate =Convert.ToDateTime( item.ToDate); ea.Descr = item.Reason.ToString(); eList.Add(ea); } return eList; }
public bool insertLeave(EmpLeave el) { eDataContext = new EmpDalDataContext(); eDataContext.InsertLeave(el.EmpId,el.FromDate,el.ToDate,el.Descr); eDataContext.SubmitChanges(); return true; }