partial void UpdateTimesheetHeader(TimesheetHeader instance);
partial void DeleteTimesheetHeader(TimesheetHeader instance);
partial void InsertTimesheetHeader(TimesheetHeader instance);
private void detach_TimesheetHeaders1(TimesheetHeader entity) { this.SendPropertyChanging(); entity.Employee1 = null; }
private void attach_TimesheetHeaders(TimesheetHeader entity) { this.SendPropertyChanging(); entity.Employee = this; }
//------------------------------------------------------------------------- protected void btnCreateNewRecord_Click(object sender, EventArgs e) { FlyingFishClassesDataContext ff = new FlyingFishClassesDataContext(); try { var qry = (from emp in ff.Employees where emp.empId == Convert.ToInt32(Session["CurEmpId"]) select emp.approver).FirstOrDefault(); TimesheetHeader tmp = new TimesheetHeader() { tsDate = Convert.ToDateTime(Session["CurrentDate"]), empId = Convert.ToInt32(Session["CurEmpId"]), status = "SAVED", approvedBy = qry, comments = "Comments" }; var qry2 = (from th in ff.TimesheetHeaders where th.empId == tmp.empId && th.tsDate == tmp.tsDate select th).ToList(); if (qry2.Count == 0) { ff.TimesheetHeaders.InsertOnSubmit(tmp); ff.SubmitChanges(); } TimesheetEntry tmp2 = new TimesheetEntry() { tsDate = Convert.ToDateTime(Session["CurrentDate"]), empId = Convert.ToInt32(Session["CurEmpId"]), projId = Convert.ToInt32(ddlProjectId.SelectedValue), wpId = (ddlWpId.SelectedValue).ToString(), sun = Convert.ToInt32(tbSun.Text), sat = Convert.ToInt32(tbSat.Text), fri = Convert.ToInt32(tbFri.Text), thu = Convert.ToInt32(tbThu.Text), wed = Convert.ToInt32(tbWed.Text), tue = Convert.ToInt32(tbTue.Text), mon = Convert.ToInt32(tbMon.Text), notes = tbNote.Text }; ff.TimesheetEntries.InsertOnSubmit(tmp2); ff.SubmitChanges(); lblteSubmitSuccess.Text = "Submit has been saved."; divNewRecord.Visible = false; btnNewRecord.Visible = true; divtotal.Visible = true; tbFri.Text = String.Empty; tbMon.Text = String.Empty; tbNote.Text = String.Empty; //tbProjectID.Text = String.Empty; tbSat.Text = String.Empty; tbSun.Text = String.Empty; tbThu.Text = String.Empty; tbTue.Text = String.Empty; tbWed.Text = String.Empty; //tbWpID.Text = String.Empty; } catch (Exception myException) { lblteSubmitSuccess.Text = "ENTRY ALREADY EXISTS"; // Label1.Text = "You have sumbitted the record before, Cannot insert duplicate record into the database!!!"; } }