protected void btnUpdate_Click(object sender, EventArgs e) { HR_Contact hR_Contact = new HR_Contact (); hR_Contact.ContactID= int.Parse(Request.QueryString["ID"].ToString()); hR_Contact.EmployeeID = Profile.card_id; hR_Contact.CurrentAddress= txtCurrentAddress.Text; hR_Contact.PermanentAddress= txtPermanentAddress.Text; hR_Contact.Telephone= txtTelephone.Text; hR_Contact.Mobile= txtMobile.Text; hR_Contact.Email= txtEmail.Text; hR_Contact.AddedBy= Profile.card_id; hR_Contact.AddedDate= DateTime.Now; hR_Contact.ModifiedBy= Profile.card_id; hR_Contact.ModifiedDate= DateTime.Now; bool resutl =HR_ContactManager.UpdateHR_Contact(hR_Contact); var eimployeeID =Request.QueryString["eid"]; if (eimployeeID != null) { Response.Redirect("AdminHR_EmployeeDetails.aspx?ID=" + eimployeeID); } else { Response.Redirect("AdminDisplayHR_Contact.aspx"); } }
public static HR_Contact GetHR_ContactObjectByEmployeeID(string EmployeeID) { HR_Contact hR_Contact = new HR_Contact(); SqlHR_ContactProvider sqlHR_ContactProvider = new SqlHR_ContactProvider(); hR_Contact = sqlHR_ContactProvider.GetHR_ContactObjectByEmployeeID(EmployeeID); return hR_Contact; }
public static HR_Contact GetHR_ContactByContactID(int ContactID) { HR_Contact hR_Contact = new HR_Contact(); SqlHR_ContactProvider sqlHR_ContactProvider = new SqlHR_ContactProvider(); hR_Contact = sqlHR_ContactProvider.GetHR_ContactByContactID(ContactID); return hR_Contact; }
private void showHR_ContactData() { HR_Contact hR_Contact = new HR_Contact (); hR_Contact = HR_ContactManager.GetHR_ContactByContactID(Int32.Parse(Request.QueryString["ID"])); txtCurrentAddress.Text =hR_Contact.CurrentAddress.ToString(); txtPermanentAddress.Text =hR_Contact.PermanentAddress.ToString(); txtTelephone.Text =hR_Contact.Telephone.ToString(); txtMobile.Text =hR_Contact.Mobile.ToString(); txtEmail.Text =hR_Contact.Email.ToString(); }
protected void btnAdd_Click(object sender, EventArgs e) { HR_Contact hR_Contact = new HR_Contact (); // hR_Contact.ContactID= int.Parse(ddlContactID.SelectedValue); hR_Contact.EmployeeID = Profile.card_id; hR_Contact.CurrentAddress= txtCurrentAddress.Text; hR_Contact.PermanentAddress= txtPermanentAddress.Text; hR_Contact.Telephone= txtTelephone.Text; hR_Contact.Mobile= txtMobile.Text; hR_Contact.Email= txtEmail.Text; hR_Contact.AddedBy= Profile.card_id; hR_Contact.AddedDate= DateTime.Now; hR_Contact.ModifiedBy= Profile.card_id; hR_Contact.ModifiedDate= DateTime.Now; int resutl =HR_ContactManager.InsertHR_Contact(hR_Contact); Response.Redirect("AdminDisplayHR_Contact.aspx"); }
public bool UpdateHR_Contact(HR_Contact hR_Contact) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateHR_Contact", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ContactID", SqlDbType.Int).Value = hR_Contact.ContactID; cmd.Parameters.Add("@EmployeeID", SqlDbType.NVarChar).Value = hR_Contact.EmployeeID; cmd.Parameters.Add("@CurrentAddress", SqlDbType.NVarChar).Value = hR_Contact.CurrentAddress; cmd.Parameters.Add("@PermanentAddress", SqlDbType.NVarChar).Value = hR_Contact.PermanentAddress; cmd.Parameters.Add("@Telephone", SqlDbType.NVarChar).Value = hR_Contact.Telephone; cmd.Parameters.Add("@Mobile", SqlDbType.NVarChar).Value = hR_Contact.Mobile; cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = hR_Contact.Email; cmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar).Value = hR_Contact.ModifiedBy; cmd.Parameters.Add("@ModifiedDate", SqlDbType.DateTime).Value = hR_Contact.ModifiedDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public HR_Contact GetHR_ContactFromReader(IDataReader reader) { try { HR_Contact hR_Contact = new HR_Contact ( DataAccessObject.IsNULL<int>(reader["ContactID"]), DataAccessObject.IsNULL<string>(reader["EmployeeID"].ToString()), DataAccessObject.IsNULL<string>(reader["CurrentAddress"]), DataAccessObject.IsNULL<string>(reader["PermanentAddress"]), DataAccessObject.IsNULL<string>(reader["Telephone"]), DataAccessObject.IsNULL<string>(reader["Mobile"]), DataAccessObject.IsNULL<string>(reader["Email"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["ModifiedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["ModifiedDate"]) ); return hR_Contact; } catch(Exception ex) { return null; } }
protected void btnAddContact_Click(object sender, EventArgs e) { if (hfEmployeeID.Value != null) { HR_Contact hR_Contact = new HR_Contact(); // hR_Contact.ContactID= int.Parse(ddlContactID.SelectedValue); hR_Contact.EmployeeID = hfEmployeeID.Value.ToString(); hR_Contact.CurrentAddress = txtCurrentAddress.Text; hR_Contact.PermanentAddress = txtPermanentAddress.Text; hR_Contact.Telephone = txtTelephone.Text; hR_Contact.Mobile = txtMobile.Text; hR_Contact.Email = txtEmail.Text; string userID = Profile.card_id; hR_Contact.AddedBy = userID; hR_Contact.AddedDate = DateTime.Now; hR_Contact.ModifiedBy = userID; hR_Contact.ModifiedDate = DateTime.Now; int resutl = HR_ContactManager.InsertHR_Contact(hR_Contact); hdnContactsID.Value = resutl.ToString(); //Response.Redirect("AdminDisplayHR_Contact.aspx"); lblContactMsg.Text = "Contact Information is saved successfully"; lblContactMsg.ForeColor = System.Drawing.Color.Green; } else { lblContactMsg.Text = "Employee is not specified."; lblContactMsg.ForeColor = System.Drawing.Color.Red; } }
private void RefreshContact() { HR_Contact hR_Contact = new HR_Contact(); hR_Contact = HR_ContactManager.GetHR_ContactObjectByEmployeeID(hfEmployeeID.Value.ToString()); if (hR_Contact != null) { hdnContactsID.Value = hR_Contact.ContactID.ToString(); txtCurrentAddress.Text = hR_Contact.CurrentAddress; txtPermanentAddress.Text = hR_Contact.PermanentAddress; txtTelephone.Text = hR_Contact.Telephone; txtMobile.Text = hR_Contact.Mobile; txtEmail.Text = hR_Contact.Email; } }
protected void btnUpdateContacts_click(object sender, EventArgs e) { HR_Contact hR_Contact = new HR_Contact(); //hR_Contact.ContactID = int.Parse(hdnContactsID.Value); hR_Contact.EmployeeID = hfEmployeeID.Value.ToString(); hR_Contact.CurrentAddress = txtCurrentAddress.Text; hR_Contact.PermanentAddress = txtPermanentAddress.Text; hR_Contact.Telephone = txtTelephone.Text; hR_Contact.Mobile = txtMobile.Text; hR_Contact.Email = txtEmail.Text; string userID = Profile.card_id; hR_Contact.AddedBy = userID; hR_Contact.AddedDate = DateTime.Now; hR_Contact.ModifiedBy = userID; hR_Contact.ModifiedDate = DateTime.Now; if (hdnContactsID.Value==string.Empty) { int resutl = HR_ContactManager.InsertHR_Contact(hR_Contact); hdnContactsID.Value = resutl.ToString(); } else { hR_Contact.ContactID = int.Parse(hdnContactsID.Value); bool resutl = HR_ContactManager.UpdateHR_Contact(hR_Contact); } lblContactMsg.Text = "Information is updated successfully."; lblContactMsg.ForeColor = System.Drawing.Color.Green; }
public static int InsertHR_Contact(HR_Contact hR_Contact) { SqlHR_ContactProvider sqlHR_ContactProvider = new SqlHR_ContactProvider(); return sqlHR_ContactProvider.InsertHR_Contact(hR_Contact); }
public static bool UpdateHR_Contact(HR_Contact hR_Contact) { SqlHR_ContactProvider sqlHR_ContactProvider = new SqlHR_ContactProvider(); return sqlHR_ContactProvider.UpdateHR_Contact(hR_Contact); }