Esempio n. 1
0
    protected void upd_btn_Click(object sender, EventArgs e)
    {
        con.Open();
        //SqlCommand cmd = new SqlCommand("vendor_proc", con);
        //cmd.CommandType = CommandType.StoredProcedure;
        //cmd.Parameters.AddWithValue("@action", "update");
        //cmd.Parameters.AddWithValue("@pk_id", Label_id.Text);
        //cmd.Parameters.AddWithValue("@name", Text_name.Text);
        //cmd.Parameters.AddWithValue("@contact_no", Text_contact.Text);
        //cmd.Parameters.AddWithValue("@email", Text_email.Text);
        //cmd.Parameters.AddWithValue("@address", Text_address.Text);
        //cmd.ExecuteNonQuery();
        library.libservice obj = new library.libservice();
        int a = obj.vendorupdate(Convert.ToInt32(Label_id.Text), Text_name.Text, Text_contact.Text, Text_email.Text, Text_address.Text);

        if (a > 0)
        {
            gridshow();
            blank();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Updated!!!!');", true);

            submit_btn.Visible = true;
            upd_btn.Visible    = false;
            clear_btn.Visible  = false;
        }
        con.Close();
    }
Esempio n. 2
0
    protected void upd_btn_Click(object sender, EventArgs e)
    {
        con.Open();
        //SqlCommand cmd = new SqlCommand("add_book_proc", con);
        //cmd.CommandType = CommandType.StoredProcedure;
        //cmd.Parameters.AddWithValue("@action", "update");
        //cmd.Parameters.AddWithValue("@book_id", Label_id.Text);
        //cmd.Parameters.AddWithValue("@book_name", Text_bname.Text);
        //cmd.Parameters.AddWithValue("@book_category", Bookcategory_ddl.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@subtitle", Text_subtitle.Text);
        //cmd.Parameters.AddWithValue("@isbn_no", Lbl_isbn.Text);
        //cmd.Parameters.AddWithValue("@author", Text_author.Text);
        //cmd.Parameters.AddWithValue("@cupboard", Cupboard_ddl.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@cupboard_self", Cupboard_self.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@edition", Text_edition.Text);
        //cmd.Parameters.AddWithValue("@publisher", Text_publisher.Text);
        //cmd.Parameters.AddWithValue("@book_cost", Text_bookcost.Text);
        //cmd.Parameters.AddWithValue("@book_vendor", Bookvendor_ddl.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@copy", Text_copy.Text);
        //cmd.Parameters.AddWithValue("@Remarks", Text_remarks.Text);
        //cmd.Parameters.AddWithValue("@ASN_no", Text_asnno.Text);
        //cmd.ExecuteNonQuery();
        library.libservice obj = new library.libservice();
        int a = obj.addbookupdate(Convert.ToInt32(Label_id.Text), Text_bname.Text, Bookcategory_ddl.SelectedItem.ToString(), Text_subtitle.Text, Lbl_isbn.Text, Text_author.Text, Cupboard_ddl.SelectedItem.ToString(), Cupboard_self.SelectedItem.ToString(),
                                  Text_edition.Text, Text_publisher.Text, Text_bookcost.Text, Bookvendor_ddl.SelectedItem.ToString(), Text_copy.Text, Text_remarks.Text, Text_asnno.Text);

        if (a > 0)
        {
            gridshow();
            blank();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Updated!!!!');", true);
            string barCode = Text_asnno.Text;
            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            using (Bitmap bitMap = new Bitmap(barCode.Length * 40, 80))
            {
                using (Graphics graphics = Graphics.FromImage(bitMap))
                {
                    Font       oFont      = new Font("IDAutomationHC39M", 16);
                    PointF     point      = new PointF(2f, 2f);
                    SolidBrush blackBrush = new SolidBrush(Color.Black);
                    SolidBrush whiteBrush = new SolidBrush(Color.White);
                    graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);
                    graphics.DrawString("*" + barCode + "*", oFont, blackBrush, point);
                }
                using (MemoryStream ms = new MemoryStream())
                {
                    bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    byte[] byteImage = ms.ToArray();

                    Convert.ToBase64String(byteImage);
                    imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
                plBarCode.Controls.Add(imgBarCode);
            }
            clear_btn.Visible  = false;
            submit_btn.Visible = true;
            upd_btn.Visible    = false;
        }
        con.Close();
    }
    protected void upd_btn_Click(object sender, EventArgs e)
    {
        con.Open();
        //SqlCommand cmd = new SqlCommand("librarycard_generate_proc", con);
        //cmd.CommandType = CommandType.StoredProcedure;
        //cmd.Parameters.AddWithValue("@action", "update");
        //cmd.Parameters.AddWithValue("@pk_id", Label_id.Text);
        //cmd.Parameters.AddWithValue("@card_no", Text_cardno.Text);
        //cmd.Parameters.AddWithValue("@type", DropDown_holder.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@id", Text_id.Text);
        //cmd.Parameters.AddWithValue("@name", Text_name.Text);
        //cmd.Parameters.AddWithValue("@batch", Text_batch.Text);
        //cmd.Parameters.AddWithValue("@class", Text_class.Text);
        //cmd.Parameters.AddWithValue("@section", Text_section.Text);
        //cmd.Parameters.AddWithValue("@stream", Text_stream.Text);
        //cmd.Parameters.AddWithValue("@roll", Text_roll.Text);
        //cmd.Parameters.AddWithValue("@father_name", Text_father.Text);
        //cmd.Parameters.AddWithValue("@mobile", Text_mobile.Text);
        //cmd.Parameters.AddWithValue("@address1", Text_address.Text);
        //cmd.ExecuteNonQuery();
        library.libservice obj = new library.libservice();
        int a = obj.update(Convert.ToInt32(Label_id.Text), Text_cardno.Text, DropDown_holder.SelectedItem.ToString(), Text_id.Text, Text_name.Text, Text_batch.Text, Text_class.Text,
                           Text_section.Text, Text_stream.Text, Text_roll.Text, Text_father.Text, Text_mobile.Text, Text_address.Text);

        if (a > 0)
        {
            gridshow();
            blank();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Updated!!!!');", true);
        }
        submit_btn.Visible   = true;
        upd_btn.Visible      = false;
        Export_excel.Visible = false;
        con.Close();
    }
