protected void Page_Load(object sender, EventArgs e) { lblResult.Text = string.Empty; contractTypeHandler = new ContractTypeHandler(); if (IsPostBack == false) { BindData(); } }
protected void btnYES_Click(object sender, EventArgs e) { ContractType contractType = new ContractType(); contractType.Title = txtTitle.Text; ContractTypeHandler contractTypeHandler = new ContractTypeHandler(); if (contractTypeHandler.Insert(contractType) > 0) { Response.Redirect("Z_ContractTypeDefault.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { string contractTypeID = Request.QueryString["contractTypeID"] as string; if (contractTypeID == null) { Response.Redirect("Z_ContractTypeDefault.aspx"); } try { contractTypeContractTypeID = Convert.ToInt32(contractTypeID.Trim()); contractTypeHandler = new ContractTypeHandler(); ContractType contractType = contractTypeHandler.GetDetails(contractTypeContractTypeID); lblContractTypeID.Text = contractType.ContractTypeID.ToString(); lblTitle.Text = contractType.Title.ToString(); } catch (Exception) { Response.Redirect("Z_ContractTypeDefault.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { ContractTypeHandler contractTypeHandler = new ContractTypeHandler(); List <ContractType> contractTypeList = contractTypeHandler.GetListAll(); DataTable contractTypeTable = new DataTable(); contractTypeTable.Columns.Add("ContractTypeID"); if (contractTypeList != null) { foreach (ContractType contractType in contractTypeList) { contractTypeTable.Rows.Add(contractType.ContractTypeID); } } if (!IsPostBack) { ddlContractTypeID.DataSource = contractTypeTable; ddlContractTypeID.DataTextField = "ContractTypeID"; ddlContractTypeID.DataValueField = "ContractTypeID"; ddlContractTypeID.DataBind(); } DepartmentHandler departmentHandler = new DepartmentHandler(); List <Department> departmentList = departmentHandler.GetListAll(); DataTable departmentTable = new DataTable(); departmentTable.Columns.Add("DepartmentID"); if (departmentList != null) { foreach (Department department in departmentList) { departmentTable.Rows.Add(department.DepartmentID); } } if (!IsPostBack) { ddlDepartmentID.DataSource = departmentTable; ddlDepartmentID.DataTextField = "DepartmentID"; ddlDepartmentID.DataValueField = "DepartmentID"; ddlDepartmentID.DataBind(); } RoleTypeHandler roleTypeHandler = new RoleTypeHandler(); List <RoleType> roleTypeList = roleTypeHandler.GetListAll(); DataTable roleTypeTable = new DataTable(); roleTypeTable.Columns.Add("RoleTypeID"); if (roleTypeList != null) { foreach (RoleType roleType in roleTypeList) { roleTypeTable.Rows.Add(roleType.RoleTypeID); } } if (!IsPostBack) { ddlRoleTypeID.DataSource = roleTypeTable; ddlRoleTypeID.DataTextField = "RoleTypeID"; ddlRoleTypeID.DataValueField = "RoleTypeID"; ddlRoleTypeID.DataBind(); } }