protected void Button2_Click(object sender, EventArgs e) { Vehicle_Info v_inf = new Vehicle_Info(); Vehicle_Sp v_sp = new Vehicle_Sp(); Memb_Info info = new Memb_Info(); Memb_Sp sp = new Memb_Sp(); v_inf.Bus_Reg_No = txtvehicle.Text.ToLower(); if (v_sp.CompareBusRegNo(v_inf.Bus_Reg_No) != 0) { Vehicle_Info nv_inf = new Vehicle_Info(); nv_inf = v_sp.ViewVehicleThroughBusRegNo(v_inf.Bus_Reg_No); int sds = nv_inf.Own_No; Memb_Info ninfo = new Memb_Info(); ninfo = sp.ViewMember(sds); lbname.Text = ninfo.MemberName; lbage.Text = ninfo.Age.ToString(); lbadd.Text = ninfo.Address; lbemail.Text = ninfo.E_Mail; lbphno.Text = ninfo.Mobile; lbnob.Text = ninfo.Nob.ToString(); String path = Server.MapPath("~/Photos/Owners/"); Image1.ImageUrl = path + ninfo.Phot; MultiView1.SetActiveView(View2); } else { Label14.Visible = true; } }
protected void Button1_Click(object sender, EventArgs e) { Memb_Info inf = new Memb_Info(); Memb_Sp sp1 = new Memb_Sp(); int xx = int.Parse(GridView2.SelectedDataKey.Value.ToString()); sp1.Update1(xx); inf = sp1.ViewMember(xx); Session["username"] = inf.Usrname; Session["own_name"] = inf.MemberName; Response.Redirect("admin_vehicle_info.aspx"); }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { Memb_Sp sp = new Memb_Sp(); Memb_Info info = sp.ViewMember(int.Parse(GridView1.SelectedValue.ToString())); lbname.Text = info.MemberName; lbage.Text = info.Age.ToString(); lbadd.Text = info.Address; lbemail.Text = info.E_Mail; lbphno.Text = info.Mobile; lbnob.Text = info.Nob.ToString(); String path = Server.MapPath("~/Photos/Owners/"); Image1.ImageUrl = path + info.Phot; MultiView1.SetActiveView(View2); }
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { //Memb_Info info = new Memb_Info(); //Memb_Sp sp = new Memb_Sp(); //sp.ViewAllMembers(); // Memb_Info info = new Memb_Info(); Memb_Sp sp = new Memb_Sp(); //sp.ViewAllData(); Memb_Info info = sp.ViewMember(int.Parse(GridView2.SelectedValue.ToString())); txtage.Text = info.Age.ToString(); txtname.Text = info.MemberName; txtaddress.Text = info.Address; txtnob.Text = info.Nob.ToString(); txtmobile.Text = info.Mobile; String path = Server.MapPath("~/Photos/Owners/"); Image1.ImageUrl = path + info.Phot; MultiView1.SetActiveView(View2); }
protected void Button1_Click(object sender, EventArgs e) { string dest = ""; bool flag = true; Memb_Info info = new Memb_Info(); Memb_Sp sp = new Memb_Sp(); info.MemberName = txtuname.Text; info.Age = int.Parse(txtage.Text); info.Password = txtpw.Text; info.Address = txtadd.Text; info.E_Mail = txtemid.Text; info.Mobile = txtmob.Text; info.Nob = int.Parse(txtnob.Text); info.Usrname = txtusrname.Text; if (sp.Compareusername(info.Usrname) != 0) { flag = false; } string imagepath = ""; Boolean fileOK = false; String path = Server.MapPath("~/Photos/Owners/"); if (FileUpload1.HasFile) { String fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } } if (fileOK) { try { imagepath = path + FileUpload1.FileName; FileUpload1.PostedFile.SaveAs(imagepath); FileInfo f = new FileInfo(imagepath); dest = new Memb_Sp().GetMaxCode() + "." + f.Name.Split('.')[1]; if (flag == true) { f.CopyTo(path + dest); info.Phot = dest; sp.Add(info); txtuname.Text = ""; txtage.Text = ""; txtpw.Text = ""; txtvpw.Text = ""; txtadd.Text = ""; txtemid.Text = ""; txtmob.Text = ""; txtnob.Text = ""; txtusrname.Text = ""; int id = (sp.GetMaxCode() - 1); Memb_Info inf = new Memb_Info(); inf = sp.ViewMember(id); lbid.Text = inf.No.ToString(); lbusrname2.Text = inf.Usrname; lbhiname.Text = inf.MemberName; MultiView1.SetActiveView(View2); } else { lbusrname1.Text = "usrer name exists!!."; lbusrname1.Visible = true; } f = new FileInfo(imagepath); f.Delete(); } catch (Exception ex) { lbfile.Text = "File could not be uploaded!!."; lbfile.Visible = true; } } else { lbfile.Text = "Cannot accept files of this type!!."; lbfile.Visible = true; } }