• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DBConnector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DBConnector的典型用法代码示例。如果您正苦于以下问题:C# DBConnector类的具体用法?C# DBConnector怎么用?C# DBConnector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DBConnector类属于命名空间,在下文中一共展示了DBConnector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: validateLogin

        public static bool validateLogin(UserLog ul)
        {
            DBConnector dbcon = new DBConnector();
            dbcon.openConnection();

            //try {

            MySqlCommand cmd = new MySqlCommand();
            cmd.CommandText = "SELECT * FROM user WHERE username='" + ul.getUsername() + "' AND password=MD5('" + ul.getPassword() + "')";
            cmd.Connection = dbcon.connection;

            MySqlDataReader login = cmd.ExecuteReader();

            if (login.Read())
            {
                LoginSession.setSession(login.GetString("iduser"));

                //login.Close();
                dbcon.closeConnection();
                return true;
            }
            else
            {
                //login.Close();
                dbcon.closeConnection();
                return false;
            }
            //}
            //catch (MySqlException e){
            //int errorcode = e.Number;
            //return false;
            //}
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:33,代码来源:LoginValidator.cs


示例2: GetPaymentsAsync

        public Task<IEnumerable<PaymentInfo>> GetPaymentsAsync(DateTime start, CancellationToken cancellationToken)
        {
            DB.RegisterFactory("MySql", MySql.Data.MySqlClient.MySqlClientFactory.Instance);
            DB.RegisterFactory("MySql.Data.MySqlClient", MySql.Data.MySqlClient.MySqlClientFactory.Instance);

            var db = new DBConnector(Config.GetElement("Databases", "WordPress"));

            using (var reader = db.ExecuteReader(@"
            SELECT p.id, s.name,
            us.billingFirstName, us.billingLastName, us.billingCompany,
            us.billingAddress, us.billingCity, us.billingState, us.billingZip, us.billingCountry, us.billingPhone,
            us.emailAddress,
            us.lastFourDigitsOfCreditCard, p.xAmount, p.paymentDate,
            us.subscriptionNotes, us.userIP,
            CONVERT(p.fullAuthorizeNetResponse USING utf8) AS response
            FROM wp_authnet_user_subscription us
            JOIN wp_authnet_payment p ON us.ID = p.user_subscription_id
            LEFT JOIN wp_authnet_subscription s ON s.ID = p.xSubscriptionId
            WHERE p.paymentDate > ?start", new { start })) {
                return Task.FromResult<IEnumerable<PaymentInfo>>(reader.Cast<IDataRecord>()
                             .Select(dr => new PaymentInfo {
                                 Id = dr.GetString(dr.GetOrdinal("id")),
                                 Email = dr.GetString(dr.GetOrdinal("emailAddress")),
                                 FinalFour = dr.GetString(dr.GetOrdinal("lastFourDigitsOfCreditCard")),
                                 CardIssuer = dr.GetString(dr.GetOrdinal("response")).Split('|')[51],
                                 Date = dr.GetDateTime(dr.GetOrdinal("paymentDate")),
                                 Amount = dr.GetDecimal(dr.GetOrdinal("xAmount")),
                                 Comments = dr.GetString(dr.GetOrdinal("subscriptionNotes"))
                                          + "\nIP Address: " + dr.GetString(dr.GetOrdinal("userIP"))
                             })
                             .ToList());
            }
        }
开发者ID:ShomreiTorah,项目名称:Billing,代码行数:33,代码来源:WpAuthNetSource.cs


示例3: addResignationRecord

        public static bool addResignationRecord()
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO resignation (letter_submitted_date, resignation_date, employee_idemployee) VALUES ('" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }

            /*}
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                dbcon.closeConnection();
                return false;
            }*/
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:ResignationHandler.cs


示例4: GetAlterationsByTicketId

        public TicketAlterationResource GetAlterationsByTicketId(int ticketId)
        {
            DBConnector connector = new DBConnector();
            MySqlCommand getAlterationsCommand = new MySqlCommand();
            getAlterationsCommand.Connection = connector.connection;
            getAlterationsCommand.CommandText = @"SELECT * from Ticket_Alterations where ticket_id = @ticket_id ORDER BY order_index";
            getAlterationsCommand.Parameters.AddWithValue("@ticket_id", ticketId);

            List<TicketAlterationResourceItem> alterationItems = new List<TicketAlterationResourceItem>();
            try
            {
                MySqlDataReader reader = getAlterationsCommand.ExecuteReader();
                while (reader.Read())
                {
                    alterationItems.Add(new TicketAlterationResourceItem
                    {
                        Price = Convert.ToDouble(reader["price"]),
                        Quantity = Convert.ToInt32(reader["quantity"]),
                        Description = (String)reader["description"],
                        Taxable = Convert.ToInt32(reader["taxable"])
                    });
                }
                reader.Close();
                connector.CloseConnection();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("There was an error. Contact Jay with this message: " + ex.Message + " error code: " + ex.Number);
            }

            TicketAlterationResource alterationRes = TicketAlterationFactory.CreateTicketAlterationResource(alterationItems);
            return alterationRes;
        }
开发者ID:jpark822,项目名称:HKT,代码行数:33,代码来源:TicketAlterationRepository.cs


示例5: addQualification

        public static bool addQualification(Qualification q)
        {
            DBConnector dbcon = new DBConnector();

            try
            {
                if (dbcon.openConnection())
                {
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "INSERT INTO qualification (qualification_no, institute, months, occupation_relevant, highest_qualification, status, note, qualification, year, employee_idemployee) VALUES (N'" + q.qualification_no + "', N'" + q.institute + "', N'" + q.months + "', " + q.occupation_relevant + ", " + q.highest_qualification + ", N'" + q.status + "', N'" + q.note + "', N'" + q.qualification + "', N'" + q.year + "', " + Employee.employee_id + ")";
                    cmd.Connection = dbcon.connection;
                    cmd.Prepare();
                    cmd.ExecuteNonQuery();

                    dbcon.closeConnection();
                    return true;
                }
                else
                {
                    dbcon.closeConnection();
                    return false;
                }

            }
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                dbcon.closeConnection();
                return false;
            }
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:QualificationsHandler.cs


示例6: InsertData

        /// <summary>
        /// Insert data to database
        /// </summary>
        /// <param name="sqlString">Query striing</param>
        /// <returns></returns>
        public bool InsertData(string sqlString)
        {
            dbConnectorObject = new DBConnector();
            sqlConnectionObject = new SqlConnection();
            sqlConnectionObject = dbConnectorObject.GetConnection;

            try
            {
                sqlConnectionObject.Open();
                SqlCommand sqlCommandObject = new SqlCommand(sqlString, sqlConnectionObject);

                int i = sqlCommandObject.ExecuteNonQuery();
                if (i > 0)
                    return true;
                else
                    return false;
            }

            catch (SqlException ex)
            {
                throw new Exception(" Database problem.\n" + ex.Message);
            }

            finally
            {
                if (sqlConnectionObject.State == ConnectionState.Open)
                {
                    sqlConnectionObject.Close();
                }
            }
        }
开发者ID:waliul-cse,项目名称:CrimePortalProject1,代码行数:36,代码来源:clsBase.cs


示例7: addDisciplinaryDetailsRecord

        public static bool addDisciplinaryDetailsRecord()
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO desciplinary_details (breaking_date, given_sentence_date, verdict_of_director_general_date, suspended_date, rejoined_date, employee_idemployee) VALUES ('" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }

            /*}
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                dbcon.closeConnection();
                return false;
            }*/
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:DisciplinaryDetailsHandler.cs


示例8: addFinanceBank

        public static bool addFinanceBank(FinanceBank fb)
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO finance_bank (bank_name, branch_name, account_number, account_type, begin_date, end_date, qualification, qual_year, employee_idemployee) VALUES (N'" + fb.bank_name + "', N'" + fb.branch_name + "', N'" + fb.account_number + "', N'" + fb.account_type + "', '" + fb.getBegin_date().ToString("yyyy-MM-dd") + "', '" + fb.getEnd_date().ToString("yyyy-MM-dd") + "', N'" + fb.qualification + "', N'" + fb.Qual_year + "', " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }

            //}
            //catch (MySqlException e)
            //{
            //int errorcode = e.Number;
            //dbcon.closeConnection();
            //return false;
            //}
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:FinanceBankHandler.cs


示例9: addRemuneration

        public static bool addRemuneration(Remuneration r)
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO remuneration (rank, post, salary_grade, salary_slip_no, basic_salary, transport_allowance, fuel_allowance, mobile_phone_allowance, housing_allowance, other_allowance, salary_increase_date, salary_increase_amount, current_total_salary, employee_idemployee) VALUES (N'" + r.rank + "', N'" + r.post + "', N'" + r.salary_grade + "', N'" + r.salary_slip_no + "', " + r.basic_salary + ", " + r.transport_allowance + ", " + r.fuel_allowance + ", " + r.mobile_phone_allowance + ", " + r.housing_allowance + ", " + r.other_allowance + ", '" + r.getsalary_increase_date().ToString("yyyy-MM-dd") + "', " + r.salary_increase_amount + ", " + r.current_total_salary + ", " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }

            //}
            //catch (MySqlException e)
            //{
            //int errorcode = e.Number;
            //dbcon.closeConnection();
            //return false;
            //}
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:RemunerationHandler.cs


示例10: addPensionAndDeath

        public static bool addPensionAndDeath(PensionAndDeath pd)
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO pension_death (retired, dead, died_date, informed_date, note, employee_idemployee) VALUES (" + pd.retired + ", " + pd.dead + ", '" + pd.died_date.ToString("yyyy-MM-dd") + "', '" + pd.informed_date.ToString("yyyy-MM-dd") + "', N'" + pd.note + "', " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }

            /*}
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                dbcon.closeConnection();
                return false;
            }*/
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:PensionAndDeathHandler.cs


示例11: addNotification

        public static bool addNotification(Notification n)
        {
            DBConnector dbcon = new DBConnector();

            try
            {
                if (dbcon.openConnection())
                {
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "INSERT INTO notification (title, content, date, employee_name, employee_number, employee_idemployee, user_iduser) VALUES (N'" + n.Title + "', N'" + n.Content + "', '" + n.Date.ToString("yyyy-MM-dd") + "', N'" + n.Employee_name + "', N'" + n.Employee_number + "', " + n.Employee_idemployee + ", " + n.User_iduser + ")";
                    cmd.Connection = dbcon.connection;
                    cmd.Prepare();
                    cmd.ExecuteNonQuery();

                    dbcon.closeConnection();
                    return true;
                }
                else
                {
                    dbcon.closeConnection();
                    return false;
                }

            }
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                Console.Write(e.Message + "\n");
                dbcon.closeConnection();
                return false;
            }
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:32,代码来源:NotificationHandler.cs


示例12: addTraining

        public static bool addTraining(Training t)
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO training (course_name, course_type, institute, payments, started_date, ending_date, extended_days, new_ending_date, country, result, employee_idemployee) VALUES (N'" + t.course_name + "', N'" + t.course_type + "', N'" + t.institute + "', N'" + t.payments + "', '" + t.started_date.ToString("yyyy-MM-dd") + "', '" + t.ending_date.ToString("yyyy-MM-dd") + "', N'" + t.extended_days + "', '" + t.new_ending_date.ToString("yyyy-MM-dd") + "', N'" + t.country + "', N'" + t.result + "', " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }

            /*}
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                dbcon.closeConnection();
                return false;
            }*/
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:TrainingHandler.cs


示例13: GetActiveTicketsBetweenDates

        public List<TicketResource> GetActiveTicketsBetweenDates(DateTime startDate, DateTime endDate)
        {
            DBConnector connector = new DBConnector();
            MySqlCommand getTicketsCommand = new MySqlCommand();
            getTicketsCommand.Connection = connector.connection;
            getTicketsCommand.CommandText = "SELECT * from Tickets join Customer on Tickets.CustomerId = Customer.id where date_ready >= @startDate AND date_ready <= @endDate AND status = 'a'";
            getTicketsCommand.Parameters.AddWithValue("@startDate", ConvertDateTimeToUTCString(startDate));
            getTicketsCommand.Parameters.AddWithValue("@endDate", ConvertDateTimeToUTCString(endDate));

            List<TicketResource> ticketResources = new List<TicketResource>();
            try
            {
                MySqlDataReader reader = getTicketsCommand.ExecuteReader();
                while (reader.Read())
                {
                    ticketResources.Add(ConvertSQLReaderRowToTicketResource(reader));
                }
                reader.Close();
                connector.CloseConnection();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("There was an error. Contact Jay with this message: " + ex.Message + " error code: " + ex.Number);
            }

            return ticketResources;
        }
开发者ID:jpark822,项目名称:HKT,代码行数:27,代码来源:TicketRepository.cs


示例14: addJobStatusRecord

        public static bool addJobStatusRecord()
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO job_status (contract_started_date, contract_ended_date, probation_started_date, probation_ended_date, probation_to_permanent_date, contract_to_permanent_date, employee_idemployee) VALUES ('" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }

            /*}
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                dbcon.closeConnection();
                return false;
            }*/
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:JobStatusHandler.cs


示例15: getCustomerById

        public CustomerResource getCustomerById(int customerId)
        {
            DBConnector connector = new DBConnector();
            MySqlCommand getTicketCommand = new MySqlCommand();
            getTicketCommand.Connection = connector.connection;
            getTicketCommand.CommandText = "select * from Customer where id = @customer_id LIMIT 1";
            getTicketCommand.Parameters.AddWithValue("@customer_id", customerId);

            CustomerResource customerToReturn = null;
            try
            {
                MySqlDataReader reader = getTicketCommand.ExecuteReader();
                while (reader.Read())
                {
                    customerToReturn = ConvertSQLReaderRowToTicketResource(reader);
                }
                reader.Close();
                connector.CloseConnection();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("There was an error. Contact Jay with this message: " + ex.Message + " error code: " + ex.Number);
            }

            return customerToReturn;
        }
开发者ID:jpark822,项目名称:HKT,代码行数:26,代码来源:CustomerRepository.cs


示例16: addExtracurricularActivity

        public static bool addExtracurricularActivity(ExtracurricularActivity eca)
        {
            DBConnector dbcon = new DBConnector();

            try
            {
                if (dbcon.openConnection())
                {
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "INSERT INTO extracurricular_activity (type, method, award, employee_idemployee) VALUES (N'" + eca.type + "', N'" + eca.method + "', N'" + eca.award + "', " + Employee.employee_id + ")";
                    cmd.Connection = dbcon.connection;
                    cmd.Prepare();
                    cmd.ExecuteNonQuery();

                    dbcon.closeConnection();
                    return true;
                }
                else
                {
                    dbcon.closeConnection();
                    return false;
                }

            }
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                dbcon.closeConnection();
                return false;
            }
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:ExtracurricularActivityHandler.cs


示例17: addDependentDetails

        public static bool addDependentDetails(DependentDetails dd)
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
            if (dbcon.openConnection())
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "INSERT INTO dependent_details (salutation, full_name, relation, date_of_post, nic_no, personal_tp, office_tp, personal_address, official_address, education, status, note, birth_certificate, marriage_certificate, deathade, doctor, employee_idemployee) VALUES (N'" + dd.salutation + "', N'" + dd.full_name + "', N'" + dd.relation + "', '" + dd.getDate_of_post().ToString("yyyy-MM-dd") + "', N'" + dd.nic_no + "', N'" + dd.personal_tp + "', N'" + dd.office_tp + "', N'" + dd.personal_address + "', N'" + dd.official_address + "', N'" + dd.education + "', N'" + dd.status + "', N'" + dd.note + "', N'" + dd.birth_certificate + "', N'" + dd.marriage_certificate + "', " + dd.deathade + ", " + dd.doctor + ", " + Employee.employee_id + ")";
                cmd.Connection = dbcon.connection;
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                dbcon.closeConnection();
                return true;
            }
            else
            {
                dbcon.closeConnection();
                return false;
            }

            //}
            //catch (MySqlException e)
            //{
            //int errorcode = e.Number;
            //dbcon.closeConnection();
            //return false;
            //}
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:DependentDetailsHandler.cs


示例18: addDisciplinaryDetails

        public static bool addDisciplinaryDetails(DisciplinaryDetails dd)
        {
            DBConnector dbcon = new DBConnector();

            //try
            //{
                if (dbcon.openConnection())
                {
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "INSERT INTO desciplinary_details (rank, post, breaking, request_main_admin, breaking_date, given_sentence, given_sentence_date, verdict_of_director_general, verdict_of_director_general_date, inquiry_officer, suspended_date, rejoined_date, suspended_time, employee_idemployee) VALUES (N'" + dd.rank + "', N'" + dd.post + "', N'" + dd.breaking + "', N'" + dd.request_main_admin + "', '" + dd.breaking_date.ToString("yyyy-MM-dd") + "', N'" + dd.given_sentence + "', '" + dd.given_sentence_date.ToString("yyyy-MM-dd") + "', N'" + dd.verdict_of_director_general + "', '" + dd.verdict_of_director_general_date.ToString("yyyy-MM-dd") + "', N'" + dd.inquiry_officer + "', '" + dd.suspended_date.ToString("yyyy-MM-dd") + "', '" + dd.rejoined_date.ToString("yyyy-MM-dd") + "', N'" + dd.suspended_time + "', " + Employee.employee_id + ")";
                    cmd.Connection = dbcon.connection;
                    cmd.Prepare();
                    cmd.ExecuteNonQuery();

                    dbcon.closeConnection();
                    return true;
                }
                else
                {
                    dbcon.closeConnection();
                    return false;
                }

            /*}
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                dbcon.closeConnection();
                return false;
            }*/
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:DisciplinaryDetailsHandler.cs


示例19: addWorkingExperience

        public static bool addWorkingExperience(WorkingExperience we)
        {
            DBConnector dbcon = new DBConnector();

            try
            {
                if (dbcon.openConnection())
                {
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "INSERT INTO working_experience (institute, address, telephone, email, department, contact, date_from, date_to, date_perma, resign_reason, responsibility, occupation_relevant, award, employee_idemployee) VALUES (N'" + we.institute + "', N'" + we.address + "', N'" + we.telephone + "', N'" + we.email + "', N'" + we.department + "', N'" + we.contact + "', '" + we.getDate_from().ToString("yyyy-MM-dd") + "', '" + we.getDate_to().ToString("yyyy-MM-dd") + "', '" + we.getDate_perma().ToString("yyyy-MM-dd") + "', N'" + we.resign_reason + "', N'" + we.responsibility + "', " + we.occupation_relevant + ", N'" + we.award + "', " + Employee.employee_id + ")";
                    cmd.Connection = dbcon.connection;
                    cmd.Prepare();
                    cmd.ExecuteNonQuery();

                    dbcon.closeConnection();
                    return true;
                }
                else
                {
                    dbcon.closeConnection();
                    return false;
                }

            }
            catch (MySqlException e)
            {
                int errorcode = e.Number;
                dbcon.closeConnection();
                return false;
            }
        }
开发者ID:lakmalbuddikalucky,项目名称:OOSD-Project,代码行数:31,代码来源:WorkingExperienceHandler.cs


示例20: ButtonLogin_Click

 protected void ButtonLogin_Click(object sender, EventArgs e)
 {
     String strSql = "Select count(*) from Users where ID =" + TextBoxUserName.Text + " And Pwd = '" +
         Helper.CalMD5(TextBoxPassword.Text) + "'";
     DBConnector db = new DBConnector();
     if ((Int32)db.ExecuteObject(strSql) > 0)
     {
         Helper.UserId = int.Parse(TextBoxUserName.Text);
         strSql = "SELECT Name FROM Users WHERE ID = " + Helper.UserId;
         Helper.UserName = (String)db.ExecuteObject(strSql);
         strSql = "SELECT IsAdmin FROM Users WHERE ID = " + Helper.UserId;
         Helper.IsAdmin = (bool)db.ExecuteObject(strSql);
         if (Helper.IsAdmin)
         {
             MultiView1.SetActiveView(ViewAdministrator);
             LabelAdminName.Text = Helper.UserName;
             LinkButton2.Visible = true;
         }
         else
         {
             MultiView1.SetActiveView(ViewUsers);
             LabelUserName.Text = Helper.UserName;
             LinkButton2.Visible = true;
         }
         Response.Redirect(".");
     }
     else
     {
         Helper.MsgBox("登陆失败");
     }
 }
开发者ID:dalinhuang,项目名称:zhaoxiang,代码行数:31,代码来源:Master.master.cs



注:本文中的DBConnector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DBContext类代码示例发布时间:2022-05-24
下一篇:
C# DBConnection_Accessor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap