protected void btngive_Click(object sender, EventArgs e) { DateTime d1 = DateTime.Now; AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); string qryUpdate = "update tblRequestForBlood set tRecieved='true',tReceivedDate='" + DateTime.Now.ToShortDateString() + "' " + " where t_id='" + hftid.Value + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(qryUpdate); string qryUpdate2_rejectOtherRequests = "update tblRequestForBlood set tRecieved='false',tRejected='true',tRejectionReason='Donor is not Eligible Now' " + " where tDonor_id='" + _UserID + "' and t_id <> '" + hftid.Value + "' and tAcceptedbyDonor='false'"; lblmsg.Text = ajdbClass.UpdateDatabase(qryUpdate2_rejectOtherRequests); string qryUpdateDnrEligibilityDate = "Update tblRegister set RBloodPointDate='" + d1.ToShortDateString() + "' " + " where r_id='" + _UserID + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(qryUpdateDnrEligibilityDate); btngive.Enabled = false; }
protected void Page_Load(object sender, EventArgs e) { if (Session["CurrentUser_ID"] != null) { _userId = Session["CurrentUser_ID"].ToString(); } if (Session["CurrentUser_ID"] == null) { Response.Redirect("Login.aspx"); } AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); if (!IsPostBack) { ds = ajdbClass.GetRecords("tblCities", "select * from tblCities"); cboCities.DataSource = ds.Tables[0]; cboCities.DataValueField = "ct_id"; cboCities.DataTextField = "ctName"; cboCities.DataBind(); ds = ajdbClass.GetRecords("tblBloodGroups", "select * from tblBloodGroups"); cboBGroup.DataSource = ds.Tables[0]; cboBGroup.DataValueField = "Bl_id"; cboBGroup.DataTextField = "BlName"; cboBGroup.DataBind(); } GetRecords(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["CurrentUser_ID"] != null) { _UserID = Session["CurrentUser_ID"].ToString(); } else { Response.Redirect("login.aspx"); } AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); if (!IsPostBack) { if (Request.QueryString["id"] != null) { hftid.Value = Request.QueryString["id"].ToString(); } else { Response.Redirect("SearchDonor.aspx"); } ds = ajdbClass.GetRecords("tblCities", "select * from tblCities"); cboacities.DataSource = ds.Tables[0]; cboacities.DataValueField = "ct_id"; cboacities.DataTextField = "ctName"; cboacities.DataBind(); ds.Clear(); ds = ajdbClass.GetRecords("tblRequestForBlood", "select * from tblRequestForBlood where t_id='" + hftid.Value + "'"); string _acceptorid = ""; foreach (DataRow dr in ds.Tables[0].Rows) { _acceptorid = dr["tAcceptor_id"].ToString().Trim(); } ds.Clear(); ds = ajdbClass.GetRecords("tblRegister", "select * from tblRegister where r_id='" + _acceptorid + "'"); foreach (DataRow dr in ds.Tables[0].Rows) { lblaname.Text = dr["rname"].ToString().Trim(); lblaemail.Text = dr["remail"].ToString().Trim(); cboacities.SelectedValue = dr["rct_id"].ToString().Trim(); cboagender.SelectedValue = dr["rgender"].ToString().Trim(); lblacon.Text = dr["rcontact"].ToString().Trim(); lblaAddr.Text = dr["raddress"].ToString().Trim(); } } }
protected void gvbind() { AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); ds.Clear(); string qry = "select [PrId], [PrName],[PrPrice] ,[PrQty] from [Purchase]"; ds = ajdbClass.GetRecords("Purchase", qry); if (ds.Tables[0].Rows.Count > 0) { GridView1.DataSource = ds; GridView1.DataBind(); } else { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GridView1.DataSource = ds; GridView1.DataBind(); int columncount = GridView1.Rows[0].Cells.Count; GridView1.Rows[0].Cells.Clear(); GridView1.Rows[0].Cells.Add(new TableCell()); GridView1.Rows[0].Cells[0].ColumnSpan = columncount; GridView1.Rows[0].Cells[0].Text = "No Records Found"; } }
protected void Page_Load(object sender, EventArgs e) { string _id = null; if (Session["CurrentUser_ID"] != null) { _id = Session["CurrentUser_ID"].ToString(); AJ_DataClass myDataClass = new AJ_DataClass(); string CurrentUser = ""; string UserRole = ""; myDataClass.GetUserInfo(_id, ref CurrentUser, ref UserRole); lblUser.Text = CurrentUser; lblUserRole.Text = UserRole; mnuLogin.Visible = false; mnuRegister.Visible = false; mnuLogOut.Visible = true; mnuChangePWD.Visible = true; mnuUserProfile.Visible = true; mnuMyRequests.Visible = true; if (Convert.ToBoolean(UserRole.Contains("Donor")) == true) { mnuConfirmation.Visible = true; mnumybloodrequested.Visible = true; mnuSearchDonor.Visible = false; } else { mnuSearchDonor.Visible = true; } if (_id == "1") { mnuUsersBloodRequests.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { string _id = null; if (Session["CurrentUser_ID"] != null) { _id = Session["CurrentUser_ID"].ToString().Trim(); AJ_DataClass myDataClass = new AJ_DataClass(); string CurrentUser = ""; string UserRole = ""; myDataClass.GetUserInfo(_id, ref CurrentUser, ref UserRole); lblUser.Text = CurrentUser; lblUserRole.Text = UserRole; mnuLogin.Visible = false; mnuRegister.Visible = false; mnuLogOut.Visible = true; mnuChangePWD.Visible = true; } else { mnuLogin.Visible = true; mnuRegister.Visible = true; mnuLogOut.Visible = false; mnuChangePWD.Visible = false; } }
protected void btnUpdate_Click(object sender, EventArgs e) { string _isAcceptor = "false"; string _isDonor = "false"; if (chkAcceptor.Checked == true) { _isAcceptor = "True"; } if (chkDonor.Checked == true) { _isDonor = "True"; } AJ_DataClass ajdbClass = new AJ_DataClass(); string updateQry = "update tblRegister set rName = '" + txtName.Text.Replace("'", "''").Trim() + "'," + "rcontact='" + txtcontact.Text.Trim().Replace("'", "''") + "'," + "raddress='" + txtaddr.Text.Trim().Replace("'", "''") + "'," + "rbl_id='" + cboBGroup.SelectedValue + "'," + "rct_id='" + cboCities.SelectedValue + "'," + "rgender='" + cboGender.SelectedValue + "'," + "risAcceptor='" + _isAcceptor + "'," + "risDonor='" + _isDonor + "' " + " where r_id='" + _UserID + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(updateQry); }
protected void BtnAdd_Click(object sender, EventArgs e) { if (Session["CurrentUser_ID"] != null) { _id = Session["CurrentUser_ID"].ToString(); AJ_DataClass ajdbClass = new AJ_DataClass(); string _name = txtname.Text; string _price = txtPrice.Text; string _quantity = txtQty.Text; string _DataFields = "PrAdminId,PrName,PrPrice ,PrQty"; string _Values = "'" + _id + "','" + _name + "','" + _price + "','" + _quantity + "'"; string Result = ajdbClass.InsertIntoDatabase("Purchase", _DataFields, _Values); lblmsg.Text = Result; if (Result == "Record(s) Added Successfully") { txtname.Text = ""; txtPrice.Text = ""; txtQty.Text = ""; } } }
public DataTable UpdateItemIntoTable(DataTable dtMyTable_Adr, string itid, string qty, string catname, string _retf) { AJ_DataClass ajdbClass = new AJ_DataClass(); foreach (DataRow dr in dtMyTable_Adr.Rows) { if (dr["itid"].ToString().Trim() == itid) { string price = "0"; string desc = "."; string name = ""; string thisQty = dr["itqty"].ToString(); DataSet dsx = new DataSet(); dsx = ajdbClass.GetRecords("tbl", "select * from items where itid='" + itid + "'"); foreach (DataRow drx in dsx.Tables[0].Rows) { price = drx["itprice"].ToString().Trim(); desc = drx["itdesc"].ToString().Trim(); name = drx["itname"].ToString().Trim(); } if (qty == "1") { qty = (Convert.ToInt16(thisQty) + 1).ToString(); } if (qty == "-1") { if (thisQty != "0") { qty = (Convert.ToInt16(thisQty) - 1).ToString(); } } decimal total = 0; if (thisQty != "0") { total = Convert.ToDecimal(price) * Convert.ToDecimal(qty); } dr.SetField("itprice", price); dr.SetField("itqty", qty); dr.SetField("ittotal", total); //DataRow myNewRow_Adr = dtMyTable_Adr.NewRow(); //myNewRow_Adr["catname"] = catname; //myNewRow_Adr["itid"] = itid; //myNewRow_Adr["itname"] = name; //myNewRow_Adr["itdesc"] = desc; //myNewRow_Adr["itprice"] = price; //myNewRow_Adr["itqty"] = qty; //myNewRow_Adr["ittotal"] = total; //dtMyTable_Adr.Rows.Add(myNewRow_Adr); //dtMyTable_Adr.AcceptChanges(); } } return(dtMyTable_Adr); }
protected void BtnUpdate_Click(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); string _catgory = cboCatgory.SelectedValue; string _name = txtname.Text; string _price = txtPrice.Text; string _quantity = txtQty.Text; if (fuImageFile.HasFile) { string picture = fuImageFile.FileName.ToString(); fuImageFile.PostedFile.SaveAs(Server.MapPath("upload/") + picture); string _DataFields = "ICategoryID ,ItName ,ItPrice ,ItPicture,ItQuantity"; string _Values = "'" + _catgory + "','" + _name + "','" + _price + "','" + picture + "','" + _quantity + "'"; string Result = ajdbClass.InsertIntoDatabase("Items", _DataFields, _Values); Label1.Visible = true; Label1.Text = "Items inserted successfully"; txtname.Text = ""; } else { Label1.Visible = true; Label1.Text = "Plz upload the image!!!!"; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["CurrentUser_ID"] != null) { _UserID = Session["CurrentUser_ID"].ToString(); } AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); if (!IsPostBack) { string _oldPwd = ""; ds.Clear(); ds = ajdbClass.GetRecords("tblRegister", "select * from tblRegister where r_id='" + _UserID + "'"); if (ds.Tables[0].Rows.Count == 0) { lblmsg.Text = "Invalid User Name or Password"; } else { foreach (DataRow dr in ds.Tables[0].Rows) { _oldPwd = dr["rPassword"].ToString().Trim(); } } } }
//protected void btnUpdate_Click(object sender, EventArgs e) //{ // string _isAcceptor = "false"; // string _isDonor = "false"; // if (chkAcceptor.Checked == true) _isAcceptor = "True"; // if (chkDonor.Checked == true) _isDonor = "True"; // AJ_DataClass ajdbClass = new AJ_DataClass(); // string updateQry = "update tblRegister set rName = '" + txtName.Text.Replace("'", "''").Trim() + "'," + // "rcontact='" + txtcontact.Text.Trim().Replace("'", "''") + "'," + // "raddress='" + txtaddr.Text.Trim().Replace("'", "''") + "'," + // "rbl_id='" + cboBGroup.SelectedValue + "'," + // "rct_id='" + cboCities.SelectedValue + "'," + // "rgender='" + cboGender.SelectedValue + "'," + // "risAcceptor='" + _isAcceptor + "'," + // "risDonor='" + _isDonor + "' " + // " where r_id='" + _UserID + "'"; // lblmsg.Text = ajdbClass.UpdateDatabase(updateQry); //} protected void btnchngPwd_Click(object sender, EventArgs e) { if (txtopwd.Text.Trim().Length == 0) { lblmsg.Text = "Invalid Old Password or User Name ! "; txtopwd.Focus(); return; } if (txtnpwd.Text.Trim() != txtrpwd.Text.Trim()) { lblmsg.Text = "Password MissMatched !"; txtrpwd.Focus(); return; } AJ_DataClass ajdbClass = new AJ_DataClass(); string updateQry = "update tblRegister set rPassword = '******'", "''").Trim() + "' " + " where r_id='" + _UserID + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(updateQry); if (lblmsg.Text == "Update Record(s) Succfully") { lblmsg.Text = "Password Changed Successfully"; txtnpwd.Text = ""; txtopwd.Text = ""; txtrpwd.Text = ""; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["CurrentUser_ID"] == null) { Response.Redirect("login.aspx"); } AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); string qry = "SELECT Catagory.CatID, Catagory.CatName, Items.ItId, Items.ItName, Items.ItPrice, Items.itDesc " + " FROM Catagory INNER JOIN " + "Items ON Catagory.CatID = Items.ICategoryID"; ds = ajdbClass.GetRecords("tbl", qry); string _litVal = ""; foreach (DataRow dr in ds.Tables[0].Rows) { _litVal = _litVal + "<tr>" + "<td style = 'text-align: center;' >" + dr["itid"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["catName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["itName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["itdesc"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["itprice"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + "<img style='width:150px;height:100px;' src = 'upload/" + dr["itid"].ToString().Trim() + ".jpg' />" + "</td> " + " <td style = 'text-align: center;' ><a href = 'FoodMenuItemAdd.aspx?catname=" + dr["catname"].ToString().Trim() + "&id=" + dr["itid"].ToString().Trim() + "&qty=1&retf=1'> Add </a></td> " + " </tr>"; } string _heaed = "<table style='border:thin black; width:100% ; height:75px;background-color:white' cellpadding = '2' cellspacing = '2' >" + "<td style = 'color: #C0C0C0; background-color: #FF5050' class='text-center'>ID</td>" + "<td style = 'color: #C0C0C0; background-color: #FF5050' class='text-center'>Category</td>" + "<td style = 'color: #C0C0C0; background-color: #FF5050' class='text-center'>Items</td>" + "<td style = 'color: #C0C0C0; background-color: #FF5050' class='text-center'>Desc</td>" + "<td style = 'color: #C0C0C0; background-color: #FF5050' class='text-center'>Price</td>" + "<td style = 'color: #C0C0C0; background-color: #FF5050' class='text-center'>Food</td>" + "<td style = 'color: #C0C0C0; background-color: #FF5050' class='text-center'> Add +1 </td>" + "</tr>"; litDnr.Text = _heaed + _litVal + "</table> "; if (Session["sestitmes"] != null) { lbltitmes.Text = Session["sestitmes"].ToString(); } if (Session["sesgtotal"] != null) { lblgtotal.Text = Session["sesgtotal"].ToString(); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex]; Label lbldeleteid = (Label)row.FindControl("lblID"); AJ_DataClass aj = new AJ_DataClass(); aj.DeleteFromDatabase("delete FROM Purchase where Prid='" + Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()) + "'"); gvbind(); }
protected void Page_Load(object sender, EventArgs e) { //if (Session["CurrentUser_ID"] == null) Response.Redirect("Login.aspx"); AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); if (!IsPostBack) { ds = ajdbClass.GetRecords("tblCities", "select * from tblCities"); cboCities.DataSource = ds.Tables[0]; cboCities.DataValueField = "ct_id"; cboCities.DataTextField = "ctName"; cboCities.DataBind(); ds = ajdbClass.GetRecords("tblBloodGroups", "select * from tblBloodGroups"); cboBGroup.DataSource = ds.Tables[0]; cboBGroup.DataValueField = "Bl_id"; cboBGroup.DataTextField = "BlName"; cboBGroup.DataBind(); } string qry = "select * from tblRegister where RisDonor='true' or RisAcceptor='true'"; qry = "SELECT tblRegister.r_id, tblRegister.RName, tblBloodGroups.BlName, tblRegister.RisAcceptor, tblRegister.RisDonor, tblRegister.REmail, tblCities.ctName, tblRegister.RGender, " + " tblRegister.RContact, tblRegister.RAddress, tblRegister.RUserName, tblRegister.RPassword, tblRegister.RDBFree, tblRegister.rdBPrice, tblRegister.RBlock, " + " tblRegister.RBlockedDated, tblRegister.RDate " + " FROM tblBloodGroups INNER JOIN " + " tblRegister ON tblBloodGroups.Bl_id = tblRegister.rBl_id INNER JOIN " + " tblCities ON tblRegister.Rct_id = tblCities.ct_id " + " where RisDonor = 'true' or RisAcceptor='true' "; ds = ajdbClass.GetRecords("tblRegister", qry); string _litVal = ""; foreach (DataRow dr in ds.Tables[0].Rows) { _litVal = _litVal + "<tr>" + " <td style = 'text-align: center;' >" + dr["r_id"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["rName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["blName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["ctName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' ><a href = 'Blood-Request-Form.aspx?id=" + dr["r_id"].ToString().Trim() + "'> Request </a></td> " + " </tr>"; } string _heaed = "<table style='border:thin solid gray; width:100%;background-color:white' cellpadding = '1' cellspacing = '1' >" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Dnr-ID</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Name</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Blood Group</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>City</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'> Send </td>" + "</tr>"; litDnr.Text = _heaed + _litVal + "</table> "; }
protected void Page_Load(object sender, EventArgs e) { if (Session["CurrentUser_ID"] != null) { _UserID = Session["CurrentUser_ID"].ToString(); } else { Response.Redirect("login.aspx"); } AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); if (!IsPostBack) { ds = ajdbClass.GetRecords("tblCities", "select * from tblCities"); cboCities.DataSource = ds.Tables[0]; cboCities.DataValueField = "ct_id"; cboCities.DataTextField = "ctName"; cboCities.DataBind(); ds = ajdbClass.GetRecords("tblBloodGroups", "select * from tblBloodGroups"); cboBGroup.DataSource = ds.Tables[0]; cboBGroup.DataValueField = "Bl_id"; cboBGroup.DataTextField = "BlName"; cboBGroup.DataBind(); ds.Clear(); ds = ajdbClass.GetRecords("tblRegister", "select * from tblRegister where r_id='" + _UserID + "'"); string _isAcceptor = "false"; string _isDonor = "false"; foreach (DataRow dr in ds.Tables[0].Rows) { txtName.Text = dr["rname"].ToString().Trim(); cboBGroup.SelectedValue = dr["rbl_id"].ToString().Trim(); lblEmail.Text = dr["remail"].ToString().Trim(); cboCities.SelectedValue = dr["rct_id"].ToString().Trim(); cboGender.SelectedValue = dr["rgender"].ToString().Trim(); txtcontact.Text = dr["rcontact"].ToString().Trim(); txtaddr.Text = dr["raddress"].ToString().Trim(); _isAcceptor = dr["risAcceptor"].ToString().Trim(); _isDonor = dr["risdonor"].ToString().Trim(); if (_isAcceptor == "True") { chkAcceptor.Checked = true; } if (_isDonor == "True") { chkDonor.Checked = true; } } } }
private void GetRecords() { AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); ds.Clear(); string qry = "SELECT tblRequestForBlood.t_id, tblRequestForBlood.tAcceptor_id, tblRegister.RName, tblBloodGroups.BlName, tblRegister.REmail, tblRegister.RGender, tblRegister.RContact, " + " tblRegister.RAddress, tblCities.ctName, tblRequestForBlood.tDonor_id, tblRequestForBlood.tRequestDate, tblRequestForBlood.tRejected,tAcceptedbyDonor " + " FROM tblRequestForBlood INNER JOIN " + " tblRegister ON tblRequestForBlood.tAcceptor_id = tblRegister.r_id INNER JOIN " + " tblBloodGroups ON tblRequestForBlood.tBloodGroup_id = tblBloodGroups.Bl_id INNER JOIN " + " tblCities ON tblRegister.Rct_id = tblCities.ct_id " + " where tDonor_id = '" + _userId + "' and tRejected='false' "; ds = ajdbClass.GetRecords("tblRequestForBlood", qry); string _litVal = ""; foreach (DataRow dr in ds.Tables[0].Rows) { DateTime _dt = Convert.ToDateTime(dr["tRequestDate"]); _litVal = _litVal + "<tr>" + "<td style = 'text-align: center;' >" + dr["tAcceptor_id"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["rName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["blName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + _dt.ToShortDateString() + "</td> "; string _Accepted = dr["tAcceptedbyDonor"].ToString().Trim(); if (_Accepted == "True") { _litVal = _litVal + " <td style = 'text-align: center;' >Accepted </td> "; } else { _litVal = _litVal + " <td style = 'text-align: center;' ><a href = 'Donor-Acceptor-Appointment.aspx?id=" + dr["t_id"].ToString().Trim() + "'> Proceed </a></td> "; } _litVal = _litVal + " </tr>"; } string _heaed = "<table style='border:thin solid gray; width:100%;background-color:white' cellpadding = '1' cellspacing = '1' >" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Acptr-ID</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Name</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Blood</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Dated</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Request</td>" + "</tr>"; litDnr.Text = _heaed + _litVal + "</table> "; }
protected void btnchngPwd_Click(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); string updateQry = "update tblRegister set rPassword = '' " + " where r_id='" + _UserID + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(updateQry); if (lblmsg.Text == "Update Record(s) Succfully") { lblmsg.Text = "Password Changed Successfully"; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["CurrentUser_ID"] != null) { _userId = Session["CurrentUser_ID"].ToString(); } if (Session["CurrentUser_ID"] == null) Response.Redirect("Login.aspx"); AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); GetRecords(); }
private void GetRecords() { AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); ds.Clear(); string qry = "select * from tblRegister where RisDonor='true'"; qry = "SELECT tblRegister.r_id, tblRegister.RName, tblBloodGroups.BlName, tblRegister.RisAcceptor, tblRegister.RisDonor, tblRegister.REmail, tblCities.ctName, tblRegister.RGender, " + " tblRegister.RContact, tblRegister.RAddress, tblRegister.RUserName, tblRegister.RPassword, tblRegister.RDBFree, tblRegister.rdBPrice, tblRegister.RBlock, " + " tblRegister.RBlockedDated, tblRegister.RDate " + " FROM tblBloodGroups INNER JOIN " + " tblRegister ON tblBloodGroups.Bl_id = tblRegister.rBl_id INNER JOIN " + " tblCities ON tblRegister.Rct_id = tblCities.ct_id " + " where RisDonor = 'true' "; if (chkBlood.Checked == true) { qry = qry + " and bl_id='" + cboBGroup.SelectedValue + "' "; } if (chkCities.Checked == true) { qry = qry + " and ct_id = '" + cboCities.SelectedValue + "'"; } ds = ajdbClass.GetRecords("tblRegister", qry); string _litVal = ""; foreach (DataRow dr in ds.Tables[0].Rows) { _litVal = _litVal + "<tr>" + " <td style = 'text-align: center;' >" + dr["r_id"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["rName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["blName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["ctName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >f = 'Blood-Request-Form.aspx?id=" + dr["r_id"].ToString().Trim() + "'> Request </a></td> " + " </tr>"; } string _heaed = "<table style='border:thin solid gray; width:100%;background-color:white' cellpadding = '1' cellspacing = '1' >" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Dnr-ID</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Name</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Blood Group</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>City</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'> Send </td>" + "</tr>"; litDnr.Text = _heaed + _litVal + "</table> "; }
protected void Page_Load(object sender, EventArgs e) { if (Session["CurrentUser_ID"] == null) { Response.Redirect("login.aspx"); } AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); string qry = "SELECT [User].UId, [User].UName, [User].UCellNo,[Order].OdId, [Order].OdGtotal, [Order].OdFwdFoodCheff FROM [User] INNER JOIN [Order] On [User].UId = [Order].OdUserId"; ds = ajdbClass.GetRecords("tbl", qry); string _litVal = ""; foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["OdId"].ToString().Trim() != "0") { _litVal = _litVal + "<tr>" + " <td style = 'text-align: center;' >" + dr["OdId"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["UName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["UCellNo"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["OdGtotal"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["OdFwdFoodCheff"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' ><a href = 'Chef.aspx?id=" + dr["OdId"].ToString().Trim() + "'> SendToChef </a></td> " + " </tr>"; } } string _heaed = "<table style='border:black; width:100%;background-color:white' cellpadding = '1' cellspacing = '1' >" + "<td style = 'color: #C0C0C0; background-color: deeppink' class='text-center'>ID. </td>" + "<td style = 'color: #C0C0C0; background-color: deeppink' class='text-center'>UserName</td>" + "<td style = 'color: #C0C0C0; background-color: deeppink' class='text-center'>CellNo</td>" + "<td style = 'color: #C0C0C0; background-color: deeppink' class='text-center'>Price</td>" + "<td style = 'color: #C0C0C0; background-color: deeppink' class='text-center'>ForwardChef</td>" + "<td style = 'color: #C0C0C0; background-color: deeppink' class='text-center'> Sent to Chef </td>" + "</tr>"; litDnr.Text = _heaed + _litVal + "</table> "; }
protected void btnRegister_Click(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); string _name = txtName.Text; string _email = txtEmail.Text; string _contact = txtcontact.Text; string _addr = txtaddr.Text; string _utype = cboUtype.SelectedItem.ToString(); string _pwd = txtPwd.Text; // Check if user already have an account. *email int trec = ajdbClass.TRec("select * from [User] where UEmail='" + txtEmail.Text.Trim() + "'"); if (trec != 0) { lblmsg.Text = " Email already exists !"; txtEmail.Focus(); return; } else { lblmsg.Text = ""; } if (txtPwd.Text.Trim() != txtPwd2.Text.Trim()) { lblmsg.Text = "Password MissMatched !"; txtPwd2.Focus(); return; } else { lblmsg.Text = ""; } string _DataFields = "UName,UAddress,UCellNo,UEmail, Utype,UPwd"; string _Values = "'" + _name + "','" + _addr + "','" + _contact + "','" + _email + "','" + _utype + "','" + _pwd + "'"; string Result = ajdbClass.InsertIntoDatabase("[User]", _DataFields, _Values); lblmsg.Text = Result; if (Result == "Record(s) Added Successfully") { txtName.Text = ""; txtEmail.Text = ""; txtcontact.Text = ""; txtaddr.Text = ""; txtPwd.Text = ""; } }
protected void btnLogin_Click(object sender, EventArgs e) { int RowCount; AJ_DataClass myClass = new AJ_DataClass(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); string _email = txtemail.Text.Trim(); string _pwd = txtpwd.Text.Trim(); string _utype = cboUtype.SelectedItem.ToString(); string qry = "select * from [User] where UEmail='" + _email + "' and UPwd='" + _pwd + "' and Utype='" + _utype + "'"; ds = myClass.GetRecords("[User]", qry); // lblmsg.Text = "user successfully login!"; RowCount = dt.Rows.Count; if (ds.Tables[0].Rows.Count == 0) { lblmsg.Text = "Invalid User"; } else { foreach (DataRow dr in ds.Tables[0].Rows) { { if (_utype == "User") { Session["CurrentUser_ID"] = dr["Uid"]; Response.Redirect("Menu.aspx"); } else if (_utype == "Chef") { Session["CurrentUser_ID"] = dr["Uid"]; Response.Redirect("ChefOrders.aspx"); } else if (_utype == "DeliveryBoy") { Session["CurrentUser_ID"] = dr["Uid"]; Response.Redirect("DeliveryBoyOrder.aspx"); } else { Session["CurrentUser_ID"] = dr["Uid"]; Response.Redirect("Items.aspx"); } } } } }
protected void Page_Load(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); // ,[OdDelivered] //,[OdDeliveredTime] //,[OdPaymentRecieved] string qry = " SELECT[User].UId, [User].UName, [User].UAddress, [User].UCellNo,[Order].OdId, [Order].OdGtotal, " + "[Order].OdFwdFoodCheff, [Order].OdDelivered ,[Order].OdPaymentRecieved FROM[User] INNER JOIN [Order] " + "ON[User].UId = [Order].OdUserId where OdFwdFoodCheff = 1 and OdDelivered =1"; ds = ajdbClass.GetRecords("tbl", qry); string _litVal = ""; foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["OdId"].ToString().Trim() != "0") { _litVal = _litVal + "<tr>" + " <td style = 'text-align: center;' >" + dr["OdId"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["UName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["UCellNo"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["OdGtotal"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["OdPaymentRecieved"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' ><a href = 'SentToAdmin.aspx?id=" + dr["OdId"].ToString().Trim() + "'> SentToAdmin </a></td> " + " </tr>"; } } string _heaed = "<table style='border:black; width:100%;background-color:white' cellpadding = '1' cellspacing = '1' >" + "<td style = 'color: #C0C0C0; background-color:#FF5050' class='text-center'>ID. </td>" + "<td style = 'color: #C0C0C0; background-color:#FF5050' class='text-center'>UserName</td>" + "<td style = 'color: #C0C0C0; background-color:#FF5050' class='text-center'>CellNo</td>" + "<td style = 'color: #C0C0C0; background-color:#FF5050' class='text-center'>Price</td>" + "<td style = 'color: #C0C0C0; background-color:#FF5050' class='text-center'>PaymentRecieve</td>" + "<td style = 'color: #C0C0C0; background-color:#FF5050' class='text-center'> Sent </td>" + "</tr>"; litDnr.Text = _heaed + _litVal + "</table> "; }
protected void btnSend_Click(object sender, EventArgs e) { try { AJ_DataClass myClass = new AJ_DataClass(); DataSet ds = new DataSet(); string _email = txtemail.Text.Trim(); // string _pwd = txtpwd.Text.Trim(); string qry = "select * from [User] where UEmail='" + _email + "'"; ds = myClass.GetRecords("[User]", qry); if (ds.Tables[0].Rows.Count > 0) { MailMessage Msg = new MailMessage(); // Sender e-mail address. Msg.From = new MailAddress(txtemail.Text); // Recipient e-mail address. Msg.To.Add(txtemail.Text); Msg.Subject = "Your Password Details"; Msg.Body = "Dear " + ds.Tables[0].Rows[0]["UName"].ToString().Trim() + ", <br/>Please check your Login Details<br/><br/>User Name: " + ds.Tables[0].Rows[0]["UEmail"].ToString().Trim() + "<br/><br/>Password: "******"UPwd"] + "<br/><br/>"; Msg.IsBodyHtml = true; // your remote SMTP server IP. SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; //smtp.Port = 465; Remove this line.... smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "mymomismylife123"); smtp.EnableSsl = true; smtp.Send(Msg); //Msg = null; lblmsg.Text = "Your Password Details Sent to your mail"; // Clear the textbox valuess txtemail.Text = ""; } else { lblmsg.Text = "The Email you entered does not exists."; } } catch (Exception ex) { string s = ex.Message.ToString() + "<br>" + ex.StackTrace.ToString(); lblmsg.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); if (Request.QueryString["id"].ToString() != null) { _UserID = Request.QueryString["id"].ToString(); } bool chef = true; string s = ajdbClass.UpdateDatabase("update [Order] set OdFwdFoodCheff='" + chef + "' where OdId='" + _UserID + "'"); lblmsg.Text = s + " Order has been sent to chef "; }
protected void Page_Load(object sender, EventArgs e) { this.Title = "Online Food Corner"; AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); if (!IsPostBack) { ds = ajdbClass.GetRecords("Catagory", "select * from Catagory"); cboCatgory.DataSource = ds.Tables[0]; cboCatgory.DataValueField = "CatID"; cboCatgory.DataTextField = "CatName"; cboCatgory.DataBind(); } }
// delete rows from clos private void gvClo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { if (AskYesNo() == false) { return; } int selectedrowindex = gvClo.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = gvClo.Rows[selectedrowindex]; string _id = Convert.ToString(selectedRow.Cells["id"].Value); AJ_DataClass ajdbClass = new AJ_DataClass(); string s = ajdbClass.DeleteFromDatabase("delete from clo where id='" + _id + "'"); ajdbClass.popGrid(gvClo, "select id,name from clo"); ajdbClass.popCmb(cmbClo, "select * from clo", "id", "name"); lblrubricLevels.Text = "Rubrics Level - Settings Clo:" + cmbClo.Text; } }
protected void Button1_Click(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); if (Request.QueryString["id"].ToString() != null) { _UserID = Request.QueryString["id"].ToString(); } bool chef = true; bool deliver = true; bool pay = true; string s = ajdbClass.UpdateDatabase("update [Order] set OdFwdFoodCheff='" + chef + "',OdDelivered='" + deliver + "',OdDeliveredTime='" + DateTime.Now + "',OdPaymentRecieved='" + pay + "' where OdId='" + _UserID + "'"); lblmsg.Text = s + " I deliver order and recieve payment !!!"; }
protected void Button1_Click(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); if (Request.QueryString["id"].ToString() != null) { _UserID = Request.QueryString["id"].ToString(); } bool chef = true; bool deliver = true; // string s = ajdbClass.UpdateDatabase("update clo set name='" + _name + "',dateupdated='" + _dateupdated + "' where id='" + _id + "'"); string s = ajdbClass.UpdateDatabase("update [Order] set OdFwdFoodCheff='" + chef + "',OdDelivered='" + deliver + "' where OdId='" + _UserID + "'"); lblmsg.Text = s + " Order has been delivered !!! "; }