protected void btnAddNew_Click(object sender, EventArgs e) { if (checkemail() == true) { lblalreademsg.Text = "Doctor ID Already Registered"; txtDoctorID.BackColor = System.Drawing.Color.PaleGreen; } else { try { FUImeage.SaveAs(Server.MapPath("~/DoctorImages/") + Path.GetFileName(FUImeage.FileName)); String link = "DoctorImages/" + Path.GetFileName(FUImeage.FileName); MySqlCommand cmd = new MySqlCommand("INSERT INTO hospitaldb.doctortable" + " (DoctorName, DoctorSpeciality, DoctorHospital, DoctorFees,DoctorImage, DoctorGender, DoctorUserID, DoctorPassword) VALUES (@DoctorName, @DoctorSpeciality, @DoctorHospital, @DoctorFees,@DoctorImage, @DoctorGender, @DoctorUserID, @DoctorPassword)", con); cmd.Parameters.AddWithValue("@DoctorName", txtName.Text); cmd.Parameters.AddWithValue("@DoctorSpeciality", txtSpeciality.Text); cmd.Parameters.AddWithValue("@DoctorHospital", txtHospital.Text); cmd.Parameters.AddWithValue("@DoctorFees", txtFees.Text); cmd.Parameters.AddWithValue("@DoctorImage", link); cmd.Parameters.AddWithValue("@DoctorGender", DDLGender.Text); cmd.Parameters.AddWithValue("@DoctorUserID", txtDoctorID.Text); cmd.Parameters.AddWithValue("@DoctorPassword", txtDoctorPass.Text); cmd.ExecuteNonQuery(); txtDoctorID.Text = ""; txtDoctorPass.Text = ""; txtFees.Text = ""; txtHospital.Text = ""; txtName.Text = ""; txtSpeciality.Text = ""; DDLGender.ClearSelection(); GVbind(); } catch (Exception ex) { Response.Write(ex.Message); } finally { Response.Write("<script LANGUAGE='JavaScript' >alert('Add New Doctor Succssfull')</script>"); } } }
private void ShowEmployeeDetails(int recordId) { string Query = "SELECT * FROM View_EmployeeDetails WHERE ID='" + recordId + "'"; DataSet DSRecords = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, Query); DataTable DTRecords = DSRecords.Tables[0]; if (DTRecords.Rows.Count > 0) { MVEmployee.ActiveViewIndex = 1; ImgLogo.ImageUrl = DTRecords.Rows[0]["Image"].ToString(); TBEmpCode.Text = DTRecords.Rows[0]["EmployeeCode"].ToString(); TBFirstName.Text = DTRecords.Rows[0]["FirstName"].ToString(); TBMiddleName.Text = DTRecords.Rows[0]["MiddleName"].ToString(); TBLastName.Text = DTRecords.Rows[0]["LastName"].ToString(); TBSearchCode.Text = DTRecords.Rows[0]["SearchCode"].ToString(); TBDOB.Text = DTRecords.Rows[0]["DateOfBirth"].ToString(); DDLMaritalStatus.ClearSelection(); DDLMaritalStatus.Items.FindByText(DTRecords.Rows[0]["MartialStatus"].ToString()).Selected = true; DDLGender.ClearSelection(); DDLGender.Items.FindByText(DTRecords.Rows[0]["Gender"].ToString()).Selected = true; TBDOJ.Text = DTRecords.Rows[0]["DateOfJoining"].ToString(); BindDDLBusinessLocation(); DDLBusinessLocation.ClearSelection(); DDLBusinessLocation.Items.FindByValue(DTRecords.Rows[0]["BusinessLocation"].ToString()).Selected = true; BindDDLDepartment(); DDLDepartment.ClearSelection(); DDLDepartment.Items.FindByValue(DTRecords.Rows[0]["Department"].ToString()).Selected = true; BindDDLDesignation(); DDLEmployeeDesignation.ClearSelection(); DDLEmployeeDesignation.Items.FindByValue(DTRecords.Rows[0]["Designation"].ToString()).Selected = true; //CBCanRequestReportViaSMS.Checked = Convert.ToBoolean(DTRecords.Rows[0]["EmployeeCode"].ToString()); CBNotAnEmployee.Checked = Convert.ToBoolean(DTRecords.Rows[0]["NotAnEmployee"].ToString()); BindDDLWorkShift(); DDLWorkingShift.ClearSelection(); DDLWorkingShift.Items.FindByValue(DTRecords.Rows[0]["WorkingShift"].ToString()).Selected = true; TBAddressLine1.Text = DTRecords.Rows[0]["Address1"].ToString(); TBAddressLine2.Text = DTRecords.Rows[0]["Address2"].ToString(); TBCity.Text = DTRecords.Rows[0]["City"].ToString(); TBState.Text = DTRecords.Rows[0]["State"].ToString(); TBCountry.Text = DTRecords.Rows[0]["Country"].ToString(); TBPin.Text = DTRecords.Rows[0]["ZipCode"].ToString(); TBPhoneNumber.Text = DTRecords.Rows[0]["TelephoneNumber"].ToString(); TBMobileNumber.Text = DTRecords.Rows[0]["MobileNumber"].ToString(); TBFaxNumber.Text = DTRecords.Rows[0]["FaxNumber"].ToString(); TBEmail.Text = DTRecords.Rows[0]["Email"].ToString(); TBWebsite.Text = DTRecords.Rows[0]["Website"].ToString(); btnSubmit.Text = "Update"; } }