protected void Update_Click(object sender, EventArgs e)
        {
            if (!IsOk())
            {
                string filename;
                if (FileUpload1.HasFile)
                {
                    filename = $"books/{Path.GetFileName(FileUpload1.PostedFile.FileName)}";
                }
                else
                {
                    filename = file_path;
                }


                string genre = "";
                foreach (int i in ListBox_Genre.GetSelectedIndices())
                {
                    genre += ListBox_Genre.Items[i] + ",";
                }

                SqlCommand cmd = new SqlCommand("UPDATE book_master_tbl set book_name=@book_name, genre=@genre, " +
                                                "author_name=@author_name, publisher_name=@publisher_name, publish_data=@publish_date, language=@language, " +
                                                "edition=@edition, book_cost=@book_cost, nr_of_pages=@no_of_pages, book_description=@book_description, " +
                                                "actual_stock=@actual_stock, current_stock=@current_stock, book_img_link=@book_img_link where book_id='"
                                                + BookID.Text.Trim() + "'", Con1.Connect());



                cmd.Parameters.AddWithValue("@book_name", BookName.Text.Trim());
                cmd.Parameters.AddWithValue("@genre", genre);
                cmd.Parameters.AddWithValue("@author_name", DropDownList_AuthorName.SelectedItem.Value);
                cmd.Parameters.AddWithValue("@publisher_name", DropDownList_Publisher.SelectedItem.Value);
                cmd.Parameters.AddWithValue("@publish_date", Date.Text.Trim());
                cmd.Parameters.AddWithValue("@language", DropDownList_Language.SelectedItem.Value);
                cmd.Parameters.AddWithValue("@edition", Edition.Text.Trim());
                cmd.Parameters.AddWithValue("@book_cost", BookCost.Text.Trim());
                cmd.Parameters.AddWithValue("@no_of_pages", Pages.Text.Trim());
                cmd.Parameters.AddWithValue("@book_description", Description.Text.Trim());
                cmd.Parameters.AddWithValue("@actual_stock", Stock.Text.Trim());
                int stock = Int32.Parse(Stock.Text.Trim()) - Int32.Parse(CurrentStock.Text.Trim());
                cmd.Parameters.AddWithValue("@current_stock", stock.ToString());
                cmd.Parameters.AddWithValue("@book_img_link", filename);

                cmd.ExecuteNonQuery();

                Show();
            }
            else
            {
                Response.Write("<script>alert(' Carte Inexistenta ');</script>");
            }
        }
Esempio n. 2
0
        protected void Button_Delete_Click(object sender, EventArgs e)
        {
            if (!IsOk())
            {
                SqlCommand cmd = new SqlCommand($"DELETE FROM author_master_tbl WHERE author_ID='{TextBox_ID.Text.Trim()}'", Con1.Connect());
                cmd.ExecuteNonQuery();

                Response.Write("<script>alert(' Deleted ');</script>");
                Show();
            }
            else
            {
                Response.Write("<script>alert(' Autor Inexistent ');</script>");
            }
        }
