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
        private void EditMode(string id)
        {
            string    query = "SELECT `ID`, `Name`, `Email`, Age, Gender,`Phone`, `Address`,`EntryDate`, `BloodGroupId` FROM `donors` WHERE ID='" + id + "'";
            DataTable dt    = MySQLQuery.ReturnDataTable(query);

            if (dt.Rows.Count > 0)
            {
                txtName.Text = dt.Rows[0]["Name"].ToString();
                LoadBloodGroup();
                if (dt.Rows[0]["Gender"].ToString() == "Male")
                {
                    rdMail.Checked   = true;
                    rdFemale.Checked = false;
                }
                else
                {
                    rdMail.Checked   = false;
                    rdFemale.Checked = true;
                }
                LoginInfo.Visible           = false;
                ddlBloodGroup.SelectedValue = dt.Rows[0]["BloodGroupId"].ToString();
                txtAge.Text     = dt.Rows[0]["Age"].ToString();
                txtName.Text    = dt.Rows[0]["Name"].ToString();
                txtEmail.Text   = dt.Rows[0]["Email"].ToString();
                txtPhone.Text   = dt.Rows[0]["Phone"].ToString();
                txtAddress.Text = dt.Rows[0]["Address"].ToString();
                btnSave.Text    = "Update";
                msgLabel.Text   = "Edit Mode Activated!";
                msgLabel.Attributes.Add("class", "info");
                Session["Id"] = id;
            }
        }
Пример #3
0
        private void EditMode(string id)
        {
            string    query = "SELECT `ID`, `Name`, `Email`, Age, Gender,`Phone`, `Address`,`EntryDate`, `BloodGroupId` FROM `donors` WHERE UserId='" + id + "'";
            DataTable dt    = MySQLQuery.ReturnDataTable(query);

            if (dt.Rows.Count > 0)
            {
                txtName.Text = dt.Rows[0]["Name"].ToString();
                LoadBloodGroup();
                if (dt.Rows[0]["Gender"].ToString() == "Male")
                {
                    rdMail.Checked   = true;
                    rdFemale.Checked = false;
                }
                else
                {
                    rdMail.Checked   = false;
                    rdFemale.Checked = true;
                }

                ddlBloodGroup.SelectedValue = dt.Rows[0]["BloodGroupId"].ToString();
                txtAge.Text     = dt.Rows[0]["Age"].ToString();
                txtName.Text    = dt.Rows[0]["Name"].ToString();
                txtEmail.Text   = dt.Rows[0]["Email"].ToString();
                txtPhone.Text   = dt.Rows[0]["Phone"].ToString();
                txtAddress.Text = dt.Rows[0]["Address"].ToString();
                Session["Id"]   = dt.Rows[0]["ID"].ToString();
            }
        }
Пример #4
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);
     }
 }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if ((Session["UserName"] == null) && (Session["Password"] == null))
                {
                    //Response.Redirect("Login.aspx");
                    auth.Visible      = false;
                    authLogin.Visible = true;
                }
                else
                {
                    auth.Visible      = true;
                    authLogin.Visible = false;

                    lblUserName.Text = MySQLQuery.ReturnString("SELECT Name FROM user Where  UserName='******'");
                }
                if (Session["Role"] == null)
                {
                    GetMenu("");
                }
                else
                {
                    GetMenu(Session["Role"].ToString());
                }
            }
        }
Пример #6
0
        private void BindDonorGridView()
        {
            string    query = "SELECT `req_id`, `name`, `gender`, `age`, `mobile`, `email`, `reqdate`, `detail`,(SELECT BloodGroup FROM bloodgroup WHERE Id=bgroup) AS BloodGroup FROM requestes Order By req_id DESC";
            DataTable dt    = MySQLQuery.ReturnDataTable(query);

            bloodRequestGrid.DataSource = dt;
            bloodRequestGrid.DataBind();
            bloodRequestGrid.EmptyDataText = "No Data found!";
        }
Пример #7
0
        private void BindDonorGridView()
        {
            string    query = "SELECT ID, BloodGroup FROM BloodGroup ORDER BY BloodGroup ASC";
            DataTable dt    = MySQLQuery.ReturnDataTable(query);

            BloodGroupGrid.DataSource = dt;
            BloodGroupGrid.DataBind();
            BloodGroupGrid.EmptyDataText = "No Data found!";
        }
Пример #8
0
        private void BindDonorGridView()
        {
            string    query = "SELECT ID, Name, Email,Age, Gender, Phone, Address, EntryDate,(SELECT BloodGroup FROM bloodgroup WHERE Id=BloodGroupId) AS BloodGroup FROM donors Order By ID DESC";
            DataTable dt    = MySQLQuery.ReturnDataTable(query);

            donorGrid.DataSource = dt;
            donorGrid.DataBind();
            donorGrid.EmptyDataText = "No Data found!";
        }
