protected void BtAddPeople(object sender, EventArgs e) { hfPeoplesViewState.Value = ""; UpdateGrid(); if (!string.IsNullOrEmpty(tbltype.Text) && !string.IsNullOrEmpty(tblsubtype.Text) && !string.IsNullOrEmpty(tbllastname.Text) && !string.IsNullOrEmpty(tblfirstname.Text) && !string.IsNullOrEmpty(tblmiddlename.Text) && !string.IsNullOrEmpty(tblpost.Text) && !string.IsNullOrEmpty(tblemail1.Text) && !string.IsNullOrEmpty(tblemail2.Text) && !string.IsNullOrEmpty(tblroom.Text) && !string.IsNullOrEmpty(tblphone1.Text) && !string.IsNullOrEmpty(tblphone2.Text) && !string.IsNullOrEmpty(tblphone3.Text)) { var id = Peoples.Count > 0 ? Peoples.Max(x => x.p_Id) + 1 : 1; var p = new People { p_Id = id, p_type = tbltype.Text, p_subtype = tblsubtype.Text, p_lastname = tbllastname.Text, p_firstname = tblfirstname.Text, p_middlename = tblmiddlename.Text, p_post = tblpost.Text, p_email1 = tblemail1.Text, p_email2 = tblemail2.Text, p_room = tblroom.Text, p_phone1 = tblphone1.Text, p_phone2 = tblphone2.Text, p_phone3 = tblphone3.Text }; Peoples.Add(p); comm_sqlDataContext mylinq = new comm_sqlDataContext(); int bb = mylinq.addrow(tbltype.Text, tblsubtype.Text, tbllastname.Text, tblfirstname.Text, tblmiddlename.Text, tblpost.Text, tblemail1.Text, tblemail2.Text, tblroom.Text, tblphone1.Text, tblphone2.Text, tblphone3.Text); UpdateGrid(); Button3.Style.Add("display", "none"); } }
protected void goAddPeople(object sender, EventArgs e) { hfPeoplesViewState.Value = ""; UpdateGrid(); if (!string.IsNullOrEmpty(add_type.Text) || !string.IsNullOrEmpty(add_subtype.Text) || !string.IsNullOrEmpty(add_lastname.Text) || !string.IsNullOrEmpty(add_firstname.Text) || !string.IsNullOrEmpty(add_middlename.Text) || !string.IsNullOrEmpty(add_post.Text) || !string.IsNullOrEmpty(add_email1.Text) || !string.IsNullOrEmpty(add_email2.Text) || !string.IsNullOrEmpty(add_room.Text) || !string.IsNullOrEmpty(add_phone1.Text) || !string.IsNullOrEmpty(add_phone2.Text) || !string.IsNullOrEmpty(add_phone3.Text)) { var id = Peoples.Count > 0 ? Peoples.Max(x => x.p_Id) + 1 : 1; var p = new People { p_Id = id, p_type = add_type.Text, p_subtype = add_subtype.Text, p_lastname = add_lastname.Text, p_firstname = add_firstname.Text, p_middlename = add_middlename.Text, p_post = add_post.Text, p_email1 = add_email1.Text, p_email2 = add_email2.Text, p_room = add_room.Text, p_phone1 = add_phone1.Text, p_phone2 = add_phone2.Text, p_phone3 = add_phone3.Text }; Peoples.Add(p); comm_sqlDataContext mylinq = new comm_sqlDataContext(); int bb = mylinq.addrow(add_type.Text, add_subtype.Text, add_lastname.Text, add_firstname.Text, add_middlename.Text, add_post.Text, add_email1.Text, add_email2.Text, add_room.Text, add_phone1.Text, add_phone2.Text, add_phone3.Text); UpdateGrid(); mylinq.Connection.Close(); Button3.Visible = false; Table1.Visible = false; Table2.Visible = false; c_edit.Visible = false; c_ok.Visible = false; add.Visible = false; delete.Visible = false; } }