protected void btnSaveArticle_Click(object sender, EventArgs e) { Article ac = new Article(); ac.UserName = HttpContext.Current.User.Identity.Name; ac.DurationId = dm.getDurationId(); ac.ArticleName = txtArticleName.Text; ac.PublishTypeId = Convert.ToInt32(ddPublishType.SelectedValue); if(CheckBox1.Checked){ ac.ResearchId = Convert.ToInt32(ddResearchRefer.SelectedValue); } ac.Description = txtDesc.Text; db.Articles.InsertOnSubmit(ac); db.SubmitChanges(); }
private void detach_Articles(Article entity) { this.SendPropertyChanging(); entity.Research = null; }
partial void DeleteArticle(Article instance);
private void attach_Articles(Article entity) { this.SendPropertyChanging(); entity.Research = this; }
partial void UpdateArticle(Article instance);
partial void InsertArticle(Article instance);
private void detach_Articles(Article entity) { this.SendPropertyChanging(); entity.PublishType = null; }
protected void ASPxGridView2_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { Article ac = new Article(); ac.ArticleId = Convert.ToInt32(((HiddenField)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ArticleName"], "hidEditId")).Value); ac.ArticleName = ((TextBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ArticleName"], "txtEditArticleName")).Text; ac.PublishTypeId = Convert.ToInt32(((ASPxComboBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["PublishTypeId"], "ddEditPublishTypeId")).Value); ac.ResearchId = Convert.ToInt32(((ASPxComboBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ResearchName"], "ddEditResearchId")).Value); dll_Research_Article dll = new dll_Research_Article(username, dr.getDurationId()); dll.updateData(ac); this.ASPxGridView2.CancelEdit(); e.Cancel = true; FillGridView2(); }
protected void ASPxGridView2_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { Article ac = new Article(); ac.UserName = username; ac.DurationId = durationId; ac.ArticleName = ((TextBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ArticleName"], "txtEditArticleName")).Text; ac.PublishTypeId = Convert.ToInt32(((ASPxComboBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["PublishTypeId"], "ddEditPublishTypeId")).Value); ac.ResearchId = Convert.ToInt32(((ASPxComboBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ResearchId"], "ddEditResearchId")).Value); dll_Research_Article dll = new dll_Research_Article(username, durationId); dll.insertData(ac); e.Cancel = true; ASPxGridView2.CancelEdit(); FillGridView2(); }