Esempio n. 4
0
    protected void bookissue_click(object sender, EventArgs e)
    {
        con.Open();
        if (holder_ddl.SelectedItem.ToString() == "Student")
        {
            //SqlCommand cmd = new SqlCommand("insert into issue_book values('" + Text_isbn.Text + "','" + Text_bname.Text + "','" + Text_bookcategory.Text + "','" + Text_subtitle.Text + "','" + Text_author.Text + "','" + Text_cupboard.Text + "','" + Text_cupboard_self.Text + "','" + Text_edition.Text + "','" + Text_publisher.Text + "','" +
            //Text_bookcost.Text + "','" + Text_vendor.Text + "','" + Text_copy.Text + "','" + holder_ddl.SelectedItem.ToString() + "','" + Text_cardno.Text + "'
            //,'" + Text_batch.Text + "','" + Text_class.Text + "','" + Text_section.Text + "','" + Text_stream.Text + "','" + Text_roll.Text+ "','" + Text_holdername.Text + "','" + Text_hname.Text + "','" + Text_issuedate.Text + "')", con);
            //cmd.ExecuteNonQuery();
            library.libservice obj = new library.libservice();
            int a = obj.issuebookinsert(Text_isbn.Text, Text_bname.Text, Text_bookcategory.Text, Text_subtitle.Text, Text_author.Text, Text_cupboard.Text,
                                        Text_cupboard_self.Text, Text_edition.Text, Text_publisher.Text, Text_bookcost.Text, Text_vendor.Text, Text_copy.Text, holder_ddl.SelectedItem.ToString(), Text_cardno.Text,
                                        Text_batch.Text, Text_class.Text, Text_section.Text, Text_stream.Text, Text_roll.Text, Text_holdername.Text, Text_hname.Text, Text_issuedate.Text);
            if (a > 0)
            {
                SqlDataAdapter da = new SqlDataAdapter("select * from add_books where isbn_no='" + Text_isbn.Text + "'", con);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                double current_qty = double.Parse(dt.Rows[0]["copy"].ToString());
                double qty         = double.Parse(Text_copy.Text);
                double now_qty     = (current_qty - qty);

                SqlCommand cmd1 = new SqlCommand("update add_books set copy='" + now_qty + "' where author='" + Text_author.Text + "' and book_name='" + Text_bname.Text + "'", con);
                cmd1.ExecuteNonQuery();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Book Issue Successfully!!!!');", true);
                shows();
                blank();
            }
        }
        else if (holder_ddl.SelectedItem.ToString() == "Employee")
        {
            //SqlCommand cmd = new SqlCommand("insert into issue_book values('" + Text_isbn.Text + "','" + Text_bname.Text + "','" + Text_bookcategory.Text + "'
            //,'" + Text_subtitle.Text + "','" + Text_author.Text + "','" + Text_cupboard.Text + "','" + Text_cupboard_self.Text + "','" + Text_edition.Text + "',
            //'" + Text_publisher.Text + "','" + Text_bookcost.Text + "','" + Text_vendor.Text + "','" + Text_copy.Text + "','" + holder_ddl.SelectedItem.ToString() + "',
            //'" + Text_cardno.Text + "','','','','','','','" + Text_hname.Text + "','" + Text_issuedate.Text + "')", con);
            //cmd.ExecuteNonQuery();
            library.libservice obj = new library.libservice();
            int a = obj.issuebookinserts(Text_isbn.Text, Text_bname.Text, Text_bookcategory.Text, Text_subtitle.Text, Text_author.Text, Text_cupboard.Text,
                                         Text_cupboard_self.Text, Text_edition.Text, Text_publisher.Text, Text_bookcost.Text, Text_vendor.Text, Text_copy.Text, holder_ddl.SelectedItem.ToString(), Text_cardno.Text,
                                         "", "", "", "", "", "", Text_hname.Text, Text_issuedate.Text);
            SqlDataAdapter da = new SqlDataAdapter("select * from add_books where isbn_no='" + Text_isbn.Text + "'", con);
            DataTable      dt = new DataTable();
            da.Fill(dt);
            double current_qty = double.Parse(dt.Rows[0]["copy"].ToString());
            double qty         = double.Parse(Text_copy.Text);
            double now_qty     = (current_qty - qty);

            SqlCommand cmd1 = new SqlCommand("update add_books set copy='" + now_qty + "' where author='" + Text_author.Text + "' and book_name='" + Text_bname.Text + "'", con);
            cmd1.ExecuteNonQuery();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Book Issue Successfully!!!!');", true);
            shows();
            blank();
        }
        con.Close();
    }
 public void gridshow()
 {
     //SqlDataAdapter da = new SqlDataAdapter("librarycard_generate_dlt_proc", con);
     //da.SelectCommand.CommandType = CommandType.StoredProcedure;
     //da.SelectCommand.Parameters.AddWithValue("@action", "show");
     //da.SelectCommand.Parameters.AddWithValue("@pk_id", "");
     //DataTable dt = new DataTable();
     //da.Fill(dt);
     library.libservice obj = new library.libservice();
     GridView1.DataSource = obj.show();
     GridView1.DataBind();
 }
