//Submit Add Form protected void AddIcdButton_Click(object sender, EventArgs e) { Button btn = (Button)sender; String btnId = btn.ID; if (btnId.Equals("AddIcdButton")) { if (IsValid) { System.Threading.Thread.Sleep(3000); var icdName = NameTextBox.Text; var chapter = GroupNameTextBox.Text; var chapterId = GetGroupId(chapter)[0]; var codeName = CodeTextBox.Text; var icd = new Icd() { icdName = icdName, icdChapterId = chapterId, icdCode = codeName}; _dataContext.Icds.InsertOnSubmit(icd); _dataContext.SubmitChanges(); IcdList.DataBind(); ResetInputField(); } } else if (btnId.Equals("ResetIcdButton")) { ResetInputField(); } }
//Control Update Process protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); var editedRowIndex = IcdList.EditIndex; var lblId = IcdList.Rows[editedRowIndex].FindControl("EditId") as Label; var txtbGroupId = IcdList.Rows[editedRowIndex].FindControl("EditChapterId") as TextBox; var txtbName = IcdList.Rows[editedRowIndex].FindControl("EditName") as TextBox; var txtbCode = IcdList.Rows[editedRowIndex].FindControl("EditCode") as TextBox; var id = long.Parse(lblId.Text); var groupId = GetGroupId(txtbGroupId.Text)[0]; var name = txtbName.Text; var codeName = txtbCode.Text; var icd = new Icd() { icdId = id, icdChapterId = groupId, icdName = name, icdCode = codeName}; _dataContext.Icds.Attach(icd); _dataContext.Refresh(RefreshMode.KeepCurrentValues, icd); _dataContext.SubmitChanges(); IcdList.EditIndex = -1; //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("groupId: " + groupdId); //Debug.WriteLine("Name: " + name); //Debug.WriteLine("price: " + price); } }
partial void DeleteIcd(Icd instance);
partial void UpdateIcd(Icd instance);
partial void InsertIcd(Icd instance);
private void detach_Icds(Icd entity) { this.SendPropertyChanging(); entity.IcdChapter = null; }
private void attach_Icds(Icd entity) { this.SendPropertyChanging(); entity.IcdChapter = this; }