protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
CheckBox CHKBOX = (e.Row.FindControl("Released") as CheckBox);
CheckBox CHKBOX1 = (e.Row.FindControl("Released1") as CheckBox);
DropDownList ddlEmployee = (e.Row.FindControl("ddlEmp") as DropDownList);
DropDownList ddlEmployee2 = (e.Row.FindControl("ddlEmp2") as DropDownList);
var emp1 = _service.GetEmployeeDutyByEmployee_Id(MyUser.Employee_Id).LastOrDefault();
var EmpList = _service.GetAllEmployeeDuty().OrderByDescending(x => x.EndDate).GroupBy(x => x.Employee_Id).Select(x => x.First()).ToList();
var empList = EmpList.Where(X => X.ToSector_Id == emp1.ToSector_Id).ToList();
ddlEmployee.Bind(empList, "EmployeeIdName", "Employee_Id");
ddlEmployee2.Bind(empList, "EmployeeIdName", "Employee_Id");
}
protected void ddlEmp_SelectedIndexChanged(object sender, EventArgs e)
Entities entities = new Entities();
Control row = ((Control)sender).NamingContainer;
DropDownList ddlEmp = (DropDownList)row.FindControl("ddlEmp");
DropDownList ddlEmp2 = (DropDownList)row.FindControl("ddlEmp2");
Label lblPointName = (Label)ddlEmp.NamingContainer.FindControl("lblPointName");
Label lblPointName1 = (Label)ddlEmp.NamingContainer.FindControl("lblPointName1");
string Emp1 = ddlEmp.SelectedValue;
string Emp2 = ddlEmp2.SelectedValue;
string pointname = lblPointName.Text;
string pointname1 = lblPointName1.Text;
var PointIdByName = (from mdp in entities.SectorWisePoints.Where(x => x.Name == pointname) select mdp).Single();
var EmployeeById = (from ebi in entities.ModifiedNames.Where(x => x.BeltNo == Emp1) select ebi).Single();
CTP.HRMS.Business.DailyManualRoaster dmr = new Business.DailyManualRoaster();
dmr.SectorWisePoint_Id = PointIdByName.Id;
dmr.Employee_Id = EmployeeById.BeltNo;
dmr.ManDailyRoasterDate = DateTime.Now;
dmr.Sector_Id = 1;
_service.InsertDailyManualRoaster(dmr); }