public bool Update(Savings savinginfo)        //적금을 연장할 때 부르는 함수
        {
            MySqlTransaction trans = conn.BeginTransaction();

            try
            {
                string       sql = @"update savings
                                  set 
                                        OutAccount = @outaccount,
                                        OutAccountPwd = @outpwd,
                                        NewPwd = @newpd,
                                        Duration = Duration + @duration
                                 where SAccountNum = @saccoutnum";
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.Transaction = trans;


                cmd.Parameters.Add("@outaccount", MySqlDbType.VarChar);
                cmd.Parameters["@outaccount"].Value = savinginfo.OutAccount;

                cmd.Parameters.Add("@outpwd", MySqlDbType.VarChar);
                cmd.Parameters["@outpwd"].Value = savinginfo.OutAccountPwd;

                cmd.Parameters.Add("@newpd", MySqlDbType.VarChar);
                cmd.Parameters["@newpd"].Value = savinginfo.NewPwd;

                cmd.Parameters.Add("@duration", MySqlDbType.VarChar);
                cmd.Parameters["@duration"].Value = savinginfo.Duration;

                cmd.Parameters.Add("@saccoutnum", MySqlDbType.Int32);
                cmd.Parameters["@saccoutnum"].Value = savinginfo.SAccountNum;

                if (cmd.ExecuteNonQuery() > 0)
                {
                    trans.Commit();
                    return(true);
                }
                else
                {
                    trans.Rollback();
                    return(false);
                }
            }
            catch (Exception)
            {
                trans.Rollback();
                return(false);
            }
        }
        public bool Insert(Savings savinginfo)
        {
            MySqlTransaction trans = conn.BeginTransaction();

            try
            {
                string       sql = @"insert into savings (DateCreated, CustomerNum, CustomerName, KindOfAcc, Duration, 
                                                    PayPerMonth, OutAccount, OutAccountPwd, NewPwd)
                                            values(now(), @customernum, @customername, @kindofacc, @duration, @paypermonth, @outaccount, @outaccountpwd, @newpwd)";
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.Transaction = trans;

                cmd.Parameters.Add("@customernum", MySqlDbType.Int32);
                cmd.Parameters["@customernum"].Value = Convert.ToInt32(savinginfo.CustomerNum);

                cmd.Parameters.Add("@customername", MySqlDbType.VarChar);
                cmd.Parameters["@customername"].Value = savinginfo.CustomerName;

                cmd.Parameters.Add("@kindofacc", MySqlDbType.VarChar);
                cmd.Parameters["@kindofacc"].Value = savinginfo.KindOfAcc;

                cmd.Parameters.Add("@duration", MySqlDbType.VarChar);
                cmd.Parameters["@duration"].Value = savinginfo.Duration;

                cmd.Parameters.Add("@paypermonth", MySqlDbType.VarChar);
                cmd.Parameters["@paypermonth"].Value = savinginfo.PayPerMonth;

                cmd.Parameters.Add("@outaccount", MySqlDbType.VarChar);
                cmd.Parameters["@outaccount"].Value = savinginfo.OutAccount;

                cmd.Parameters.Add("@outaccountpwd", MySqlDbType.VarChar);
                cmd.Parameters["@outaccountpwd"].Value = savinginfo.OutAccountPwd;

                cmd.Parameters.Add("@newpwd", MySqlDbType.VarChar);
                cmd.Parameters["@newpwd"].Value = savinginfo.NewPwd;

                cmd.ExecuteNonQuery();
                trans.Commit();
                return(true);
            }
            catch (Exception)
            {
                trans.Rollback();
                return(false);
            }
        }