protected void GetInfo() { first tip = new first(); tip.MealAmount = double.Parse(MealTextBox.Text); if (OtherTextBox.Text == "") { tip.TipPercent = 0; foreach (ListItem item in TipPercentsRBL.Items) { if (item.Text.Equals("Ten Percent")) { tip.TipPercent = .1; } else if (item.Text.Equals("Fifteen Percent")) { tip.TipPercent = .15; } else if (item.Text.Equals("Twenty Percent")) { tip.TipPercent = .2; } } // end foreach } // end if else { tip.TipPercent = double.Parse(OtherTextBox.Text); } Result.Text = "Amount: " + tip.MealAmount.ToString() + "<br />" + "Tip: " + tip.CalculateTip().ToString() + "<br/>" + "Tax: " + tip.CalculateTax().ToString() + "<br/>" + "Total: " + tip.CalculateTotal().ToString(); } // end getinfo
public ActionResult getdata() { var m = new List <first>(); string str = ConfigurationManager.ConnectionStrings["str"].ToString(); SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from tbl_fn_ln"; cmd.CommandType = CommandType.Text; cmd.Connection = con; con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { first f = new first(); f.id = reader.GetInt32(0); f.fname = reader.GetString(1); f.lname = reader.GetString(2); m.Add(f); } con.Close(); return(View(m)); }
static void Main(string[] args) { //access modifiers first f = new first(); Console.ReadKey(); }
public ActionResult Delete(int id, first f) { var p = (from n in dc.tbl_reg where n.id == id select n).FirstOrDefault(); dc.tbl_reg.Remove(p); dc.SaveChanges(); return(RedirectToAction("getdata")); }
static void Main(string[] args) { first fc = new first(); second sc = new second(); fc.func(); sc.func(); Console.ReadKey(); }
public ActionResult edit(int id, first f) { var p = (from n in dc.tbl_reg where n.id == id select n).FirstOrDefault(); p.id = f.id; p.fname = f.fname; p.lname = f.lname; dc.SaveChanges(); return(RedirectToAction("getdata")); }
public ActionResult Delete(int id) { var p = (from n in dc.tbl_reg where n.id == id select n).FirstOrDefault(); first f = new first(); f.id = p.id; f.fname = p.fname; f.lname = p.lname; return(View(f)); }
static void Main(string[] args) { first delMain = null; first del = new first(M1); first del1 = new first(M2); delMain = del + del1; delMain(); Console.ReadKey(); }
static void Main(string[] args) { Console.Write("\n Method Calls Demo"); Console.Write("\n ===================\n"); ParamDemo pd = new ParamDemo(); int xv = 2, yv = 3; pd.intValueParams(xv, yv); Console.Write("\n values after returning:"); Console.Write("\n xv = {0}, yv = {1}", xv, yv); Console.Write("\n\n"); int xr = 2, yr = 3; pd.intRefParams(ref xr, ref yr); Console.Write("\n values after returning:"); Console.Write("\n xr = {0}, yr = {1}", xr, yr); Console.Write("\n\n"); StringBuilder sv = new StringBuilder("string sv"); StringBuilder tv = new StringBuilder("string tv"); pd.StringBuilderValueParams(sv, tv); Console.Write("\n values after returning:"); Console.Write("\n sv = {0}, tv = {1}", sv, tv); Console.Write("\n\n"); StringBuilder sr = new StringBuilder("string sr"); StringBuilder tr = new StringBuilder("string tr"); pd.StringBuilderRefParams(ref sr, ref tr); Console.Write("\n values after returning:"); Console.Write("\n sr = {0}, tr = {1}", sr, tr); Console.Write("\n\n"); first ov = new first(); second pv = new second(); pd.ObjectValueParams(ov, pv); Console.Write("\n values after returning:"); Console.Write("\n ov = {0}, pv = {1}", ov.ToString(), pv.ToString()); Console.Write("\n\n"); object or = new first(); object pr = new second(); pd.ObjectRefParams(ref or, ref pr); Console.Write("\n values after returning:"); Console.Write("\n or = {0}, pr = {1}", or.ToString(), pr.ToString()); Console.Write("\n\n"); }
public ActionResult Insert(first f) { tbl_reg tr = new tbl_reg(); tr.fname = f.fname; tr.lname = f.lname; dc.tbl_reg.Add(tr); dc.SaveChanges(); ViewBag.msg = "Insert Successfully"; return(View()); }
public ActionResult delete(int id, first f) { SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "delete from tbl_fn_ln where id='" + id + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); return(RedirectToAction("getdata")); }
public ActionResult getdata() { var p = from n in dc.tbl_reg select n; var model = new List <first>(); foreach (var item in p) { first f = new first(); f.id = item.id; f.fname = item.fname; f.lname = item.lname; model.Add(f); } return(View(model)); }
public ActionResult edit(int id, first f) { SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Update tbl_fn_ln set fname=@fn,lname=@ln where id='" + id + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = con; cmd.Parameters.AddWithValue("@fn", f.fname); cmd.Parameters.AddWithValue("@ln", f.lname); con.Open(); cmd.ExecuteNonQuery(); con.Close(); return(RedirectToAction("getdata")); }
public ActionResult Index(first f) { SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "insert into tbl_fn_ln values(@fn,@ln)"; cmd.CommandType = CommandType.Text; cmd.Connection = con; cmd.Parameters.AddWithValue("@fn", f.fname); cmd.Parameters.AddWithValue("@ln", f.lname); con.Open(); cmd.ExecuteNonQuery(); con.Close(); return(View()); }
public ActionResult getdata() { var p = from n in dc.tbl_all select n; var model = new List <first>(); foreach (var item in p) { first f = new first(); f.id = item.id; f.fname = item.fname; f.password = item.pass; f.gender = item.gender; f.hobby = item.hobby; f.state = item.state; f.img = item.img; model.Add(f); } return(View(model)); }
public List <first> getdata(int id, string name, string address) { if (id.ToString() == null) { id = 0; } List <first> objlist = new List <first>(5000); if (con.State == ConnectionState.Broken || con.State == ConnectionState.Closed) { con.Open(); } string smt = ""; if (id == 0) { smt = "select id, name, address from mvcdemo"; } else { smt = "select id, name, address from mvcdemo where id='" + id + "'"; } SqlDataAdapter da = new SqlDataAdapter(smt, con); DataSet ds = new DataSet(); da.Fill(ds, "Table"); int i = 0; while (i < ds.Tables[0].Rows.Count) { first obj1 = new first(); obj1.id = Convert.ToInt32(ds.Tables[0].Rows[i]["id"]); obj1.name = Convert.ToString(ds.Tables[0].Rows[i]["name"]); obj1.address = Convert.ToString(ds.Tables[0].Rows[i]["address"]); objlist.Add(obj1); i++; } return(objlist); }
public ActionResult edit(int id) { string str = ConfigurationManager.ConnectionStrings["str"].ToString(); SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from tbl_fn_ln where id='" + id + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = con; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet dt = new DataSet(); da.Fill(dt); first f = new first(); f.id = int.Parse(dt.Tables[0].Rows[0]["id"].ToString()); f.fname = dt.Tables[0].Rows[0]["fname"].ToString(); f.lname = dt.Tables[0].Rows[0]["lname"].ToString(); con.Close(); return(View(f)); }
private void btnLogin_Click(object sender, EventArgs e) { string connectionString = "Data Source=.;Initial Catalog=Poysal;Integrated Security=True"; SqlConnection con = new SqlConnection(connectionString); con.Open(); SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From Login where Name='" + txtUser.Text + "'and ID ='" + txtPass.Text + "'", con); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { this.Hide(); first ss = new first(); ss.Show(); } //txtUser.Text = labelUserName.Text; else { MessageBox.Show("Please provide correct User Name and Password"); } }
return(FullGroupJoin(first, second, firstKeySelector, secondKeySelector, ValueTuple.Create, EqualityComparer <TKey> .Default));
IntersectInternal(first, second, comparer, cutOffLength);
return(new NodeCollection(first, second._items, second._count, third));
return(new HyperComplex <TInner>(Add(first, other.first), Add(second, other.second)));
providedValues = Prepend(first, providedValues);
var(first, last) = GetFirstLast(context);
var(first, second) = twoItems;
set => AddOrReplace(first, value);
return(new HyperSplitComplex <TInner, TComponent>(Add(first, other.first), Add(second, other.second)));
GenerateBezierV128V1(first, last, tanL, tanR, pts, u, out retVal);
public ActionResult Index(first f, HttpPostedFileBase file1) { tbl_all tr = new tbl_all(); tr.fname = f.fname; tr.pass = f.password; tr.gender = f.gender; string str = ""; if (f.cric == true) { if (str == "") { str = "Cricket"; } else { str = str + "," + "Cricket"; } } if (f.foot == true) { if (str == "") { str = "Football"; } else { str = str + "," + "Football"; } } if (f.Hockey == true) { if (str == "") { str = "Hockey"; } else { str = str + "," + "Hockey"; } } tr.hobby = str; tr.state = f.state; if (file1 != null) { filename = file1.FileName; path = Server.MapPath("~/img/"); fulpath = path + "\\" + filename; file1.SaveAs(fulpath); str1 = "~/img/" + filename; } tr.img = str1; dc.tbl_all.Add(tr); dc.SaveChanges(); var p = new SelectList(new[] { "Gujrat", "Mh", "Delhi" }); ViewBag.state = p; return(View()); }
var(first, firstFailure) = @this;