Пример #9
0
        private void BindDonorGridView()
        {
            string    query = "SELECT `donation_id`, `ddate`, `units`,Location, `detail`, `userId` FROM `donation` WHERE UserID='" + Session["UserName"] + "'";
            DataTable dt    = MySQLQuery.ReturnDataTable(query);

            donationGrid.DataSource = dt;
            donationGrid.DataBind();
            donationGrid.EmptyDataText = "No Data found!";
        }
Пример #10
0
        private void BindDonor()
        {
            string sql = "";

            if (ddlBloodGroup.SelectedValue != "0")
            {
                sql = "WHERE BloodGroupId='" + ddlBloodGroup.SelectedValue + "'";
            }
            string    query = "SELECT ID, Name, Email,Age, Gender, Phone, Address, EntryDate,(SELECT BloodGroup FROM bloodgroup WHERE Id=BloodGroupId) AS BloodGroup FROM donors " + sql + " Order By ID DESC";
            DataTable dt    = MySQLQuery.ReturnDataTable(query);

            Repeater1.DataSource = dt;
            Repeater1.DataBind();
        }
Пример #11
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);
     }
 }
Пример #12
0
        private void EditMode(string id)
        {
            string    query = "SELECT `ID`, `BloodGroup` FROM `BloodGroup` WHERE ID='" + id + "'";
            DataTable dt    = MySQLQuery.ReturnDataTable(query);

            if (dt.Rows.Count > 0)
            {
                txtBloodGroup.Text = dt.Rows[0]["BloodGroup"].ToString();
                btnSave.Text       = "Update";
                msgLabel.Text      = "Edit Mode Activated!";
                msgLabel.Attributes.Add("class", "info");
                Session["Id"] = id;
            }
        }
Пример #13
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);
     }
 }
Пример #14
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();
        }
Пример #15
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);
     }
 }
Пример #16
0
            public async Task RegisterUserInformation(string userNickName)
            {
                IGuild guild = Context.Guild;

                jsonHandler.TokenName = "serverEmoji.heart.name";
                jsonHandler.FilePath  = "emoji.json";

                MySQLQuery createQuery = new MySQLQuery();

                string[] userInformation = new string[2];

                try
                {
                    userInformation = createQuery.GetUserInformationByNickName(userNickName);
                    var user = await guild.GetUserAsync(Context.User.Id);

                    if (userInformation != null && user != null)
                    {
                        await user.ModifyAsync(x =>
                        {
                            x.Nickname = $"{userInformation[0]} {userInformation[1]}";
                        });

                        await Context.Channel.SendMessageAsync($"Successfully registered {userNickName} for {Context.User.Mention}. {jsonHandler.GetJsonToken()}");
                    }
                    else
                    {
                        await Context.Channel.SendMessageAsync($"{userNickName} cannot be found.");

                        return;
                    }
                }
                catch (Exception ex)
                {
                    logMessage = new LogMessage(
                        LogSeverity.Critical,
                        ex.Message,
                        $"Source: {ex.Source} => {ex.InnerException}"
                        );
                    return;
                }
            }
Пример #17
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);
     }
 }
Пример #18
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string    query = "SELECT UserName,Password,Role FROM user Where  UserName='******' AND Password='******'";
            DataTable dt    = MySQLQuery.ReturnDataTable(query);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow item in dt.Rows)
                {
                    Session["UserName"] = item["UserName"];
                    Session["Password"] = item["Password"];
                    Session["Role"]     = item["Role"];
                    if ((Session["UserName"] != null) && (Session["Password"] != null))
                    {
                        Response.Redirect("Default.aspx");
                    }
                }
            }
            else
            {
                FailureText.Text     = "UserName or Password Invalid!";
                ErrorMessage.Visible = true;
            }
        }
