protected void grdExpried_ItemDatabound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { this.contract = e.Item.DataItem as VNPT.Modules.EmployeeContract.EmployeeContractInfo; Label lblStartDate = e.Item.FindControl("lblStartDate") as Label; if (lblStartDate != null) { lblStartDate.Text = String.Format("{0:dd/MM/yyyy}", this.contract.datestart); } Label lblEndDate = e.Item.FindControl("lblEndDate") as Label; if (lblEndDate != null) { lblEndDate.Text = String.Format("{0:dd/MM/yyyy}", this.contract.dateend); } Label lblContractType = e.Item.FindControl("lblContractType") as Label; if (lblContractType != null) { lblContractType.Text = objContracType.GetLaborContractType(this.contract.contracttype).name; } Label lblUnit = e.Item.FindControl("lblUnit") as Label; if (lblUnit != null) { lblUnit.Text = objUnit.GetUnit(objEmplyess.GetEmployees(this.contract.employeeid).unitid).name; } HyperLink hplName = e.Item.FindControl("hplName") as HyperLink; if (hplName != null) { hplName.Text = objEmplyess.GetEmployees(this.contract.employeeid).fullname; hplName.NavigateUrl = String.Format(DotNetNuke.Common.Globals.ApplicationPath + "nhanvien/kyhopdong/tabid/154/Default.aspx?Id={0}", this.contract.employeeid); } } }
protected void grdContract_ItemCommand(object source, DataGridCommandEventArgs e) { int id = Int32.Parse(e.CommandArgument.ToString()); if (e.CommandName == "Delete") { this.contract = objContract.GetEmployeeContract(id); objContract.DeleteEmployeeContract(this.contract); grdContract.DataSource = objContract.GetEmployeeContracts(); grdContract.DataBind(); } }
protected void grdContract_ItemDatabound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { this.contract = e.Item.DataItem as VNPT.Modules.EmployeeContract.EmployeeContractInfo; Label lblStart = e.Item.FindControl("lblStart") as Label; if (lblStart != null) { lblStart.Text = String.Format("{0:dd/MM/yyyy}", this.contract.datestart); } Label lblEnd = e.Item.FindControl("lblEnd") as Label; if (lblEnd != null) { lblEnd.Text = String.Format("{0:dd/MM/yyyy}", this.contract.dateend); } ImageButton imgDelete = e.Item.FindControl("imgDelete") as ImageButton; if (imgDelete != null) { imgDelete.Attributes.Add("onClick", "javascript:return confirm('Bạn có muốn xóa');"); } //Label lblUnitName = e.Item.FindControl("lblUnitName") as Label; //if (lblUnitName != null) //{ // lblUnitName.Text =objUnit.GetUnit(this.contract.unitid).name; //} Label lblContractType = e.Item.FindControl("lblContractType") as Label; if (lblContractType != null) { lblContractType.Text = objContracType.GetLaborContractType(this.contract.contracttype).name; } HyperLink hplName = e.Item.FindControl("hplName") as HyperLink; if (hplName != null) { if (this.contract.employeeid != null) { VNPT.Modules.Employees.EmployeesInfo emp = objEmplyess.GetEmployees(Int32.Parse(this.contract.employeeid.ToString().Trim())); if (emp != null) { hplName.Text = emp.fullname; } } } } }