protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         string isExist = MySQLQuery.ReturnString("SELECT UserId From Donors WHERE UserId='" + txtUser.Text + "'");
         if (isExist == "")
         {
             string gender = "Male";
             if (rdFemale.Checked)
             {
                 gender = "Female";
             }
             string query    = "INSERT INTO donors (Name,Gender,Age,BloodGroupId, Email, Phone,Address,UserId) VALUES ('" + txtName.Text + "','" + gender + "','" + txtAge.Text + "','" + ddlBloodGroup.SelectedValue + "','" + txtEmail.Text + "','" + txtPhone.Text + "','" + txtAddress.Text + "','" + txtUser.Text + "')";
             string sqlquery = "INSERT INTO user (UserName, Password, Name, Role) VALUES ('" + txtUser.Text + "','" + txtPassword.Text + "','" + txtName.Text + "','Donor')";
             MySQLQuery.ExecNonQry(query);
             MySQLQuery.ExecNonQry(sqlquery);
             MySQLQuery.ShowMessage("Donor registration successfully:", "success", msgLabel);
             ClearControls();
         }
         else
         {
             MySQLQuery.ShowMessage("User Id already exist! try another user id", "warning", msgLabel);
         }
     }
     catch (Exception ex)
     {
         MySQLQuery.ShowMessage("ERROR:" + ex.ToString(), "error", msgLabel);
     }
 }
예제 #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (btnSave.Text == "Save")
         {
             string query = "INSERT INTO BloodGroup (BloodGroup) VALUES ('" + txtBloodGroup.Text + "')";
             MySQLQuery.ExecNonQry(query);
             MySQLQuery.ShowMessage("Blood Group add successfully:", "success", msgLabel);
             ClearControls();
             BindDonorGridView();
         }
         else
         {
             string query = "UPDATE BloodGroup SET BloodGroup='" + txtBloodGroup.Text + "' WHERE ID='" + Session["Id"] + "'";
             MySQLQuery.ExecNonQry(query);
             MySQLQuery.ShowMessage("Blood Group update successfully:", "success", msgLabel);
             ClearControls();
             BindDonorGridView();
             btnSave.Text = "Save";
         }
     }
     catch (Exception ex)
     {
         MySQLQuery.ShowMessage("ERROR:" + ex.ToString(), "error", msgLabel);
     }
 }
예제 #3
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string query = "INSERT INTO `donation`(`ddate`,Location, `units`, `detail`, `userId`) VALUES ('" + txtDate.Text + "','" + txtLocation.Text + "','" + txtUnit.Text + "','" + txtDetails.Text + "','" + Session["UserName"] + "')";
         MySQLQuery.ExecNonQry(query);
         MySQLQuery.ShowMessage("Save successfully:", "success", msgLabel);
         ClearControls();
     }
     catch (Exception ex)
     {
         MySQLQuery.ShowMessage("ERROR:" + ex.ToString(), "error", msgLabel);
     }
 }
예제 #4
0
 protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     try
     {
         int    id    = Convert.ToInt32(e.CommandArgument.ToString());
         string query = "DELETE FROM donors WHERE(ID = '" + id + "')";
         MySQLQuery.ExecNonQry(query);
         BindDonorGridView();
         MySQLQuery.ShowMessage("Record Deleted ", "success", msgLabel);
     }
     catch (Exception ex)
     {
         MySQLQuery.ShowMessage("ERROR:" + ex.ToString(), "error", msgLabel);
     }
 }
예제 #5
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            string gender = "Male";

            if (rdFemale.Checked)
            {
                gender = "Female";
            }
            string query = "UPDATE donors SET Name='" + txtName.Text + "',Gender='" + gender + "',Age='" + txtAge.Text + "',BloodGroupId='" + ddlBloodGroup.SelectedValue + "', Email='" + txtEmail.Text + "', Phone='" + txtPhone.Text + "',Address='" + txtAddress.Text + "' WHERE ID='" + Session["Id"] + "'";

            MySQLQuery.ExecNonQry(query);
            MySQLQuery.ShowMessage("Profile update successfully:", "success", msgLabel);
            //ClearControls();
            //btnSave.Text = "Save";
            //BindDonorGridView();
        }
예제 #6
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         string gender = "Male";
         if (rdFemale.Checked)
         {
             gender = "Female";
         }
         if (btnSave.Text == "Add Donor")
         {
             string isExist = MySQLQuery.ReturnString("SELECT UserId From Donors WHERE UserId='" + txtUser.Text + "'");
             if (isExist == "")
             {
                 string query    = "INSERT INTO donors (Name,Gender,Age,BloodGroupId, Email, Phone,Address,UserId) VALUES ('" + txtName.Text + "','" + gender + "','" + txtAge.Text + "','" + ddlBloodGroup.SelectedValue + "','" + txtEmail.Text + "','" + txtPhone.Text + "','" + txtAddress.Text + "','" + txtUser.Text + "')";
                 string sqlquery = "INSERT INTO user (UserName, Password, Name, Role) VALUES ('" + txtUser.Text + "','" + txtPassword.Text + "','" + txtName.Text + "','Donor')";
                 MySQLQuery.ExecNonQry(query);
                 MySQLQuery.ExecNonQry(sqlquery);
                 MySQLQuery.ShowMessage("Donor add successfully:", "success", msgLabel);
                 ClearControls();
                 LoginInfo.Visible = true;
                 BindDonorGridView();
             }
             else
             {
                 MySQLQuery.ShowMessage("User Id already exist! try another user id", "warning", msgLabel);
             }
         }
         else
         {
             //string query = "INSERT INTO donors (Name,Gender,Age,BloodGroupId, Email, Phone,Address) VALUES ('" + txtName.Text + "','" + gender + "','" + txtAge.Text + "','" + ddlBloodGroup.SelectedValue + "','" + txtEmail.Text + "','" + txtPhone.Text + "','" + txtAddress.Text + "')";
             string query = "UPDATE donors SET Name='" + txtName.Text + "',Gender='" + gender + "',Age='" + txtAge.Text + "',BloodGroupId='" + ddlBloodGroup.SelectedValue + "', Email='" + txtEmail.Text + "', Phone='" + txtPhone.Text + "',Address='" + txtAddress.Text + "' WHERE ID='" + Session["Id"] + "'";
             MySQLQuery.ExecNonQry(query);
             MySQLQuery.ShowMessage("Donor update successfully:", "success", msgLabel);
             ClearControls();
             btnSave.Text = "Save";
             BindDonorGridView();
         }
     }
     catch (Exception ex)
     {
         MySQLQuery.ShowMessage("ERROR:" + ex.ToString(), "error", msgLabel);
     }
 }
예제 #7
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string gender = "Male";
         if (rdFemale.Checked)
         {
             gender = "Female";
         }
         string query = "INSERT INTO `requestes`(`name`, `gender`, `age`, `mobile`, `email`, `bgroup`, `reqdate`, `detail`) VALUES ('" + txtName.Text + "','" + gender + "','" + txtAge.Text + "','" + txtPhone.Text + "','" + txtEmail.Text + "','" + ddlBloodGroup.SelectedValue + "','" + txtDate.Text + "','" + txtDetails.Text + "')";
         MySQLQuery.ExecNonQry(query);
         MySQLQuery.ShowMessage("Request Submit successfully:", "success", msgLabel);
         ClearControls();
         BindDonorGridView();
     }
     catch (Exception ex)
     {
         MySQLQuery.ShowMessage("ERROR:" + ex.ToString(), "error", msgLabel);
     }
 }