protected void btnUpdateEmergency_Click(object sender, EventArgs e) { try { Attendance.Entities.EmergencyContactInfo objContactInfo = new EmergencyContactInfo(); int UserID = Convert.ToInt32(Session["UserID"]); int EmployeeID = Convert.ToInt32(hdnUserID.Value); String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); objContactInfo.Person1 = txtCn1Name.Text.ToString() == "" ? "" : GeneralFunction.ToProper(txtCn1Name.Text.ToString().Trim()); objContactInfo.P1Address1 = GeneralFunction.ToProperNotes(txtCn1Address1.Text.ToString().Trim()); objContactInfo.P1Address2 = GeneralFunction.ToProperNotes(txtCn1Address2.Text.ToString().Trim()); objContactInfo.Phone1 = txtCn1Phone.Text.ToString().Trim(); objContactInfo.Relation1 = GeneralFunction.ToProperNotes(txtCn1Relation.Text.ToString().Trim()); objContactInfo.Email1 = txtCn1Email.Text.ToString().Trim(); objContactInfo.StateID1 = Convert.ToInt32(ddlCn1State.SelectedItem.Value); // objContactInfo.Zip1 = txtCn1Zip.Text.Trim(); if (txtCn1Zip.Text != "" && txtCn1Zip.Text.Trim().Length == 4) { objContactInfo.Zip1 = "0" + txtCn1Zip.Text.Trim(); } else { objContactInfo.Zip1 = txtCn1Zip.Text.Trim(); } objContactInfo.Person2 = txtCn2Name.Text.ToString() == "" ? "" : GeneralFunction.ToProper(txtCn2Name.Text.ToString().Trim()); objContactInfo.P2Address1 = GeneralFunction.ToProperNotes((txtCn2Address1.Text.ToString().Trim())); objContactInfo.P2Address2 = GeneralFunction.ToProperNotes(txtCn2Address2.Text.ToString().Trim()); objContactInfo.Phone2 = txtCn2Phone.Text.ToString().Trim(); objContactInfo.Relation2 = GeneralFunction.ToProperNotes(txtCn2Relation.Text.ToString().Trim()); objContactInfo.Email2 = txtCn2Email.Text.ToString().Trim(); objContactInfo.StateID2 = Convert.ToInt32(ddlCn2State.SelectedItem.Value); if (txtCn2Zip.Text != "" && txtCn2Zip.Text.Trim().Length == 4) { objContactInfo.Zip2 = "0" + txtCn2Zip.Text.Trim(); } else { objContactInfo.Zip2 = txtCn2Zip.Text.Trim(); } objContactInfo.Person3 = txtCn3Name.Text.ToString() == "" ? "" : GeneralFunction.ToProper(txtCn3Name.Text.ToString().Trim()); objContactInfo.P3Address1 = GeneralFunction.ToProperNotes(txtCn3Address1.Text.ToString().Trim()); objContactInfo.P3Address2 = GeneralFunction.ToProperNotes(txtCn3Address2.Text.ToString().Trim()); objContactInfo.Phone3 = txtCn3Phone.Text.ToString().Trim(); objContactInfo.Relation3 = GeneralFunction.ToProperNotes(txtCn3Relation.Text.ToString().Trim()); objContactInfo.Email3 = txtCn3Email.Text.ToString().Trim(); objContactInfo.StateID3 = Convert.ToInt32(ddlCn3State.SelectedItem.Value); if (txtCn3Zip.Text != "" && txtCn3Zip.Text.Trim().Length == 4) { objContactInfo.Zip3 = "0" + txtCn3Zip.Text.Trim(); } else { objContactInfo.Zip3 = txtCn3Zip.Text.Trim(); } Attendance.BAL.Report obj = new Report(); obj.UpdateEmergencyDetails(objContactInfo, UserID, EmployeeID, strIp); //Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); GetEmpDet(EmployeeID); mdlEditEmergContactDet.Hide(); } catch (Exception ex) { } }