Esempio n. 6
0
    protected void return_btn_Click(object sender, EventArgs e)
    {
        con.Open();
        if (DropDownList1.SelectedItem.ToString() == "Student")
        {
            ////SqlCommand cmd = new SqlCommand("insert into return_book_data values(
            //'" + Text_isbn.Text + "','" + Text_bname.Text + "','" + Text_bookcategory.Text + "','" + Text_author.Text + "','" + Text_edition.Text + "','" + Text_vendor.Text + "','" + DropDownList1.SelectedItem.ToString() + "','" + Text_cardno.Text + "','" + Text_hname.Text + "','','" + Text_batch.Text + "','" + Text_class.Text + "','" + Text_section.Text + "','" + Text_roll.Text + "','" + Text_stream.Text + "','" + Text_copy.Text + "','" + Text_issuedate.Text + "','" + Text_return.Text + "','" + noofday_txt.Text + "','" + fine_txt.Text + "')", con);
            ////cmd.ExecuteNonQuery();
            library.libservice obj = new library.libservice();
            int a = obj.returnbookinsert(Text_isbn.Text, Text_bname.Text, Text_bookcategory.Text, Text_author.Text, Text_edition.Text, Text_vendor.Text, DropDownList1.SelectedItem.ToString(), Text_cardno.Text, Text_hname.Text, Text_batch.Text, Text_class.Text, Text_section.Text, Text_roll.Text, Text_stream.Text, Text_copy.Text, Text_issuedate.Text, Text_return.Text, noofday_txt.Text, fine_txt.Text);
            if (a > 0)
            {
                SqlDataAdapter da = new SqlDataAdapter("select * from add_books where isbn_no='" + Text_isbn.Text + "'", con);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                double     current_qty = double.Parse(dt.Rows[0]["copy"].ToString());
                double     qty         = double.Parse(Text_copy.Text);
                double     now_qty     = (current_qty + qty);
                SqlCommand cmd1        = new SqlCommand("update add_books set copy='" + now_qty + "' where author='" + Text_author.Text + "' and book_name='" + Text_bname.Text + "'", con);
                cmd1.ExecuteNonQuery();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Book Returned Successfully!!!!');", true);
                blank();
            }
        }
        else if (DropDownList1.SelectedItem.ToString() == "Employee")
        {
            //SqlCommand cmd = new SqlCommand("insert into return_book_data values('" + Text_isbn.Text + "','" + Text_bname.Text + "','" + Text_bookcategory.Text + "','" + Text_author.Text + "','" + Text_edition.Text + "','" + Text_vendor.Text + "','" + DropDownList1.SelectedItem.ToString() + "','"+Text_cardno.Text+"','" + Text_holdername.Text + "',',',',',',',',',',',',','"+Text_copy.Text+"','"+Text_issuedate.Text+"','" + Text_return.Text + "','" + noofday_txt.Text + "','" + fine_txt.Text + "')", con);
            //d.ExecuteNonQuery();
            library.libservice obj = new library.libservice();
            int a = obj.returnbookinsert(Text_isbn.Text, Text_bname.Text, Text_bookcategory.Text, Text_author.Text, Text_edition.Text, Text_vendor.Text, DropDownList1.SelectedItem.ToString(), Text_cardno.Text, Text_holdername.Text, "", "", "", "", "", Text_copy.Text, Text_issuedate.Text, Text_return.Text, noofday_txt.Text, fine_txt.Text);
            if (a > 0)
            {
                SqlDataAdapter da = new SqlDataAdapter("select * from add_books where isbn_no='" + Text_isbn.Text + "'", con);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                double     current_qty = double.Parse(dt.Rows[0]["copy"].ToString());
                double     qty         = double.Parse(Text_copy.Text);
                double     now_qty     = (current_qty + qty);
                SqlCommand cmd1        = new SqlCommand("update add_books set copy='" + now_qty + "' where author='" + Text_author.Text + "' and book_name='" + Text_bname.Text + "'", con);
                cmd1.ExecuteNonQuery();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Book Returned Successfully!!!!');", true);

                blank();
            }
        }

        con.Close();
    }
