protected void btnSubmit_Click(object sender, EventArgs e) { string company = Session["PSEName"].ToString(); BA_Timesheet batine = new BA_Timesheet(); //DateTime x = Convert.ToDateTime(tsTimeIn.Hour.ToString() + ":" + tsTimeIn.Minute.ToString() + tsTimeIn.AmPm); //DateTime y = Convert.ToDateTime(tsTimeOut.Hour.ToString() + ":" + tsTimeOut.Minute.ToString() + tsTimeOut.AmPm); string x = tsTimeIn.Hour.ToString() + ":" + tsTimeIn.Minute.ToString() + tsTimeIn.AmPm; string y = tsTimeOut.Hour.ToString() + ":" + tsTimeOut.Minute.ToString() + tsTimeOut.AmPm; TimeSpan timediff = Convert.ToDateTime(y) - Convert.ToDateTime(x); string timedif = timediff.ToString(); string[] ar = timedif.Split(':'); string[] total; string tt = string.Empty; int cnt = 0; foreach (string t in ar) { if (cnt < 2) { tt = tt + t.ToString() + '.'; cnt++; } } tt = tt.Remove(tt.Length - 1, 1); string totalwork = tt.ToString(); //int val=Convert.ToInt16(timediff.ToString()); string d = ddlday.SelectedItem.ToString(); string sid = ddlusers.SelectedValue; string worktype = ddlDayType.SelectedItem.ToString(); //if (worktype=="Working") //{ batine.InsertTimeSheet(x, y, d, sid, totalwork, worktype, company); //} //else if (worktype=="Holiday" || worktype=="Leave") //{ // batine.InsertOff(sid,d,worktype); //} DataSet ds = new DataSet(); string id1 = ddlusers.SelectedValue; //lblEmpName.Text = ddlusers.SelectedItem.ToString(); ds = batine.GetTimeSheetInfo(id1); dlTsdet.DataSource = ds; dlTsdet.DataBind(); }
protected void ddlusers_SelectedIndexChanged(object sender, EventArgs e) { BA_Timesheet batine = new BA_Timesheet(); DataSet ds = new DataSet(); string id1 = ddlusers.SelectedValue; //lblEmpName.Text = ddlusers.SelectedItem.ToString(); ds = batine.GetTimeSheetInfo(id1); dlTsdet.DataSource = ds; dlTsdet.DataBind(); ddlday.DataSource = ds; ddlday.DataTextField = "day"; ddlday.DataValueField = "day"; ddlday.DataBind(); ddlday.Items.Insert(0, new ListItem("--Select--", "--Select--")); pnlgrid.Visible = true; }