Esempio n. 3
0
        protected void Update_Click(object sender, EventArgs e)
        {
            string password;

            if (NewPassword.Text.Trim() == "")
            {
                password = OldPassword.Text;
            }
            else
            {
                password = NewPassword.Text.Trim();
            }


            SqlCommand cmd = new SqlCommand("update member_master_tbl set full_name=@full_name, dob=@dob, contact_no=@contact_no, email=@email, state=@state, city=@city, pincode=@pincode, full_adress=@full_address, password=@password, account_status=@account_status WHERE member_id='" + Session["username"].ToString().Trim() + "'", Con1.Connect());

            cmd.Parameters.AddWithValue("@full_name", FullName_TextBox.Text.Trim());
            cmd.Parameters.AddWithValue("@dob", BirtDate_TextBox.Text.Trim());
            cmd.Parameters.AddWithValue("@contact_no", ContactNumber_TextBox.Text.Trim());
            cmd.Parameters.AddWithValue("@email", Email_TextBox.Text.Trim());
            cmd.Parameters.AddWithValue("@state", DropDownList_Country.SelectedItem.Value);
            cmd.Parameters.AddWithValue("@city", City_TextBox.Text.Trim());
            cmd.Parameters.AddWithValue("@pincode", PinCode_TextBox.Text.Trim());
            cmd.Parameters.AddWithValue("@full_address", FullAdress_TextBox.Text.Trim());
            cmd.Parameters.AddWithValue("@password", password);
            cmd.Parameters.AddWithValue("@account_status", "pending");

            cmd.ExecuteNonQuery();
            Label1.CssClass = "badge badge-pill badge-warning";
        }
        private bool IsOk()
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM member_master_tbl where member_id='{UserId_Label.Text.Trim()}';", Con1.Connect());
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
            DataTable      dt       = new DataTable();

            addaptor.Fill(dt);

            if (dt.Rows.Count >= 1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        public bool IsOk()
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM publisher_master_tbl where publisher_id='{Publisher_ID.Text.Trim()}';", Con1.Connect());
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
            DataTable      dt       = new DataTable();

            addaptor.Fill(dt);

            if (dt.Rows.Count >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 protected void Delete_Click(object sender, EventArgs e)
 {
     if (IsOk())
     {
         SqlCommand cmd = new SqlCommand($"DELETE FROM publisher_master_tbl WHERE publisher_id='{Publisher_ID.Text.Trim()}';", Con1.Connect());
         cmd.ExecuteNonQuery();
         Show();
     }
     else
     {
         Response.Write("<script>alert(' Publisheru nu se afla in baza de date ');</script>");
     }
 }
 protected void Add_Click(object sender, EventArgs e)
 {
     if (!IsOk())
     {
         SqlCommand cmd = new SqlCommand("INSERT INTO publisher_master_tbl(publisher_id,publisher_name) values(@publisher_id,@publisher_name)", Con1.Connect());
         cmd.Parameters.AddWithValue("@publisher_id", Publisher_ID.Text.Trim());
         cmd.Parameters.AddWithValue("@publisher_name", Publisher_name.Text.Trim());
         cmd.ExecuteNonQuery();
         Show();
     }
     else
     {
         Response.Write("<script>alert(' Publisheru se afla in baza de date ');</script>");
     }
 }
        protected void Add_Click(object sender, EventArgs e)
        {
            if (IsOk())
            {
                try
                {
                    SqlCommand     cmd      = new SqlCommand($"SELECT * FROM book_issue_tbl where book_id='{BookID.Text.Trim()}';", Con1.Connect());
                    SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
                    DataTable      dt       = new DataTable();
                    addaptor.Fill(dt);



                    string stock = (Int32.Parse(Stock.Text.Trim()) - dt.Rows.Count).ToString();
                    string s     = CurrentStock.Text.Trim();
                    string gen   = "";

                    foreach (int i in ListBox_Genre.GetSelectedIndices())
                    {
                        gen += $"{ListBox_Genre.Items[i].Text},";
                    }

                    string filename;

                    if (FileUpload1.HasFile)
                    {
                        filename = $"books/{Path.GetFileName(FileUpload1.PostedFile.FileName)}";
                    }
                    else
                    {
                        filename = "gol";
                    }


                    cmd = new SqlCommand($"INSERT INTO book_master_tbl(book_id,book_name,author_name,publisher_name,publish_data,language," +
                                         $"edition,book_cost,nr_of_pages,book_description,actual_stock,current_stock,book_img_link,genre) values('{BookID.Text.Trim()}','{BookName.Text.Trim()}'," +
                                         $"'{DropDownList_AuthorName.SelectedValue.Trim()}','{DropDownList_Publisher.SelectedValue.Trim()}','{Date.Text.Trim()}'," +
                                         $"'{DropDownList_Language.SelectedValue.Trim()}','{Edition.Text.Trim()}','{BookCost.Text.Trim()}','{Pages.Text.Trim()}'," +
                                         $"'{Description.Text.Trim()}','{Stock.Text.Trim()}','{stock}', @file,@gen)", Con1.Connect());

                    cmd.Parameters.AddWithValue("@file", filename);
                    cmd.Parameters.AddWithValue("@gen", gen);


                    cmd.ExecuteNonQuery();

                    Response.Write("<script>alert(' Successful ');</script>");
                    Show();
                }
                catch (Exception ex)
                {
                    Response.Write("<script>alert('" + ex.Message + "');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Already In');</script>");
            }

            Show();
        }
        public void IncreDecre(bool a)
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM book_master_tbl where book_id='{Book_ID.Text.Trim()}';", Con1.Connect());
            DataTable      dt       = new DataTable();
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);

            addaptor.Fill(dt);

            string actualstock = dt.Rows[0]["current_stock"].ToString();
            int    curentstock;

            if (a)
            {
                curentstock = Int32.Parse(actualstock) + 1;
            }
            else
            {
                curentstock = Int32.Parse(actualstock) - 1;
            }

            string current = curentstock.ToString();

            cmd = new SqlCommand("UPDATE book_master_tbl  SET current_stock = @stock  Where book_id = @id", Con1.Connect());
            cmd.Parameters.AddWithValue("@stock", current);
            cmd.Parameters.AddWithValue("@id", Book_ID.Text.Trim());
            cmd.ExecuteNonQuery();
        }
        private void Show()
        {
            DataTable      dt      = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM book_issue_tbl", Con1.Connect());

            adapter.Fill(dt);
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
        protected void LogIn_Click(object sender, EventArgs e)
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM member_master_tbl where member_id='{TextBox_ID.Text.Trim()}';", Con1.Connect());
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
            DataTable      dt       = new DataTable();

            addaptor.Fill(dt);

            if (dt.Rows.Count == 0)
            {
                Response.Write($"<script>alert('Username nu exista')</script>");
                return;
            }

            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    if (reader.GetValue(9).ToString() == TextBox_Pass.Text.Trim())
                    {
                        Session["fullname"] = reader.GetValue(0).ToString();
                        Session["role"]     = "user";
                        Session["username"] = reader.GetValue(8).ToString();

                        reader.Close();
                        Response.Redirect("Home.aspx");
                    }
                    else
                    {
                        Response.Write($"<script>alert('Parola incorecta')</script>");
                    }
                }
                reader.Close();
            }
        }
