public void GetPhotos() { con.getConnection(); string query = "select top 3 * from Picture order by NEWID()"; SqlCommand com = new SqlCommand(query, con.getConnection()); SqlDataReader rd = com.ExecuteReader(); List <string> ls = new List <string>(); List <string> des = new List <string>(); string path = ""; string descript = ""; while (rd.Read()) { path = rd["pic"].ToString(); descript = rd["Description"].ToString(); ls.Add(path); des.Add(descript); descript = ""; path = ""; } //images Image1.ImageUrl = ls[0]; Image2.ImageUrl = ls[1]; Image3.ImageUrl = ls[2]; //description Label1.Text = des[0]; Label2.Text = des[1]; Label3.Text = des[2]; }
protected void Button1_Click(object sender, EventArgs e) { string em = ""; string id = ""; string fee = ""; Classes.FeeSlip fe = new Classes.FeeSlip(); if (Session["UserInfo"] == null) { Response.Write("<script>alert('Please login first')</script>"); Response.Redirect("login.aspx"); } else { em = Session["UserInfo"].ToString(); } Classes.Connection connection = new Classes.Connection(); connection.getConnection(); SqlCommand com = new SqlCommand("select Uid,CName,GName from UserReg where email = '" + em + "'", connection.con); SqlDataReader rd = com.ExecuteReader(); while (rd.Read()) { id = rd["Uid"].ToString(); fe.ChildName = rd["CName"].ToString(); fe.GardianName = rd["GName"].ToString(); } rd.Close(); SqlCommand com1 = new SqlCommand("select Amount from Fee where Uid = '" + id + "'", connection.con); SqlDataReader rd1 = com1.ExecuteReader(); while (rd1.Read()) { fee = rd1["Amount"].ToString(); } if (fee == "") { fe.Fee = ""; } fe.Fee = fee; fe.Date = DateTime.Now; fe.DueDate = "10 days"; fe.Recipt(fe); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter writer = PdfWriter.GetInstance(pdfDoc, Response.OutputStream); pdfDoc.Open(); htmlparser.Parse(fe.Recipt(fe)); pdfDoc.Close(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=Slip_" + fe.Date + ".pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Write(pdfDoc); Response.End(); }
public void GetPhotos() { con.getConnection(); string query = "select top 16 * from Picture order by Pid Desc"; SqlCommand com = new SqlCommand(query, con.getConnection()); SqlDataReader rd = com.ExecuteReader(); List <string> ls = new List <string>(); List <string> des = new List <string>(); string path = ""; string descript = ""; while (rd.Read()) { path = rd["pic"].ToString(); descript = rd["Description"].ToString(); ls.Add(path); des.Add(descript); descript = ""; path = ""; } //images assign_images(Image1, Image2, Image3, Image4, Image5, Image6, Image7, Image8, Image9, Image10, Image11, Image12, Image13, Image14, Image15, Image16); int j = 0; foreach (var item in ls) { img[j].ImageUrl = item; j++; } //description assign_labels(Label1, Label2, Label3, Label4, Label5, Label6, Label7, Label8, Label9, Label10, Label11, Label12, Label13, Label14, Label15, Label16); int k = 0; foreach (var item in des) { lb[k].Text = item; k++; } }
protected void Button1_Click(object sender, EventArgs e) { Classes.Connection con = new Classes.Connection(); con.getConnection(); SqlCommand com = new SqlCommand("select Uid from UserReg where CName ='" + DropDownList1.Text + "'", con.getConnection()); SqlDataReader rd = com.ExecuteReader(); while (rd.Read()) { fe.Uid = Convert.ToInt32(rd["Uid"]); } fe.Amount = TextBox1.Text; fe.DateTimeNow = DateTime.Now; fe.Add(fe); Response.Write("<script>alert('Sucessfully Inserted')</script>"); TextBox1.Text = ""; }
public void Add(Fee s) { con.getConnection(); con.ExecuteQuery("insert into Fee values('" + s.Uid + "','" + s.Amount + "','" + s.DateTimeNow + "')"); }
public void GetEvents() { string query = "select top 16 * from Events order by Eid Desc"; SqlCommand com = new SqlCommand(query, con.getConnection()); SqlDataReader rd = com.ExecuteReader(); List <string> ls = new List <string>(); List <string> des = new List <string>(); List <string> nam = new List <string>(); List <string> dat = new List <string>(); List <string> tim = new List <string>(); string path = ""; string descript = ""; string Name = ""; string date = ""; string time = ""; while (rd.Read()) { path = rd["EPic"].ToString(); descript = rd["Description"].ToString(); Name = rd["name"].ToString(); date = rd["Date"].ToString(); time = rd["time"].ToString(); dat.Add(date); tim.Add(time); ls.Add(path); des.Add(descript); nam.Add(Name); descript = ""; Name = ""; path = ""; date = ""; time = ""; } //images assign_images(Image1, Image2, Image3, Image4, Image5, Image6, Image7, Image8, Image9, Image10, Image11, Image12, Image13, Image14, Image15, Image16); int j = 0; foreach (var item in ls) { img[j].ImageUrl = item; j++; } assign_labels(Label1, Label2, Label3, Label4, Label5, Label6, Label7, Label8, Label9, Label10, Label11, Label12, Label13, Label14, Label15, Label16); int k = 0; foreach (var item in nam) { lb[k].Text = item; k++; } //description assign_labels(Label17, Label18, Label19, Label20, Label21, Label22, Label23, Label24, Label25, Label26, Label27, Label28, Label29, Label30, Label31, Label32); int p = 0; foreach (var item in des) { lb[p].Text = item; p++; } //date and time assign_labels(Label33, Label34, Label35, Label36, Label37, Label38, Label39, Label40, Label41, Label42, Label43, Label44, Label45, Label46, Label47, Label48); int l = 0; foreach (var item in dat) { lb[l].Text = item; l++; } }
public void Add(Events s) { con.getConnection(); con.ExecuteQuery("insert into Events values('" + s.Name + "','" + s.Description + "','" + s.EventsPic + "','" + s.Date + "','" + s.Time + "')"); }
public void Add(Picture s) { con.getConnection(); con.ExecuteQuery("insert into Picture values('" + s.Descrption + "','" + s.pic + "')"); }