Esempio n. 7
0
    protected void submit_btn_Click(object sender, EventArgs e)
    {
        con.Open();
        //SqlCommand cmd1 = new SqlCommand("select * from vendor where name='" + Text_name.Text + "'and email='" + Text_email.Text + "' ", con);
        SqlCommand cmd1 = new SqlCommand("vendor_proc", con);

        cmd1.CommandType = CommandType.StoredProcedure;
        cmd1.Parameters.AddWithValue("@action", "exist");
        cmd1.Parameters.AddWithValue("@pk_id", "");
        cmd1.Parameters.AddWithValue("@name", Text_name.Text);
        cmd1.Parameters.AddWithValue("@contact_no", "");
        cmd1.Parameters.AddWithValue("@email", Text_email.Text);
        cmd1.Parameters.AddWithValue("@address", "");
        cmd1.ExecuteNonQuery();
        SqlDataReader dr = cmd1.ExecuteReader();

        if (dr.Read())
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Record Already Exist!!!!');", true);

            dr.Close();
        }
        else
        {
            dr.Close();
            //SqlCommand cmd = new SqlCommand("vendor_proc", con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.AddWithValue("@action", "insert");
            //cmd.Parameters.AddWithValue("@pk_id", "");
            //cmd.Parameters.AddWithValue("@name", Text_name.Text);
            //cmd.Parameters.AddWithValue("@contact_no", Text_contact.Text);
            //cmd.Parameters.AddWithValue("@email", Text_email.Text);
            //cmd.Parameters.AddWithValue("@address", Text_address.Text);
            //cmd.ExecuteNonQuery();
            library.libservice obj = new library.libservice();
            int a = obj.vendorinsert(Text_name.Text, Text_contact.Text, Text_email.Text, Text_address.Text);
            if (a > 0)
            {
                gridshow();
                blank();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Submit!!!!');", true);
            }
        }
        con.Close();
    }
