private void CreateRelation() { string sql = @"SELECT entitysettings.addrelationtoentity( @p_entityid, @p_entityname, @p_synapsenamespaceid, @p_synapsenamespacename, @p_parententityid, @p_parententityname, @p_parentsynapsenamespaceid, @p_parentsynapsenamespacename, @p_attributeid, @p_attributename, CAST(@p_ordinal_position AS integer), @p_entityversionid, @p_username, @p_localentityattributeid, @p_localentityattributename )"; DataTable dt = SynapseHelpers.GetEntityDSFromID(this.hdnEntityID.Value); DataTable dtParent = SynapseHelpers.GetEntityDSFromID(this.ddlEntity.SelectedValue); DataTable dtKey = SynapseHelpers.GetEntityKeyAttributeFromID(this.ddlEntity.SelectedValue); string attributename = dtKey.Rows[0]["attributename"].ToString(); if (this.ddlLocalAttribute.SelectedIndex > 0) { attributename += "_" + this.ddlLocalAttribute.SelectedItem.Text; } var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("p_entityid", this.hdnEntityID.Value), new KeyValuePair <string, string>("p_entityname", SynapseHelpers.GetEntityNameFromID(this.hdnEntityID.Value)), new KeyValuePair <string, string>("p_synapsenamespaceid", dt.Rows[0]["synapsenamespaceid"].ToString()), new KeyValuePair <string, string>("p_synapsenamespacename", dt.Rows[0]["synapsenamespacename"].ToString()), new KeyValuePair <string, string>("p_parententityid", this.ddlEntity.SelectedValue), new KeyValuePair <string, string>("p_parententityname", this.ddlEntity.SelectedItem.Text), new KeyValuePair <string, string>("p_parentsynapsenamespaceid", dtParent.Rows[0]["synapsenamespaceid"].ToString()), new KeyValuePair <string, string>("p_parentsynapsenamespacename", dtParent.Rows[0]["synapsenamespacename"].ToString()), new KeyValuePair <string, string>("p_attributeid", dtKey.Rows[0]["attributeid"].ToString()), new KeyValuePair <string, string>("p_attributename", attributename), new KeyValuePair <string, string>("p_ordinal_position", this.hdnNextOrdinalPosition.Value), new KeyValuePair <string, string>("p_entityversionid", SynapseHelpers.GetCurrentEntityVersionFromID(this.hdnEntityID.Value)), new KeyValuePair <string, string>("p_username", this.hdnUserName.Value), new KeyValuePair <string, string>("p_localentityattributeid", this.ddlLocalAttribute.SelectedValue), new KeyValuePair <string, string>("p_localentityattributename", this.ddlLocalAttribute.SelectedItem.Text) }; DataServices.ExcecuteNonQueryFromSQL(sql, paramList); ClearAttributesForm(); this.hdnNextOrdinalPosition.Value = SynapseHelpers.GetNextOrdinalPositionFromID(this.hdnEntityID.Value); BindEntityGrid(); this.lblSuccess.Text = "Relation created"; this.lblSuccess.Visible = true; }
protected void btnSave_Click(object sender, EventArgs e) { string haserr = "form-group has-error"; string noerr = "form-group"; this.lblError.Text = string.Empty; this.lblError.Visible = false; this.lblSuccess.Visible = false; this.fgDeviceName.CssClass = noerr; if (string.IsNullOrEmpty(this.txtDeviceName.Text.ToString())) { this.lblError.Text = "Please enter the device name"; this.txtDeviceName.Focus(); this.lblError.Visible = true; this.fgDeviceName.CssClass = haserr; return; } this.fgIPAddress.CssClass = noerr; if (string.IsNullOrEmpty(this.txtIPAddress.Text.ToString())) { this.lblError.Text = "Please enter the IP Address"; this.txtIPAddress.Focus(); this.lblError.Visible = true; this.fgIPAddress.CssClass = haserr; return; } this.fgLocationCode.CssClass = noerr; if (string.IsNullOrEmpty(this.txtLocationCode.Text.ToString())) { this.lblError.Text = "Please enter the Location Code"; this.txtLocationCode.Focus(); this.lblError.Visible = true; this.fgLocationCode.CssClass = haserr; return; } string sql = @"UPDATE eboards.Locatorboarddevice SET Locatorboarddevicename = @Locatorboarddevicename, Locatorboard_id = @Locatorboard_id, deviceipaddress = @deviceipaddress, locationid = @locationid WHERE Locatorboarddevice_id = @Locatorboarddevice_id;" ; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("Locatorboarddevice_id", this.hdnDeviceID.Value), new KeyValuePair <string, string>("Locatorboarddevicename", this.txtDeviceName.Text), new KeyValuePair <string, string>("Locatorboard_id", this.ddlLocatorBoard.SelectedValue), new KeyValuePair <string, string>("deviceipaddress", this.txtIPAddress.Text), new KeyValuePair <string, string>("locationid", this.txtLocationCode.Text) }; try { DataServices.ExcecuteNonQueryFromSQL(sql, paramList); } catch (Exception ex) { this.lblError.Text = ex.ToString(); this.lblError.Visible = true; return; } Response.Redirect("LocatorBoardDeviceView.aspx?id=" + this.hdnDeviceID.Value); }
protected void btnValidateEntity_Click(object sender, EventArgs e) { this.txtEntityName.Text = RemoveAndReplaceSpecialCharacters(this.txtEntityName.Text); this.txtEntityName.Enabled = true; string haserr = "form-group has-error"; string noerr = "form-group"; this.lblError.Text = string.Empty; this.lblError.Visible = false; this.lblSuccess.Visible = false; this.fgCoreEntity.CssClass = noerr; if (string.IsNullOrEmpty(this.txtEntityName.Text.ToString())) { this.lblError.Text = "Please enter a new name for the entity"; this.txtEntityName.Focus(); this.lblError.Visible = true; this.fgEntityName.CssClass = haserr; return; } if (this.ddlLocalNamespace.SelectedIndex == 0) { this.lblError.Text = "Please select the namespace that you want to create the entity in"; this.ddlLocalNamespace.Focus(); this.lblError.Visible = true; this.fgCoreEntity.CssClass = haserr; return; } string localtablename = this.ddlLocalNamespace.SelectedItem.Text + "_" + this.txtEntityName.Text; string sql = "SELECT * FROM entitysettings.entitymanager WHERE synapseNamespaceid = @synapseNamespaceid and entityname = @entityname;"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("synapseNamespaceid", this.hdnNamespaceID.Value), new KeyValuePair <string, string>("entityname", localtablename) }; DataSet ds = DataServices.DataSetFromSQL(sql, paramList); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { this.lblError.Text = "There is already a local entity called " + localtablename; this.ddlLocalNamespace.Focus(); this.lblError.Visible = true; this.fgCoreEntity.CssClass = haserr; return; } this.lblSuccess.Visible = true; this.lblSuccess.Text = "Validation succeeded"; this.btnCreateNewEntity.Visible = true; this.btnCancel.Visible = true; this.btnCreateNewEntity.Focus(); this.btnValidateEntity.Visible = false; this.ddlLocalNamespace.Enabled = false; this.txtEntityName.Enabled = false; }
private void AddUser() { try { string userId = Guid.NewGuid().ToString(); string hashedPassword = string.Empty; PasswordHasher <IdentityUser> passwordHasher = new PasswordHasher <IdentityUser>(); IdentityUser user = new IdentityUser(this.txtUsername.Text); hashedPassword = passwordHasher.HashPassword(user, this.txtPassword.Text); //using (SHA256 shA256 = SHA256.Create()) //{ // byte[] bytes = Encoding.UTF8.GetBytes(this.txtPassword.Text); // hashedPassword = Convert.ToBase64String(((HashAlgorithm)shA256).ComputeHash(bytes)); //} string sql = "INSERT INTO \"AspNetUsers\"(\"Id\", \"UserName\", \"NormalizedUserName\", \"Email\", \"NormalizedEmail\", \"EmailConfirmed\", \"PasswordHash\", \"SecurityStamp\", \"ConcurrencyStamp\", \"PhoneNumberConfirmed\", \"TwoFactorEnabled\", \"LockoutEnabled\", \"AccessFailedCount\") " + " VALUES(@Id, @UserName, @NormalizedUserName, @Email, @NormalizedEmail, false, @PasswordHash, @SecurityStamp, @ConcurrencyStamp, false, false, false, 0)"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("Id", userId), new KeyValuePair <string, string>("Username", this.txtUsername.Text), new KeyValuePair <string, string>("NormalizedUserName", this.txtUsername.Text.ToUpper()), new KeyValuePair <string, string>("Email", this.txtEmail.Text), new KeyValuePair <string, string>("NormalizedEmail", this.txtEmail.Text.ToUpper()), new KeyValuePair <string, string>("PasswordHash", hashedPassword), new KeyValuePair <string, string>("SecurityStamp", Guid.NewGuid().ToString()), new KeyValuePair <string, string>("ConcurrencyStamp", Guid.NewGuid().ToString()) }; DataServices.ExcecuteNonQueryFromSQL(sql, paramList, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS); string query = "INSERT INTO \"AspNetUserClaims\" (\"UserId\", \"ClaimType\", \"ClaimValue\") " + "VALUES(@UserId, @ClaimType, @ClaimValue), " + "(@UserId, @ClaimType1, @ClaimValue1), " + "(@UserId, @ClaimType2, @ClaimValue2), " + "(@UserId, @ClaimType3, @ClaimValue3), " + "(@UserId, @ClaimType4, @ClaimValue4);"; var parameters = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("UserId", userId), new KeyValuePair <string, string>("ClaimType", "name"), new KeyValuePair <string, string>("ClaimValue", this.txtFirstName.Text + ' ' + this.txtLastName.Text), new KeyValuePair <string, string>("ClaimType1", "given_name"), new KeyValuePair <string, string>("ClaimValue1", this.txtFirstName.Text), new KeyValuePair <string, string>("ClaimType2", "family_name"), new KeyValuePair <string, string>("ClaimValue2", this.txtLastName.Text), new KeyValuePair <string, string>("ClaimType3", "email"), new KeyValuePair <string, string>("ClaimValue3", this.txtEmail.Text), new KeyValuePair <string, string>("ClaimType4", "email_verified"), new KeyValuePair <string, string>("ClaimValue4", "true") }; DataServices.ExcecuteNonQueryFromSQL(query, parameters, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS); ClearAttributesForm(); this.lblSuccess.Text = "New user added"; this.lblSuccess.Visible = true; } catch (Exception ex) { this.lblError.Text = ex.ToString(); this.lblError.Visible = true; return; } }
private void BindDBFields() { string sql = "SELECT * FROM eboards.bedboard WHERE bedboard_id = @bedboard_id;"; DataSet ds = new DataSet(); var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("bedboard_id", hdnBedBoardID.Value) }; try { ds = DataServices.DataSetFromSQL(sql, paramList); } catch (Exception ex) { StringBuilder sbe = new StringBuilder(); sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>"); sbe.AppendLine(ex.ToString()); sbe.AppendLine("</div>"); this.ltrlError.Visible = true; this.ltrlError.Text = sbe.ToString(); return; } DataTable dt = ds.Tables[0]; try { this.txtBedBoardName.Text = dt.Rows[0]["bedboardname"].ToString(); } catch { } try { this.txtBedBoardDescription.Text = dt.Rows[0]["bedboarddescription"].ToString(); } catch { } SetDDLSource(this.ddlBaseViewNamespace, dt.Rows[0]["baseviewnamespace_id"].ToString()); BindBaseViewList(); SetDDLSource(this.ddlBaseView, dt.Rows[0]["baseview_id"].ToString()); BindBaseViewFields(); SetDDLSource(this.ddlPersonIDField, dt.Rows[0]["baseviewpersonidfield"].ToString()); SetDDLSource(this.ddlEncounterIDField, dt.Rows[0]["baseviewencounteridfield"].ToString()); SetDDLSource(this.ddlWardField, dt.Rows[0]["baseviewwardfield"].ToString()); SetDDLSource(this.ddlBedField, dt.Rows[0]["baseviewbedfield"].ToString()); SetDDLSource(this.ddlTopSetting, dt.Rows[0]["topsetting"].ToString()); CheckTopOptions(); SetDDLSource(this.ddlTopField, dt.Rows[0]["topfield"].ToString()); SetDDLSource(this.ddlTopLeftField, dt.Rows[0]["topleftfield"].ToString()); SetDDLSource(this.ddlTopRightField, dt.Rows[0]["toprightfield"].ToString()); SetDDLSource(this.ddlMiddleSetting, dt.Rows[0]["middlesetting"].ToString()); CheckMiddleOptions(); SetDDLSource(this.ddlMiddleField, dt.Rows[0]["middlefield"].ToString()); SetDDLSource(this.ddlMiddleLeftField, dt.Rows[0]["middleleftfield"].ToString()); SetDDLSource(this.ddlMiddleRightField, dt.Rows[0]["middlerightfield"].ToString()); SetDDLSource(this.ddlBottomSetting, dt.Rows[0]["bottomsetting"].ToString()); CheckBottomOptions(); SetDDLSource(this.ddlBottomField, dt.Rows[0]["bottomfield"].ToString()); SetDDLSource(this.ddlBottomLeftField, dt.Rows[0]["bottomleftfield"].ToString()); SetDDLSource(this.ddlBottomRightField, dt.Rows[0]["bottomrightfield"].ToString()); }
protected void btnSave_Click(object sender, EventArgs e) { string haserr = "form-group has-error"; string noerr = "form-group"; this.ltrlError.Text = string.Empty; this.ltrlError.Visible = false; this.lblSuccess.Visible = false; int errcount = 0; StringBuilder sb = new StringBuilder(); sb.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Please resolve the following errors:</h3><ul>"); this.fgLocatorBoardName.CssClass = noerr; if (string.IsNullOrWhiteSpace(this.txtLocatorBoardName.Text)) { sb.AppendLine("<li>" + "Please enter a new name for the Bed Board" + "</li>"); this.fgLocatorBoardName.CssClass = haserr; errcount++; } //Lists this.fgList.CssClass = noerr; if (this.ddlList.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the underlying list for the board" + "</li>"); this.fgList.CssClass = haserr; errcount++; } this.fgListLocationField.CssClass = noerr; if (this.ddlListLocationField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the location id field for the list" + "</li>"); this.fgListLocationField.CssClass = haserr; errcount++; } this.fgBaseViewNamespace.CssClass = noerr; if (this.ddlBaseViewNamespace.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the location specific information baseview" + "</li>"); this.fgBaseViewNamespace.CssClass = haserr; errcount++; } this.fgBaseView.CssClass = noerr; if (this.ddlBaseView.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select a location specific baseview" + "</li>"); this.fgBaseView.CssClass = haserr; errcount++; } this.fgLocationIDField.CssClass = noerr; if (this.ddlLocationIDField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the Bed Code field from the baseview" + "</li>"); this.fgLocationIDField.CssClass = haserr; errcount++; } this.fgHeading.CssClass = noerr; if (this.ddlHeading.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the Heading column from the baseview" + "</li>"); this.fgHeading.CssClass = haserr; errcount++; } this.fgTopLeftField.CssClass = noerr; if (this.ddlTopLeftField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Top Left Section" + "</li>"); this.fgTopLeftField.CssClass = haserr; errcount++; } this.fgTopRightField.CssClass = noerr; if (ddlTopRightField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Top Right Section" + "</li>"); this.fgTopRightField.CssClass = haserr; errcount++; } if (errcount > 0) { sb.AppendLine("</ul></div>"); this.ltrlError.Visible = true; this.ltrlError.Text = sb.ToString(); return; } string sql = @"INSERT INTO eboards.LocatorBoard( _createdby, LocatorBoard_id, LocatorBoardname, LocatorBoarddescription, list_id, listlocationfield, locationbaseviewnamespace_id, locationbaseview_id, locationidfield, locationdisplayfield, topleftfield, toprightfield ) VALUES( @_createdby, @LocatorBoard_id, @LocatorBoardname, @LocatorBoarddescription, @list_id, @listlocationfield, @locationbaseviewnamespace_id, @locationbaseview_id, @locationidfield, @locationdisplayfield, @topleftfield, @toprightfield )"; string newID = System.Guid.NewGuid().ToString(); var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("_createdby", this.hdnUserName.Value), new KeyValuePair <string, string>("LocatorBoard_id", newID), new KeyValuePair <string, string>("LocatorBoardname", this.txtLocatorBoardName.Text), new KeyValuePair <string, string>("LocatorBoarddescription", this.txtLocatorBoardDescription.Text), new KeyValuePair <string, string>("list_id", this.ddlList.SelectedValue), new KeyValuePair <string, string>("listlocationfield", this.ddlListLocationField.SelectedValue), new KeyValuePair <string, string>("locationbaseviewnamespace_id", this.ddlBaseViewNamespace.SelectedValue), new KeyValuePair <string, string>("locationbaseview_id", this.ddlBaseView.SelectedValue), new KeyValuePair <string, string>("locationidfield", this.ddlLocationIDField.SelectedValue), new KeyValuePair <string, string>("locationdisplayfield", this.ddlHeading.SelectedValue), new KeyValuePair <string, string>("topleftfield", this.ddlTopLeftField.SelectedValue), new KeyValuePair <string, string>("toprightfield", this.ddlTopRightField.SelectedValue) }; try { DataServices.ExcecuteNonQueryFromSQL(sql, paramList); } catch (Exception ex) { StringBuilder sbe = new StringBuilder(); sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>"); sbe.AppendLine(ex.ToString()); sbe.AppendLine("</div>"); this.ltrlError.Visible = true; this.ltrlError.Text = sbe.ToString(); return; } Response.Redirect("LocatorBoardManagerView.aspx?id=" + newID); }
private void BindFormFields() { string sql = "SELECT * FROM listsettings.listmanager WHERE list_id = @list_id;"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("list_id", this.hdnListID.Value) }; DataSet ds = new DataSet(); try { ds = DataServices.DataSetFromSQL(sql, paramList); } catch (Exception ex) { StringBuilder sbe = new StringBuilder(); sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>"); sbe.AppendLine(ex.ToString()); sbe.AppendLine("</div>"); this.ltrlError.Visible = true; this.ltrlError.Text = sbe.ToString(); return; } DataTable dt = ds.Tables[0]; try { this.hdnBaseView.Value = dt.Rows[0]["baseview_id"].ToString(); } catch {} BindBaseViewContextFields(); BindDropDownList(this.ddlDefaultContext, "SELECT entityid, synapsenamespacename || '.' || entityname as entitydisplayname, keycolumn FROM entitysettings.entitymanager order by 2", "entityid", "entitydisplayname", 1, null); try { this.txtListName.Text = dt.Rows[0]["listname"].ToString(); } catch { } try { this.txtListComments.Text = dt.Rows[0]["listdescription"].ToString(); } catch { } try { this.txtDefaultTableRowCSS.Text = dt.Rows[0]["defaultrowcssstyle"].ToString(); } catch { } try { this.txtTableClass.Text = dt.Rows[0]["tablecssstyle"].ToString(); } catch { } try { this.txtTableHeaderClass.Text = dt.Rows[0]["tableheadercssstyle"].ToString(); } catch { } try { SetDDLSource(this.ddlDefaultContext, dt.Rows[0]["defaultcontext"].ToString()); } catch { } try { this.lblDefaultContextField.Text = dt.Rows[0]["defaultcontextfield"].ToString(); } catch { } try { SetDDLSource(this.ddlMatchedContextField, dt.Rows[0]["matchedcontextfield"].ToString()); } catch {} try { SetDDLSource(this.ddlPatientBannerField, dt.Rows[0]["patientbannerfield"].ToString()); } catch { } try { SetDDLSource(this.ddlRowCSSField, dt.Rows[0]["rowcssfield"].ToString()); } catch { } try { SetDDLSource(this.ddlWardPersonaContextField, dt.Rows[0]["wardpersonacontextfield"].ToString()); } catch { } try { SetDDLSource(this.ddlCUPersonaContextField, dt.Rows[0]["clinicalunitpersonacontextfield"].ToString()); } catch { } try { SetDDLSource(this.ddlSpecialtyPersonaContextField, dt.Rows[0]["specialtypersonacontextfield"].ToString()); } catch { } try { SetDDLSource(this.ddlTeamPersonaContextField, dt.Rows[0]["teampersonacontextfield"].ToString()); } catch { } try { SetDDLSource(this.ddlSnapshotLine1, dt.Rows[0]["snapshottemplateline1"].ToString()); } catch { } try { SetDDLSource(this.ddlSnapshotLine2, dt.Rows[0]["snapshottemplateline2"].ToString()); } catch { } try { SetDDLSource(this.ddlSnapshotBadge, dt.Rows[0]["snapshottemplatebadge"].ToString()); } catch { } try { SetDDLSource(this.ddlDefaultSortColumn, dt.Rows[0]["defaultsortcolumn"].ToString()); } catch { } try { SetDDLSource(this.ddlDefaultSortOrder, dt.Rows[0]["defaultsortorder"].ToString()); } catch { } }
private void GetFormFields() { string sql = "SELECT * FROM listsettings.questionoption WHERE questionoption_id = @questionoption_id;"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("questionoption_id", this.hdnOptionID.Value) }; DataSet ds = new DataSet(); try { ds = DataServices.DataSetFromSQL(sql, paramList); } catch (Exception ex) { StringBuilder sbe = new StringBuilder(); sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>"); sbe.AppendLine(ex.ToString()); sbe.AppendLine("</div>"); this.ltrlError.Visible = true; this.ltrlError.Text = sbe.ToString(); return; } DataTable dt = ds.Tables[0]; try { this.hdnOptionCollectionID.Value = dt.Rows[0]["questionoptioncollection_id"].ToString(); } catch { } try { this.txtOptionValueText.Text = dt.Rows[0]["optionvaluetext"].ToString(); } catch { } try { this.txtOptionDisplayText.Text = dt.Rows[0]["optiondisplaytext"].ToString(); } catch { } try { this.txtOptionFlag.Text = dt.Rows[0]["optionflag"].ToString(); } catch { } try { this.txtOptionFlagAlt.Text = dt.Rows[0]["optionflagalt"].ToString(); } catch { } try { this.lblListOptionCollection.Text = dt.Rows[0]["questionoptioncollectionname"].ToString(); } catch { } }
public static int SendMail(string messageBody, string messageSubject, string emailTo, out string msg) { string emailhost = ""; string emailuser = ""; string emailpassword = ""; Int16 emailport = 0; bool emailusetls = false; string emailfromaddress = ""; string emailfromname = "Physical Health App"; string sql = "SELECT * FROM systemsettings.systemsetup WHERE systemsetupid = 1;"; DataSet ds = DataServices.DataSetFromSQL(sql, null); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { try { emailhost = dt.Rows[0]["emailhost"].ToString(); } catch { } try { emailuser = dt.Rows[0]["emailuser"].ToString(); } catch { } try { emailpassword = dt.Rows[0]["emailpassword"].ToString(); } catch { } try { emailport = System.Convert.ToInt16(dt.Rows[0]["emailport"].ToString()); } catch { } try { emailusetls = System.Convert.ToBoolean(dt.Rows[0]["emailusetls"].ToString()); } catch { } try { emailfromaddress = dt.Rows[0]["emailfromaddress"].ToString(); } catch { } try { emailfromname = dt.Rows[0]["emailfromname"].ToString(); } catch { } } if (string.IsNullOrEmpty(emailhost)) { msg = "Email not configured"; return(0); } MailMessage Message = new MailMessage(); Message.Subject = messageSubject; Message.Body = messageBody; Message.From = new System.Net.Mail.MailAddress(emailfromaddress, emailfromname); Message.ReplyToList.Add(Message.From); Message.IsBodyHtml = true; Message.To.Add(new MailAddress(emailTo)); SmtpClient client = new SmtpClient(); client.Host = emailhost; client.Port = emailport; client.UseDefaultCredentials = true; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.EnableSsl = emailusetls; client.Credentials = new NetworkCredential(emailuser, emailpassword); try { client.Send(Message); msg = "Email sent successfully"; return(1); } catch (Exception ex) { msg = "Problem with email account: " + ex.ToString(); return(0); } }
private void SaveNewList() { string haserr = "form-group has-error"; string noerr = "form-group"; this.lblError.Text = string.Empty; this.lblError.Visible = false; this.lblSuccess.Visible = false; this.fgListName.CssClass = noerr; if (string.IsNullOrEmpty(this.txtListName.Text.ToString())) { this.lblError.Text = "Please enter a new name for the List"; this.txtListName.Focus(); this.lblError.Visible = true; this.fgListName.CssClass = haserr; return; } this.fgDefaultContext.CssClass = noerr; if (this.ddlDefaultContext.SelectedIndex == 0) { this.lblError.Text = "Please select the entity that defines the default context"; this.ddlDefaultContext.Focus(); this.lblError.Visible = true; this.fgDefaultContext.CssClass = haserr; return; } this.fgMatchedContextField.CssClass = noerr; if (this.ddlMatchedContextField.SelectedIndex == 0) { this.lblError.Text = "Please select the field from the baseview that matches the default context key defined"; this.ddlMatchedContextField.Focus(); this.lblError.Visible = true; this.fgMatchedContextField.CssClass = haserr; return; } string sql = "UPDATE listsettings.listmanager SET " + "listname = @listname, " + "listdescription = @listdescription, " + "defaultcontext = @defaultcontext, " + "defaultcontextfield = @defaultcontextfield, " + "matchedcontextfield = @matchedcontextfield, " + "tablecssstyle = @tablecssstyle, " + "tableheadercssstyle = @tableheadercssstyle, " + "defaultrowcssstyle = @defaultrowcssstyle, " + "patientbannerfield = @patientbannerfield, " + "rowcssfield = @rowcssfield, " + "wardpersonacontextfield = @wardpersonacontextfield, " + "clinicalunitpersonacontextfield = @clinicalunitpersonacontextfield, " + "specialtypersonacontextfield = @specialtypersonacontextfield, " + "teampersonacontextfield = @teampersonacontextfield, " + "snapshottemplateline1 = @snapshottemplateline1, " + "snapshottemplateline2 = @snapshottemplateline2, " + "snapshottemplatebadge = @snapshottemplatebadge, " + "defaultsortcolumn = @defaultsortcolumn, " + "defaultsortorder = @defaultsortorder " + "WHERE list_id = @list_id;"; string newId = this.hdnListID.Value; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("list_id", newId), new KeyValuePair <string, string>("listname", this.txtListName.Text), new KeyValuePair <string, string>("listdescription", this.txtListComments.Text), new KeyValuePair <string, string>("defaultcontext", this.ddlDefaultContext.SelectedValue), new KeyValuePair <string, string>("defaultcontextfield", this.lblDefaultContextField.Text), new KeyValuePair <string, string>("matchedcontextfield", this.ddlMatchedContextField.SelectedValue), new KeyValuePair <string, string>("patientbannerfield", this.ddlPatientBannerField.SelectedValue), new KeyValuePair <string, string>("rowcssfield", this.ddlRowCSSField.SelectedValue), new KeyValuePair <string, string>("tablecssstyle", this.txtTableClass.Text), new KeyValuePair <string, string>("tableheadercssstyle", this.txtTableHeaderClass.Text), new KeyValuePair <string, string>("defaultrowcssstyle", this.txtDefaultTableRowCSS.Text), new KeyValuePair <string, string>("wardpersonacontextfield", this.ddlWardPersonaContextField.SelectedValue == "0" ? null : this.ddlWardPersonaContextField.SelectedValue), new KeyValuePair <string, string>("clinicalunitpersonacontextfield", this.ddlCUPersonaContextField.SelectedValue == "0" ? null : this.ddlCUPersonaContextField.SelectedValue), new KeyValuePair <string, string>("specialtypersonacontextfield", this.ddlSpecialtyPersonaContextField.SelectedValue == "0" ? null : this.ddlSpecialtyPersonaContextField.SelectedValue), new KeyValuePair <string, string>("teampersonacontextfield", this.ddlTeamPersonaContextField.SelectedValue == "0" ? null : this.ddlTeamPersonaContextField.SelectedValue), new KeyValuePair <string, string>("snapshottemplateline1", this.ddlSnapshotLine1.SelectedValue == "0" ? null : this.ddlSnapshotLine1.SelectedValue), new KeyValuePair <string, string>("snapshottemplateline2", this.ddlSnapshotLine2.SelectedValue == "0" ? null : this.ddlSnapshotLine2.SelectedValue), new KeyValuePair <string, string>("snapshottemplatebadge", this.ddlSnapshotBadge.SelectedValue == "0" ? null : this.ddlSnapshotBadge.SelectedValue), new KeyValuePair <string, string>("defaultsortcolumn", this.ddlDefaultSortColumn.SelectedValue == "0" ? null : this.ddlDefaultSortColumn.SelectedValue), // Don't save defaultsortorder if defaultsortcolumn is not selected new KeyValuePair <string, string>("defaultsortorder", this.ddlDefaultSortColumn.SelectedValue == "0" ? null : this.ddlDefaultSortOrder.SelectedValue) }; try { DataServices.ExcecuteNonQueryFromSQL(sql, paramList); updateTeminusFilter(); } catch (Exception ex) { this.lblError.Text = ex.ToString(); this.lblError.Visible = true; return; } Response.Redirect("ListManagerList.aspx"); }
protected void btnCreateNewEntity_Click(object sender, EventArgs e) { //Drop the baseeview string sqlDrop = @"SELECT listsettings.dropbaseview( @p_baseview_id, @p_baseviewname )"; var paramListDrop = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("p_baseview_id", this.hdnBaseViewID.Value), new KeyValuePair <string, string>("p_baseviewname", this.lblSummaryType.Text) }; DataServices.ExcecuteNonQueryFromSQL(sqlDrop, paramListDrop); //Recreate the baseview //string tmpViewName = Guid.NewGuid().ToString("N"); //Check if we can create a temporary view using the supplied SQL Statement string sqlCreate = "CREATE VIEW baseviewcore." + this.lblNamespaceName.Text + "_" + this.lblBaseViewName.Text + " AS " + this.txtSQL.Text + ";"; var paramListCreate = new List <KeyValuePair <string, string> >() { }; try { DataServices.executeSQLStatement(sqlCreate, paramListCreate); } catch (Exception ex) { this.lblError.Text = "Error creating view: " + ex.ToString(); this.lblError.Visible = true; return; } string baseviewid = this.hdnBaseViewID.Value; string sql = "SELECT listsettings.recreatebaseview(@p_baseviewnamespaceid, @p_baseviewnamespace, @p_baseviewname, @p_baseviewdescription, @p_baseviewsqlstatement, @p_username, @baseviewid);"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("p_baseviewnamespaceid", this.hdnNamespaceID.Value), new KeyValuePair <string, string>("p_baseviewnamespace", this.lblNamespaceName.Text), new KeyValuePair <string, string>("p_baseviewname", this.lblBaseViewName.Text), new KeyValuePair <string, string>("p_baseviewdescription", this.lblBaseViewComments.Text), new KeyValuePair <string, string>("p_baseviewsqlstatement", this.txtSQL.Text), new KeyValuePair <string, string>("p_username", this.hdnUserName.Value), new KeyValuePair <string, string>("baseviewid", this.hdnBaseViewID.Value), }; DataSet ds = new DataSet(); try { ds = DataServices.DataSetFromSQL(sql, paramList); } catch (Exception ex) { this.lblError.Text = "Error creating view: " + ex.ToString(); this.lblError.Visible = true; return; } DataTable dt = ds.Tables[0]; string newGuid = ""; try { newGuid = dt.Rows[0][0].ToString(); } catch { } Response.Redirect("BaseViewManageSQL.aspx?id=" + newGuid); }
protected void btnValidateEntity_Click(object sender, EventArgs e) { string haserr = "form-group has-error"; string noerr = "form-group"; this.lblError.Text = string.Empty; this.lblError.Visible = false; this.lblSuccess.Visible = false; this.fgSQL.CssClass = noerr; ////Check if name already exists //string sql = "SELECT * FROM listsettings.baseviewmanager WHERE baseviewnamespaceid = @baseviewnamespaceid and baseviewname = @baseviewname;"; //var paramList = new List<KeyValuePair<string, string>>() { // new KeyValuePair<string, string>("baseviewnamespaceid", this.hdnNamespaceID.Value), // new KeyValuePair<string, string>("baseviewname", this.lblBaseViewName.Text) //}; //DataSet ds = DataServices.DataSetFromSQL(sql, paramList); //DataTable dt = ds.Tables[0]; //if (dt.Rows.Count > 0) //{ // this.lblError.Text = "The name of the baseview that you you have entered already exists"; // this.txtSQL.Focus(); // this.lblError.Visible = true; // this.fgSQL.CssClass = haserr; // return; //} string tmpViewName = Guid.NewGuid().ToString("N"); //Check if we can create a temporary view using the supplied SQL Statement string sqlCreate = "CREATE VIEW baseviewtemp." + this.lblNamespaceName.Text + "_" + tmpViewName + " AS " + this.txtSQL.Text + ";"; var paramListCreate = new List <KeyValuePair <string, string> >() { }; try { DataServices.executeSQLStatement(sqlCreate, paramListCreate); } catch (Exception ex) { this.lblError.Text = "Error creating view: " + ex.ToString(); this.txtSQL.Focus(); this.lblError.Visible = true; this.fgSQL.CssClass = haserr; return; } this.lblSuccess.Visible = true; this.lblSuccess.Text = "Validation succeeded"; this.btnCreateNewEntity.Visible = true; this.btnCancel.Visible = true; this.btnCreateNewEntity.Focus(); this.btnValidateEntity.Visible = false; this.lblBaseViewName.Enabled = false; this.txtSQL.Enabled = false; }
protected void btnSave_Click(object sender, EventArgs e) { string haserr = "form-group has-error"; string noerr = "form-group"; this.lblError.Text = string.Empty; this.lblError.Visible = false; this.lblSuccess.Visible = false; this.fgOptionValueText.CssClass = noerr; this.fgOptionDisplayText.CssClass = noerr; if (string.IsNullOrEmpty(this.txtOptionValueText.Text.ToString())) { this.lblError.Text = "Please enter value associated with the option"; this.txtOptionValueText.Focus(); this.lblError.Visible = true; this.fgOptionValueText.CssClass = haserr; return; } if (string.IsNullOrEmpty(this.txtOptionDisplayText.Text.ToString())) { this.lblError.Text = "Please enter what you would like to display to the end user for this option"; this.txtOptionDisplayText.Focus(); this.lblError.Visible = true; this.fgOptionDisplayText.CssClass = haserr; return; } string sql = "INSERT INTO listsettings.questionoption (questionoption_id, questionoptioncollection_id, questionoptioncollectionname, questionoptioncollectionorder, optionvaluetext, optiondisplaytext, optionflag, optionflagalt) VALUES (@questionoption_id, @questionoptioncollection_id, @questionoptioncollectionname, CAST(@questionoptioncollectionorder AS INT), @optionvaluetext, @optiondisplaytext, @optionflag, @optionflagalt);"; string id = System.Guid.NewGuid().ToString(); int order = 0; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("questionoption_id", id), new KeyValuePair <string, string>("questionoptioncollection_id", this.hdnOptionCollectionID.Value), new KeyValuePair <string, string>("questionoptioncollectionname", this.lblListOptionCollection.Text), new KeyValuePair <string, string>("questionoptioncollectionorder", order.ToString()), new KeyValuePair <string, string>("optionvaluetext", this.txtOptionValueText.Text), new KeyValuePair <string, string>("optiondisplaytext", this.txtOptionDisplayText.Text), new KeyValuePair <string, string>("optionflag", this.txtOptionFlag.Text), new KeyValuePair <string, string>("optionflagalt", this.txtOptionFlagAlt.Text), }; try { DataServices.executeSQLStatement(sql, paramList); } catch (Exception ex) { this.lblError.Text = "Error creating question option: " + System.Environment.NewLine + ex.ToString(); this.lblError.Visible = true; return; } Response.Redirect("ListOptionView.aspx?id=" + id); }
protected void btnValidateAttribute_Click(object sender, EventArgs e) { this.txtAttributeName.Text = RemoveAndReplaceSpecialCharacters(this.txtAttributeName.Text); this.txtAttributeName.Enabled = true; string haserr = "form-group has-error"; string noerr = "form-group"; this.lblError.Text = string.Empty; this.lblError.Visible = false; this.lblSuccess.Visible = false; this.fgAttributeName.CssClass = noerr; this.fgDataType.CssClass = noerr; if (string.IsNullOrEmpty(this.txtAttributeName.Text.ToString())) { this.lblError.Text = "Please enter a new name for the attribute"; this.txtAttributeName.Focus(); this.lblError.Visible = true; this.fgAttributeName.CssClass = haserr; return; } char stringFirstCharacter = this.txtAttributeName.Text.ToCharArray().ElementAt(0); if (char.IsNumber(stringFirstCharacter)) { this.lblError.Text = "Attribute name cannot start with numeric characters"; this.txtAttributeName.Focus(); this.lblError.Visible = true; this.fgAttributeName.CssClass = haserr; return; } if (this.ddlDataType.SelectedIndex == 0) { this.lblError.Text = "Please select a data type"; this.ddlDataType.Focus(); this.lblError.Visible = true; this.fgDataType.CssClass = haserr; return; } string sql = "SELECT * FROM entitysettings.entityattribute WHERE entityid = @entityid and attributename = @attributename;"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("entityid", this.hdnEntityID.Value), new KeyValuePair <string, string>("attributename", this.txtAttributeName.Text) }; DataSet ds = DataServices.DataSetFromSQL(sql, paramList); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { this.lblError.Text = "The name of the attribute that you you have entered already exists in this entitiy"; this.txtAttributeName.Focus(); this.lblError.Visible = true; this.fgAttributeName.CssClass = haserr; return; } this.lblSuccess.Visible = true; this.lblSuccess.Text = "Validation succeeded"; this.btnCreateNewAttribute.Visible = true; this.btnCancel.Visible = true; this.btnCreateNewAttribute.Focus(); this.btnValidateAttribute.Visible = false; this.txtAttributeName.Enabled = false; this.ddlDataType.Enabled = false; CreateNewAttribute(); }
protected void btnSave_Click(object sender, EventArgs e) { string sql = "UPDATE listsettings.question SET defaultcontext = @defaultcontext, defaultcontextfieldname = @defaultcontextfieldname, questiontype_id = @questiontype_id, questiontypetext = @questiontypetext, labeltext = @labeltext, defaultvaluetext = @defaultvaluetext, defaultvaluedatetime = null, questionquickname = @questionquickname, questionview_id = @questionview_id, questionviewname = @questionviewname, questionviewsql = @questionviewsql, optiontype = @optiontype, questionoptioncollection_id = @questionoptioncollection_id, questionoptionsqlstatement = @questionoptionsqlstatement, questioncustomhtml = @questioncustomhtml, questioncustomhtmlalt = @questioncustomhtmlalt WHERE question_id= @question_id;"; //, , , , , , , , , , , , , , string question_id = this.hdnQuestionID.Value; string defaultcontext = this.ddlDefaultContext.SelectedValue; string defaultcontextfieldname = this.lblDefaultContextField.Text; string questiontype_id = this.ddlQuestionType.SelectedValue; string questiontypetext = this.ddlQuestionType.SelectedItem.Text; string labeltext = ""; string defaultvaluetext = ""; string questioncustomhtml = ""; string questioncustomhtmlalt = ""; if (this.ddlQuestionType.SelectedValue != "3aa99ab6-9df6-4c3a-a966-6cc51ce1a3bf") //"Not HTML Tag (Label, Custom HTML)" 3 { defaultvaluetext = this.txtDefaultValueText.Text; labeltext = this.txtLabelText.Text; } if (this.ddlQuestionType.SelectedValue == "3aa99ab6-9df6-4c3a-a966-6cc51ce1a3bf") //"HTML Tag (Label, Custom HTML)" 3 { questioncustomhtml = this.txtCustomHTML.Text; } if (this.ddlQuestionType.SelectedValue == "164c31d5-d32e-4c97-91d6-a0d01822b9b6" || this.ddlQuestionType.SelectedValue == "221ca4a0-3a39-42ff-a0f4-885ffde0f0bd") //"Single Checkbox (Binary)" or "Checkbox Image (Binary)" { questioncustomhtml = this.txtCustomHTML.Text; questioncustomhtmlalt = this.txtCustomHTMLAlt.Text; } string questionquickname = this.txtQuickName.Text; string questionview_id = ""; string questionviewname = ""; string questionviewsql = ""; string optiontype = ""; string questionoptioncollection_id = ""; string questionoptionsqlstatement = ""; if (this.ddlQuestionType.SelectedValue == "fc1f2643-b491-4889-8d1a-910619b65722" || this.ddlQuestionType.SelectedValue == "3d236e17-e40e-472d-95a5-5e45c5e02faf" || this.ddlQuestionType.SelectedValue == "4f31c02d-fa36-4033-8977-8f25bef33d52" || this.ddlQuestionType.SelectedValue == "ca1f1b24-b490-4e57-8921-9f680819e47c" || this.ddlQuestionType.SelectedValue == "71490eff-a54b-455a-86b1-a4d5ab676f32" ) // "Drop Down List" 4 // "Check Box List" 5 // "Auto-complete Selection List" 8 // "Radio Button List" // "Radio Button Image List" { optiontype = this.ddlOptionType.SelectedValue; if (this.ddlOptionType.SelectedValue == "e9e6feda-f02d-4388-8c5b-9fc97558c684")//Internal Option Collection { questionoptioncollection_id = this.ddlOptionCollection.SelectedValue; } if (this.ddlOptionType.SelectedValue == "638dadd6-fca7-4f9b-b25f-692c45172524") //Custom SQL Statement { questionoptionsqlstatement = this.txtCustomHTML.Text; } } var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("question_id", question_id), new KeyValuePair <string, string>("defaultcontext", defaultcontext), new KeyValuePair <string, string>("defaultcontextfieldname", defaultcontextfieldname), new KeyValuePair <string, string>("questiontype_id", questiontype_id), new KeyValuePair <string, string>("questiontypetext", questiontypetext), new KeyValuePair <string, string>("labeltext", labeltext), new KeyValuePair <string, string>("questioncustomhtml", questioncustomhtml), new KeyValuePair <string, string>("questionquickname", questionquickname), new KeyValuePair <string, string>("defaultvaluetext", defaultvaluetext), new KeyValuePair <string, string>("questionview_id", questionview_id), new KeyValuePair <string, string>("questionviewname", questionviewname), new KeyValuePair <string, string>("questionviewsql", questionviewsql), new KeyValuePair <string, string>("optiontype", optiontype), new KeyValuePair <string, string>("questionoptioncollection_id", questionoptioncollection_id), new KeyValuePair <string, string>("questionoptionsqlstatement", questionoptionsqlstatement), new KeyValuePair <string, string>("questioncustomhtmlalt", questioncustomhtmlalt) }; try { DataServices.executeSQLStatement(sql, paramList); } catch (Exception ex) { this.lblError.Text = "Error creating question: " + System.Environment.NewLine + ex.ToString(); this.lblError.Visible = true; return; } Response.Redirect("ListManagerList.aspx?id=" + question_id); }
private void CreateNewAttribute() { DataTable dtBVs = SynapseHelpers.GetEntityBaseviewsDT(this.hdnEntityID.Value); this.hdnDataType.Value = SynapseHelpers.GetDataTypeFromID(this.ddlDataType.SelectedValue); string sql = @"SELECT entitysettings.addattributetoentity( @p_entityid, @p_entityname, @p_synapsenamespaceid, @p_synapsenamespacename, @p_username, @p_attributename, @p_attributedescription, @p_datatype, @p_datatypeid, CAST(@p_ordinal_position AS integer), @p_attributedefault, @p_maximumlength, @p_commondisplayname, @p_isnullsetting, @p_entityversionid )"; DataTable dt = SynapseHelpers.GetEntityDSFromID(this.hdnEntityID.Value); string maxLength = ""; if (this.ddlDataType.SelectedItem.Text == "Short String") { maxLength = "255"; } if (this.ddlDataType.SelectedItem.Text == "Long String") { maxLength = "1000"; } var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("p_entityid", this.hdnEntityID.Value), new KeyValuePair <string, string>("p_entityname", SynapseHelpers.GetEntityNameFromID(this.hdnEntityID.Value)), new KeyValuePair <string, string>("p_synapsenamespaceid", dt.Rows[0]["synapsenamespaceid"].ToString()), new KeyValuePair <string, string>("p_synapsenamespacename", dt.Rows[0]["synapsenamespacename"].ToString()), new KeyValuePair <string, string>("p_username", this.hdnUserName.Value), new KeyValuePair <string, string>("p_attributename", this.txtAttributeName.Text), new KeyValuePair <string, string>("p_attributedescription", "Description"), new KeyValuePair <string, string>("p_datatype", this.hdnDataType.Value), new KeyValuePair <string, string>("p_datatypeid", this.ddlDataType.SelectedValue), new KeyValuePair <string, string>("p_ordinal_position", this.hdnNextOrdinalPosition.Value), new KeyValuePair <string, string>("p_attributedefault", ""), new KeyValuePair <string, string>("p_maximumlength", maxLength), new KeyValuePair <string, string>("p_commondisplayname", ""), new KeyValuePair <string, string>("p_isnullsetting", ""), new KeyValuePair <string, string>("p_entityversionid", SynapseHelpers.GetCurrentEntityVersionFromID(this.hdnEntityID.Value)) }; DataServices.ExcecuteNonQueryFromSQL(sql, paramList); ClearAttributesForm(); this.lblSuccess.Text = "Attribute created"; this.lblSuccess.Visible = true; this.hdnNextOrdinalPosition.Value = SynapseHelpers.GetNextOrdinalPositionFromID(this.hdnEntityID.Value); foreach (DataRow row in dtBVs.Rows) { string baseview_id = row["baseview_id"].ToString(); string sqlRecreate = "SELECT listsettings.recreatebaseview(@baseview_id);"; var paramListRecreate = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("baseview_id", baseview_id) }; try { DataServices.ExcecuteNonQueryFromSQL(sqlRecreate, paramListRecreate); } catch (Exception ex) { var a = ex.ToString(); } } BindEntityGrid(); }
private void BindFormFields() { String sql = "SELECT * FROM listsettings.question WHERE question_id = @question_id;"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("question_id", this.hdnQuestionID.Value) }; DataSet ds = new DataSet(); try { ds = DataServices.DataSetFromSQL(sql, paramList); } catch (Exception ex) { StringBuilder sbe = new StringBuilder(); sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>"); sbe.AppendLine(ex.ToString()); sbe.AppendLine("</div>"); this.lblError.Visible = true; this.lblError.Text = sbe.ToString(); return; } DataTable dt = ds.Tables[0]; try { this.txtCustomHTML.Text = dt.Rows[0]["questioncustomhtml"].ToString(); } catch { } try { this.txtCustomHTMLAlt.Text = dt.Rows[0]["questioncustomhtmlalt"].ToString(); } catch { } try { this.lblDefaultContextField.Text = dt.Rows[0]["defaultcontextfieldname"].ToString(); } catch { } try { this.txtDefaultValueText.Text = dt.Rows[0]["defaultvaluetext"].ToString(); } catch { } try { this.txtLabelText.Text = dt.Rows[0]["labeltext"].ToString(); } catch { } try { this.txtOptionSQLStatement.Text = dt.Rows[0]["questionoptionsqlstatement"].ToString(); } catch { } try { this.txtQuickName.Text = dt.Rows[0]["questionquickname"].ToString(); } catch { } try { SetDDLSource(this.ddlDefaultContext, dt.Rows[0]["defaultcontext"].ToString()); } catch { } try { SetDDLSource(this.ddlOptionCollection, dt.Rows[0]["questionoptioncollection_id"].ToString()); } catch { } try { SetDDLSource(this.ddlOptionType, dt.Rows[0]["optiontype"].ToString()); } catch { } try { SetDDLSource(this.ddlQuestionType, dt.Rows[0]["questiontype_id"].ToString()); } catch { } }
private void GetPreviewURL() { string sql = "SELECT * FROM eboards.bedboard WHERE bedboard_id = @bedboard_id;"; DataSet ds = new DataSet(); var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("bedboard_id", hdnBedBoardID.Value) }; try { ds = DataServices.DataSetFromSQL(sql, paramList); } catch (Exception ex) { StringBuilder sbe = new StringBuilder(); sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>"); sbe.AppendLine(ex.ToString()); sbe.AppendLine("</div>"); //this.ltrlError.Visible = true; //this.ltrlError.Text = sbe.ToString(); return; } DataTable dt = ds.Tables[0]; string baseview_id = ""; try { baseview_id = dt.Rows[0]["baseview_id"].ToString(); } catch { } string baseviewname = SynapseHelpers.GetBaseViewNameAndNamespaceFromID(baseview_id); string PersonIDField = ""; try { PersonIDField = dt.Rows[0]["baseviewpersonidfield"].ToString(); } catch { } string EncounterIDField = ""; try { EncounterIDField = dt.Rows[0]["baseviewencounteridfield"].ToString(); } catch { } string WardField = ""; try { WardField = dt.Rows[0]["baseviewwardfield"].ToString(); } catch { } string BedField = ""; try { BedField = dt.Rows[0]["baseviewbedfield"].ToString(); } catch { } string sqlBoard = "SELECT " + WardField + " as WardField, " + BedField + " as BedField" + " FROM baseview." + baseviewname + " order by random() LIMIT 1;"; var paramListbOARD = new List <KeyValuePair <string, string> >() { }; DataSet dsBoard = new DataSet(); try { dsBoard = DataServices.DataSetFromSQL(sqlBoard, paramListbOARD); } catch (Exception ex) { StringBuilder sbe = new StringBuilder(); sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>"); sbe.AppendLine(ex.ToString()); sbe.AppendLine("</div>"); //this.ltrlError.Visible = true; //this.ltrlError.Text = sbe.ToString(); return; } DataTable dtBoard = dsBoard.Tables[0]; string ward = ""; try { ward = dtBoard.Rows[0]["WardField"].ToString(); } catch { } string bed = ""; try { bed = dtBoard.Rows[0]["BedField"].ToString(); } catch { } string apiURL = SynapseHelpers.GetAPIURL(); string uri = SynapseHelpers.GetEBoardURL() + "bedboard.aspx?BedBoardID=" + this.hdnBedBoardID.Value + "&Ward=" + ward + "&Bed=" + bed; this.hlPreview.NavigateUrl = uri; }
public static String RemoveQuestionFromList(string listId, string question_id) { string sqlCheck = "SELECT ordinalposition FROM listsettings.listquestion WHERE list_id= @list_id AND question_id = @question_id;"; var paramListCheck = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("list_id", listId), new KeyValuePair <string, string>("question_id", question_id), }; DataSet dsCheck = DataServices.DataSetFromSQL(sqlCheck, paramListCheck); DataTable dtCheck = new DataTable(); dtCheck = dsCheck.Tables[0]; int ordinalposition = 0; try { ordinalposition = System.Convert.ToInt16(dtCheck.Rows[0]["ordinalposition"].ToString()); } catch (Exception ex) { var a = ex; } string sql = ""; sql = @"UPDATE listsettings.listquestion SET isselected = false, ordinalposition = null WHERE list_id = @list_id AND question_id = @question_id; UPDATE listsettings.listquestion SET ordinalposition = ordinalposition - 1 WHERE list_id = @list_id AND ordinalposition > CAST(@ordinalposition AS INT); "; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("list_id", listId), new KeyValuePair <string, string>("question_id", question_id), new KeyValuePair <string, string>("ordinalposition", ordinalposition.ToString()), }; try { DataServices.executeSQLStatement(sql, paramList); } catch (Exception ex) { var httpErr = new SynapseHTTPError(); httpErr.ErrorCode = "HTTP.400"; httpErr.ErrorType = "Client Error"; httpErr.ErrorDescription = ex.ToString(); return(JsonConvert.SerializeObject(httpErr, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); } return("Question removed"); }
protected void btnClone_Click(object sender, EventArgs e) { string haserr = "form-group has-error"; string noerr = "form-group"; this.ltrlError.Text = string.Empty; this.ltrlError.Visible = false; this.lblSuccess.Visible = false; int errcount = 0; StringBuilder sb = new StringBuilder(); sb.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Please resolve the following errors:</h3><ul>"); this.fgBedBoardName.CssClass = noerr; if (string.IsNullOrWhiteSpace(this.txtBedBoardName.Text)) { sb.AppendLine("<li>" + "Please enter a new name for the Bed Board" + "</li>"); this.fgBedBoardName.CssClass = haserr; errcount++; } this.fgBaseView.CssClass = noerr; if (this.ddlBaseView.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select a baseview" + "</li>"); this.fgBaseView.CssClass = haserr; errcount++; } this.fgPersonIDField.CssClass = noerr; if (this.ddlPersonIDField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the PersonID field from the baseview" + "</li>"); this.fgPersonIDField.CssClass = haserr; errcount++; } this.fgEncounterIDField.CssClass = noerr; if (this.ddlEncounterIDField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the EncounterID field from the baseview" + "</li>"); this.fgEncounterIDField.CssClass = haserr; errcount++; } this.fgWardField.CssClass = noerr; if (this.ddlWardField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the Ward Code field from the baseview" + "</li>"); this.fgWardField.CssClass = haserr; errcount++; } this.fgBedField.CssClass = noerr; if (this.ddlBedField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the Bed Code field from the baseview" + "</li>"); this.fgBedField.CssClass = haserr; errcount++; } this.fgTopSetting.CssClass = noerr; if (this.ddlTopSetting.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the top section setting" + "</li>"); this.fgTopSetting.CssClass = haserr; errcount++; } this.fgTopField.CssClass = noerr; if (this.ddlTopSetting.SelectedValue == "1" && this.ddlTopField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Top Section" + "</li>"); this.fgTopField.CssClass = haserr; errcount++; } this.fgTopLeftField.CssClass = noerr; if (this.ddlTopSetting.SelectedValue == "2" && this.ddlTopLeftField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Top Left Section" + "</li>"); this.fgTopField.CssClass = haserr; errcount++; } this.fgTopRightField.CssClass = noerr; if (this.ddlTopSetting.SelectedValue == "2" && this.ddlTopRightField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Top Right Section" + "</li>"); this.fgTopField.CssClass = haserr; errcount++; } this.fgMiddleSetting.CssClass = noerr; if (this.ddlMiddleSetting.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the Middle section setting" + "</li>"); this.fgMiddleSetting.CssClass = haserr; errcount++; } this.fgMiddleField.CssClass = noerr; if (this.ddlMiddleSetting.SelectedValue == "1" && this.ddlMiddleField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Middle Section" + "</li>"); this.fgMiddleField.CssClass = haserr; errcount++; } this.fgMiddleLeftField.CssClass = noerr; if (this.ddlMiddleSetting.SelectedValue == "2" && this.ddlMiddleLeftField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Middle Left Section" + "</li>"); this.fgMiddleField.CssClass = haserr; errcount++; } this.fgMiddleRightField.CssClass = noerr; if (this.ddlMiddleSetting.SelectedValue == "2" && this.ddlMiddleRightField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Middle Right Section" + "</li>"); this.fgMiddleField.CssClass = haserr; errcount++; } this.fgBottomSetting.CssClass = noerr; if (this.ddlBottomSetting.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the Bottom section setting" + "</li>"); this.fgBottomSetting.CssClass = haserr; errcount++; } this.fgBottomField.CssClass = noerr; if (this.ddlBottomSetting.SelectedValue == "1" && this.ddlBottomField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Bottom Section" + "</li>"); this.fgBottomField.CssClass = haserr; errcount++; } this.fgBottomLeftField.CssClass = noerr; if (this.ddlBottomSetting.SelectedValue == "2" && this.ddlBottomLeftField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Bottom Left Section" + "</li>"); this.fgBottomField.CssClass = haserr; errcount++; } this.fgBottomRightField.CssClass = noerr; if (this.ddlBottomSetting.SelectedValue == "2" && this.ddlBottomRightField.SelectedIndex == 0) { sb.AppendLine("<li>" + "Please select the field column from the baseview for the Bottom Right Section" + "</li>"); this.fgBottomField.CssClass = haserr; errcount++; } if (errcount > 0) { sb.AppendLine("</ul></div>"); this.ltrlError.Visible = true; this.ltrlError.Text = sb.ToString(); return; } string sql = @"INSERT INTO eboards.bedboard( _createdby, bedboard_id, bedboardname, bedboarddescription, baseviewnamespace_id, baseview_id, baseviewpersonidfield, baseviewencounteridfield, baseviewwardfield, baseviewbedfield, topsetting, middlesetting, bottomsetting, topfield, topleftfield, toprightfield, middlefield, middleleftfield, middlerightfield, bottomfield, bottomleftfield, bottomrightfield ) VALUES( @_createdby, @bedboard_id, @bedboardname, @bedboarddescription, @baseviewnamespace_id, @baseview_id, @baseviewpersonidfield, @baseviewencounteridfield, @baseviewwardfield, @baseviewbedfield, @topsetting, @middlesetting, @bottomsetting, @topfield, @topleftfield, @toprightfield, @middlefield, @middleleftfield, @middlerightfield, @bottomfield, @bottomleftfield, @bottomrightfield )"; string newID = System.Guid.NewGuid().ToString(); var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("_createdby", this.hdnUserName.Value), new KeyValuePair <string, string>("bedboard_id", newID), new KeyValuePair <string, string>("bedboardname", this.txtBedBoardName.Text + "_Clone"), new KeyValuePair <string, string>("bedboarddescription", this.txtBedBoardDescription.Text), new KeyValuePair <string, string>("baseviewnamespace_id", this.ddlBaseViewNamespace.SelectedValue), new KeyValuePair <string, string>("baseview_id", this.ddlBaseView.SelectedValue), new KeyValuePair <string, string>("baseviewpersonidfield", this.ddlPersonIDField.SelectedValue), new KeyValuePair <string, string>("baseviewencounteridfield", this.ddlEncounterIDField.SelectedValue), new KeyValuePair <string, string>("baseviewwardfield", this.ddlWardField.SelectedValue), new KeyValuePair <string, string>("baseviewbedfield", this.ddlBedField.SelectedValue), new KeyValuePair <string, string>("topsetting", this.ddlTopSetting.SelectedValue), new KeyValuePair <string, string>("middlesetting", this.ddlMiddleSetting.SelectedValue), new KeyValuePair <string, string>("bottomsetting", this.ddlBottomSetting.SelectedValue), new KeyValuePair <string, string>("topfield", this.ddlTopField.SelectedValue), new KeyValuePair <string, string>("topleftfield", this.ddlTopLeftField.SelectedValue), new KeyValuePair <string, string>("toprightfield", this.ddlTopRightField.SelectedValue), new KeyValuePair <string, string>("middlefield", this.ddlMiddleField.SelectedValue), new KeyValuePair <string, string>("middleleftfield", this.ddlMiddleLeftField.SelectedValue), new KeyValuePair <string, string>("middlerightfield", this.ddlMiddleRightField.SelectedValue), new KeyValuePair <string, string>("bottomfield", this.ddlBottomField.SelectedValue), new KeyValuePair <string, string>("bottomleftfield", this.ddlBottomLeftField.SelectedValue), new KeyValuePair <string, string>("bottomrightfield", this.ddlBottomRightField.SelectedValue) }; try { DataServices.ExcecuteNonQueryFromSQL(sql, paramList); } catch (Exception ex) { StringBuilder sbe = new StringBuilder(); sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>"); sbe.AppendLine(ex.ToString()); sbe.AppendLine("</div>"); this.ltrlError.Visible = true; this.ltrlError.Text = sbe.ToString(); return; } Response.Redirect("BedBoardManagerView.aspx?id=" + newID); }
protected void btnRegister_Click(object sender, EventArgs e) { string haserr = "form-group has-error"; string noerr = "form-group"; this.lblError.Text = string.Empty; this.lblError.Visible = false; this.fgEmail.CssClass = noerr; this.fgPassword.CssClass = noerr; this.fgEmail.CssClass = noerr; this.fgPassword.CssClass = noerr; this.fgConfirmPassword.CssClass = noerr; this.fgMatchedOrganisation.CssClass = noerr; this.fgFirstName.CssClass = noerr; this.fgLastName.CssClass = noerr; this.fgGMCCode.CssClass = noerr; //if (this.ddlMatchedOrganisation.SelectedIndex == 0) //{ // this.lblError.Text = "Please select an organisation"; // this.lblError.Visible = true; // this.fgMatchedOrganisation.CssClass = haserr; // return; //} if (string.IsNullOrEmpty(this.txtFirstName.Text.ToString())) { this.lblError.Text = "Please enter your first name"; this.lblError.Visible = true; this.fgFirstName.CssClass = haserr; return; } if (string.IsNullOrEmpty(this.txtLastName.Text.ToString())) { this.lblError.Text = "Please enter your last name"; this.lblError.Visible = true; this.fgLastName.CssClass = haserr; return; } //if (string.IsNullOrEmpty(this.txtGMCCode.Text.ToString())) //{ // this.lblError.Text = "Please enter your GMC Number"; // this.lblError.Visible = true; // this.fgGMCCode.CssClass = haserr; // return; //} if (string.IsNullOrEmpty(this.txtRegistrationEmail.Text.ToString())) { this.lblError.Text = "Please enter your email address"; this.lblError.Visible = true; this.fgEmail.CssClass = haserr; return; } if (CheckEmailAddress() == 1) { this.lblError.Text = "This email address has already been registered"; this.lblError.Visible = true; this.fgEmail.CssClass = haserr; return; } if (string.IsNullOrEmpty(this.txtRegistrationPassword.Text.ToString())) { this.lblError.Text = "Please enter a password"; this.lblError.Visible = true; this.fgPassword.CssClass = haserr; return; } if (string.IsNullOrEmpty(this.txtConfirmPassword.Text.ToString())) { this.lblError.Text = "Please confirm your password"; this.lblError.Visible = true; this.fgConfirmPassword.CssClass = haserr; return; } if (this.txtRegistrationPassword.Text != this.txtConfirmPassword.Text) { this.lblError.Text = "Passwords do not match"; this.lblError.Visible = true; this.fgConfirmPassword.CssClass = haserr; this.fgPassword.CssClass = haserr; return; } string sql = "INSERT INTO systemsettings.app_user(usertype, userpassword, emailaddress, firstname, lastname, isactive, emailconfirmed, issysadmin, isauthorised)"; sql += " VALUES (@usertype, crypt(@userpassword, gen_salt('bf', 8)), @emailaddress, @firstname, @lastname, true, true, true, true)"; var paramListSave = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("usertype", this.ddlUserType.SelectedValue), new KeyValuePair <string, string>("userpassword", this.txtRegistrationPassword.Text), new KeyValuePair <string, string>("emailaddress", this.txtRegistrationEmail.Text), new KeyValuePair <string, string>("firstname", this.txtFirstName.Text), new KeyValuePair <string, string>("lastname", this.txtLastName.Text) }; DataServices.executeSQLStatement(sql, paramListSave); Response.Redirect("RegistrationThankYou.aspx?id=patient"); }
protected void btnLogin_Click(object sender, EventArgs e) { this.lblError.Text = string.Empty; this.lblError.Visible = false; this.btnResendValidationEmail.Visible = false; this.txtEmail.CssClass = this.txtEmail.CssClass.Replace("has-error", ""); this.txtPassword.CssClass = this.txtPassword.CssClass.Replace("has-error", ""); this.fgtxtEmail.CssClass = this.fgtxtEmail.CssClass.Replace("has-error", ""); this.fgtxtPassword.CssClass = this.fgtxtPassword.CssClass.Replace("has-error", ""); if (string.IsNullOrEmpty(this.txtEmail.Text.ToString())) { this.lblError.Text = "Please enter your email address"; this.lblError.Visible = true; this.fgtxtEmail.CssClass = this.fgtxtEmail.CssClass.Replace("form-group", "form-group has-error"); return; } if (string.IsNullOrEmpty(this.txtPassword.Text.ToString())) { this.lblError.Text = "Please enter your password"; this.lblError.Visible = true; this.fgtxtPassword.CssClass = this.fgtxtPassword.CssClass.Replace("form-group", "form-group has-error"); return; } string IPAddress = ""; try { IPAddress = GetIPAddress(); } catch { } string sql = "SELECT * FROM systemsettings.app_user WHERE emailaddress = @email AND userpassword = crypt(@password, userpassword);"; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("email", this.txtEmail.Text), new KeyValuePair <string, string>("password", this.txtPassword.Text) }; DataSet ds = DataServices.DataSetFromSQL(sql, paramList); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { //Valid User Session["UserDetailsSxn"] = dt; //Record Login string userid = "0"; try { userid = dt.Rows[0]["userid"].ToString(); } catch { } Session["userID"] = userid; string emailconfirmed = "False"; try { emailconfirmed = dt.Rows[0]["emailconfirmed"].ToString(); } catch { } string userFullName = ""; try { userFullName = dt.Rows[0]["firstname"].ToString() + " " + dt.Rows[0]["lastname"].ToString(); } catch { } Session["userFullName"] = userFullName; string userType = ""; try { userType = dt.Rows[0]["usertype"].ToString(); } catch { //Response.Redirect("Login.aspx"); } Session["userType"] = userType; string matchedclinicianid = ""; try { matchedclinicianid = dt.Rows[0]["matchedclinicianid"].ToString(); } catch { //Response.Redirect("Login.aspx"); } Session["matchedclinicianid"] = matchedclinicianid; this.hdnEmail.Value = this.txtEmail.Text; if (emailconfirmed == "False") { this.lblError.Text = "Your account has been created but you have not confirmed your email address yet.<br /><br />Please check your spam folder for the email containing the link to confirm your account"; this.btnResendValidationEmail.Visible = true; this.lblError.Visible = true; return; } string isauthorised = "False"; try { isauthorised = dt.Rows[0]["isauthorised"].ToString(); } catch { } if (isauthorised == "False") { this.lblError.Text = "Your account has not been authorised yet"; this.lblError.Visible = true; return; } sql = "INSERT INTO systemsettings.loginhistory (userid, emailaddress, ipaddress) VALUES (CAST(@userid AS INT), @emailaddress, @ipaddress);"; var paramListHistory = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("userid", userid), new KeyValuePair <string, string>("emailaddress", this.txtEmail.Text), new KeyValuePair <string, string>("ipaddress", IPAddress) }; DataServices.executeSQLStatement(sql, paramListHistory); Response.Redirect(this.lblRedirect.Text); } else { //Invalid User sql = "INSERT INTO systemsettings.failedlogin(emailaddress, ipaddress) VALUES ( @emailaddress, @ipaddress); "; var paramListFail = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("emailaddress", this.txtEmail.Text), new KeyValuePair <string, string>("ipaddress", IPAddress) }; DataServices.executeSQLStatement(sql, paramListFail); this.lblError.Text = "Invalid Username or Password"; this.lblError.Visible = true; } }
protected void btnValidateAttribute_Click(object sender, EventArgs e) { string haserr = "form-group has-error"; string noerr = "form-group"; this.lblError.Text = string.Empty; this.lblError.Visible = false; this.lblSuccess.Visible = false; this.fgEntity.CssClass = noerr; this.fgSynapseNamespace.CssClass = noerr; if (this.ddlSynapseNamespace.SelectedIndex == 0) { this.lblError.Text = "Please select a namespace"; this.ddlSynapseNamespace.Focus(); this.lblError.Visible = true; this.fgSynapseNamespace.CssClass = haserr; return; } if (this.ddlEntity.SelectedIndex == 0) { this.lblError.Text = "Please select an entity"; this.ddlEntity.Focus(); this.lblError.Visible = true; this.fgEntity.CssClass = haserr; return; } if (this.ddlEntity.SelectedValue == this.hdnEntityID.Value) { this.lblError.Text = "You are unable to create a relation to the same entity"; this.ddlEntity.Focus(); this.lblError.Visible = true; this.fgEntity.CssClass = haserr; return; } string sql = ""; var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("entityid", this.hdnEntityID.Value), new KeyValuePair <string, string>("parententityid", this.ddlEntity.SelectedValue) }; if (this.ddlLocalAttribute.SelectedIndex == 0) { sql = "SELECT * FROM entitysettings.entityrelation WHERE entityid = @entityid and parententityid = @parententityid;"; } else { sql = "SELECT * FROM entitysettings.entityrelation WHERE entityid = @entityid and parententityid = @parententityid and localentityattributeid = @localentityattributeid;"; paramList.Add(new KeyValuePair <string, string>("localentityattributeid", this.ddlLocalAttribute.SelectedValue)); } DataSet ds = DataServices.DataSetFromSQL(sql, paramList); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { this.lblError.Text = "The relation that you are trying to create already exists for this entity"; this.ddlEntity.Focus(); this.lblError.Visible = true; this.fgEntity.CssClass = haserr; return; } this.lblSuccess.Visible = true; this.lblSuccess.Text = "Validation succeeded"; this.btnCreateNewAttribute.Visible = true; this.btnCancel.Visible = true; this.btnCreateNewAttribute.Focus(); this.btnValidateAttribute.Visible = false; this.ddlEntity.Enabled = false; this.ddlSynapseNamespace.Enabled = false; CreateRelation(); }
public static String AddAttributeToList(string listId, string attributename, int ordinalposition) { string sqlCheck = "SELECT COUNT(*) AS recCount FROM listsettings.listattribute WHERE list_id= @list_id AND attributename = @attributename;"; var paramListCheck = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("list_id", listId), new KeyValuePair <string, string>("attributename", attributename), }; DataSet dsCheck = DataServices.DataSetFromSQL(sqlCheck, paramListCheck); DataTable dtCheck = new DataTable(); dtCheck = dsCheck.Tables[0]; int recs = 0; try { recs = System.Convert.ToInt16(dtCheck.Rows[0]["recCount"].ToString()); } catch { } string sql = ""; if (recs == 0) //Do insert { sql = @"INSERT INTO listsettings.listattribute(listattribute_id, list_id, baseviewattribute_id, attributename, datatype, ordinalposition) SELECT uuid_generate_v4() AS listattribute_id, @list_id, baseviewattribute_id, @attributename, datatype, CAST(@ordinalposition AS INT) AS ordinalposition FROM listsettings.baseviewattribute WHERE attributename = @attributename AND baseview_id IN (SELECT baseview_id FROM listsettings.listmanager WHERE list_id = @list_id);"; } else //Do update { sql = @"UPDATE listsettings.listattribute SET isselected = true, ordinalposition = CAST(@ordinalposition AS INT) WHERE list_id = @list_id AND attributename = @attributename;"; } var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("list_id", listId), new KeyValuePair <string, string>("attributename", attributename), new KeyValuePair <string, string>("ordinalposition", ordinalposition.ToString()), }; try { DataServices.executeSQLStatement(sql, paramList); } catch (Exception ex) { var httpErr = new SynapseHTTPError(); httpErr.ErrorCode = "HTTP.400"; httpErr.ErrorType = "Client Error"; httpErr.ErrorDescription = ex.ToString(); return(JsonConvert.SerializeObject(httpErr, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); } return("Attribute added"); }
private void BindDBFields() { string sql = "SELECT * FROM eboards.locatorboard WHERE locatorboard_id = @locatorboard_id;"; DataSet ds = new DataSet(); var paramList = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("locatorboard_id", hdnBoardID.Value) }; try { ds = DataServices.DataSetFromSQL(sql, paramList); } catch (Exception ex) { StringBuilder sbe = new StringBuilder(); sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>"); sbe.AppendLine(ex.ToString()); sbe.AppendLine("</div>"); this.ltrlError.Visible = true; this.ltrlError.Text = sbe.ToString(); return; } DataTable dt = ds.Tables[0]; try { this.txtLocatorBoardName.Text = dt.Rows[0]["locatorboardname"].ToString(); } catch { } try { this.txtLocatorBoardDescription.Text = dt.Rows[0]["locatorboarddescription"].ToString(); } catch { } SetDDLSource(this.ddlBaseViewNamespace, dt.Rows[0]["locationbaseviewnamespace_id"].ToString()); BindBaseViewList(); SetDDLSource(this.ddlList, dt.Rows[0]["list_id"].ToString()); BindListBaseViewFields(); SetDDLSource(this.ddlListLocationField, dt.Rows[0]["listlocationfield"].ToString()); SetDDLSource(this.ddlBaseView, dt.Rows[0]["locationbaseview_id"].ToString()); BindBaseViewFields(); SetDDLSource(this.ddlLocationIDField, dt.Rows[0]["locationidfield"].ToString()); SetDDLSource(this.ddlHeading, dt.Rows[0]["locationdisplayfield"].ToString()); SetDDLSource(this.ddlTopLeftField, dt.Rows[0]["topleftfield"].ToString()); SetDDLSource(this.ddlTopRightField, dt.Rows[0]["toprightfield"].ToString()); }