public void SaveTemplateField(DataFormFieldTemplate fieldTemplate) { if (fieldTemplate.TemplateID == 0) { claimRulerDBContext.DataFormFieldTemplate.Add(fieldTemplate); } claimRulerDBContext.SaveChanges(); }
public void btnSaveScreenFields_Click(object sender, EventArgs e) { int templateID = 0; int formID = 0; int fieldID = 0; DataFormFieldTemplate fieldTemplate = null; int clientID = SessionHelper.getClientId(); using (DataFormManager repository = new DataFormManager()) { using (TransactionScope scope = new TransactionScope()) { try { foreach (GridViewRow row in gvFields.Rows) { CheckBox cbxSelected = row.FindControl("cbxSelected") as CheckBox; HiddenField hf_templateID = row.FindControl("hf_templateID") as HiddenField; HiddenField hf_formID = row.FindControl("hf_formID") as HiddenField; HiddenField hf_fieldID = row.FindControl("hf_fieldID") as HiddenField; templateID = Convert.ToInt32(hf_templateID.Value); formID = Convert.ToInt32(hf_formID.Value); //(int)gvFields.DataKeys[row.RowIndex].Values[1]; fieldID = Convert.ToInt32(hf_fieldID.Value); //(int)gvFields.DataKeys[row.RowIndex].Values[2]; if (templateID > 0) { fieldTemplate = repository.GetTemplate(templateID); } else { fieldTemplate = new DataFormFieldTemplate(); } fieldTemplate.ClientID = clientID; fieldTemplate.TemplateID = templateID; fieldTemplate.FormID = formID; fieldTemplate.FieldID = fieldID; fieldTemplate.IsSelected = cbxSelected.Checked; repository.SaveTemplateField(fieldTemplate); } scope.Complete(); lblMessage.Text = "Fields Template saved successfully."; lblMessage.CssClass = "ok"; } catch (Exception ex) { Core.EmailHelper.emailError(ex); lblMessage.Text = "Unable to save fields template."; lblMessage.CssClass = "error"; } // try/catch } // using (TransactionScope } }
public void btnSaveScreenFields_Click(object sender, EventArgs e) { int templateID = 0; int formID = 0; int fieldID = 0; DataFormFieldTemplate fieldTemplate = null; int clientID = SessionHelper.getClientId(); using (DataFormManager repository = new DataFormManager()) { using (TransactionScope scope = new TransactionScope()) { try { foreach (GridViewRow row in gvFields.Rows) { CheckBox cbxSelected = row.FindControl("cbxSelected") as CheckBox; HiddenField hf_templateID = row.FindControl("hf_templateID") as HiddenField; HiddenField hf_formID = row.FindControl("hf_formID") as HiddenField; HiddenField hf_fieldID = row.FindControl("hf_fieldID") as HiddenField; templateID = Convert.ToInt32(hf_templateID.Value); formID = Convert.ToInt32(hf_formID.Value); //(int)gvFields.DataKeys[row.RowIndex].Values[1]; fieldID = Convert.ToInt32(hf_fieldID.Value); //(int)gvFields.DataKeys[row.RowIndex].Values[2]; if (templateID > 0) fieldTemplate = repository.GetTemplate(templateID); else fieldTemplate = new DataFormFieldTemplate(); fieldTemplate.ClientID = clientID; fieldTemplate.TemplateID = templateID; fieldTemplate.FormID = formID; fieldTemplate.FieldID = fieldID; fieldTemplate.IsSelected = cbxSelected.Checked; repository.SaveTemplateField(fieldTemplate); } scope.Complete(); lblMessage.Text = "Fields Template saved successfully."; lblMessage.CssClass = "ok"; } catch (Exception ex) { Core.EmailHelper.emailError(ex); lblMessage.Text = "Unable to save fields template."; lblMessage.CssClass = "error"; } // try/catch } // using (TransactionScope } }
public DataFormFieldTemplate GetTemplate(int id) { DataFormFieldTemplate template = null; template = (from x in claimRulerDBContext.DataFormFieldTemplate where x.TemplateID == id select x ).FirstOrDefault(); return(template); }
public void SaveTemplateField(DataFormFieldTemplate fieldTemplate) { if (fieldTemplate.TemplateID == 0) claimRulerDBContext.DataFormFieldTemplate.Add(fieldTemplate); claimRulerDBContext.SaveChanges(); }