protected void ddlCompUsers_SelectedIndexChanged1(object sender, EventArgs e) { pnlGrid.Visible = true; gridComp.Visible = true; BA_Timesheet1 batine = new BA_Timesheet1(); DataSet ds = new DataSet(); string id1 = ddlCompUsers.SelectedValue; ds = batine.GetTimeSheetInfo(id1); gridComp.DataSource = ds; gridComp.DataBind(); ddlCompday.DataSource = ds; ddlCompday.DataTextField = "day"; ddlCompday.DataValueField = "day"; ddlCompday.DataBind(); ddlCompday.Items.Insert(0, new ListItem("--Select--", "--Select--")); }
protected void btnComp_Click(object sender, EventArgs e) { string company = ddlcompany.SelectedItem.ToString(); BA_Timesheet1 batine = new BA_Timesheet1(); 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 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(); string d = ddlCompday.SelectedItem.ToString(); string sid = ddlCompUsers.SelectedValue; string worktype = ddlCompDayType.SelectedItem.ToString(); if (worktype == "Working") { batine.InsertTimeSheet(x, y, d, sid, totalwork, worktype, company); } else if (worktype == "Holiday" || worktype == "Leave") { batine.InsertTimeSheet(x, y, d, sid, totalwork, worktype, company); } DataSet ds = new DataSet(); string id1 = ddlCompUsers.SelectedValue; ds = batine.GetTimeSheetInfo(id1); gridComp.DataSource = ds; gridComp.DataBind(); }
protected void TimeSheet_ActiveTabChanged(object sender, EventArgs e) { gridComp.Visible = false; if (TimeSheet.ActiveTabIndex == 0) { if (ddlCompUsers.SelectedIndex != 0 && ddlcompany.SelectedIndex != 0) { pnlGrid.Visible = true; gridComp.Visible = true; BA_Timesheet1 batine = new BA_Timesheet1(); DataSet ds = new DataSet(); string id1 = ddlCompUsers.SelectedValue; ds = batine.GetTimeSheetInfo(id1); gridComp.DataSource = ds; gridComp.DataBind(); ddlCompday.DataSource = ds; ddlCompday.DataTextField = "day"; ddlCompday.DataValueField = "day"; ddlCompday.DataBind(); ddlCompday.Items.Insert(0, new ListItem("--Select--", "--Select--")); } } else { if (ddlusers.SelectedIndex != 0) { pnlGrid.Visible = true; gridComp.Visible = true; BA_Timesheet1 batine = new BA_Timesheet1(); DataSet ds = new DataSet(); string id1 = ddlusers.SelectedValue; ds = batine.GetTimeSheetInfo(id1); gridComp.DataSource = ds; gridComp.DataBind(); ddlusersday.DataSource = ds; ddlusersday.DataTextField = "day"; ddlusersday.DataValueField = "day"; ddlusersday.DataBind(); ddlusersday.Items.Insert(0, new ListItem("--Select--", "--Select--")); } } }
protected void ddlusers_SelectedIndexChanged(object sender, EventArgs e) { pnlGrid.Visible = true; gridComp.Visible = true; BA_Timesheet1 batine = new BA_Timesheet1(); DataSet ds = new DataSet(); string id1 = ddlusers.SelectedValue; ds = batine.GetTimeSheetInfo(id1); ViewState["CompName"] = ds.Tables[0].Rows[0]["CompanyName"].ToString(); gridComp.DataSource = ds; gridComp.DataBind(); ddlusersday.DataSource = ds; ddlusersday.DataTextField = "day"; ddlusersday.DataValueField = "day"; ddlusersday.DataBind(); ddlusersday.Items.Insert(0, new ListItem("--Select--", "--Select--")); }