Esempio n. 12
0
 protected void LinkButton_Inactive_Click(object sender, EventArgs e)
 {
     if (Ok())
     {
         SqlCommand cmd = new SqlCommand($"UPDATE member_master_tbl set account_status=@account_status where member_id = '{Member_id.Text.Trim()}'", Con1.Connect());
         cmd.Parameters.AddWithValue("@account_status", "inactive");
         cmd.ExecuteNonQuery();
         Show();
     }
 }
Esempio n. 13
0
        protected void Go_Click(object sender, EventArgs e)
        {
            if (Ok())
            {
                SqlCommand     cmd      = new SqlCommand($"SELECT * FROM member_master_tbl where member_id = '{Member_id.Text.Trim()}'", Con1.Connect());
                DataTable      dt       = new DataTable();
                SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
                addaptor.Fill(dt);

                FullName.Text      = dt.Rows[0]["full_name"].ToString();
                AccountStatus.Text = dt.Rows[0]["account_status"].ToString();
                BirtDate.Text      = dt.Rows[0]["dob"].ToString();
                ContactNr.Text     = dt.Rows[0]["contact_no"].ToString();
                Email.Text         = dt.Rows[0]["email"].ToString();
                Country.Text       = dt.Rows[0]["state"].ToString();
                City.Text          = dt.Rows[0]["city"].ToString();
                PinCode.Text       = dt.Rows[0]["pincode"].ToString();
                FullAdress.Text    = dt.Rows[0]["full_adress"].ToString();
            }
            else
            {
                Response.Write($"<script>alert('User Inexistent');</script>");
            }
        }
Esempio n. 14
0
 protected void DeleteButton_Click(object sender, EventArgs e)
 {
     if (Ok())
     {
         SqlCommand cmd = new SqlCommand($"DELETE FROM member_master_tbl WHERE member_id='{Member_id.Text.Trim()}';", Con1.Connect());
         cmd.ExecuteNonQuery();
         Show();
     }
     else
     {
         Response.Write("<script>alert(' Member Inexistent ');</script>");
     }
 }
