Ejemplo n.º 1
0
 protected void btnOwnerPhoto_Click(object sender, EventArgs e)
 {
     if (FileUploadOwnerPhoto.HasFile)
     {
         string ext      = "";
         string FileName = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss");
         string FileExt  = Path.GetExtension(FileUploadOwnerPhoto.FileName.ToLower());
         if (FileExt == ".jpg")
         {
             ext = ".jpg";
         }
         else if (FileExt == ".jpeg")
         {
             ext = ".jpeg";
         }
         else if (FileExt == ".png")
         {
             ext = ".png";
         }
         else
         {
             lblOwnerResult.ForeColor = System.Drawing.Color.Red;
             lblOwnerResult.Text      = "Upload File (*.jpg,*.jpeg,*.png)";
         }
         if (ext != "")
         {
             string Hospital_ID = Session["HospitalID"].ToString();
             FileUploadOwnerPhoto.SaveAs(Server.MapPath("../Hospital/Image/Owner/" + FileName + FileExt));
             cmd.Connection  = con;
             cmd.CommandText = "update HospitalRegistation set OwnerPhoto='" + FileName + FileExt + "' where HospitalID='" + Hospital_ID + "'";
             con.Open();
             cmd.ExecuteNonQuery();
             con.Close();
             lblOwnerResult.ForeColor = System.Drawing.Color.Green;
             lblOwnerResult.Text      = "Photo Upload Sucessfully.";
             var st = " from HospitalRegistation where HospitalID='" + Hospital_ID + "'";
             imageOwnerPhoto.ImageUrl = "../Hospital/Image/Owner/" + chk.stringCheck("select OwnerPhoto " + st);
         }
     }
     else
     {
         lblOwnerResult.ForeColor = System.Drawing.Color.Red;
         lblOwnerResult.Text      = "Select File.";
     }
 }
