protected void btnDoctorRegistaion_Click(object sender, EventArgs e) { if (ddlCountry.SelectedValue != "0" && ddlDistrict.SelectedValue != "0" && ddlDvision.SelectedValue != "0" && ddlGender.SelectedValue != "0" && ddlUpazila.SelectedValue != "0" && txtDesignation.Text != "" && txtDoctorAddress.Text != "" && txtDoctorEmail.Text != "" && txtDoctorFullName.Text != "" && txtDoctorMobile.Text != "" && txtExpertise.Text != "" && txtNID.Text != "" && txtPresentProfession.Text != "" && txtQualification.Text != "" && txtRegistationNumber.Text != "") { lblResult.Text = ""; SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = @"insert into DoctorRegistation (DoctorID,FullName,Qualification,Designation,Categories,Expertise,RegistationNumber,PresentProfession,Gender,Country,Division,District,Upazila,NID,Mobile,Telephone,Email,Username,Password,Address,DoctorPhoto,DoctorLicensePhoto,Date,Month,Year,IssuDate,Authorise,LoginParmit,Verify,Owner,Command,DoctorDetails) values(@DoctorID,@FullName,@Qualification,@Designation,@Categories,@Expertise,@RegistationNumber,@PresentProfession,@Gender,@Country,@Division,@District,@Upazila,@NID,@Mobile,@Telephone,@Email,@Username,@Password,@Address,@DoctorPhoto,@DoctorLicensePhoto,@Date,@Month,@Year,@IssuDate,@Authorise,@LoginParmit,@Verify,@Owner,@Command,@DoctorDetails)"; RandomNumberGenarator rn = new RandomNumberGenarator(); rn.ResultDate = 10; string DoctorID = rn.RandomStringNumber("DoctorID"); cmd.Parameters.AddWithValue("@DoctorID", DoctorID); cmd.Parameters.AddWithValue("@FullName", txtDoctorFullName.Text); cmd.Parameters.AddWithValue("@Qualification", txtQualification.Text); cmd.Parameters.AddWithValue("@Designation", txtDesignation.Text); cmd.Parameters.AddWithValue("@Categories", ddlDoctorCatagoris.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Expertise", txtExpertise.Text); cmd.Parameters.AddWithValue("@RegistationNumber", txtRegistationNumber.Text); cmd.Parameters.AddWithValue("@PresentProfession", txtPresentProfession.Text); cmd.Parameters.AddWithValue("@Gender", ddlGender.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Country", ddlCountry.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Division", ddlDistrict.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@District", ddlDistrict.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Upazila", ddlUpazila.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@NID", txtNID.Text); cmd.Parameters.AddWithValue("@Mobile", txtDoctorMobile.Text); cmd.Parameters.AddWithValue("@Telephone", txtDoctorTelephone.Text); cmd.Parameters.AddWithValue("@Email", txtDoctorEmail.Text); cmd.Parameters.AddWithValue("@Username", txtDoctorUserName.Text); cmd.Parameters.AddWithValue("@Password", txtDoctorPassword.Text); cmd.Parameters.AddWithValue("@Address", txtDoctorAddress.Text); if (FileUploadDoctorImage.HasFile) { string Name = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss"); string Ext = ""; string FileName = Path.GetExtension(FileUploadDoctorImage.FileName.ToLower()); if (FileName == ".jpg") { Ext = ".jpg"; } else if (FileName == ".jpeg") { Ext = ".jpeg"; } else if (FileName == ".png") { Ext = ".png"; } else { lblResult.ForeColor = Color.Red; lblResult.Text += "Doctor Image Upload (.jpg, .jpeg, .png)"; } if (Ext != "") { cmd.Parameters.AddWithValue("@DoctorPhoto", FileName + Ext); FileUploadDoctorImage.SaveAs(Server.MapPath("../Doctor/Temp/" + FileName + Ext)); doctor.Login log = new Login(); log.ImageEdit(FileName, Ext); } } else { if (ddlGender.SelectedValue == "Male") { cmd.Parameters.AddWithValue("@DoctorPhoto", "MaleProfile.jpg"); } else { cmd.Parameters.AddWithValue("@DoctorPhoto", "FemaleProfile.jpg"); } } if (FileUploadDoctorLicenceInage.HasFile) { string Name = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss"); string Ext = ""; string FileName = Path.GetExtension(FileUploadDoctorLicenceInage.FileName.ToLower()); if (FileName == ".jpg") { Ext = ".jpg"; } else if (FileName == ".jpeg") { Ext = ".jpeg"; } else if (FileName == ".png") { Ext = ".png"; } else { lblResult.ForeColor = Color.Red; lblResult.Text += "Doctor licence Upload (.jpg, .jpeg, .png)"; } if (Ext != "") { cmd.Parameters.AddWithValue("@DoctorPhoto", FileName + Ext); FileUploadDoctorLicenceInage.SaveAs(Server.MapPath("../Doctor/LicenceImage/" + FileName + Ext)); } } else { cmd.Parameters.AddWithValue("@DoctorLicensePhoto", "N/A"); } cmd.Parameters.AddWithValue("@Date", Convert.ToInt32(DateTime.Now.ToString("dd"))); cmd.Parameters.AddWithValue("@Month", Convert.ToInt32(DateTime.Now.ToString("MM"))); cmd.Parameters.AddWithValue("@Year", Convert.ToInt32(DateTime.Now.ToString("yyyy"))); cmd.Parameters.AddWithValue("@IssuDate", DateTime.Now.ToString()); if (chkAuthority.Checked == true) { cmd.Parameters.AddWithValue("@Authorise", "TRUE"); } else { rn.ResultDate = 5; cmd.Parameters.AddWithValue("@Authorise", rn.RandomStringNumber("Authority")); } if (chkLoginPermit.Checked == true) { cmd.Parameters.AddWithValue("@LoginParmit", "TRUE"); } else { cmd.Parameters.AddWithValue("@LoginParmit", "FALSE"); } if (chkVerify.Checked == true) { cmd.Parameters.AddWithValue("@Verify", "TRUE"); } else { cmd.Parameters.AddWithValue("@Verify", "FALSE"); } cmd.Parameters.AddWithValue("@Owner", "Admin"); cmd.Parameters.AddWithValue("@Command", "N/A"); cmd.Parameters.AddWithValue("@DoctorDetails", " "); con.Open(); cmd.ExecuteNonQuery(); con.Close(); lblResult.ForeColor = Color.Green; lblResult.Text = "Sucessfully Registaion."; } else { lblResult.ForeColor = Color.Red; lblResult.Text += "select all from's."; } }
protected void btnUpdate_Click(object sender, EventArgs e) { string Doctor_ID = Request.QueryString["Edit"].ToString(); var shortCut = " from DoctorRegistation where DoctorID='" + Doctor_ID + "'"; Check chk = new Check(); if (ddlGender.SelectedValue != "0") { lblResult.Text = ""; SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = @"update DoctorRegistation set FullName=@FullName,Qualification=@Qualification,Designation=@Designation,Categories=@Categories,Expertise=@Expertise,RegistationNumber=@RegistationNumber,PresentProfession=@PresentProfession,Gender=@Gender,Country=@Country,Division=@Division,District=@District,Upazila=@Upazila,NID=@NID,Mobile=@Mobile,Telephone=@Telephone,Email=@Email,Username=@Username,Password=@Password,Address=@Address,DoctorPhoto=@DoctorPhoto,DoctorLicensePhoto=@DoctorLicensePhoto,Date=@Date,Month=@Month,Year=@Year,IssuDate=@IssuDate,Authorise=@Authorise,LoginParmit=@LoginParmit,Verify=@Verify,Owner=@Owner,Command=@Command,DoctorDetails=@DoctorDetails where DoctorID='" + Doctor_ID + "'"; RandomNumberGenarator rn = new RandomNumberGenarator(); rn.ResultDate = 10; string DoctorID = rn.RandomStringNumber("DoctorID"); cmd.Parameters.AddWithValue("@FullName", txtDoctorFullName.Text); cmd.Parameters.AddWithValue("@Qualification", txtQualification.Text); cmd.Parameters.AddWithValue("@Designation", txtDesignation.Text); cmd.Parameters.AddWithValue("@Categories", ddlDoctorCatagoris.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Expertise", txtExpertise.Text); cmd.Parameters.AddWithValue("@RegistationNumber", txtRegistationNumber.Text); cmd.Parameters.AddWithValue("@PresentProfession", txtPresentProfession.Text); cmd.Parameters.AddWithValue("@Gender", ddlGender.SelectedItem.ToString()); string Country = ""; string Division = ""; string District = ""; string Upazila = ""; if (ddlCountry.SelectedValue != "0" && ddlDistrict.SelectedValue != "0" && ddlDvision.SelectedValue != "0" && ddlUpazila.SelectedValue != "0") { Country = ddlCountry.SelectedItem.ToString(); Division = ddlDvision.SelectedItem.ToString(); District = ddlDistrict.SelectedItem.ToString(); Upazila = ddlUpazila.SelectedItem.ToString(); } else { Country = chk.stringCheck("select Country " + shortCut); Division = chk.stringCheck("select Division " + shortCut); District = chk.stringCheck("select District " + shortCut); Upazila = chk.stringCheck("select Upazila " + shortCut); } cmd.Parameters.AddWithValue("@Country", Country); cmd.Parameters.AddWithValue("@Division", Division); cmd.Parameters.AddWithValue("@District", District); cmd.Parameters.AddWithValue("@Upazila", Upazila); cmd.Parameters.AddWithValue("@NID", txtNID.Text); cmd.Parameters.AddWithValue("@Mobile", txtDoctorMobile.Text); cmd.Parameters.AddWithValue("@Telephone", txtDoctorTelephone.Text); cmd.Parameters.AddWithValue("@Email", txtDoctorEmail.Text); cmd.Parameters.AddWithValue("@Username", txtDoctorUserName.Text); cmd.Parameters.AddWithValue("@Password", txtDoctorPassword.Text); cmd.Parameters.AddWithValue("@Address", txtDoctorAddress.Text); if (FileUploadDoctorImage.HasFile) { string Name = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss"); string Ext = ""; string FileName = Path.GetExtension(FileUploadDoctorImage.FileName.ToLower()); if (FileName == ".jpg") { Ext = ".jpg"; } else if (FileName == ".jpeg") { Ext = ".jpeg"; } else if (FileName == ".png") { Ext = ".png"; } else { lblResult.ForeColor = Color.Red; lblResult.Text += "Doctor Image Upload (.jpg, .jpeg, .png)"; } if (Ext != "") { cmd.Parameters.AddWithValue("@DoctorPhoto", Name + Ext); FileUploadDoctorImage.SaveAs(Server.MapPath("../Doctor/Temp/" + Name + Ext)); doctor.Login log = new Login(); log.ImageEdit(Name, Ext); } } else { cmd.Parameters.AddWithValue("@DoctorPhoto", chk.stringCheck("select DoctorPhoto from DoctorRegistation where DoctorID='" + Doctor_ID + "'")); } if (FileUploadDoctorLicenceInage.HasFile) { string Name = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss"); string Ext = ""; string FileName = Path.GetExtension(FileUploadDoctorLicenceInage.FileName.ToLower()); if (FileName == ".jpg") { Ext = ".jpg"; } else if (FileName == ".jpeg") { Ext = ".jpeg"; } else if (FileName == ".png") { Ext = ".png"; } else { lblResult.ForeColor = Color.Red; lblResult.Text += "Doctor licence Upload (.jpg, .jpeg, .png)"; } if (Ext != "") { cmd.Parameters.AddWithValue("@DoctorLicensePhoto", FileName + Ext); FileUploadDoctorLicenceInage.SaveAs(Server.MapPath("../Doctor/LicenceImage/" + FileName + Ext)); } } else { cmd.Parameters.AddWithValue("@DoctorLicensePhoto", chk.stringCheck("select DoctorLicensePhoto from DoctorRegistation where DoctorID='" + Doctor_ID + "' ")); } cmd.Parameters.AddWithValue("@Date", Convert.ToInt32(DateTime.Now.ToString("dd"))); cmd.Parameters.AddWithValue("@Month", Convert.ToInt32(DateTime.Now.ToString("MM"))); cmd.Parameters.AddWithValue("@Year", Convert.ToInt32(DateTime.Now.ToString("yyyy"))); cmd.Parameters.AddWithValue("@IssuDate", DateTime.Now.ToString()); if (chkAuthority.Checked == true) { cmd.Parameters.AddWithValue("@Authorise", "TRUE"); } else { rn.ResultDate = 5; cmd.Parameters.AddWithValue("@Authorise", rn.RandomStringNumber("Authority")); } if (chkLoginPermit.Checked == true) { cmd.Parameters.AddWithValue("@LoginParmit", "TRUE"); } else { cmd.Parameters.AddWithValue("@LoginParmit", "FALSE"); } if (chkVerify.Checked == true) { cmd.Parameters.AddWithValue("@Verify", "TRUE"); } else { cmd.Parameters.AddWithValue("@Verify", "FALSE"); } cmd.Parameters.AddWithValue("@Owner", "Admin"); cmd.Parameters.AddWithValue("@Command", "N/A"); cmd.Parameters.AddWithValue("@DoctorDetails", " "); con.Open(); cmd.ExecuteNonQuery(); con.Close(); lblResult.ForeColor = Color.Green; lblResult.Text = "Update Registaion."; } else { lblResult.ForeColor = Color.Red; lblResult.Text += "select all from's."; } }
protected void btnVerify_Click(object sender, EventArgs e) { int err = 0; string DoctorImageEXT = "", DoctorLicenceImageEXT = ""; if (FileUploadDoctorImage.HasFile) { string n = FileUploadDoctorImage.FileName.ToLower(); if (n.EndsWith(".jpeg")) { DoctorImageEXT = ".jpeg"; } else if (n.EndsWith(".jpg")) { DoctorImageEXT = ".jpg"; } else { err++; lblDoctorResult.Text += "<br/>Type [Doctor Image Required (*.JPEG)(*.JPG)]"; } } else { err++; lblDoctorResult.Text += "<br/>Type [Doctor Image Required]"; } if (FileUploadDoctorLicenceInage.HasFile) { string n = FileUploadDoctorLicenceInage.FileName.ToLower(); if (n.EndsWith(".jpeg")) { DoctorLicenceImageEXT = ".jpeg"; } else if (n.EndsWith(".jpg")) { DoctorLicenceImageEXT = ".jpg"; } else { err++; lblDoctorResult.Text += "<br/>Type [Doctor Licence Photocopy Required (*.JPEG)(*.JPG)]"; } } else { err++; lblDoctorResult.Text += "<br/>Type [Doctor Licence Photocopy Required]"; } if (err == 0) { string DoctorID = Session["DoctorID"].ToString(); FileUploadDoctorImage.SaveAs(Server.MapPath("../Doctor/Temp/" + DoctorID + DoctorImageEXT)); FileUploadDoctorLicenceInage.SaveAs(Server.MapPath("../Doctor/LicenceImage/" + DoctorID + DoctorLicenceImageEXT)); try { ImageEdit(DoctorID + DoctorImageEXT); SqlCommand verify = new SqlCommand(); verify.Connection = con; verify.CommandText = "update DoctorRegistation set DoctorPhoto=@DoctorPhoto,DoctorLicensePhoto=@DoctorLicensePhoto where DoctorID='" + DoctorID + "'"; verify.Parameters.AddWithValue("@DoctorPhoto", DoctorID + DoctorImageEXT); verify.Parameters.AddWithValue("@DoctorLicensePhoto", DoctorID + DoctorLicenceImageEXT); con.Open(); verify.ExecuteNonQuery(); con.Close(); imageDoctorPhoto.ImageUrl = "../Doctor/Image/Profile/" + chk.stringCheck("select DoctorPhoto from DoctorRegistation where DoctorID='" + DoctorID + "'"); imageLicencePhoto.ImageUrl = "../Doctor/LicenceImage/" + chk.stringCheck("select DoctorLicensePhoto from DoctorRegistation where DoctorID='" + DoctorID + "'"); } catch (Exception error) { lblDoctorResult.Text = "Server ERROR: " + error.Message; } } }