Пример #19
0
        private void LoadBloodGroup()
        {
            string query = "SELECT Id, BloodGroup FROM bloodgroup ORDER By BloodGroup ASC";

            MySQLQuery.PopulateDropDown(query, ddlBloodGroup, "Id", "BloodGroup");
        }
        public void OnPostNext()
        {
            String          Search_User     = HttpContext.Session.GetString("Search_User");
            String          Exception       = "";
            Boolean         CheckConnection = MyOwnMySQLConnectionClass.LoadConnection(ref Exception);
            MySqlCommand    MySQLQuery      = new MySqlCommand();
            MySqlDataReader RecordReader;
            String          Requestor_1        = "";
            String          Current_User       = HttpContext.Session.GetString("User_Name");
            String          Chat_OFFSET_String = HttpContext.Session.GetString("Chat_OFFSET");
            int             Chat_OFFSET        = int.Parse(Chat_OFFSET_String);

            OtherUserList = new List <String> {
            };
            IDList        = new List <String> {
            };
            if (Search_User != null)
            {
                if (Chat_OFFSET == 0)
                {
                    Chat_OFFSET += 50;
                }
                MySQLQuery.CommandText = "SELECT `Requestor_1`,`ID` FROM `DF_Public_Key` WHERE `Requestor_1`=@Current_User AND `Status`=@Status AND `Requestor_2` LIKE '%@Search_User%' LIMIT 50 OFFSET " + Chat_OFFSET.ToString();
                MySQLQuery.Parameters.Add("@Search_User", MySqlDbType.Text).Value  = Search_User;
                MySQLQuery.Parameters.Add("@Current_User", MySqlDbType.Text).Value = Current_User;
                MySQLQuery.Parameters.Add("@Status", MySqlDbType.Text).Value       = "R1 & R2 had established keys respectively";
                MySQLQuery.Connection = MyOwnMySQLConnectionClass.MyMySQLConnection;
                MySQLQuery.Prepare();
                RecordReader = MySQLQuery.ExecuteReader();
                while (RecordReader.Read())
                {
                    Requestor_1 = RecordReader.GetValue(0).ToString();
                    OtherUserList.Add(Requestor_1);
                    IDList.Add(RecordReader.GetValue(1).ToString());
                }
                MyOwnMySQLConnectionClass.MyMySQLConnection.Close();
                CheckConnection        = MyOwnMySQLConnectionClass.LoadConnection(ref Exception);
                MySQLQuery             = new MySqlCommand();
                MySQLQuery.CommandText = "SELECT `Requestor_2`,`ID` FROM `DF_Public_Key` WHERE `Requestor_2`=@Current_User AND `Status`=@Status AND `Requestor_1` LIKE '%@Search_User%' LIMIT 50 OFFSET " + Chat_OFFSET.ToString();
                MySQLQuery.Parameters.Add("@Search_User", MySqlDbType.Text).Value  = Search_User;
                MySQLQuery.Parameters.Add("@Current_User", MySqlDbType.Text).Value = Current_User;
                MySQLQuery.Parameters.Add("@Status", MySqlDbType.Text).Value       = "R1 & R2 had established keys respectively";
                MySQLQuery.Connection = MyOwnMySQLConnectionClass.MyMySQLConnection;
                MySQLQuery.Prepare();
                RecordReader = MySQLQuery.ExecuteReader();
                while (RecordReader.Read())
                {
                    Requestor_1 = RecordReader.GetValue(0).ToString();
                    OtherUserList.Add(Requestor_1);
                    IDList.Add(RecordReader.GetValue(1).ToString());
                }
                MyOwnMySQLConnectionClass.MyMySQLConnection.Close();
                HttpContext.Session.SetString("Chat_OFFSET", (Chat_OFFSET + 50).ToString());
            }
            else
            {
                if (Chat_OFFSET == 0)
                {
                    Chat_OFFSET += 50;
                }
                MySQLQuery.CommandText = "SELECT `Requestor_1`,`ID` FROM `DF_Public_Key` WHERE `Requestor_1`=@Current_User AND `Status`=@Status AND LIMIT 50 OFFSET " + Chat_OFFSET.ToString();
                MySQLQuery.Parameters.Add("@Current_User", MySqlDbType.Text).Value = Current_User;
                MySQLQuery.Parameters.Add("@Status", MySqlDbType.Text).Value       = "R1 & R2 had established keys respectively";
                MySQLQuery.Connection = MyOwnMySQLConnectionClass.MyMySQLConnection;
                MySQLQuery.Prepare();
                RecordReader = MySQLQuery.ExecuteReader();
                while (RecordReader.Read())
                {
                    Requestor_1 = RecordReader.GetValue(0).ToString();
                    OtherUserList.Add(Requestor_1);
                    IDList.Add(RecordReader.GetValue(1).ToString());
                }
                MyOwnMySQLConnectionClass.MyMySQLConnection.Close();
                CheckConnection        = MyOwnMySQLConnectionClass.LoadConnection(ref Exception);
                MySQLQuery             = new MySqlCommand();
                MySQLQuery.CommandText = "SELECT `Requestor_2`,`ID` FROM `DF_Public_Key` WHERE `Requestor_2`=@Current_User AND `Status`=@Status LIMIT 50 OFFSET " + Chat_OFFSET.ToString();
                MySQLQuery.Parameters.Add("@Current_User", MySqlDbType.Text).Value = Current_User;
                MySQLQuery.Parameters.Add("@Status", MySqlDbType.Text).Value       = "R1 & R2 had established keys respectively";
                MySQLQuery.Connection = MyOwnMySQLConnectionClass.MyMySQLConnection;
                MySQLQuery.Prepare();
                RecordReader = MySQLQuery.ExecuteReader();
                while (RecordReader.Read())
                {
                    Requestor_1 = RecordReader.GetValue(0).ToString();
                    OtherUserList.Add(Requestor_1);
                    IDList.Add(RecordReader.GetValue(1).ToString());
                }
                MyOwnMySQLConnectionClass.MyMySQLConnection.Close();
                HttpContext.Session.SetString("Chat_OFFSET", (Chat_OFFSET + 50).ToString());
            }
        }