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 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; } } } }
// prress key for update and delete student private void gvStudents_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (gvStudents.SelectedCells.Count > 0) { int selectedrowindex = gvStudents.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = gvStudents.Rows[selectedrowindex]; string _id = Convert.ToString(selectedRow.Cells["id"].Value); lblidStud.Text = _id; string _qry = ""; DataSet ds = new DataSet(); string qry = "SELECT Student.Id, Student.FirstName, Student.LastName, Student.Contact, Student.Email, Student.RegistrationNumber, Lookup.Name, Lookup.LookupId " + " FROM Student INNER JOIN " + " Lookup ON Student.Status = Lookup.LookupId where id='" + _id + "'"; ds = ajdbClass.GetRecords("tbl", qry); foreach (DataRow dr in ds.Tables[0].Rows) { txtfname.Text = dr["FirstName"].ToString().Trim(); txtlname.Text = dr["LastName"].ToString().Trim(); txtcon.Text = dr["Contact"].ToString().Trim(); txtemail.Text = dr["Email"].ToString().Trim(); txtRegNo.Text = dr["RegistrationNumber"].ToString().Trim(); cmbStatus.SelectedValue = dr["LookupId"].ToString().Trim(); } } } //delete student if (e.KeyCode == Keys.Delete) { if (AskYesNo() == false) { return; } int selectedrowindex = gvStudents.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = gvStudents.Rows[selectedrowindex]; string _id = Convert.ToString(selectedRow.Cells["id"].Value); string s = ajdbClass.DeleteFromDatabase("delete from student where id='" + _id + "'"); if (s != "Delete Record(s) Successfully") { s = "Unable to Delete. Record might be required in other tables"; } MessageBox.Show(s); string qry = "SELECT Student.Id, Student.FirstName, Student.LastName, Student.Contact, Student.Email, Student.RegistrationNumber, Lookup.Name, Lookup.LookupId " + " FROM Student INNER JOIN " + " Lookup ON Student.Status = Lookup.LookupId "; ajdbClass.popGrid(gvStudents, qry); txtfname.Text = ""; txtlname.Text = ""; txtRegNo.Text = ""; txtemail.Text = ""; txtcon.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 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 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) { 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(); } }
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 Page_Load(object sender, EventArgs e) { 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(); } }
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 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) { 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(); } }
protected void btnLogin_Click(object sender, EventArgs e) { AJ_DataClass myClass = new AJ_DataClass(); DataSet ds = new DataSet(); string _email = txtemail.Text.Trim(); string _pwd = txtpwd.Text.Trim(); string qry = "select * from tblRegister where REmail='" + _email + "' and RPassword='******'"; ds = myClass.GetRecords("tblRegister", qry); if (ds.Tables[0].Rows.Count == 0) { lblmsg.Text = "Invalid User"; } else { foreach (DataRow dr in ds.Tables[0].Rows) { Session["CurrentUser_ID"] = dr["r_id"]; Response.Redirect("User-Profile.aspx"); } } }
public DataTable AddItemIntoTable(DataTable dtMyTable_Adr, string itid, string qty, string catname, string _retf) { AJ_DataClass ajdbClass = new AJ_DataClass(); string price = "0"; string desc = "."; string name = ""; DataSet dsx = new DataSet(); dsx = ajdbClass.GetRecords("tbl", "select * from items where itid='" + itid + "'"); foreach (DataRow dr in dsx.Tables[0].Rows) { if (dr["itid"].ToString().Trim() == itid) { price = dr["itprice"].ToString().Trim(); desc = dr["itdesc"].ToString().Trim(); name = dr["itname"].ToString().Trim(); decimal total = Convert.ToDecimal(price) * 1; 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 Page_Load(object sender, EventArgs e) { string _id = null; string qry = "select * from [User]"; AJ_DataClass myDataClass = new AJ_DataClass(); myDataClass.GetRecords("[User]", qry); if (Session["CurrentUser_ID"] != null) { _id = Session["CurrentUser_ID"].ToString(); string CurrentUser = ""; string UserRole = ""; myDataClass.GetUserInfo(_id, ref CurrentUser, ref UserRole); lblUser.Text = CurrentUser; lblUserRole.Text = UserRole; lblUserRole.Visible = true; mnuLogin.Visible = false; mnuRegister.Visible = false; mnuLogOut.Visible = true; // mnuOrder.Visible = true; // mnuOdetails.Visible = true; mnuMenu.Visible = true; } //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; // mnuOrder.Visible = true; // mnuLogOut.Visible = true; // // mnuOdetails.Visible = true; // mnuMenu.Visible = true; // if (Convert.ToBoolean(UserRole.Contains("Chef")) == true) // { mnuCfO.Visible = true; mnuLogOut.Visible = true; } // else if (Convert.ToBoolean(UserRole.Contains("DeliveryBoy")) == true) // { mnuDbo.Visible = true; mnuLogOut.Visible = true; } // else // { // mnuLogin.Visible = false; // mnuItems.Visible = true; // mnuIdetails.Visible = true; // mnuPurchase.Visible = true; // mnuPdetails.Visible = true; // mnuLogOut.Visible = true; // mnuChckOrder.Visible = true; // } // //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; // // lblUserRole.Visible = true; // // mnuLogin.Visible = false; // // mnuRegister.Visible = false; // // mnuLogOut.Visible = true; // // mnuOrder.Visible = true; // // mnuOdetails.Visible = true; // // mnuMenu.Visible = true; // // if (Convert.ToBoolean(UserRole.Contains("Chef")) == true) // // { // // mnuLogin.Visible = false; // // mnuItems.Visible = true; // // mnuIdetails.Visible = true; // // mnuPurchase.Visible = true; // // mnuPdetails.Visible = true; // // mnuLogOut.Visible = true; // // mnuChckOrder.Visible = true; // // } // //} //} }
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) { ds.Clear(); string qry = "SELECT tblRequestForBlood.t_id, tblRegister.r_id, tblRegister.RName, tblRegister.RContact, tblRegister.RAddress, tblRequestForBlood.tDonor_id, tblRequestForBlood.tAcceptedbyDonor, " + " tblRequestForBlood.tMeetingPlace, tblRequestForBlood.tMeetingAddress, tblRequestForBlood.tMeetingDate, tblRequestForBlood.tRecieved, tblRequestForBlood.tReceivedDate, " + " tblBloodGroups.BlName, tblRegister_1.RBloodPointDate AS DNR_RBloodPointDate " + " FROM tblRegister INNER JOIN " + " tblRequestForBlood ON tblRegister.r_id = tblRequestForBlood.tAcceptor_id INNER JOIN " + " tblBloodGroups ON tblRequestForBlood.tBloodGroup_id = tblBloodGroups.Bl_id INNER JOIN " + " tblRegister AS tblRegister_1 ON tblRequestForBlood.tDonor_id = tblRegister_1.r_id " + " where tDonor_id ='" + _UserID + "' and tAcceptedbyDonor='true' and tRecieved='false' "; ds = ajdbClass.GetRecords("tblRequestForBlood", qry); string _acptID = ""; string _name = ""; string _contact = ""; string _blrequested = ""; string _place = ""; string _placeAddr = ""; string _mdate = ""; foreach (DataRow dr in ds.Tables[0].Rows) { hftid.Value = dr["t_id"].ToString().Trim(); _acptID = dr["r_id"].ToString().Trim(); _name = dr["rName"].ToString().Trim(); _contact = dr["rcontact"].ToString().Trim(); _blrequested = dr["blName"].ToString().Trim(); _place = dr["tMeetingPlace"].ToString().Trim(); _placeAddr = dr["tMeetingAddress"].ToString().Trim(); _mdate = dr["tMeetingDAte"].ToString().Trim(); hfDnrPDate.Value = dr["DNR_RBloodPointDate"].ToString().Trim(); } DateTime _dt; string _dtx = ""; try { _dt = Convert.ToDateTime(_mdate); _dtx = _dt.ToShortDateString(); } catch (Exception ex) { } string _sentense = "N/A"; if (ds.Tables[0].Rows.Count != 0) { _sentense = "Blood Acceptor " + _name + " (" + _acptID + ") *Contact#: " + _contact + " Requested for Blood Group(" + _blrequested + "). Meetings Place is :" + _place + " Full Address: " + _placeAddr + " Meeting Date:" + _dtx + " was set by donor."; } else { btngive.Visible = false; } txtstatement.Text = _sentense; } }
private void GetRecords() { AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); ds.Clear(); string qry = "SELECT tblRequestForBlood.tAcceptor_id, tblRequestForBlood.t_id, tblRegister.r_id, tblRegister.RName, tblBloodGroups.BlName, tblRequestForBlood.tRequestDate, " + " tblRequestForBlood.tAcceptedbyDonor, tblRequestForBlood.tRejected, tblRequestForBlood.tRejectionReason, tblRequestForBlood.tMeeting, tblRegister_1.RName AS AcptName, " + " tblCities.ctName AS acptCityName " + " FROM tblRequestForBlood INNER JOIN " + " tblRegister ON tblRequestForBlood.tDonor_id = tblRegister.r_id INNER JOIN " + " tblBloodGroups ON tblRegister.rBl_id = tblBloodGroups.Bl_id INNER JOIN " + " tblRegister AS tblRegister_1 ON tblRequestForBlood.tAcceptor_id = tblRegister_1.r_id INNER JOIN " + " tblCities ON tblRegister_1.Rct_id = tblCities.ct_id "; if (chkRejected.Checked == false) { qry = qry + " where tRejected = 'false' "; } else { qry = qry + " where tRejected = 'true' "; } if (chkCities.Checked == true) { qry = qry + " and tblRegister_1.Rct_id='" + cboCities.SelectedValue + "' "; } if (chkBlood.Checked == true) { qry = qry + " and tBloodGroup_id='" + cboBGroup.SelectedValue + "' "; } ds = ajdbClass.GetRecords("tblRequestForBlood", qry); lbltrec.Text = "Records found: " + ds.Tables[0].Rows.Count.ToString(); string _litVal = ""; foreach (DataRow dr in ds.Tables[0].Rows) { string _acptr_id = dr["tAcceptor_id"].ToString().Trim(); string _dnrid = dr["r_id"].ToString().Trim(); DateTime _dt = Convert.ToDateTime(dr["tRequestDate"]); _litVal = _litVal + "<tr>" + " <td style = 'text-align: center;' >" + dr["acptCityName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >(" + _acptr_id + ")" + dr["AcptName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["blName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >(" + _dnrid + ")" + dr["rName"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + _dt.ToShortDateString() + "</td> " + " <td style = 'text-align: center;' ><a href = 'User-Blood-Request-Action.aspx?actid=" + dr["t_id"].ToString().Trim() + "'> Action/Detail</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'>City</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Acceptor</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>B.Needed</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Donor</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>R.Date</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Action</td>" + "</tr>"; litDnr.Text = _heaed + _litVal + "</table> "; }
private void GetRecords() { AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); ds.Clear(); string qry = "SELECT tblRequestForBlood.tAcceptor_id, tblRequestForBlood.t_id, tblRegister.r_id, tblRegister.RName, tblBloodGroups.BlName, tblRequestForBlood.tRequestDate, " + " tblRequestForBlood.tAcceptedbyDonor, tblRequestForBlood.tRejected, tblRequestForBlood.tRejectionReason,tMeetingPlace,tMeetingAddress,tMeetingDate " + " FROM tblRequestForBlood INNER JOIN " + " tblRegister ON tblRequestForBlood.tDonor_id = tblRegister.r_id INNER JOIN " + " tblBloodGroups ON tblRegister.rBl_id = tblBloodGroups.Bl_id " + " where tAcceptor_id = '"+ _userId +"' "; ds = ajdbClass.GetRecords("tblRequestForBlood", qry); string _litVal = ""; foreach (DataRow dr in ds.Tables[0].Rows) { DateTime _dt = Convert.ToDateTime(dr["tRequestDate"]); DateTime _dtm ; string _dts = "N/A"; try { _dtm = Convert.ToDateTime(dr["tmeetingDate"]); _dts = _dtm.ToShortDateString(); } catch (Exception ex) { } _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;' >" + _dt.ToShortDateString() + "</td> " + " <td style = 'text-align: center;' >" + dr["tRejected"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["tRejectionReason"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["tAcceptedbyDonor"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["tmeetingPlace"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + dr["tmeetingAddress"].ToString().Trim() + "</td> " + " <td style = 'text-align: center;' >" + _dts + "</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</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Dated</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Rejected</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Reason</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Accepted</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Place</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Address</td>" + "<td style = 'color: #C0C0C0; background-color: darkcyan' class='text-center'>Date</td>" + "</tr>"; litDnr.Text = _heaed + _litVal + "</table> "; }
protected void btnSubmit_Click(object sender, EventArgs e) { //AJ_DataClass ajdbClass = new AJ_DataClass(); //bool chef = false; //bool delivr = false; //string delivrtime = DateTime.Now.ToShortDateString() ; //bool payRec = false; //string _DataFields = "OdUserId,OdDate,OdGtotal ,OdFwdFoodCheff,OdDelivered ,OdDeliveredTime ,OdPaymentRecieved"; //string _Values = "'" + _UserID + "','" + DateTime.Now.ToShortDateString() + "','" + lblgtotal.Text + "','" + // chef + "','" + delivr+ "','" + delivrtime + "','" + payRec + "'"; //string Result = ajdbClass.InsertIntoDatabase("[Order]", _DataFields, _Values); ////"OddOdid" = "OdId"; ////string _itid = "Items.ItId"; ////string _price = "itprice"; ////string _quantity = "itqty"; ////string _total = "ittotal"; ////string _DataField1 = "[OddOdid] ,[Odditid] ,[OddPrice] ,[OddQuantity],[OddTotal]"; ////string _Values1 = "'" + _odid + "','" + _itid + "','" + _price + "','" + //// _quantity + "','" + _total + "'"; ////string Result1 = ajdbClass.InsertIntoDatabase("[OrderDetails]", _DataField1, _Values1); //lblmsg.Text = Result + " Your order has been sent "; AJ_DataClass ajdbClass = new AJ_DataClass(); DataTable dtMyTable_Adr; if (Session["sesOrderTable"] != null) { dtMyTable_Adr = (DataTable)Session["sesOrderTable"]; } else { return; } foreach (DataRow dr in dtMyTable_Adr.Rows) { if (dr["itqty"].ToString().Trim() != "0") { string _DataFields = "OAdminId,OdUserId,OdDate ,OdGtotal,OdFwdFoodCheff ,OdDelivered ,OdDeliveredTime,OdPaymentRecieved "; string _Values = "'1','1','" + DateTime.Now.ToShortDateString() + "','" + lblgtotal.Text + "','0','0','" + DateTime.Now.ToShortDateString() + "','0' "; string Result = ajdbClass.InsertIntoDatabase("[Order]", _DataFields, _Values); lblmsg.Text = Result + " Order has been sent "; } break; } string _lastid = "0"; DataSet ds = new DataSet(); ds = ajdbClass.GetRecords("tbl", "select odid from [Order] "); foreach (DataRow dr in ds.Tables[0].Rows) { _lastid = dr["odid"].ToString().Trim(); } foreach (DataRow dr in dtMyTable_Adr.Rows) { if (dr["itqty"].ToString().Trim() != "0") { string st = dr["itid"].ToString().Trim(); string _DataFields = "OddOdid,Odditid,OddPrice ,OddQuantity,OddTotal "; string _Values = "'" + _lastid + "','" + dr["itid"].ToString().Trim() + "','" + dr["itprice"].ToString().Trim() + "','" + dr["itqty"].ToString().Trim() + "','" + lblgtotal.Text.Trim() + "' "; string Result = ajdbClass.InsertIntoDatabase("OrderDetails", _DataFields, _Values); lblmsg.Text = Result + " Order has been sent "; } } Session["sesOrderTable"] = null; Session["sestitmes"] = null; Session["sesgtotal"] = null; // Response.Redirect("FoodMenuMyOrder.aspx"); }