public void updateData(Research data) { var q = (from p in db.Researches where p.UserName == username where p.DurationId == durationId where p.ResearchId == data.ResearchId select p).First(); q.ResearchName = data.ResearchName; q.IsHeader = data.IsHeader; q.PercentWork = data.PercentWork; db.SubmitChanges(); }
protected void btnSave_Click(object sender, EventArgs e) { Research re = new Research(); re.UserName = HttpContext.Current.User.Identity.Name; re.DurationId = dm.getDurationId(); re.ResearchName = txtResearchName.Text; re.IsHeader = cbIsheader.Checked; re.PercentWork = Convert.ToDouble(txtPercent.Text); re.Description = txtDesc.Text; db.Researches.InsertOnSubmit(re); db.SubmitChanges(); }
protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { Research rs = new Research(); rs.ResearchId = Convert.ToInt32(((HiddenField)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["ResearchName"], "hidEditId")).Value); rs.ResearchName = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["ResearchName"], "txtEditResearchName")).Text; rs.IsHeader = ((ASPxCheckBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["IsHeader"], "cbEditIsHeader")).Checked; rs.PercentWork = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PercentWork"], "txtEditPercentWork")).Text); dll_Research dll = new dll_Research(username, dr.getDurationId()); dll.updateData(rs); this.ASPxGridView1.CancelEdit(); e.Cancel = true; FillGridView(); }
protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { Research rs = new Research(); rs.UserName = username; rs.DurationId = durationId; rs.ResearchName = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["ResearchName"], "txtEditResearchName")).Text; rs.IsHeader = ((ASPxCheckBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["IsHeader"], "cbEditIsHeader")).Checked; rs.PercentWork = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PercentWork"], "txtEditPercentWork")).Text); dll_Research dll = new dll_Research(username, durationId); dll.insertData(rs); e.Cancel = true; ASPxGridView1.CancelEdit(); FillGridView(); }
partial void DeleteResearch(Research instance);
private void detach_Researches(Research entity) { this.SendPropertyChanging(); entity.DurationResearch = null; }
partial void UpdateResearch(Research instance);
partial void InsertResearch(Research instance);
public void insertData(Research data) { db.Researches.InsertOnSubmit(data); db.SubmitChanges(); }