Ejemplo n.º 2
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ddlExprience.SelectedValue != "0" && ddlHospitalShift.SelectedValue != "0" && ddlHospitalType.SelectedValue != "0" && ddlOwnerApproval.SelectedValue != "0" && ddlPersonalGender.SelectedValue != "0" && ddlWorkHere.SelectedValue != "0")
            {
                string Hospital_ID = Request.QueryString["Edit"].ToString();
                Check  chk         = new Check();
                var    sortcut     = " from HospitalRegistation where HospitalID='" + Hospital_ID + "'";

                btnUpdate.Visible = true;
                btnHospitalRegistation.Visible = false;
                string Country  = "";
                string Division = "";
                string District = "";
                string Upazilla = "";
                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();
                    Upazilla = ddlUpazila.SelectedItem.ToString();
                }
                else
                {
                    Country  = chk.stringCheck("select Country " + sortcut);
                    Division = chk.stringCheck("select Division " + sortcut);
                    District = chk.stringCheck("select District " + sortcut);
                    Upazilla = chk.stringCheck("select Upazilla " + sortcut);
                }
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con;
                cmd.CommandText = @"insert into HospitalRegistation (HospitalID,Country,Division,District,Upazilla,HospitalCategory,HospitalType,HospitalShift,RegistationNumber,HospitalName,HospitalWebsite,HospitalEmail,HospitalMoblile,HospitalAddress,OwnerName,OwnerMobile,OwnerApproval,PersonalFullname,PersonalEmail,PersonalMoblie,username,password,NID,WorkHere,Experience,PersonalAddress,Gender,PersonalPhoto,OwnerPhoto,LicencePhoto,HospitalPhoto,Authority,LoginParmit,Verify,Command,Date,Month,Year,IssuDate,Owner)
                (@HospitalID,@Country,@Division,@District,@Upazilla,@HospitalCategory,@HospitalType,@HospitalShift,@RegistationNumber,@HospitalName,@HospitalWebsite,@HospitalEmail,@HospitalMoblile,@HospitalAddress,@OwnerName,@OwnerMobile,@OwnerApproval,@PersonalFullname,@PersonalEmail,@PersonalMoblie,@username,@password,@NID,@WorkHere,@Experience,@PersonalAddress,@Gender,@PersonalPhoto,@OwnerPhoto,@LicencePhoto,@HospitalPhoto,@Authority,@LoginParmit,@Verify,@Command,@Date,@Month,@Year,@IssuDate,@Owner)";
                RandomNumberGenarator rn = new RandomNumberGenarator();
                rn.ResultDate = 15;
                lblHostipalResult.ForeColor = Color.Red;
                int err = 0;
                cmd.Parameters.AddWithValue("@HospitalID", rn.RandomStringNumber("HospitalID"));
                cmd.Parameters.AddWithValue("@Country", Country);
                cmd.Parameters.AddWithValue("@Division", Division);
                cmd.Parameters.AddWithValue("@District", District);
                cmd.Parameters.AddWithValue("@Upazilla", Upazilla);
                cmd.Parameters.AddWithValue("@HospitalCategory", ddlHostipal.SelectedItem.ToString());
                cmd.Parameters.AddWithValue("@HospitalType", ddlHospitalType.SelectedItem.ToString());
                cmd.Parameters.AddWithValue("@HospitalShift", ddlHospitalShift.SelectedItem.ToString());
                cmd.Parameters.AddWithValue("@RegistationNumber", txtHospitalRegNumber.Text);
                cmd.Parameters.AddWithValue("@HospitalName", txtHospitalName.Text);
                cmd.Parameters.AddWithValue("@HospitalWebsite", txtHospitalWebsite.Text);
                cmd.Parameters.AddWithValue("@HospitalEmail", txtHospitalEmail.Text);
                cmd.Parameters.AddWithValue("@HospitalMoblile", txtHospitalMoblie.Text);
                cmd.Parameters.AddWithValue("@HospitalAddress", txtHospitalAddress.Text);
                cmd.Parameters.AddWithValue("@OwnerName", txtHospitalOwnerFullname.Text);
                cmd.Parameters.AddWithValue("@OwnerMobile", txtHospitalOwnerMobile.Text);
                cmd.Parameters.AddWithValue("@OwnerApproval", ddlOwnerApproval.Text);
                cmd.Parameters.AddWithValue("@PersonalFullname", txt_H_P_Fullname.Text);
                cmd.Parameters.AddWithValue("@PersonalEmail", txt_H_P_Email.Text);
                cmd.Parameters.AddWithValue("@PersonalMoblie", txt_H_P_Mobile.Text);
                cmd.Parameters.AddWithValue("@username", txt_H_P_UserName.Text);
                cmd.Parameters.AddWithValue("@password", txt_H_P_Password.Text);
                cmd.Parameters.AddWithValue("@NID", txt_H_P_NID.Text);
                cmd.Parameters.AddWithValue("@WorkHere", ddlWorkHere.SelectedItem.ToString());
                cmd.Parameters.AddWithValue("@Experience", ddlExprience.SelectedItem.ToString());
                cmd.Parameters.AddWithValue("@PersonalAddress", txt_H_P_Address.Text);
                cmd.Parameters.AddWithValue("@Gender", ddlPersonalGender.SelectedItem.ToString());
                if (FileUploadPersonalPhoto.HasFile)
                {
                    string ext     = "";
                    string FileExt = Path.GetExtension(FileUploadPersonalPhoto.FileName.ToLower());
                    if (FileExt == ".jpg")
                    {
                        ext = ".jpg";
                    }
                    else if (FileExt == ".jpeg")
                    {
                        ext = ".jpeg";
                    }
                    else if (FileExt == ".png")
                    {
                        ext = ".png";
                    }
                    else
                    {
                        err++;
                        lblHostipalResult.Text += "Personal Photo upload (.jpg, .jpeg, .png)";
                    }
                    if (ext != "")
                    {
                        string Name = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss");
                        cmd.Parameters.AddWithValue("@PersonalPhoto", Name + ext);
                        FileUploadPersonalPhoto.SaveAs(Server.MapPath("../Hospital/Temp/" + Name + ext));
                        PersonalEdit(Name + ext);
                    }
                }
                else
                {
                    cmd.Parameters.AddWithValue("@PersonalPhoto", chk.stringCheck("select PersonalPhoto " + sortcut));
                }
                if (FileUploadOwnerPhoto.HasFile)
                {
                    string ext     = "";
                    string FileExt = Path.GetExtension(FileUploadOwnerPhoto.FileName.ToLower());
                    if (FileExt == ".jpg")
                    {
                        ext = ".jpg";
                    }
                    else if (FileExt == ".jpeg")
                    {
                        ext = ".jpeg";
                    }
                    else if (FileExt == ".png")
                    {
                        ext = ".png";
                    }
                    else
                    {
                        err++;
                        lblHostipalResult.Text += "Owner Photo upload (.jpg, .jpeg, .png)";
                    }
                    if (ext != "")
                    {
                        string Name = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss");
                        cmd.Parameters.AddWithValue("@OwnerPhoto", Name + ext);
                        FileUploadOwnerPhoto.SaveAs(Server.MapPath("../Hospital/Image/Owner/" + Name + ext));
                    }
                }
                else
                {
                    if (ddlPersonalGender.SelectedValue == "Government")
                    {
                        cmd.Parameters.AddWithValue("@OwnerPhoto", "goverment.png");
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@OwnerPhoto", chk.stringCheck("select OwnerPhoto " + sortcut));
                    }
                }
                if (FileUploadLicencePhoto.HasFile)
                {
                    string ext     = "";
                    string FileExt = Path.GetExtension(FileUploadLicencePhoto.FileName.ToLower());
                    if (FileExt == ".jpg")
                    {
                        ext = ".jpg";
                    }
                    else if (FileExt == ".jpeg")
                    {
                        ext = ".jpeg";
                    }
                    else if (FileExt == ".png")
                    {
                        ext = ".png";
                    }
                    else
                    {
                        err++;
                        lblHostipalResult.Text += "Owner Photo upload (.jpg, .jpeg, .png)";
                    }
                    if (ext != "")
                    {
                        string Name = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss");
                        cmd.Parameters.AddWithValue("@LicencePhoto", Name + ext);
                        FileUploadLicencePhoto.SaveAs(Server.MapPath("../Hospital/Image/Owner/" + Name + ext));
                    }
                }
                else
                {
                    cmd.Parameters.AddWithValue("@LicencePhoto", chk.stringCheck("select LicencePhoto " + sortcut));
                }
                if (FileUploadHospitalPhoto.HasFile)
                {
                    string ext     = "";
                    string FileExt = Path.GetExtension(FileUploadHospitalPhoto.FileName.ToLower());
                    if (FileExt == ".jpg")
                    {
                        ext = ".jpg";
                    }
                    else if (FileExt == ".jpeg")
                    {
                        ext = ".jpeg";
                    }
                    else if (FileExt == ".png")
                    {
                        ext = ".png";
                    }
                    else
                    {
                        err++;
                        lblHostipalResult.Text += "Personal Photo upload (.jpg, .jpeg, .png)";
                    }
                    if (ext != "")
                    {
                        string Name = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss");
                        cmd.Parameters.AddWithValue("@HospitalPhoto", Name + ext);
                        FileUploadHospitalPhoto.SaveAs(Server.MapPath("../Hospital/Temp/" + Name + ext));
                        HospitalEdit(Name + ext);
                    }
                }
                else
                {
                    cmd.Parameters.AddWithValue("@HospitalPhoto", chk.stringCheck("select HospitalPhoto " + sortcut));
                }
                if (chkAuthrise.Checked == true)
                {
                    cmd.Parameters.AddWithValue("@Authority", "TRUE");
                }
                else
                {
                    rn.ResultDate = 5;
                    cmd.Parameters.AddWithValue("@Authority", rn.RandomStringNumber("Authority"));
                }
                if (chkLoginParmit.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("@Command", "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("dd-MM-yyyy"));
                cmd.Parameters.AddWithValue("@Owner", "Admin");
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();
                lblHostipalResult.Text      = "Update Sucessfully Registation.";
                lblHostipalResult.ForeColor = Color.Green;
            }
            else
            {
                lblHostipalResult.Text += "Seletct all List Fast.";
            }
        }