Esempio n. 8
0
    protected void btn_delete_Click(object sender, EventArgs e)
    {
        con.Open();
        LinkButton  lnk = (LinkButton)sender;
        GridViewRow row = (GridViewRow)lnk.NamingContainer;
        Label       l1  = (Label)row.FindControl("Lbl_id");

        //SqlCommand cmd = new SqlCommand("add_books_proc", con);
        //cmd.CommandType = CommandType.StoredProcedure;
        //cmd.Parameters.AddWithValue("@action", "delete");
        //cmd.Parameters.AddWithValue("@book_id", l1.Text);
        //cmd.ExecuteNonQuery();
        library.libservice obj = new library.libservice();
        int a = obj.addbookdelete(Convert.ToInt32(l1.Text));

        if (a > 0)
        {
            gridshow();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Deleted!!!!');", true);
        }
    }
    protected void submit_btn_Click(object sender, EventArgs e)
    {
        con.Open();



        //SqlCommand cmd = new SqlCommand("librarycard_generate_proc", con);
        //cmd.CommandType = CommandType.StoredProcedure;
        //cmd.Parameters.AddWithValue("@action", "insert");
        //cmd.Parameters.AddWithValue("@pk_id", "");
        Random ran  = new Random();
        int    i    = ran.Next(1, 9);
        int    j    = i * 45678;
        string Card = "14" + j;

        //cmd.Parameters.AddWithValue("@card_no", Card);
        //cmd.Parameters.AddWithValue("@type", DropDown_holder.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@id", Text_id.Text);
        //cmd.Parameters.AddWithValue("@name", Text_name.Text);
        //cmd.Parameters.AddWithValue("@batch", Text_batch.Text);
        //cmd.Parameters.AddWithValue("@class", Text_class.Text);
        //cmd.Parameters.AddWithValue("@section", Text_section.Text);
        //cmd.Parameters.AddWithValue("@stream", Text_stream.Text);
        //cmd.Parameters.AddWithValue("@roll", Text_roll.Text);
        //cmd.Parameters.AddWithValue("@father_name", Text_father.Text);
        //cmd.Parameters.AddWithValue("@mobile", Text_mobile.Text);
        //cmd.Parameters.AddWithValue("@address1", Text_address.Text);
        library.libservice obj = new library.libservice();
        int a = obj.insert(Card, DropDown_holder.SelectedItem.ToString(), Text_id.Text, Text_name.Text, Text_batch.Text, Text_class.Text,
                           Text_section.Text, Text_stream.Text, Text_roll.Text, Text_father.Text, Text_mobile.Text, Text_address.Text);

        if (a > 0)
        {
            //cmd.ExecuteNonQuery();
            gridshow();
            blank();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Submit!!!!');", true);
        }
    }
Esempio n. 10
0
 public void gridshow()
 {
     library.libservice obj = new library.libservice();
     GridView1.DataSource = obj.addbookshow();
     GridView1.DataBind();
 }