Esempio n. 15
0
        private void Show()
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM member_master_tbl", Con1.Connect());
            DataTable      dt       = new DataTable();
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);

            addaptor.Fill(dt);

            dt.Columns.Remove("dob");
            dt.Columns.Remove("pincode");
            dt.Columns.Remove("full_adress");
            dt.Columns.Remove("password");

            dt.Columns["member_id"].SetOrdinal(0);
            dt.Columns["account_status"].SetOrdinal(1);
            dt.Columns["full_name"].SetOrdinal(2);
            dt.Columns["email"].SetOrdinal(3);
            dt.Columns["contact_no"].SetOrdinal(4);
            dt.Columns["state"].SetOrdinal(5);
            dt.Columns["city"].SetOrdinal(6);


            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
        private void Show()
        {
            DataTable      dt      = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM book_master_tbl", Con1.Connect());

            adapter.Fill(dt);
            GridView1.AutoGenerateColumns = false;
            GridView1.DataSource          = dt;
            GridView1.DataBind();



            adapter = new SqlDataAdapter("SELECT author_name FROM author_master_tbl;", Con1.Connect());
            dt      = new DataTable();
            adapter.Fill(dt);
            DropDownList_AuthorName.DataSource     = dt;
            DropDownList_AuthorName.DataValueField = "author_name";
            DropDownList_AuthorName.DataBind();

            adapter = new SqlDataAdapter("SELECT publisher_name FROM publisher_master_tbl;", Con1.Connect());
            dt      = new DataTable();
            adapter.Fill(dt);
            DropDownList_Publisher.DataSource     = dt;
            DropDownList_Publisher.DataValueField = "publisher_name";
            DropDownList_Publisher.DataBind();
        }
        protected void Go(object sender, EventArgs e)
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM book_master_tbl where book_id='{BookID.Text.Trim()}' OR book_name ='{BookName.Text.Trim()}';", Con1.Connect());
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
            DataTable      dt       = new DataTable();

            addaptor.Fill(dt);

            if (dt.Rows.Count >= 1)
            {
                cmd      = new SqlCommand($"SELECT * FROM book_issue_tbl where book_id='{BookID.Text.Trim()}';", Con1.Connect());
                addaptor = new SqlDataAdapter(cmd);
                DataTable dtt = new DataTable();
                addaptor.Fill(dtt);

                int IssueNumber = dtt.Rows.Count;
                IssuedBooks.Text = IssueNumber.ToString();


                BookName.Text     = dt.Rows[0]["book_name"].ToString().Trim();
                Date.Text         = dt.Rows[0]["publish_data"].ToString().Trim();
                Pages.Text        = dt.Rows[0]["nr_of_pages"].ToString().Trim();
                BookCost.Text     = dt.Rows[0]["nr_of_pages"].ToString().Trim();
                Stock.Text        = dt.Rows[0]["actual_stock"].ToString().Trim();
                CurrentStock.Text = dt.Rows[0]["current_stock"].ToString();
                Description.Text  = dt.Rows[0]["book_description"].ToString().Trim();


                ListBox_Genre.ClearSelection();
                string[] genre = dt.Rows[0]["genre"].ToString().Split(',');
                for (int i = 0; i < genre.Length; i++)
                {
                    for (int j = 0; j < ListBox_Genre.Items.Count; j++)
                    {
                        if (ListBox_Genre.Items[j].ToString() == genre[i])
                        {
                            ListBox_Genre.Items[j].Selected = true;
                        }
                    }
                }

                DropDownList_AuthorName.SelectedValue = dt.Rows[0]["author_name"].ToString().Trim();
                DropDownList_Language.SelectedValue   = dt.Rows[0]["language"].ToString().Trim();
                DropDownList_Publisher.SelectedValue  = dt.Rows[0]["publisher_name"].ToString().Trim();
            }
            else
            {
                Response.Write("<script>alert(' ID incorect ');</script>");
            }
        }
        protected void Return_Click(object sender, EventArgs e)
        {
            if (Exista())
            {
                SqlCommand cmd = new SqlCommand($"DELETE FROM book_issue_tbl WHERE member_id='{Member_ID.Text.Trim()}' AND book_id='{Book_ID.Text.Trim()}'", Con1.Connect());

                cmd.ExecuteNonQuery();
                Show();
                IncreDecre(true);
            }
            else
            {
                Response.Write("<script>alert(' Date incorecte');</script>");
            }
        }
        protected void Issued_Click(object sender, EventArgs e)
        {
            Go_Click(null, EventArgs.Empty);

            if (IsOk())
            {
                SqlCommand cmd = new SqlCommand($"INSERT INTO book_issue_tbl(member_id,member_name,book_id,book_name,issue_date,return_date)" +
                                                $"values('{Member_ID.Text.Trim()}','{Member_Name.Text.Trim()}','{Book_ID.Text.Trim()}','{Book_Name.Text.Trim()}','{Date_Start.Text.Trim()}','{Date_End.Text.Trim()}')", Con1.Connect());

                cmd.ExecuteNonQuery();
                Show();
                IncreDecre(false);
            }
            else
            {
                Response.Write("<script>alert(' Un user nu poate imprumuta aceas carte de 2 ori ');</script>");
            }
        }
        protected void Go_Click(object sender, EventArgs e)
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM book_master_tbl where book_id='{Book_ID.Text.Trim()}';", Con1.Connect());
            DataTable      dt       = new DataTable();
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);

            addaptor.Fill(dt);

            if (dt.Rows.Count >= 1)
            {
                Book_Name.Text = dt.Rows[0]["book_name"].ToString().Trim();
            }
            else
            {
                Response.Write("<script>alert(' ID  book incorect ');</script>");
            }

            cmd      = new SqlCommand($"SELECT * FROM member_master_tbl where member_id='{Member_ID.Text.Trim()}';", Con1.Connect());
            dt       = new DataTable();
            addaptor = new SqlDataAdapter(cmd);
            addaptor.Fill(dt);

            if (dt.Rows.Count >= 1)
            {
                Member_Name.Text = dt.Rows[0]["full_name"].ToString().Trim();
            }
            else
            {
                Response.Write("<script>alert(' ID  member incorect ');</script>");
            }
        }
 protected void Update_Click(object sender, EventArgs e)
 {
     if (IsOk())
     {
         SqlCommand cmd = new SqlCommand($"UPDATE publisher_master_tbl set publisher_name=@publisher_name where publisher_id = '{Publisher_ID.Text.Trim()}'", Con1.Connect());
         cmd.Parameters.AddWithValue("@publisher_name", Publisher_name.Text.Trim());
         cmd.ExecuteNonQuery();
         Show();
     }
     else
     {
         Response.Write("<script>alert(' Publisheru se afla in baza de date ');</script>");
     }
 }
        private bool IsOk()
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM book_issue_tbl where book_id='{Book_ID.Text.Trim()}' AND member_id='{Member_ID.Text.Trim()}';", Con1.Connect());
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
            DataTable      dt       = new DataTable();

            addaptor.Fill(dt);

            if (dt.Rows.Count >= 1)
            {
                return(false);
            }


            return(true);
        }
        public void Show()
        {
            DataTable      dt      = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM publisher_master_tbl", Con1.Connect());

            adapter.Fill(dt);
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
Esempio n. 24
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM admin_login_tbl where username='******';", Con1.Connect());
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
            DataTable      dt       = new DataTable();

            addaptor.Fill(dt);

            if (dt.Rows.Count == 0)
            {
                Response.Write($"<script>alert('Username nu exista')</script>");
                return;
            }

            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    if (reader.GetValue(1).ToString() == TextBox_Password.Text.Trim())
                    {
                        Session["fullname"] = reader.GetValue(2).ToString();
                        Session["role"]     = "admin";
                        reader.Close();
                        Response.Redirect("Home.aspx");
                    }
                    else
                    {
                        reader.Close();
                        Response.Write($"<script>alert('Parola incorecta')</script>");
                        return;
                    }
                }
            }
        }
        protected void Go_Click(object sender, EventArgs e)
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM publisher_master_tbl where publisher_id='{Publisher_ID.Text.Trim()}';", Con1.Connect());
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
            DataTable      dt       = new DataTable();

            addaptor.Fill(dt);


            if (dt.Rows.Count >= 1)
            {
                Publisher_name.Text = dt.Rows[0]["publisher_name"].ToString();
            }
        }
