public static HR_ChildrenInfo GetHR_ChildrenInfoByChildrenInfoID(int ChildrenInfoID) { HR_ChildrenInfo hR_ChildrenInfo = new HR_ChildrenInfo(); SqlHR_ChildrenInfoProvider sqlHR_ChildrenInfoProvider = new SqlHR_ChildrenInfoProvider(); hR_ChildrenInfo = sqlHR_ChildrenInfoProvider.GetHR_ChildrenInfoByChildrenInfoID(ChildrenInfoID); return hR_ChildrenInfo; }
public static HR_ChildrenInfo GetHR_EmployeeByEmployeeID(string EmployeeID) { HR_ChildrenInfo hR_ChildrenInfo = new HR_ChildrenInfo(); SqlHR_ChildrenInfoProvider sqlHR_ChildrenInfoProvider = new SqlHR_ChildrenInfoProvider(); hR_ChildrenInfo = sqlHR_ChildrenInfoProvider.GetHR_ChildrenInfoByEmployeeID(EmployeeID); return hR_ChildrenInfo; }
public static int InsertHR_ChildrenInfo(HR_ChildrenInfo hR_ChildrenInfo) { SqlHR_ChildrenInfoProvider sqlHR_ChildrenInfoProvider = new SqlHR_ChildrenInfoProvider(); return sqlHR_ChildrenInfoProvider.InsertHR_ChildrenInfo(hR_ChildrenInfo); }
protected void btnAddChildrenInfo_Click(object sender, EventArgs e) { if (hfEmployeeID.Value!= null) { HR_ChildrenInfo hR_ChildrenInfo = new HR_ChildrenInfo(); //hR_ChildrenInfo.ChildrenInfoID= int.Parse(ddlChildrenInfoID.SelectedValue); hR_ChildrenInfo.EmployeeID = hfEmployeeID.Value.ToString(); hR_ChildrenInfo.ChildrenInfoName = txtChildrenInfoName.Text; hR_ChildrenInfo.ChildrenDateOfBirth = txtChildrenDateOfBirth.Text; hR_ChildrenInfo.Sex = ddlSex.SelectedValue; string userID = Profile.card_id; hR_ChildrenInfo.AddedBy = userID; hR_ChildrenInfo.AddedDate = DateTime.Now; hR_ChildrenInfo.ModifiedBy = userID; hR_ChildrenInfo.ModifiedDate = DateTime.Now; if (hdnChildrenInfoID.Value == string.Empty || hdnChildrenInfoID.Value == "0") { if (!IsDuplicateChildName(txtChildrenInfoName.Text)) { int resutl = HR_ChildrenInfoManager.InsertHR_ChildrenInfo(hR_ChildrenInfo); hR_ChildrenInfo.ChildrenInfoID = resutl; hdnChildrenInfoID.Value = resutl.ToString(); _childrenInfoColl.Add(hR_ChildrenInfo); txtChildrenInfoName.Text = string.Empty; txtChildrenDateOfBirth.Text = string.Empty; lblMsg.Text = "Information is saved"; lblMsg.ForeColor = System.Drawing.Color.Green; } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "Message", "alert('Children Name is already exist')", true); } } else { hR_ChildrenInfo.ChildrenInfoID = Convert.ToInt32(hdnChildrenInfoID.Value); HR_ChildrenInfoManager.UpdateHR_ChildrenInfo(hR_ChildrenInfo); _childrenInfoColl.Add(hR_ChildrenInfo); lblMsg.Text = "Information is updated"; lblMsg.ForeColor = System.Drawing.Color.Green; txtChildrenInfoName.Text = string.Empty; txtChildrenDateOfBirth.Text = string.Empty; } } else { lblMsg.Text = "Employee is not specified."; lblMsg.ForeColor = System.Drawing.Color.Red; } gvHR_ChildrenInfo.DataSource = _childrenInfoColl; gvHR_ChildrenInfo.DataBind(); }
public static bool UpdateHR_ChildrenInfo(HR_ChildrenInfo hR_ChildrenInfo) { SqlHR_ChildrenInfoProvider sqlHR_ChildrenInfoProvider = new SqlHR_ChildrenInfoProvider(); return sqlHR_ChildrenInfoProvider.UpdateHR_ChildrenInfo(hR_ChildrenInfo); }
protected void lblSelectChildren_Click(object sender, EventArgs e) { ImageButton linkButton = new ImageButton(); linkButton = (ImageButton)sender; int index = Convert.ToInt32(linkButton.CommandArgument); HR_ChildrenInfo hR_ChildrenInfo = new HR_ChildrenInfo(); hR_ChildrenInfo = _childrenInfoColl.ElementAt(index); hdnChildrenInfoID.Value = hR_ChildrenInfo.ChildrenInfoID.ToString(); txtChildrenInfoName.Text = hR_ChildrenInfo.ChildrenInfoName; txtChildrenDateOfBirth.Text = hR_ChildrenInfo.ChildrenDateOfBirth.ToString(); ddlSex.SelectedValue = hR_ChildrenInfo.Sex; _childrenInfoColl.RemoveAt(index); gvHR_ChildrenInfo.DataSource = _childrenInfoColl; gvHR_ChildrenInfo.DataBind(); UpdatePanel1.Update(); }
protected void lblChildrenDelete_Click(object sender, EventArgs e) { ImageButton linkButton = new ImageButton(); linkButton = (ImageButton)sender; int index = Convert.ToInt32(linkButton.CommandArgument); HR_ChildrenInfo hR_ChildrenInfo = new HR_ChildrenInfo(); hR_ChildrenInfo = _childrenInfoColl.ElementAt(index); if (hR_ChildrenInfo.ChildrenInfoID != 0) { bool result = HR_ChildrenInfoManager.DeleteHR_ChildrenInfo(hR_ChildrenInfo.ChildrenInfoID); } _childrenInfoColl.RemoveAt(index); gvHR_ChildrenInfo.DataSource = _childrenInfoColl; gvHR_ChildrenInfo.DataBind(); UpdatePanel1.Update(); }
protected void btnUpdateChildrenInfo_click(object sender, EventArgs e) { HR_ChildrenInfo hR_ChildrenInfo = new HR_ChildrenInfo(); hR_ChildrenInfo.ChildrenInfoID = int.Parse(hdnChildrenInfoID.Value); hR_ChildrenInfo.EmployeeID = hfEmployeeID.Value.ToString(); hR_ChildrenInfo.ChildrenInfoName = txtChildrenInfoName.Text; hR_ChildrenInfo.ChildrenDateOfBirth = txtChildrenDateOfBirth.Text; hR_ChildrenInfo.Sex = ddlSex.SelectedValue; string userID = Profile.card_id; hR_ChildrenInfo.AddedBy = userID; hR_ChildrenInfo.AddedDate = DateTime.Now; hR_ChildrenInfo.ModifiedBy = userID; hR_ChildrenInfo.ModifiedDate = DateTime.Now; bool resutl = HR_ChildrenInfoManager.UpdateHR_ChildrenInfo(hR_ChildrenInfo); //Response.Redirect("AdminDisplayHR_ChildrenInfo.aspx"); }
public bool UpdateHR_ChildrenInfo(HR_ChildrenInfo hR_ChildrenInfo) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateHR_ChildrenInfo", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ChildrenInfoID", SqlDbType.Int).Value = hR_ChildrenInfo.ChildrenInfoID; cmd.Parameters.Add("@EmployeeID", SqlDbType.NVarChar).Value = hR_ChildrenInfo.EmployeeID; cmd.Parameters.Add("@ChildrenInfoName", SqlDbType.NVarChar).Value = hR_ChildrenInfo.ChildrenInfoName; cmd.Parameters.Add("@ChildrenDateOfBirth", SqlDbType.NVarChar).Value = hR_ChildrenInfo.ChildrenDateOfBirth; cmd.Parameters.Add("@Sex", SqlDbType.NVarChar).Value = hR_ChildrenInfo.Sex; cmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar).Value = hR_ChildrenInfo.ModifiedBy; cmd.Parameters.Add("@ModifiedDate", SqlDbType.DateTime).Value = hR_ChildrenInfo.ModifiedDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public HR_ChildrenInfo GetHR_ChildrenInfoFromReader(IDataReader reader) { try { HR_ChildrenInfo hR_ChildrenInfo = new HR_ChildrenInfo ( DataAccessObject.IsNULL<int>(reader["ChildrenInfoID"]), DataAccessObject.IsNULL<string>(reader["EmployeeID"].ToString()), DataAccessObject.IsNULL<string>(reader["ChildrenInfoName"]), DataAccessObject.IsNULL<string>(reader["ChildrenDateOfBirth"]), DataAccessObject.IsNULL<string>(reader["Sex"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["ModifiedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["ModifiedDate"]) ); return hR_ChildrenInfo; } catch(Exception ex) { return null; } }