public SportDocs(DB_Connector connection, ApplicationEdit parent) { InitializeComponent(); _DB_Connection = connection; _Parent = parent; _DB_Helper = new DB_Helper(_DB_Connection); cbDocType.Items.Add(DB_Helper.SportAchievementGTO); cbDocType.Items.Add(DB_Helper.SportAchievementWorldChampionship); cbDocType.Items.Add(DB_Helper.SportAchievementEuropeChampionship); foreach (string itemName in _DB_Helper.GetDictionaryItems(FIS_Dictionary.SPORT_DIPLOMA_TYPE).Values) { cbDocType.Items.Add(itemName); } cbDocType.SelectedIndex = 0; Forms.ApplicationEdit.SDoc loadedDocument = _Parent.SportDoc; if ((loadedDocument.diplomaType != null) && (loadedDocument.diplomaType != "")) { cbDocType.SelectedItem = loadedDocument.diplomaType; tbDocName.Text = loadedDocument.docName; dtpDocDate.Value = loadedDocument.docDate; tbOrgName.Text = loadedDocument.orgName; } }
public MADIOlymps(DB_Connector connection, Forms.ApplicationEdit.MODoc olympData) { InitializeComponent(); _DB_Connection = connection; _DB_Helper = new DB_Helper(_DB_Connection); List <string> olympsNames = new List <string>(); foreach (object[] olymp in _DB_Connection.Select(DB_Table.DICTIONARY_19_ITEMS, new string[] { "olympic_name" }, new System.Collections.Generic.List <Tuple <string, Relation, object> > { new Tuple <string, Relation, object>("year", Relation.GREATER_EQUAL, DateTime.Now.Year - 1) })) { olympsNames.Add(olymp[0].ToString()); } foreach (string name in olympsNames.Distinct()) { cbOlympName.Items.Add(name); } if (olympData.olympName != null && olympData.olympName != "") { cbOlympName.Text = olympData.olympName; OlympName = olympData.olympName; tbOrganization.Text = olympData.olypmOrg; OlympOrg = olympData.olypmOrg; dtpDate.Value = olympData.olympDate; OlympDate = olympData.olympDate; } }
public ApplicationSPOEdit(DB_Connector connection, uint campaignID, string registratorsLogin, uint?applicationId) { _DB_Connection = connection; _RegistratorLogin = registratorsLogin; InitializeComponent(); _DB_Helper = new DB_Helper(_DB_Connection); _KLADR = new Classes.KLADR(connection.User, connection.Password); _CurrCampainID = Classes.Settings.CurrentCampaignID; _ApplicationID = applicationId; FillComboBox(cbIDDocType, FIS_Dictionary.IDENTITY_DOC_TYPE); FillComboBox(cbSex, FIS_Dictionary.GENDER); FillComboBox(cbNationality, FIS_Dictionary.COUNTRY); cbForeignLanguage.SelectedIndex = 0; rbCertificate.Checked = false; rbCertificate.Checked = true; cbRegion.Items.AddRange(_KLADR.GetRegions().ToArray()); dtpDateOfBirth.MaxDate = DateTime.Now; dtpIDDocDate.MaxDate = DateTime.Now; for (int i = DateTime.Now.Year; i >= 1950; i--) { cbGraduationYear.Items.Add(i); } cbGraduationYear.SelectedIndex = 0; LoadSPOProgram(); if (_ApplicationID != null) { _Loading = true; LoadApplication(); _Loading = false; } }
public static void Create(DB_Connector connection, string templateFile, string resultFile, uint id, bool readOnly = false) { #region Contracts CheckConnectionAndFilenames(connection, templateFile, resultFile); #endregion XDocument template = XDocument.Load(templateFile, LoadOptions.PreserveWhitespace); Validate(template); if (template.Root.Element("Document").Element("Word") != null) { Novacode.DocX doc = Word.CreateFromTemplate(connection, GetFonts(template.Root.Element("Fonts")), template.Root.Element("Document").Element("Word"), id, resultFile); if (readOnly) { doc.AddProtection(Novacode.EditRestrictions.readOnly); } doc.Save(); } else { throw new System.ArgumentException("Эта перегрузка принимат только тип шаблона \"Word\".", nameof(templateFile)); } }
/// <summary> /// Initializes the codes. /// </summary> private void InitCodes(BordeoDatabaseResult res, DB_Connector conn) { RivieraCode[] codes = new RivieraCode[] { new RivieraCode() { Code = "BRSTACK", Description = "Pila de paneles rectos", ElementType = RivieraElementType.PanelStack, Line = DesignLine.Bordeo }, new RivieraCode() { Code = "BRDSTACK", Description = "Pila de paneles dobles", ElementType = RivieraElementType.PanelStack, Line = DesignLine.Bordeo }, new RivieraCode() { Block = "BR2010", Code = "BR2010", Description = "Panel Recto", ElementType = RivieraElementType.Panel, Line = DesignLine.Bordeo }, new RivieraCode() { Block = "BR2020", Code = "BR2020", Description = "Panel 90°", ElementType = RivieraElementType.Panel, Line = DesignLine.Bordeo }, new RivieraCode() { Block = "BR2030", Code = "BR2030", Description = "Panel 135°", ElementType = RivieraElementType.Panel, Line = DesignLine.Bordeo }, }; res.Codes = codes.ToList(); }
protected void Page_Load(object sender, EventArgs e) { //check if user has not logged in. if (!LoggedIn()) { Response.Redirect("Login.aspx"); //redirect return; //stop further execution } if (!this.IsPostBack) { //retrieve connection string from web.config string conString = WebConfigurationManager.ConnectionStrings["cisDB"].ToString(); //assign connection string to sqldatasources ActionList.ConnectionString = conString; ActivityList.ConnectionString = conString; InjuryLocationList.ConnectionString = conString; InjuryTypeList.ConnectionString = conString; LocationList.ConnectionString = conString; TreatmentList.ConnectionString = conString; this.Master.Title = "form"; Master.HasSigPad = true; myConnector = new DB_Connector(); } else { } }
/// <summary> /// Gets the update fields. /// Only Last access can be updated /// </summary> /// <param name="conn">The connection.</param> /// <returns></returns> public override DBField[] GetUpdateFields(DB_Connector conn) { return(new DBField[] { this.CreateFieldAsDate(conn, FIELD_NAME, this.LastAccess) }); }
public EGE_Check(DB_Connector connection) { InitializeComponent(); _DB_Connection = connection; _DB_Helper = new DB_Helper(_DB_Connection); }
public Olymps(DB_Connector connection, ApplicationEdit parent) { InitializeComponent(); _DB_Connection = connection; _DB_Helper = new DB_Helper(_DB_Connection); _Parent = parent; cbDiplomaType.Items.AddRange(_DB_Helper.GetDictionaryItems(FIS_Dictionary.DIPLOMA_TYPE).Values.ToArray()); cbClass.SelectedItem = "10"; cbDiscipline.Items.AddRange(_DB_Helper.GetDictionaryItems(FIS_Dictionary.SUBJECTS).Values.ToArray()); cbCountry.Items.AddRange(_DB_Helper.GetDictionaryItems(FIS_Dictionary.COUNTRY).Values.ToArray()); Forms.ApplicationEdit.ODoc loadedDocument = _Parent.OlympicDoc; if ((loadedDocument.olympType != null) && (loadedDocument.olympType != "")) { cbOlympType.SelectedItem = loadedDocument.olympType; tbDocNumber.Text = loadedDocument.olympDocNumber.ToString(); if ((loadedDocument.diplomaType != null) && (loadedDocument.diplomaType != "")) { cbDiplomaType.SelectedItem = loadedDocument.diplomaType; } if (loadedDocument.olympID != 0) { tbOlympID.Text = loadedDocument.olympID.ToString(); cbOlympName.SelectedIndex = cbOlympName.FindString(_DB_Connection.Select(DB_Table.DICTIONARY_19_ITEMS, new string[] { "olympic_name" }, new System.Collections.Generic.List <Tuple <string, Relation, object> > { new Tuple <string, Relation, object>("olympic_id", Relation.EQUAL, loadedDocument.olympID) })[0][0].ToString()); cbOlympProfile.SelectedIndex = cbOlympProfile.FindString(loadedDocument.olympProfile); } else { if (loadedDocument.olympName != null) { cbOlympName.Text = loadedDocument.olympName; } cbOlympProfile.SelectedItem = loadedDocument.olympProfile; } if (loadedDocument.olympClass != 0) { cbClass.SelectedItem = loadedDocument.olympClass.ToString(); } if ((loadedDocument.olympDist != null) && (loadedDocument.olympDist != "")) { cbDiscipline.SelectedItem = loadedDocument.olympDist; } if ((loadedDocument.country != null) && (loadedDocument.country != "")) { cbCountry.SelectedItem = loadedDocument.country; } } }
void conectar() { DB_Connector dbconnector = GameObject.Find("Scripts").GetComponent <DB_Connector> (); con = dbconnector.conectar(); Debug.Log("**************"); }
private static void CheckConnectionAndFilenames(DB_Connector connection, string templateFile, string resultFile) { if (connection == null) { throw new System.ArgumentNullException(nameof(connection)); } CheckFilenames(templateFile, resultFile); }
public TargetOrganizations(DB_Connector connection) { InitializeComponent(); _DB_Connection = connection; UpdateTable(); }
/// <summary> /// Loads the design line data. /// </summary> /// <param name="conn">The connection.</param> /// <returns> /// The design line data result /// </returns> public override object InitDesignDatabase(DB_Connector conn) { BordeoDatabaseResult res = new BordeoDatabaseResult(); this.InitSizes(res, conn); this.InitCodes(res, conn); return(res); }
public Faculties(DB_Connector connection) { InitializeComponent(); _DB_Connection = connection; UpdateTable(); }
void conectar() { DB_Connector dbconnector = GameObject.Find("Scripts").GetComponent <DB_Connector> (); do { con = dbconnector.conectar(); } while(!dbconnector.conexion); }
/// <summary> /// Selects all projects. /// </summary> /// <param name="conn">The database connection.</param> /// <returns>The Riviera project</returns> public static IEnumerable <RivieraProject> SelectProjects(DB_Connector conn) { QueryBuilder qB = new QueryBuilder(TABLENAME, conn); qB.AddSelectionColumn(); String query = qB.GetQuery(); return(conn.Select <RivieraProject>(query)); }
public DirectionsProfiles(DB_Connector connection) { InitializeComponent(); _DB_Connection = connection; _DB_Helper = new DB_Helper(_DB_Connection); UpdateTable(); cbDirections.ValueMember = "Value"; }
public Campaigns(DB_Connector connection) { InitializeComponent(); _DB_Connection = connection; _DB_Helper = new DB_Helper(_DB_Connection); UpdateTableAndCombobox(); }
private static string SelectByPlaceholder(DB_Connector connection, uint id, string placeholder) { string[] placeholderAndFunction = placeholder.Split('|'); string[] placeholderValue = _PH_Single[placeholderAndFunction[0]].Split('.', ':'); List <System.Tuple <string, Relation, object> > whereClause; if (placeholderValue.Length == 2) { whereClause = new List <System.Tuple <string, Relation, object> > { new System.Tuple <string, Relation, object>("id", Relation.EQUAL, id) } } ; else { whereClause = new List <System.Tuple <string, Relation, object> >(); string[] equalities = placeholderValue[2].Split(','); foreach (string equality in equalities) { string[] parts = equality.Split('='); string rightValue; if (parts[1][0] == '@') { rightValue = SelectByPlaceholder(connection, id, parts[1].Substring(1)); //TODO group? } else { rightValue = parts[1]; } whereClause.Add(new System.Tuple <string, Relation, object>(parts[0], Relation.EQUAL, rightValue)); } } var selectRes = connection.Select( (DB_Table)System.Enum.Parse(typeof(DB_Table), placeholderValue[0], true), new string[] { placeholderValue[1] }, whereClause ); if (selectRes.Count != 1) { throw new System.Exception("По условию Placeholder возвращена не одна строка. Значение: " + placeholder); } if (placeholderAndFunction.Length == 1) { return(selectRes[0][0].ToString()); } else { return(_PH_Functions[placeholderAndFunction[1]](selectRes[0][0])); } }
/// <summary> /// Gets the insertion fields. /// </summary> /// <returns>The database fields</returns> public override DBField[] GetInsertionFields(DB_Connector conn) { return(new DBField[] { this.CreateFieldAsString(conn, FIELD_USERID, this.UserId.ToString()), this.CreateFieldAsNull(conn, FIELD_ID), this.CreateFieldAsString(conn, FIELD_NAME, this.ProjectName), this.CreateFieldAsDate(conn, FIELD_LAST_ACCESS, this.LastAccess) }); }
/// <summary> /// Selects the project. /// </summary> /// <param name="userId">The user identifier.</param> /// <param name="projectName">Name of the project.</param> /// <param name="conn">The database connection.</param> /// <returns>The Riviera project</returns> public static RivieraProject SelectProject(int userId, String projectName, DB_Connector conn) { QueryBuilder qB = new QueryBuilder(TABLENAME, conn); qB.AddSelectionColumn(); qB.AddEqualCondition(FIELD_USERID, userId, "AND"); qB.AddEqualCondition(FIELD_NAME, projectName); String query = qB.GetQuery(); return(conn.Select <RivieraProject>(query).FirstOrDefault()); }
public Constants(DB_Connector connection, uint campaignID) { InitializeComponent(); _DB_Connection = connection; _DB_Helper = new DB_Helper(_DB_Connection); _CurrCampaignID = campaignID; lbCurrentCampaign.Text = _DB_Connection.Select(DB_Table.CAMPAIGNS, new string[] { "name" }, new List <Tuple <string, Relation, object> > { new Tuple <string, Relation, object>("id", Relation.EQUAL, _CurrCampaignID) })[0][0].ToString(); UpdateTable(); }
public TargetOrganizationEdit(DB_Connector connection, uint organizationCode) { InitializeComponent(); _DB_Connection = connection; _UpdatingCode = organizationCode; rtbOrganizationName.Text = _DB_Connection.Select(DB_Table.TARGET_ORGANIZATIONS, new string[] { "name" }, new List <Tuple <string, Relation, object> > { new Tuple <string, Relation, object>("id", Relation.EQUAL, _UpdatingCode) })[0][0].ToString(); }
public OrderRegistration(DB_Connector connection, string number) { _DB_Connection = connection; #region Components InitializeComponent(); tbNumber.Text = (_DB_Connection.Select(DB_Table.ORDERS, "protocol_number").Max(s => s[0] as ushort? != null ? (ushort)s[0] : 1)).ToString(); #endregion _Number = number; }
/// <summary> /// Gets the ejecutivo. /// </summary> /// <param name="credential">The user credential.</param> /// <returns>The selected excutive</returns> public static int GetEjecutivoId(UserCredential credential, DB_Connector conn) { QueryBuilder qB = new QueryBuilder(TABLENAME, conn); qB.AddSelectionColumn(); qB.AddEqualCondition(FIELD_ID, credential.Username, "AND"); qB.AddEqualCondition(FIELD_PASS, credential.Password, "AND"); qB.AddEqualCondition(FIELD_COMPANY, (int)credential.Company); String query = qB.GetQuery(); Ejecutivo e = conn.Select <Ejecutivo>(query).FirstOrDefault(); return(e != null ? e.Id : -1); }
public Orders(DB_Connector connection) { InitializeComponent(); _DB_Connection = connection; #region Components dataGridView_Date.ValueType = typeof(DateTime); toolStrip_RegFilter.SelectedIndex = 0; #endregion UpdateTable(); }
public HR_DepartmentPrint(DB_Connector connection) { InitializeComponent(); _DB_Connection = connection; #region Components if (new DB_Helper(_DB_Connection).GetCampaignType(Classes.Settings.CurrentCampaignID) == DB_Helper.CampaignType.MASTER) { cbActs.Enabled = false; cbReceipts.Enabled = false; } #endregion }
public Authorization() { #region Components InitializeComponent(); cbLogin.Text = Properties.Settings.Default.Login; if (cbLogin.Text != "") { tbPassword.Select(); } #endregion while (true) { try { _DB_Connection = new DB_Connector(Properties.Settings.Default.pk_db_CS, "initial", "1234"); } catch (MySql.Data.MySqlClient.MySqlException ex) { if (ex.Number == 1042 && !SharedClasses.Utility.ShowChoiceMessageBox("Подключён ли кабель локальной сети к компьютеру?", "Ошибка подключения")) { MessageBox.Show("Выполните подключение.", "Ошибка подключения", MessageBoxButtons.OK, MessageBoxIcon.Warning); continue; //TODO } MessageBox.Show("Обратитесь к администратору. Не закрывайте это сообщение.", "Ошибка подключения", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show("Информация об ошибке:\n" + ex.Message, "Ошибка подключения", MessageBoxButtons.OK, MessageBoxIcon.Error); if (SharedClasses.Utility.ShowChoiceMessageBox("Закрыть приложение?", "Действие")) { Load += (s, e) => DialogResult = DialogResult.Abort; break; } continue; } foreach (var v in _DB_Connection.Select(DB_Table.USERS, "login")) { cbLogin.Items.Add(v[0]); } AssureConstants(); break; } }
/// <summary> /// Selects all rows from the Riviera code table. /// </summary> /// <param name="conn">The current connection.</param> /// <returns></returns> public static IEnumerable <RivieraCodeRow> SelectAll(DB_Connector conn) { try { QueryBuilder qB = new QueryBuilder(TABLENAME, conn); qB.AddSelectionColumn(); String query = qB.GetQuery(); var result = conn.SelectView <RivieraCodeRow>(query); return(result); } catch (Exception exc) { throw exc.CreateNamelessException <RivieraException>(ERR_LOAD_RIV_CODES); } }
public Users(DB_Connector connection) { #region Components InitializeComponent(); dataGridView_Phone.ValueType = typeof(ulong); #endregion _DB_Connection = connection; foreach (object[] row in _DB_Connection.Select(DB_Table.USERS)) { dataGridView.Rows.Add(row); } }