コード例 #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (tbLogin.Text == "" || tbPass.Text == "" || tbPass2.Text == "")
     {
         MessageBox.Show("Пожалуйста, заполните все поля регистрационной формы.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     else if (tbPass.Text != tbPass2.Text)
     {
         MessageBox.Show("Введенные вами пароли не совпадают. Проверьте правильность введенных данных.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     else if (curr_role != "admin" && StringHelper.TextToRole(cbRole.Text) == "admin")
     {
         MessageBox.Show("Невозможно создать пользователя с ролью администратора, не будучи администратором.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     else
     {
         try
         {
             PgSql.ConnectToUsersDB(curr_role, curr_pass);
             PgSql.InsertIntoValues("users", String.Format("'{0}', '{1}', '{2}'", tbLogin.Text, Crypter.Encrypt(tbPass.Text), StringHelper.TextToRole(cbRole.Text)));
             MessageBox.Show("Пользователь создан с правами \" " + cbRole.Text + "\". Теперь он можете войти, используя свой логин и пароль.");
             this.Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             return;
         }
     }
 }
コード例 #2
0
        private void btnAction_Click(object sender, EventArgs e)
        {
            try
            {
                switch (at)
                {
                case ActionType.Insert:
                    if (!GetInfoFromPanelControls())
                    {
                        return;
                    }
                    PgSql.InsertIntoValues("Employee", String.Format("DEFAULT, {0}, '{1}', '{2}', '{3}', {4}, {5}, {6}, {7}, {8}", numClub.Value.ToString(), tbSur.Text, tbName.Text, tbPatr.Text, position_id, numTerm.Value.ToString(), numSurcharge.Value.ToString(), (numOrgDates.Value == -1) ? "NULL" : numOrgDates.Value.ToString(), (numOrgContracts.Value == -1) ? "NULL" : numOrgContracts.Value.ToString()));
                    break;

                case ActionType.Update:
                    if (!GetInfoFromPanelControls())
                    {
                        return;
                    }
                    PgSql.UpdateSet("employee", "club_department_id, surname, name, patronymic, position, term_of_work, surcharge, num_of_organized_visits, num_of_contracts", String.Format("( {0}, '{1}', '{2}', '{3}', {4}, {5}, {6}, {7}, {8}) WHERE id = {9}", numClub.Value.ToString(), tbSur.Text, tbName.Text, tbPatr.Text, position_id, numTerm.Value.ToString(), numSurcharge.Value.ToString(), (numOrgDates.Value == -1) ? "NULL" : numOrgDates.Value.ToString(), (numOrgContracts.Value == -1) ? "NULL" : numOrgContracts.Value.ToString(), id));
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show(String.Format("Success.", at.ToString()));
            this.Close();
        }
コード例 #3
0
        private void btnAction_Click(object sender, EventArgs e)
        {
            try
            {
                switch (at)
                {
                case ActionType.Insert:
                    PgSql.InsertIntoValues("Meeting", String.Format("DEFAULT, {0}, {1}, '{2}.{3}.{4}', '{5}:{6}', {7}, {8}, {9}", numClientID.Value, numPlaceID.Value, numDay.Value, numMonth.Value, numYear.Value, numHours.Value, numMinutes.Value, (numDuration.Value == -1) ? "NULL" : numDuration.Value.ToString(),
                                                                    (cbResult.Text == "<NULL>") ? "NULL" : "\'" + cbResult.Text + "\'", numEmployeeID.Value));
                    break;

                case ActionType.Update:
                    PgSql.UpdateSet("Meeting", "client_id, place_id, meeting_date, meeting_time, meeting_duration, m_result, orginized_employee_id", String.Format("({0}, {1}, '{2}.{3}.{4}', '{5}:{6}', {7}, {8}, {9}) WHERE id = {10}", numClientID.Value, numPlaceID.Value, numDay.Value, numMonth.Value, numYear.Value, numHours.Value,
                                                                                                                                                                   numMinutes.Value, (numDuration.Value == -1) ? "NULL" : numDuration.Value.ToString(), (cbResult.Text == "<NULL>") ? "NULL" : "\'" + cbResult.Text + "\'", numEmployeeID.Value, id));
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show(String.Format("Success.", at.ToString()));
            this.Close();
        }
コード例 #4
0
        private void btnAction_Click(object sender, EventArgs e)
        {
            try
            {
                switch (at)
                {
                case ActionType.Insert:
                    if (!GetInfoFromPanelControls())
                    {
                        return;
                    }
                    PgSql.InsertIntoValues("client", String.Format("DEFAULT, {0}, '{1}', '{2}', '{3}', '{4}', {5}, '{6}.{7}.{8}', ('{9}','{10}','{11}', {12}, {13}), '{14}', '{15}', '{16}', {17}, {18}, {19}, {20}, '{21}', '{22}', '{23}', '{24}', '{25}', {26}, '{27}', '{28}'",
                                                                   numClub.Value.ToString(), tbSur.Text, tbName.Text, tbPatr.Text, cbGender.Text, nation_id, numDay.Value.ToString(), numMonth.Value.ToString(), numYear.Value.ToString(),
                                                                   tbCountry.Text, tbCity.Text, tbStreet.Text, numHouse.Value.ToString(), numHouse2.Value.ToString(), tbEmail.Text, tbPhone.Text, tbPass.Text, numHeight.Value.ToString(),
                                                                   numWeight.Value.ToString(), eyecolor_id, haircolor_id, interests, cbTemperament.Text, pos_features, neg_features, cbMartialStatus.Text, numChild.Value.ToString(), cbProsperity.Text, cbPurposeofdating.Text));
                    break;

                case ActionType.Update:
                    if (!GetInfoFromPanelControls())
                    {
                        return;
                    }
                    PgSql.UpdateSet("client", "club_department_id, surname, name, patronymic, gender, nationality, date_of_birth, address, email, phone_number, passport_id, height, weight, eye_color, hair_color, interests, temperament, positive_features, negative_features, marital_status, amount_of_children, prosperity, purpose_of_dating",
                                    String.Format("({0}, '{1}', '{2}', '{3}', '{4}', {5}, '{6}.{7}.{8}', ('{9}','{10}','{11}', {12}, {13}), '{14}', '{15}', '{16}', {17}, {18}, {19}, {20}, '{21}', '{22}', '{23}', '{24}', '{25}', {26}, '{27}', '{28}') WHERE client.id = {29}",
                                                  numClub.Value.ToString(), tbSur.Text, tbName.Text, tbPatr.Text, cbGender.Text, nation_id, numDay.Value.ToString(), numMonth.Value.ToString(), numYear.Value.ToString(),
                                                  tbCountry.Text, tbCity.Text, tbStreet.Text, numHouse.Value.ToString(), numHouse2.Value.ToString(), tbEmail.Text, tbPhone.Text, tbPass.Text, numHeight.Value.ToString(),
                                                  numWeight.Value.ToString(), eyecolor_id, haircolor_id, interests, cbTemperament.Text, pos_features, neg_features, cbMartialStatus.Text, numChild.Value.ToString(), cbProsperity.Text, cbPurposeofdating.Text, id));
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show(String.Format("Success.", at.ToString()));
            this.Close();
        }
コード例 #5
0
        private void btnAction_Click(object sender, EventArgs e)
        {
            try
            {
                switch (at)
                {
                case ActionType.Insert:
                    PgSql.InsertIntoValues("Contract", String.Format("DEFAULT, {0}, {1}, {2}, {3}, '{4}', '{5}.{6}.{7}', {8}", numClientID.Value, (numFinalPartnerID.Value == -1) ? "NULL" : numFinalPartnerID.Value.ToString(), numEmployeeID.Value, numContractTerm.Value, cbState.Text, numDay.Value, numMonth.Value, numYear.Value, numSum.Value));
                    break;

                case ActionType.Update:
                    PgSql.UpdateSet("contract", "client_id, final_partner_id, orginized_employee_id, contract_term, state, date_of_registration, price", String.Format("({0}, {1}, {2}, {3}, '{4}', '{5}.{6}.{7}', {8}) WHERE id = {9}", numClientID.Value, (numFinalPartnerID.Value == -1) ? "NULL" : numFinalPartnerID.Value.ToString(), numEmployeeID.Value, numContractTerm.Value, cbState.Text, numDay.Value, numMonth.Value, numYear.Value, numSum.Value, id));
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show(String.Format("Success.", at.ToString()));
            this.Close();
        }
コード例 #6
0
        private void btnAction_Click(object sender, EventArgs e)
        {
            try
            {
                switch (at)
                {
                case ActionType.Insert:
                    PgSql.InsertIntoValues("Pare", String.Format("{0}, {1}", numClientID.Value, numClient2Id.Value));
                    break;

                case ActionType.Update:
                    PgSql.UpdateSet("Pare", "client1_id, client2_id", String.Format("({0}, {1}) WHERE client1_id = {2} AND client2_id = {3}", numClientID.Value, numClient2Id.Value, id1, id2));
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show(String.Format("Success.", at.ToString()));
            this.Close();
        }
コード例 #7
0
        private void btnAction_Click(object sender, EventArgs e)
        {
            try
            {
                switch (at)
                {
                case ActionType.Insert:
                    PgSql.InsertIntoValues("dating_club_department", String.Format("DEFAULT, '{0}', ('{1}', '{2}', '{3}', {4}, {5}), {6}", tbName.Text, tbCountry.Text, tbCity.Text, tbStreet.Text, numHouse.Value.ToString(), numHouse2.Value.ToString(), numPayment.Value.ToString()));
                    break;

                case ActionType.Update:
                    PgSql.UpdateSet("dating_club_department", "name, address, rent_cost", String.Format("('{0}', ('{1}', '{2}', '{3}', {4}, {5}), {6}) WHERE dating_club_department.id = {7}", tbName.Text, tbCountry.Text, tbCity.Text, tbStreet.Text, numHouse.Value.ToString(), numHouse2.Value.ToString(), numPayment.Value.ToString(), id));
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show(String.Format("Success.", at.ToString()));
            this.Close();
        }
コード例 #8
0
        private void btnAction_Click(object sender, EventArgs e)
        {
            if (!GetInfoFromPanelControls())
            {
                return;
            }

            try
            {
                switch (at)
                {
                case ActionType.Insert:
                    if (!GetInfoFromPanelControls())
                    {
                        return;
                    }
                    PgSql.InsertIntoValues("meeting_place", String.Format("DEFAULT, ('{0}', '{1}', '{2}', {3}, {4}), {5}, {6}, '{7}', {8}", tbCountry.Text, tbCity.Text, tbStreet.Text, numHouse.Value, numHouse2.Value, place_type_id, place_theme_id, cbPrice.Text, numRent.Value));
                    break;

                case ActionType.Update:
                    if (!GetInfoFromPanelControls())
                    {
                        return;
                    }
                    PgSql.UpdateSet("meeting_place", "address, place_type, place_theme, price_policy,rent_cost", String.Format("(('{0}', '{1}', '{2}', {3}, {4}), {5}, {6}, '{7}', {8}) WHERE id = {9}", tbCountry.Text, tbCity.Text, tbStreet.Text, numHouse.Value, numHouse2.Value, place_type_id, place_theme_id, cbPrice.Text, numRent.Value, id));
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show(String.Format("Success.", at.ToString()));
            this.Close();
        }