protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["name"] != null) { clsSqlHelper objDb = new clsSqlHelper(clsSettings.strsqlcon); Dictionary <string, object> dicparamread = new Dictionary <string, object>(); dicparamread.Add("@pk_Client_id", Session["id"].ToString()); if (objDb.objExecuteQuery("spCheckUserDetails", HelperLibrary.clsSqlHelper.QueryExcution.storeProcedure, dicparamread)) { DataTable dt = new DataTable(); dt = objDb.objDataset.Tables[0]; if (Convert.ToInt32(dt.Rows[0][0]) == 0) { Response.Write("<script>alert('Please Signup First');</script>"); Response.Redirect("OnlineRegistration.aspx", false); return; } } Dictionary <string, object> DicData = new Dictionary <string, object>(); string StrQuery = "SELECT pkcourseid,Course FROM dbo.course with(nolock) WHERE ACTIVE='True'"; if (objDb.objExecuteQuery(StrQuery, HelperLibrary.clsSqlHelper.QueryExcution.ExecuteDataAdapter)) { ddCourse.DataSource = objDb.objDataset.Tables[0]; ddCourse.DataBind(); } ListItem licourse = new ListItem("Select Course", "-1"); ddCourse.Items.Insert(0, licourse); ListItem licategory = new ListItem("Select Category", "-1"); ddCategory.Items.Insert(0, licategory); ListItem lisemester = new ListItem("Select Semester", "-1"); ddSemester.Items.Insert(0, lisemester); ddCategory.Enabled = false; ddSemester.Enabled = false; btuapply.Enabled = false; txtcomments.Enabled = false; btncancel.Enabled = false; chkbook.Enabled = false; chkbook.Visible = false; lblBooks.Visible = false; lblComments.Visible = false; txtcomments.Visible = false; btuapply.Visible = false; btncancel.Visible = false; } else { Response.Write("<script>alert('Please SignUp First Or Login');</script>"); Response.Redirect("login.aspx"); } } }
public static void isLogin(string Param1, string Param2) { try { clsSqlHelper objDBEngine = new clsSqlHelper(clsSettings.strsqlcon); string strQuery = "SELECT firstname+''+lastname FROM dbo.signup WHERE usename=@usename AND password=@password"; Dictionary <string, object> dicData = new Dictionary <string, object>(); dicData.Add("@usename", Param1); dicData.Add("@password", Param2); objDBEngine.objExecuteQuery(strQuery, clsSqlHelper.QueryExcution.ExecuteReader, dicData); if (objDBEngine.dtrData.HasRows && objDBEngine.dtrData.Read()) { //return objDBEngine.dtrData.GetString(0); } else { //return null; } //objDB.objExecuteQuery( } catch (Exception) { throw; } }
private void BtnLogin_Click(object sender, EventArgs e) { if (txtusername.Text.Trim().Length != 0 && txtpassword.Text.Trim().Length != 0) { clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("@username", txtusername.Text); dic.Add("@password", txtpassword.Text); string qu = "SELECT pkemployeeid,firstname+' '+lastname FROM dbo.signup WHERE username=@username AND password=@password"; objDB.objExecuteQuery(qu, clsSqlHelper.QueryExcution.ExecuteReader, dic); if (objDB.dtrData.HasRows && objDB.dtrData.Read() && !objDB.dtrData.IsDBNull(0)) { int id = objDB.dtrData.GetInt32(0); string name = objDB.dtrData.GetString(1); this.Hide(); home home = new home(); home.namef = name; home.idf = id; home.Show(); } else { AutoClosingMessage.AutoClosingMessageBox.Show("Invalid Username or Password", "Error", 3000); txtpassword.Clear(); } } else { AutoClosingMessage.AutoClosingMessageBox.Show("Enter Username And Password", "Error", 3000); txtpassword.Clear(); } }
private void dataload_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == dataload.Columns["Edit"].Index) { btnsave.Text = "Update"; clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); values.Text = dataload.CurrentRow.Cells["ID"].Value.ToString(); txtsemester.Text = dataload.CurrentRow.Cells["Semester"].Value.ToString(); string SubQuery = "SELECT a.fkcourse AS [idcourse],c.course AS [course],a.fkidcategory AS[idcategory],b.category AS[category],a.active FROM dbo.semester a JOIN dbo.category b ON a.fkidcategory=b.pkidcategory JOIN dbo.course c ON c.pkcourseid=a.fkcourse WHERE a.pkidsemester='" + values.Text + "'"; if (objDB.objExecuteQuery(SubQuery, clsSqlHelper.QueryExcution.ExecuteDataAdapter)) { txtcourse.DataSource = objDB.objDataset.Tables[0]; txtcourse.ValueMember = "idcourse"; txtcourse.DisplayMember = "Course"; txtcategory.DataSource = objDB.objDataset.Tables[0]; txtcategory.ValueMember = "idcategory"; txtcategory.DisplayMember = "category"; bool active = Convert.ToBoolean(objDB.objDataset.Tables[0].Rows[0][4]); if (active) { chkactive.Checked = true; } else { chkactive.Checked = false; } } txtcourse.DropDownStyle = ComboBoxStyle.DropDown; firstpanel.Visible = false; dataload.Visible = false; thirdpanel.Visible = true; } }
protected void Login_Click(object sender, EventArgs e) { clsSqlHelper objBD = new clsSqlHelper(clsSettings.strsqlcon); try { string StrQuery = "SELECT firstname+' '+lastname,pkclient FROM dbo.client WHERE username=@username AND password=@password"; Dictionary <string, object> DicData = new Dictionary <string, object>(); DicData.Add("@username", txtusername.Text); DicData.Add("@password", txtpassword.Text); objBD.objExecuteQuery(StrQuery, HelperLibrary.clsSqlHelper.QueryExcution.ExecuteReader, DicData); if (objBD.dtrData.HasRows && objBD.dtrData.Read() && !objBD.dtrData.IsDBNull(0)) { Session["name"] = objBD.dtrData.GetString(0); Session["id"] = objBD.dtrData.GetInt32(1); Response.Redirect("Index.aspx", false); } else { Response.Write("<script>alert('Invalid Username or Password');</script>"); } } catch (Exception ex) { string j = ex.ToString(); } finally { objBD.blnCloseConnection(); } }
public void name() { clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); string strQuery = ""; if (clientid != 0) { strQuery = "SELECT pkclient AS [Id],(firstname+' '+middlename+' '+lastname)AS NAME FROM dbo.client WHERE pkclient='" + clientid + "'"; } else { strQuery = "SELECT pkclient AS [Id],(firstname+' '+middlename+' '+lastname)AS NAME FROM dbo.client"; } if (objDB.objExecuteQuery(strQuery, clsSqlHelper.QueryExcution.ExecuteDataAdapter)) { txtname.DataSource = objDB.objDataset.Tables[0]; txtname.ValueMember = "ID"; txtname.DisplayMember = "NAME"; } if (clientid == 0) { DataRow dr = objDB.objDataset.Tables[0].NewRow(); dr["ID"] = 0; dr["NAME"] = "-Select Course-"; objDB.objDataset.Tables[0].Rows.InsertAt(dr, 0); txtname.SelectedIndex = 0; } else { txtname.SelectedIndex = 0; } }
protected void ddSemester_SelectedIndexChanged(object sender, EventArgs e) { if (ddSemester.SelectedIndex != -1) { txtcomments.Enabled = true; btuapply.Enabled = true; btncancel.Enabled = true; chkbook.Visible = true; chkbook.Enabled = true; lblBooks.Visible = true; lblComments.Visible = true; txtcomments.Visible = true; btuapply.Visible = true; btncancel.Visible = true; clsSqlHelper objDb = new clsSqlHelper(clsSettings.strsqlcon); string Course1 = ddCourse.SelectedValue.ToString(); string Category = ddCategory.SelectedValue.ToString(); string semester = ddSemester.SelectedValue.ToString(); Dictionary <string, object> objParam = new Dictionary <string, object>(); objParam.Add("@Course1", Course1); objParam.Add("@Category", Category); objParam.Add("@semester", semester); string StrQuery = "SELECT pkidbooks,bookname FROM dbo.books WHERE fkidcategory=" + Category + " AND fkcourseid=" + Course1 + " AND fkidsemester=" + semester + " and ACTIVE='True'"; if (objDb.objExecuteQuery(StrQuery, HelperLibrary.clsSqlHelper.QueryExcution.ExecuteDataAdapter, objParam)) { chkbook.DataSource = objDb.objDataset.Tables[0]; chkbook.DataBind(); for (int i = 0; i < chkbook.Items.Count; i++) { chkbook.Items[i].Selected = true; } } } }
protected void btuapply_Click(object sender, EventArgs e) { clsSqlHelper ObjDb = new clsSqlHelper(clsSettings.strsqlcon); Dictionary <string, object> DicParam = new Dictionary <string, object>(); string Course1 = ddCourse.SelectedValue.ToString(); string Category = ddCategory.SelectedValue.ToString(); string semester = ddSemester.SelectedValue.ToString(); string bookid = ""; string id = Session["id"].ToString(); //string bookid= DicParam.Add("@dk_Client_id", id); DicParam.Add("@fk_Course_id", Course1); DicParam.Add("@fk_Category_id", Category); DicParam.Add("@fk_Semester_Id", semester); for (int i = 0; i < chkbook.Items.Count; i++) { if (chkbook.Items[i].Selected) { if (bookid == "") { bookid = chkbook.Items[i].Value.ToString(); } else if (bookid != "") { bookid = bookid + ',' + chkbook.Items[i].Value.ToString(); } } } DicParam.Add("@fk_Book_id", bookid); DicParam.Add("@Comments", txtcomments.Text); ObjDb.objExecuteQuery("SpInserttblTransaction", HelperLibrary.clsSqlHelper.QueryExcution.storeProcedure, DicParam); Response.Write("<script LANGUAGE='JavaScript' >alert('Thank You For apply Book');window.location='Index.aspx';</script>"); }
public void datagridload() { dataload.DataSource = null; dataload.Rows.Clear(); dataload.Columns.Clear(); string type; clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); if (secondpanel.Visible == false) { txtfromdate.Value = DateTime.Now; txttodate.Value = DateTime.Now.AddDays(+1); type = "SELECTALL"; dic.Add("@stardate", Convert.ToDateTime(txtfromdate.Value).ToString("yyyy-MM-dd")); dic.Add("@enddate", Convert.ToDateTime(txttodate.Value).ToString("yyyy-MM-dd")); dic.Add("@StatementType", type); } else { if (txtsearch.Text.Trim().Length == 0 && txtsearchlastname.Text.Trim().Length == 0) { type = "SELECTALL"; dic.Add("@stardate", Convert.ToDateTime(txtfromdate.Value).ToString("yyyy-MM-dd")); dic.Add("@enddate", Convert.ToDateTime(txttodate.Value).ToString("yyyy-MM-dd")); dic.Add("@StatementType", type); } else if (txtsearch.Text.Trim().Length != 0 || txtsearchlastname.Text.Trim().Length != 0) { type = "SELECTONE"; dic.Add("@firstname", txtsearch.Text); dic.Add("@lastname", txtsearchlastname.Text); dic.Add("@StatementType", type); } } if (objDB.objExecuteQuery("Sp_admin_client_view", clsSqlHelper.QueryExcution.storeProcedure, dic)) { DataTable dt = new DataTable(); dt = objDB.objDataset.Tables[0]; dataload.DataSource = dt; } dataload.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dataload.AlternatingRowsDefaultCellStyle.BackColor = Color.LightYellow; dataload.ClearSelection(); var col5 = new DataGridViewButtonColumn(); col5.HeaderText = "Edit"; col5.Name = "Edit"; col5.Text = "Edit"; col5.UseColumnTextForButtonValue = true; dataload.Columns.AddRange(new DataGridViewColumn[] { col5 }); //var col6 = new DataGridViewButtonColumn(); //col6.HeaderText = "PDF"; //col6.Name = "PDF"; //col6.Text = "PDF"; //col6.UseColumnTextForButtonValue = true; //dataload.Columns.AddRange(new DataGridViewColumn[] { col6 }); }
private void btnadd_Click(object sender, EventArgs e) { firstpanel.Visible = false; secondpanel.Visible = false; thirdpanel.Visible = true; dataload.Visible = false; btnsave.Text = "Save"; clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); string StrQuery = "SELECT MAX(pkidbooks) FROM dbo.books"; objDB.objExecuteQuery(StrQuery, clsSqlHelper.QueryExcution.ExecuteReader, dic); if (objDB.dtrData.HasRows && objDB.dtrData.Read() && !objDB.dtrData.IsDBNull(0)) { values.Text = (objDB.dtrData.GetInt32(0) + 1).ToString(); } else { values.Text = "1"; } txtcourse.DataSource = null; txtcourse.Text = ""; txtcategory.DataSource = null; txtcategory.Text = ""; txtsemester.DataSource = null; txtsemester.Text = ""; courseidname(); txtcourse.Enabled = true; txtcategory.Enabled = true; txtsemester.Enabled = true; btnsave.Enabled = true; chkactive.Checked = true; number = 1; }
public void datagridload() { dataload.DataSource = null; dataload.Rows.Clear(); dataload.Columns.Clear(); clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); if (objDB.objExecuteQuery("Sp_admin_currentstock", clsSqlHelper.QueryExcution.storeProcedure)) { DataTable dt = new DataTable(); dt = objDB.objDataset.Tables[0]; dataload.DataSource = dt; } dataload.ReadOnly = true; dataload.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dataload.AlternatingRowsDefaultCellStyle.BackColor = Color.LightYellow; dataload.ClearSelection(); // dataload.Columns["Srno"].DisplayIndex = 0; dataload.Columns["Course"].DisplayIndex = 1; dataload.Columns["Category"].DisplayIndex = 2; dataload.Columns["Semester"].DisplayIndex = 3; dataload.Columns["Books"].DisplayIndex = 4; dataload.Columns["Qty"].DisplayIndex = 5; dataload.Columns["status"].DisplayIndex = 6; }
private void dataload_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == dataload.Columns["Edit"].Index) { btnsave.Text = "Update"; } //else if (e.RowIndex >= 0 && e.ColumnIndex == dataload.Columns["Delete"].Index) //{ // btnsave.Text = "Delete"; //} clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("@username", dataload.CurrentRow.Cells["USERNAME"].Value.ToString()); string qu = "SELECT pkemployeeid,firstname ,middlename ,lastname ,username ,password FROM dbo.signup WHERE username=@username"; objDB.objExecuteQuery(qu, clsSqlHelper.QueryExcution.ExecuteReader, dic); if (objDB.dtrData.HasRows && objDB.dtrData.Read() && !objDB.dtrData.IsDBNull(0)) { values.Text = objDB.dtrData.GetInt32(0).ToString(); txtfirstname.Text = objDB.dtrData.GetString(1); txtmiddlename.Text = objDB.dtrData.GetString(2); txtlastname.Text = objDB.dtrData.GetString(3); txtusername.Text = objDB.dtrData.GetString(4); txtpassword.Text = objDB.dtrData.GetString(5); } firstpanel.Visible = false; dataload.Visible = false; thirdpanel.Visible = true; }
private void searchcourseidname() { txtsearchcourse.DataSource = null; clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); string qu = "SELECT pkcourseid AS [ID],Course AS [Course] FROM dbo.course"; if (objDB.objExecuteQuery(qu, clsSqlHelper.QueryExcution.ExecuteDataAdapter)) { txtsearchcourse.DataSource = objDB.objDataset.Tables[0]; txtsearchcourse.ValueMember = "ID"; txtsearchcourse.DisplayMember = "Course"; } DataRow dr = objDB.objDataset.Tables[0].NewRow(); dr["ID"] = 0; dr["Course"] = "-Select Course-"; objDB.objDataset.Tables[0].Rows.InsertAt(dr, 0); txtsearchcourse.SelectedIndex = 0; if (txtsearchcourse.SelectedIndex == 0) { txtsearchcategory.DataSource = null; txtsearchcategory.Text = ""; txtsearchsemester.DataSource = null; txtsearchsemester.Text = ""; txtsearchbook.DataSource = null; txtsearchbook.Text = ""; } }
public ClsReturnValue basie(string username, string password) { ClsReturnValue objReturn = new ClsReturnValue(); clsSqlHelper objDBEnging = new clsSqlHelper(clsSettings.strsqlcon); try { string StrQuery = "INSERT dbo.books(fkcourseid,bookname,publishyear,writename,barcode,fkemloyeeid,lastupdate)VALUES (@fkcourseid,@bookname,@publishyear,@writename,@barcode,@fkemloyeeid,@lastupdate)"; Dictionary <string, object> DicData = new Dictionary <string, object>(); DicData.Add("@username", username); DicData.Add("@password", password); objDBEnging.objExecuteQuery(StrQuery, clsSqlHelper.QueryExcution.ExecuteNonQuery, DicData); objReturn.blnSuccess = true; objReturn.strResponse = "|Data Saved|"; return(objReturn); } catch (Exception ex) { objReturn.blnSuccess = false; objReturn.strException = "|Error =" + ex.ToString() + "|"; return(objReturn); } finally { objDBEnging.blnCloseConnection(); } }
protected void inputsubmit_Click(object sender, EventArgs e) { ClsReturnValue objReturn = new ClsReturnValue(); clsSqlHelper objDBEnging = new clsSqlHelper(clsSettings.strsqlcon); try { string StrQuery = ""; Dictionary <string, object> DicData = new Dictionary <string, object>(); DicData.Add("@firstname", inputName.Text); DicData.Add("@moblie", inputnumber); DicData.Add("@emailid", emailid); DicData.Add("@username", username); DicData.Add("@password", input); objDBEnging.objExecuteQuery(StrQuery, clsSqlHelper.QueryExcution.ExecuteNonQuery, DicData); objReturn.blnSuccess = true; objReturn.strResponse = "|Data Saved|"; return(objReturn); } catch (Exception ex) { objReturn.blnSuccess = false; objReturn.strException = "|Error =" + ex.ToString() + "|"; return(objReturn); } finally { objDBEnging.blnCloseConnection(); } }
private void bookidname() { if (txtsemester.SelectedIndex > 0) { txtbook.DataSource = null; txtsemester.Text = ""; clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); string qu = "SELECT pkidbooks as [id],bookname as [book] FROM dbo.books WHERE fkcourseid='" + txtcourse.SelectedValue + "' AND fkidcategory='" + txtcategory.SelectedValue + "' AND fkidsemester='" + txtsemester.SelectedValue + "'"; if (objDB.objExecuteQuery(qu, clsSqlHelper.QueryExcution.ExecuteDataAdapter)) { txtbook.DataSource = objDB.objDataset.Tables[0]; txtbook.ValueMember = "id"; txtbook.DisplayMember = "book"; } DataRow dr = objDB.objDataset.Tables[0].NewRow(); dr["id"] = 0; dr["book"] = "-Select Book-"; objDB.objDataset.Tables[0].Rows.InsertAt(dr, 0); txtbook.SelectedIndex = 0; txtbook.Focus(); } if (txtsemester.SelectedIndex == 0) { txtbook.DataSource = null; txtbook.Text = ""; datadetail.DataSource = null; datadetail.Rows.Clear(); datadetail.Columns.Clear(); } }
private void semesteridname() { if (txtcategory.SelectedIndex > 0) { txtsemester.DataSource = null; txtsemester.Text = ""; clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); string qu = "SELECT pkidsemester as id,semester FROM dbo.semester WHERE fkcourse='" + txtcourse.SelectedValue + "' AND fkidcategory='" + txtcategory.SelectedValue + "'"; if (objDB.objExecuteQuery(qu, clsSqlHelper.QueryExcution.ExecuteDataAdapter)) { txtsemester.DataSource = objDB.objDataset.Tables[0]; txtsemester.ValueMember = "id"; txtsemester.DisplayMember = "semester"; } DataRow dr = objDB.objDataset.Tables[0].NewRow(); dr["id"] = 0; dr["semester"] = "-Select Semester-"; objDB.objDataset.Tables[0].Rows.InsertAt(dr, 0); txtsemester.SelectedIndex = 0; txtsemester.Focus(); } else if (txtcategory.SelectedIndex == 0) { txtsemester.DataSource = null; txtsemester.Text = ""; txtbooks.Text = ""; } }
protected void btufirst_Click(object sender, EventArgs e) { clsSqlHelper ObjBD = new clsSqlHelper(clsSettings.strsqlcon); Dictionary <string, object> DicData = new Dictionary <string, object>(); DicData.Add("@emailid ", txtUserEmail.Text.Trim()); if (ObjBD.objExecuteQuery("SpEmailIdAlready", HelperLibrary.clsSqlHelper.QueryExcution.storeProcedure, DicData)) { DataTable dt = new DataTable(); dt = ObjBD.objDataset.Tables[0]; if (Convert.ToInt32(dt.Rows[0][0]) != -99 && txtPassword.Text == txtConfirmPassword.Text) { first.Visible = false; second.Visible = true; third.Visible = false; } else if (Convert.ToInt32(dt.Rows[0][0]) == -99 && txtPassword.Text == txtConfirmPassword.Text) { Response.Write("<script>alert('Email ID is Already Exist');</script>"); txtUserEmail.Focus(); return; } else if (Convert.ToInt32(dt.Rows[0][0]) != -99 && txtPassword.Text != txtConfirmPassword.Text) { Response.Write("<script>alert('The password and its confirm are not the same');</script>"); txtPassword.Text = string.Empty; txtConfirmPassword.Text = string.Empty; txtPassword.Focus(); return; } } }
private void dataloadforapply() { Dvgbooks.DataSource = null; Dvgbooks.Columns.Clear(); Dvgbooks.Rows.Clear(); Dictionary <string, object> dic = new Dictionary <string, object>(); clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); dic.Add("@bookname", txtbook.Text); if (objDB.objExecuteQuery("Sp_admin_book_apply", clsSqlHelper.QueryExcution.storeProcedure, dic)) { DataTable dt = new DataTable(); dt = objDB.objDataset.Tables[0]; Dvgbooks.DataSource = dt; } Dvgbooks.Columns["Book Id"].Visible = false; Dvgbooks.Columns["Barcode"].Visible = false; Dvgbooks.Columns["Qty"].Width = 40; DataGridViewCheckBoxColumn dgvCmb = new DataGridViewCheckBoxColumn(); dgvCmb.ValueType = typeof(bool); dgvCmb.Name = "Chk"; dgvCmb.HeaderText = "Approved"; Dvgbooks.Columns.Add(dgvCmb); DataGridViewColumn column364 = dataload.Columns["Chk"]; Dvgbooks.Columns["Semester"].Width = 80; Dvgbooks.Columns["Chk"].Width = 60; Dvgbooks.Columns["Write Name"].Visible = false; Dvgbooks.Columns["Publish Year"].Visible = false; }
private void dataload_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == dataload.Columns["Edit"].Index) { btnsave.Text = "Update"; clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); values.Text = dataload.CurrentRow.Cells["ID"].Value.ToString(); txtcategory.Text = dataload.CurrentRow.Cells["Category"].Value.ToString(); pkidcategory = int.Parse(values.Text); string qu = "SELECT b.course AS [Coures],b.pkcourseid,a.active FROM dbo.category a JOIN dbo.course b ON a.fkcourseid=b.pkcourseid WHERE a.pkidcategory=" + pkidcategory + ""; if (objDB.objExecuteQuery(qu, clsSqlHelper.QueryExcution.ExecuteDataAdapter)) { txtcourse.DataSource = objDB.objDataset.Tables[0]; txtcourse.DisplayMember = "Coures"; txtcourse.ValueMember = "pkcourseid"; bool active = Convert.ToBoolean(objDB.objDataset.Tables[0].Rows[0][2]); if (active) { chkactive.Checked = true; } else { chkactive.Checked = false; } } firstpanel.Visible = false; dataload.Visible = false; thirdpanel.Visible = true; } }
private void dataload_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == dataload.Columns["Edit"].Index) { btnsave.Text = "Update"; clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("@pkcourseid", dataload.CurrentRow.Cells["ID"].Value.ToString()); string qu = "SELECT pkcourseid AS [ID],Course AS [Course],depositamount,active FROM dbo.course WHERE pkcourseid=@pkcourseid"; objDB.objExecuteQuery(qu, clsSqlHelper.QueryExcution.ExecuteReader, dic); if (objDB.dtrData.HasRows && objDB.dtrData.Read() && !objDB.dtrData.IsDBNull(0)) { values.Text = objDB.dtrData.GetInt32(0).ToString(); txtcourse.Text = objDB.dtrData.GetString(1); pkidcourse = int.Parse(values.Text); txtdepositamt.Text = objDB.dtrData.GetDecimal(2).ToString(); bool active = Convert.ToBoolean(objDB.dtrData.GetString(3)); if (active) { chkactive.Checked = true; } else { chkactive.Checked = false; } } firstpanel.Visible = false; dataload.Visible = false; thirdpanel.Visible = true; } }
private void btnsave_Click(object sender, EventArgs e) { clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); if (txtcourse.Text.Trim().Length != 0 && txtcategory.Text.Trim().Length != 0 && btnsave.Text == "Save") { dic.Add("@fkcourseid", txtcourse.SelectedValue); dic.Add("@fkidcategory", txtcategory.SelectedValue); dic.Add("@fkidsemester", txtsemester.SelectedValue); dic.Add("@fkidbooks", txtbook.SelectedValue); dic.Add("@fkemployeeid", fkemployeeid); dic.Add("@qty", txtstock.Text); dic.Add("@barcode", datadetail.Rows[0].Cells["Barcode"].Value); if (objDB.objExecuteQuery("Sp_admin_stock_insert_update", clsSqlHelper.QueryExcution.storeProcedure, dic)) { AutoClosingMessage.AutoClosingMessageBox.Show("Data Saved", "Message", 3000); datagridload(); ClearTextBoxes(this); savecancel(); } } else if (pkidstock != null) { if (qty < int.Parse(txtstock.Text)) { dic.Add("@pkidstock", pkidstock); dic.Add("@qty", txtstock.Text); dic.Add("@oldqty", qty); if (objDB.objExecuteQuery("Sp_admin_stock_update", clsSqlHelper.QueryExcution.storeProcedure, dic)) { AutoClosingMessage.AutoClosingMessageBox.Show("Data Saved", "Message", 3000); datagridload(); ClearTextBoxes(this); savecancel(); } } } else { AutoClosingMessage.AutoClosingMessageBox.Show("Please Fill All Detail", "Message", 3000); return; } }
private void btnsave_Click(object sender, EventArgs e) { if (txtcourse.Text.Trim().Length != 0 && txtcategory.Text.Trim().Length != 0 && txtsemester.Text.Trim().Length != 0 && txtbooks.Text.Trim().Length != 0 && txtpublishyear.Text.Trim().Length != 0 && txtwritename.Text.Trim().Length != 0) { barcodemake(); clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("@fkcourseid", txtcourse.SelectedValue); dic.Add("@bookname", txtbooks.Text); dic.Add("@publishyear", txtpublishyear.Text); dic.Add("@writename", txtwritename.Text); dic.Add("@barcode", barcode); dic.Add("@fkemployeeid", fkemployeeid); dic.Add("@fkidcategory", txtcategory.SelectedValue); dic.Add("@fkidsemester", txtsemester.SelectedValue); bool active = chkactive.Checked; if (active == true) { dic.Add("@isactive", "True"); } else { dic.Add("@isactive", "False"); } if (btnsave.Text == "Save") { dic.Add("@StatementType", "insert"); } else if (btnsave.Text == "Update") { dic.Add("@StatementType", "update"); dic.Add("@pkidbooks", pkidbook); } if (objDB.objExecuteQuery("Sp_admin_book_insert_update", clsSqlHelper.QueryExcution.storeProcedure, dic)) { DataTable dt = new DataTable(); dt = objDB.objDataset.Tables[0]; if (Convert.ToInt32(dt.Rows[0][0]) == 0) { AutoClosingMessage.AutoClosingMessageBox.Show("Data Saved", "Message", 3000); } else { AutoClosingMessage.AutoClosingMessageBox.Show("Data Already Saved " + Environment.NewLine + " Book ID:-" + dt.Rows[0][0].ToString() + "", "Message", 5000); } datagridload(); ClearTextBoxes(this); savecancel(); } } else { AutoClosingMessage.AutoClosingMessageBox.Show("Please Fill All Detail", "Message", 3000); return; } }
private void dataload_CellClick(object sender, DataGridViewCellEventArgs e) { clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("@pkidstock", dataload.CurrentRow.Cells["Id"].Value); if (e.RowIndex >= 0 && e.ColumnIndex == dataload.Columns["Delete"].Index) { dataload.CurrentRow.DefaultCellStyle.SelectionBackColor = Color.Red; DialogResult a = MessageBox.Show("Are You Sure Delete" + Environment.NewLine + "Book Name:- " + dataload.CurrentRow.Cells["Book Name"].Value + Environment.NewLine + "Qty:- " + dataload.CurrentRow.Cells["Qty"].Value + "", "Question ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (a == DialogResult.Yes) { if (objDB.objExecuteQuery("Sp_admin_stock_delete", clsSqlHelper.QueryExcution.storeProcedure, dic)) { DataTable dt = new DataTable(); dt = objDB.objDataset.Tables[0]; if (Convert.ToInt32(dt.Rows[0][0]) == 1) { AutoClosingMessage.AutoClosingMessageBox.Show("Data Saved", "Message", 3000); } else { AutoClosingMessage.AutoClosingMessageBox.Show("Can't Delete Sum Books Are Issue ", "Message", 5000); } datagridload(); ClearTextBoxes(this); savecancel(); } } else if (a == DialogResult.No) { dataload.CurrentRow.DefaultCellStyle.SelectionBackColor = Color.Empty; } } else if (e.RowIndex >= 0 && e.ColumnIndex == dataload.Columns["Edit"].Index) { pkidstock = int.Parse(dataload.CurrentRow.Cells["Id"].Value.ToString()); secondpanel.Visible = false; btnhidesearch.Visible = false; firstpanel.Visible = false; ClearTextBoxes(this); datagridload(); thirdpanel.Visible = true; values.Text = dataload.CurrentRow.Cells["Id"].Value.ToString(); txtcourse.Text = dataload.CurrentRow.Cells["Course"].Value.ToString(); txtcategory.Text = dataload.CurrentRow.Cells["Category"].Value.ToString(); txtsemester.Text = dataload.CurrentRow.Cells["Semester"].Value.ToString(); txtbook.Text = dataload.CurrentRow.Cells["Book Name"].Value.ToString(); qty = int.Parse(dataload.CurrentRow.Cells["Qty"].Value.ToString()); txtstock.Text = qty.ToString(); btnsave.Text = "Update"; comboxenabledisable(); } }
private void btnsearchclick_Click(object sender, EventArgs e) { bookdetail.DataSource = null; bookdetail.Rows.Clear(); bookdetail.Columns.Clear(); Dictionary <string, object> dic = new Dictionary <string, object>(); clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); dic.Add("@fkclient", Client_ID); string strProcedureName = ""; if (paymentreturn == "Yes") { strProcedureName = "Sp_admin_bookview_return"; btnsave.Text = "Payment Return"; } else { strProcedureName = "Sp_admin_bookview_approved"; btnsave.Text = "Book Return"; } if (objDB.objExecuteQuery(strProcedureName, clsSqlHelper.QueryExcution.storeProcedure, dic)) { DataTable dt = new DataTable(); dt = objDB.objDataset.Tables[0]; bookdetail.DataSource = dt; if (bookdetail.Rows.Count == 0) { AutoClosingMessage.AutoClosingMessageBox.Show("Data not found" + txtfirstname.Text + "", "Message", 3000); txtfirstname.Text = ""; txtlastname.Text = ""; return; } } detailpanel.Visible = true; DataGridViewCheckBoxColumn dgvCmb = new DataGridViewCheckBoxColumn(); dgvCmb.ValueType = typeof(bool); dgvCmb.Name = "retrun"; dgvCmb.HeaderText = "Retrun"; bookdetail.Columns.Add(dgvCmb); DataGridViewColumn column = bookdetail.Columns["retrun"]; visiblecolumns(); foreach (DataGridViewRow row in bookdetail.Rows) { DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells["retrun"]; chk.Value = !(chk.Value == null ? false : (bool)chk.Value); //because chk.Value is initialy null } secondpanel.Visible = false; firstpanel.Visible = false; btnhidesearch.Visible = false; btnsearch.Visible = true; }
protected void btnaccept_Click(object sender, EventArgs e) { clsSqlHelper ObjBD = new clsSqlHelper(clsSettings.strsqlcon); Dictionary <string, object> DicData = new Dictionary <string, object>(); DicData.Add("@pkclient", Session["id"]); if (ObjBD.objExecuteQuery("Sp_client_teamandcondition", HelperLibrary.clsSqlHelper.QueryExcution.storeProcedure, DicData)) { Response.Write("<script>alert('Apply For Books');</script>"); Server.Transfer("Books.aspx", true); } }
public void datagridload() { dataload.DataSource = null; dataload.Rows.Clear(); dataload.Columns.Clear(); Dictionary <string, object> dic = new Dictionary <string, object>(); clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); if (secondpanel.Visible == false) { txtfromdate.Value = DateTime.Now; txttodate.Value = DateTime.Now.AddDays(+1); } dic.Add("@setdate", Convert.ToDateTime(txtfromdate.Value).ToString("yyyy-MM-dd")); dic.Add("@enddate", Convert.ToDateTime(txttodate.Value).ToString("yyyy-MM-dd")); if (objDB.objExecuteQuery("Sp_admin_bookissue", clsSqlHelper.QueryExcution.storeProcedure, dic)) { DataTable dt = new DataTable(); dt = objDB.objDataset.Tables[0]; dataload.DataSource = dt; } if (dataload.Rows.Count > 0) { dataload.Columns["Totaldeposit"].DefaultCellStyle.Format = "0.00##"; dataload.Columns["pk_course_id"].Visible = false; dataload.Columns["pk_id_category"].Visible = false; dataload.Columns["pk_id_semester"].Visible = false; var col5 = new DataGridViewButtonColumn(); col5.HeaderText = "Details"; col5.Name = "Details"; col5.Text = "Details"; col5.UseColumnTextForButtonValue = true; dataload.Columns.AddRange(new DataGridViewColumn[] { col5 }); var View = new DataGridViewButtonColumn(); View.HeaderText = "BooksView"; View.Name = "Booksview"; View.Text = "Booksview"; View.UseColumnTextForButtonValue = true; dataload.Columns.AddRange(new DataGridViewColumn[] { View }); var picture = new DataGridViewButtonColumn(); picture.HeaderText = "Picture"; picture.Name = "Picture"; picture.Text = "Picture"; picture.UseColumnTextForButtonValue = true; dataload.Columns.AddRange(new DataGridViewColumn[] { picture }); dataload.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dataload.AlternatingRowsDefaultCellStyle.BackColor = Color.LightYellow; dataload.ClearSelection(); } }
private void semestername() { clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); string qu = "SELECT semester FROM dbo.semester WHERE fkcourse='" + txtcourse.SelectedValue + "' and fkidcategory='" + txtcategory.SelectedValue + "'"; objDB.objExecuteQuery(qu, clsSqlHelper.QueryExcution.ExecuteReader); if (objDB.dtrData.HasRows && objDB.dtrData.Read() && !objDB.dtrData.IsDBNull(0)) { txtsemester.Text = objDB.dtrData.GetString(0); } }
public void idsemester() { clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("@bookname", usernamefind); string qu = "SELECT pkidbooks FROM dbo.books WHERE bookname=@bookname"; objDB.objExecuteQuery(qu, clsSqlHelper.QueryExcution.ExecuteReader, dic); if (objDB.dtrData.HasRows && objDB.dtrData.Read() && !objDB.dtrData.IsDBNull(0)) { pkidbook = objDB.dtrData.GetInt32(0); } }
private void btnadd_Click(object sender, EventArgs e) { firstpanel.Visible = false; secondpanel.Visible = false; thirdpanel.Visible = true; dataload.Visible = false; clsSqlHelper objDB = new clsSqlHelper(ConfigurationManager.ConnectionStrings["CN"].ConnectionString); Dictionary <string, object> dic = new Dictionary <string, object>(); string StrQuery = "SELECT MAX(pkemployeeid) FROM dbo.signup"; objDB.objExecuteQuery(StrQuery, clsSqlHelper.QueryExcution.ExecuteReader, dic); if (objDB.dtrData.HasRows && objDB.dtrData.Read() && !objDB.dtrData.IsDBNull(0)) { values.Text = (objDB.dtrData.GetInt32(0) + 1).ToString(); } }