protected void Page_Load(object sender, EventArgs e) { Label lb; lb = (Label)Page.Master.FindControl("lblloginusr"); lb.Text = Session["uname"].ToString(); if (Session["isadmin"].ToString() == "Y") { Menu mnu; mnu = (Menu)Page.Master.FindControl("mnuadmin"); mnu.Visible = true; } if (Session["isstaff"].ToString() == "Y") { dr = db.SqlDataReaderConnection("select intStaff_ID,intItem_ID,intBookDetail_ID,Issue_Date,Due_Date,Status from IssueRenewReturnTable where intStaff_ID= '" + Session["uid"].ToString() + "' and Status='Y'", "IssueRenewReturnTable"); } if (Session["isstaff"].ToString() == "N") { dr = db.SqlDataReaderConnection("select intStudent_ID,intItem_ID,intBookDetail_ID,Issue_Date,Due_Date,Status from IssueRenewReturnTable where intStudent_ID= '" + Session["uid"].ToString() + "' and Status='Y'", "IssueRenewReturnTable"); } GridView1.DataSource = dr; GridView1.DataBind(); }
protected void btninsert_Click(object sender, EventArgs e) { SqlDataReader dr; SqlCommand cmd = new SqlCommand(); string rid; dr = db.SqlDataReaderConnection("select [intAuthor_ID] from AuthorMaster", "AuthorMaster"); if (dr.HasRows == false) { rid = "AID" + 1; txtauthorid.Text = rid; txtauthornm.Text = ""; } else { cmd = db.SqlCommandConnection("select count([intAuthor_ID]) from AuthorMaster", "AuthorMaster"); rid = cmd.ExecuteScalar().ToString(); //rid = rid.Substring(3); rid = "AID" + (int.Parse(rid) + 1).ToString(); } txtauthorid.Text = rid; txtauthornm.Text = ""; btnsave.Enabled = true; btninsert.Enabled = false; }
protected void btninsert_Click(object sender, EventArgs e) { SqlDataReader dr; SqlCommand cmd = new SqlCommand(); string rid; dr = db.SqlDataReaderConnection("select [intBill_ID] from BillDetailMaster", "BillDetailMaster"); if (dr.HasRows == false) { rid = "BID" + 1; txtbid.Text = rid; txtbrno.Text = ""; txtdscnt.Text = ""; txtamt.Text = ""; } else { cmd = db.SqlCommandConnection("select max([intBill_ID]) from BillDetailMaster", "BillDetailMaster"); rid = cmd.ExecuteScalar().ToString(); rid = rid.Substring(3); rid = "BID" + (int.Parse(rid) + 1).ToString(); } txtbid.Text = rid; txtbrno.Text = ""; txtdscnt.Text = ""; txtamt.Text = ""; btnsave.Enabled = true; btninsert.Enabled = false; }
protected void btninsert_Click(object sender, EventArgs e) { SqlDataReader dr; SqlCommand cmd = new SqlCommand(); string rid; dr = db.SqlDataReaderConnection("select max([intYear_ID]) from YearMaster", " YearMaster"); if (dr.HasRows == false) { rid = "SID" + 1; txtstkid.Text = rid; txtstknm.Text = ""; } else { cmd = db.SqlCommandConnection("select [intStock_Type_ID] from StockTypeMaster", " StockTypeMaster"); rid = cmd.ExecuteScalar().ToString(); rid = rid.Substring(3); rid = "SID" + (int.Parse(rid) + 1).ToString(); } txtstkid.Text = rid; txtstknm.Text = ""; btnsave.Enabled = true; btninsert.Enabled = false; }
protected void Page_Load(object sender, EventArgs e) { Label lb; MainDB db = new MainDB(); lb = (Label)Page.Master.FindControl("lblloginusr"); lb.Text = Session["uname"].ToString(); if (Session["isadmin"].ToString() == "Y") { Menu mnu; mnu = (Menu)Page.Master.FindControl("mnuadmin"); mnu.Visible = true; } if (!IsPostBack) { GridViewDataBind(); Session["ds"] = ds; } dr = db.SqlDataReaderConnection("select intSupplier_ID from SupplierMaster", "SupplierMaster"); ddlspid.DataSource = dr; ddlspid.DataTextField = "intSupplier_ID"; ddlspid.DataBind(); }