Esempio n. 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable      dt      = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM book_master_tbl", Con1.Connect());

            adapter.Fill(dt);
            GridView1.AutoGenerateColumns = false;
            GridView1.DataSource          = dt;
            GridView1.DataBind();
        }
        private void Insert()
        {
            try
            {
                SqlCommand cmd = new SqlCommand("INSERT INTO member_master_tbl(full_name,dob,contact_no,email,state,city,pincode,full_adress,member_id,password,account_status) values(@full_name,@dob,@contact_no,@email,@state,@city,@pincode,@full_adress,@member_id,@password,@account_status)", Con1.Connect());

                cmd.Parameters.AddWithValue("@full_name", FullName_Label.Text.Trim());
                cmd.Parameters.AddWithValue("@dob", BirtDate_Label.Text.Trim());
                cmd.Parameters.AddWithValue("@contact_no", ContactNumber_Label.Text.Trim());
                cmd.Parameters.AddWithValue("@email", Email_Label.Text.Trim());
                cmd.Parameters.AddWithValue("@state", Country_DropDown.SelectedItem.Value);
                cmd.Parameters.AddWithValue("@city", City_Label.Text.Trim());
                cmd.Parameters.AddWithValue("@pincode", PinCode_Label.Text.Trim());
                cmd.Parameters.AddWithValue("@full_adress", FullAdress_Label.Text.Trim());
                cmd.Parameters.AddWithValue("@member_id", UserId_Label.Text.Trim());
                cmd.Parameters.AddWithValue("@password", Password_Label.Text.Trim());
                cmd.Parameters.AddWithValue("@account_status", "pending");

                cmd.ExecuteNonQuery();


                Response.Write("<script>alert('Sign Up Successful. Go to User Login to Login');</script>");
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('" + ex.Message + "');</script>");
            }
        }
        private bool IsOk()
        {
            SqlCommand     cmd      = new SqlCommand($"SELECT * FROM book_master_tbl where book_id='{BookID.Text.Trim()}' OR book_name ='{BookName.Text.Trim()}';", Con1.Connect());
            SqlDataAdapter addaptor = new SqlDataAdapter(cmd);
            DataTable      dt       = new DataTable();

            addaptor.Fill(dt);

            if (dt.Rows.Count >= 1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 29
0
        void Show()
        {
            if (!(Session["username"] == null) && !(Session["username"].Equals("")))
            {
                SqlCommand     cmdd     = new SqlCommand($"SELECT * from book_issue_tbl WHERE member_id='{Session["username"]}'", Con1.Connect());
                DataTable      dt       = new DataTable();
                SqlDataAdapter addaptor = new SqlDataAdapter(cmdd);
                addaptor.Fill(dt);
                GridView1.DataSource = dt;
                GridView1.DataBind();

                cmdd     = new SqlCommand($"SELECT * from member_master_tbl WHERE member_id = '{Session["username"]}'", Con1.Connect());
                dt       = new DataTable();
                addaptor = new SqlDataAdapter(cmdd);
                addaptor.Fill(dt);

                FullName_TextBox.Text              = dt.Rows[0]["full_name"].ToString();
                BirtDate_TextBox.Text              = dt.Rows[0]["dob"].ToString();
                ContactNumber_TextBox.Text         = dt.Rows[0]["contact_no"].ToString();
                Email_TextBox.Text                 = dt.Rows[0]["email"].ToString();
                PinCode_TextBox.Text               = dt.Rows[0]["pincode"].ToString();
                FullAdress_TextBox.Text            = dt.Rows[0]["full_adress"].ToString();
                UserID_TextBox.Text                = dt.Rows[0]["member_id"].ToString();
                OldPassword.Text                   = dt.Rows[0]["password"].ToString();
                City_TextBox.Text                  = dt.Rows[0]["city"].ToString();
                DropDownList_Country.SelectedValue = dt.Rows[0]["state"].ToString().Trim();


                Label1.Text = dt.Rows[0]["account_status"].ToString().Trim();

                if (Label1.Text == "active")
                {
                    Label1.CssClass = "badge badge-pill badge-success";
                }
                else if (Label1.Text == "pending")
                {
                    Label1.CssClass = "badge badge-pill badge-warning";
                }
                else if (Label1.Text == "inactive")
                {
                    Label1.CssClass = "badge badge-pill badge-danger";
                }
                else
                {
                    Label1.Attributes.Add("class", "badge  badge-info");
                }
            }
        }
Esempio n. 30
0
        protected void Button_Update_Click(object sender, EventArgs e)
        {
            if (!IsOk())
            {
                SqlCommand cmd = new SqlCommand($"UPDATE author_master_tbl SET author_name='{TextBox_AuthorName.Text.Trim()}' WHERE author_ID='{TextBox_ID.Text.Trim()}'", Con1.Connect());
                cmd.ExecuteNonQuery();

                Response.Write("<script>alert(' Successful ');</script>");
                Show();
            }
            else
            {
                Response.Write("<script>alert(' Autor Inexistent ');</script>");
            }
        }