当前位置: 首页>>代码示例>>C#>>正文


C# MySqlDataReader.GetDecimal方法代码示例

本文整理汇总了C#中MySql.Data.MySqlClient.MySqlDataReader.GetDecimal方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlDataReader.GetDecimal方法的具体用法?C# MySqlDataReader.GetDecimal怎么用?C# MySqlDataReader.GetDecimal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MySql.Data.MySqlClient.MySqlDataReader的用法示例。


在下文中一共展示了MySqlDataReader.GetDecimal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DBColumnToPyObject

        public static PyObject DBColumnToPyObject(int index, ref MySqlDataReader reader)
        {
            Type type = reader.GetFieldType(index);

            switch (type.Name)
            {
                case "String":
                    return new PyString(reader.GetString(index));
                case "UInt32":
                case "Int32":
                case "UInt16":
                case "Int16":
                case "SByte":
                case "Byte":
                    return new PyInt(reader.GetInt32(index));
                case "UInt64":
                case "Int64":
                    return new PyLongLong(reader.GetInt64(index));
                case "Byte[]":
                    return new PyBuffer((byte[])reader.GetValue(index));
                case "Double":
                    return new PyFloat(reader.GetDouble(index));
                case "Decimal":
                    return new PyFloat((double)reader.GetDecimal(index));
                case "Boolean":
                    return new PyBool(reader.GetBoolean(index));
                default:
                    Log.Error("Database", "Unhandled MySQL type " + type.Name);
                    break;
            }

            return null;
        }
开发者ID:Reve,项目名称:EVESharp,代码行数:33,代码来源:DBUtils.cs

示例2: GetAlbaran

 public static Albaran GetAlbaran(MySqlDataReader rdr)
 {
     if (rdr.IsDBNull(rdr.GetOrdinal("NUMALBAR")))
         return null;
     Albaran a = new Albaran();
     a.CodTipom = rdr.GetString("CODTIPOM");
     a.NumAlbar = rdr.GetInt32("NUMALBAR");
     a.FechaAlb = rdr.GetDateTime("FECHAALB");
     a.TotalAlb = rdr.GetDecimal("TOTALALB");
     return a;
 }
开发者ID:rafaelgr,项目名称:ArigesMovil,代码行数:11,代码来源:CntAriGes.cs

示例3: AddDataIntoSalesList

 private void AddDataIntoSalesList(SQLiteDataReader sqLiteDataReader, MySqlDataReader mySqlDataReader, List<SaleForExcelReport> sales)
 {
     var productTax = Convert.ToDecimal(sqLiteDataReader["Tax"].ToString());
     var income = mySqlDataReader.GetDecimal(2);
     var taxPercentage = productTax / 100;
     var currentTax = income * taxPercentage;
     var sale = new SaleForExcelReport(mySqlDataReader.GetString(0),
         income,
         mySqlDataReader.GetDecimal(3),
         currentTax);
     sales.Add(sale);
 }
开发者ID:Team-Goldenrod,项目名称:SupermarketsChain,代码行数:12,代码来源:SqliteMysqlToExcel.cs

示例4: FillProjectMember

 private static ProjectMember FillProjectMember(MySqlDataReader dr)
 {
     ProjectMember p = new ProjectMember();
     p = new ProjectMember();
     p.EmpProj = dr.GetInt32("EmpProj");
     p.ProjID = dr.GetInt32("ProjID");
     p.EmpID = dr.GetInt32("EmpID");
     p.Role = dr.GetString("Role");
     p.TotalHours = dr.GetDecimal("TotalHours");
     p.StartDate = dr.GetDateTime("StartDate");
     p.EndDate = dr["EndDate"] as DateTime?;
     return p;
 }
开发者ID:metin,项目名称:ProTracker,代码行数:13,代码来源:ProjectMember.Finders.cs

示例5: SMSModel

        public SMSModel(MySqlDataReader dataReader)
        {
            id = dataReader.GetInt32("id");

            if (!string.IsNullOrEmpty(dataReader["msg_id"].ToString()))
                msg_id = dataReader.GetString("msg_id");

            if (!string.IsNullOrEmpty(dataReader["number"].ToString()))
                number = dataReader.GetString("number");
            if (!string.IsNullOrEmpty(dataReader["message"].ToString()))
                message = dataReader.GetString("message");

            if (!string.IsNullOrEmpty(dataReader["sign"].ToString()))
                sign = dataReader.GetString("sign");

            if (!string.IsNullOrEmpty(dataReader["cost"].ToString()))
                cost = dataReader.GetDecimal("cost");

            if (!string.IsNullOrEmpty(dataReader["balance"].ToString()))
                balance = dataReader.GetDecimal("balance");

            if (!string.IsNullOrEmpty(dataReader["added"].ToString()))
                added = dataReader.GetString("added");

            if (!string.IsNullOrEmpty(dataReader["sended"].ToString()))
                sended = dataReader.GetString("sended");

            if (!string.IsNullOrEmpty(dataReader["received"].ToString()))
                received = dataReader.GetString("received");

            if (!string.IsNullOrEmpty(dataReader["error_code"].ToString()))
                error_code = dataReader.GetString("error_code");

            if (!string.IsNullOrEmpty(dataReader["status"].ToString()))
                status = dataReader.GetString("status");
        }
开发者ID:belko,项目名称:TurboSMSua,代码行数:36,代码来源:SMSModel.cs

示例6: createSessionFromDataReader

        public Session createSessionFromDataReader(MySqlDataReader dr)
        {
            Session session;
            String userLogin;
            int code = 0;
            DateTime date;
            String dateString;
            Video video;
            String mode;
            String comment;

            float evaluetion;

            if (dr.Equals(DBNull.Value)) return null;

            if (!dr["comment"].Equals(DBNull.Value))
                comment = dr.GetString("comment");
            else
                comment = "";

            if (dr["code"].Equals(DBNull.Value)) return null;
            code = dr.GetInt32("code");

            if (dr["userLogin"].Equals(DBNull.Value)) return null;
            userLogin = dr.GetString("userLogin");

            if (!dr["evaluetion"].Equals(DBNull.Value))
                evaluetion = (float)Convert.ToDouble(dr.GetDecimal("evaluetion"));
            else
                evaluetion = 0;

            DaoVideo daoVideo = new DaoVideo();
            daoVideo.openConnection();

            video = daoVideo.getVideoByCode(dr.GetInt32("videoCode"));

            date = dr.GetDateTime("date");
            dateString = date.Day + "/" + date.Month + "/" + date.Year;

            if (!dr["modeCode"].Equals(DBNull.Value))
                mode = getModeByCode(dr.GetInt32("modeCode"));
            else
                mode = "";

            session = new Session(userLogin, video, dateString, evaluetion, mode, comment);
            session.setCode(code);
            return session;
        }
开发者ID:igorbc,项目名称:PROJETO_FINAL_LC,代码行数:48,代码来源:DaoSession.cs

示例7: BuildObject

        private ShoppingCart BuildObject(MySqlDataReader reader)
        {
            if (!reader.Read()) return null;
            var cart = new ShoppingCart();
            do {
                cart.Items.Add(new ShoppingCart.ShoppingCartItem {
                    Product = new Product {
                        Id = reader.GetInt64("ProductId"),
                        Name = reader.GetString("Name"),
                        Price = reader.GetDecimal("Price"),
                        Description = reader.GetString("Description"),
                    },
                    Quantity = reader.GetInt32("Quantity"),
                });
            } while (reader.Read());

            return cart;
        }
开发者ID:jaysan1292,项目名称:COMP-3073-Group-Project,代码行数:18,代码来源:ShoppingCartDbProvider.cs

示例8: GetLinFactura

 public static LinFactura GetLinFactura(MySqlDataReader rdr)
 {
     if (rdr.IsDBNull(rdr.GetOrdinal("NUMLINEA")))
         return null;
     LinFactura lf = new LinFactura();
     lf.CodTipoa = rdr.GetString("CODTIPOA");
     lf.NumAlbar = rdr.GetInt32("NUMALBAR");
     lf.NumLinea = rdr.GetInt32("NUMLINEA");
     lf.CodArtic = rdr.GetString("CODARTIC");
     lf.NomArtic = rdr.GetString("NOMARTIC");
     lf.PrecioAr = rdr.GetDecimal("PRECIOAR");
     lf.Cantidad = rdr.GetDecimal("CANTIDAD");
     lf.DtoLine1 = rdr.GetDecimal("DTOLINE1");
     lf.DtoLine2 = rdr.GetDecimal("DTOLINE2");
     lf.Importel = rdr.GetDecimal("IMPORTEL");
     return lf;
 }
开发者ID:rafaelgr,项目名称:ArigesMovil,代码行数:17,代码来源:CntAriGes.cs

示例9: readToUser

        private List<User> readToUser(MySqlDataReader _reader)
        {
            List<User> users = new List<User>();
            string usersQuery = String.Format("SELECT user_type, {0}.users.id, Username, name, dateOfBirth, surname, gender, password, length, weight FROM {0}.users LEFT JOIN {0}.client_bmi_info on {0}.users.id = {0}.client_bmi_info.users_id  ", _database);
            OpenConnection();
            _selectCommand = new MySqlCommand(usersQuery, Connection);


            while (_reader.Read())
            {
                User u;
                int type = _reader.GetInt32(0);
                if (type == 2)
                {
                    u = new Administrator()
                    {
                        Username = _reader.IsDBNull(2) ? null : _reader.GetString(2),
                        Surname = _reader.IsDBNull(5) ? null : _reader.GetString(5),
                        Name = _reader.IsDBNull(3) ? null : _reader.GetString(3),
                        DateOfBirth = _reader.IsDBNull(4) ? DateTime.MinValue : (DateTime)_reader.GetMySqlDateTime(4),
                        Id = _reader.IsDBNull(1) ? 0 : _reader.GetInt32(1),
                        Gender = _reader.IsDBNull(6) ? null : _reader.GetString(6)
                    };
                }
                else if (type == 1)
                {
                    u = new Specialist
                    {
                        Username = _reader.IsDBNull(2) ? null : _reader.GetString(2),
                        Surname = _reader.IsDBNull(5) ? null : _reader.GetString(5),
                        Name = _reader.IsDBNull(3) ? null : _reader.GetString(3),
                        DateOfBirth = _reader.IsDBNull(4) ? DateTime.MinValue : (DateTime)_reader.GetMySqlDateTime(4),
                        Id = _reader.IsDBNull(1) ? 0 : _reader.GetInt32(1),
                        Gender = _reader.IsDBNull(6) ? null : _reader.GetString(6)
                    };
                }
                else if (_reader.GetInt32(0) == 0)
                {
                    u = new Client
                    {
                        Username = _reader.IsDBNull(2) ? null : _reader.GetString(2),
                        Surname = _reader.IsDBNull(5) ? null : _reader.GetString(5),
                        Name = _reader.IsDBNull(3) ? null : _reader.GetString(3),
                        DateOfBirth = _reader.IsDBNull(4) ? DateTime.MinValue : (DateTime)_reader.GetMySqlDateTime(4),
                        Id = _reader.IsDBNull(1) ? 0 : _reader.GetInt32(1),
                        Gender = _reader.IsDBNull(6) ? null : _reader.GetString(6),
                        Lenght = _reader.IsDBNull(8) ? -1 : _reader.GetDecimal(8),
                        Weight = _reader.IsDBNull(9) ? -1 : _reader.GetDecimal(9)
                    };
                }
                else
                    continue;
                users.Add(u);
            }
            _reader.Close();
            return users;
        }
开发者ID:JordySipkema,项目名称:LD326_RH_A5,代码行数:57,代码来源:DBConnect.cs

示例10: rNextButton_Click


//.........这里部分代码省略.........
                t = float.Parse(hcTranspoIn.Text);
                s = float.Parse(hcSomethingIn.Text);
                lwt = float.Parse(hcLWTIn.Text);
                pax = float.Parse(hcNoPaxIn.Text);

                cost.setHCParams(np, m, o, nd, h, t, s, lwt, pax);
            }
            catch (Exception err)
            {
                Console.WriteLine("Cost Table Field Error(HCP): " + err.Message);
            }

            if (true)
            {
                if (OpenConnection())
                {
                    string query = "INSERT INTO FACESHEET(PATID,CLIENTID,CTRAINING,AMBWELLNESS,SENIORRES,REQDETAILS) " +
                    "VALUES (@ptid,@ctid,@cty,@amb,@sen,@rqdet)";
                    cmd = new MySqlCommand(query, conn);
                    cmd.Prepare();
                    cmd.Parameters.AddWithValue("@ptid", fsheet.PatientID);
                    cmd.Parameters.AddWithValue("@ctid", fsheet.ClientID);
                    cmd.Parameters.AddWithValue("@cty", fsheet.CarTra);
                    cmd.Parameters.AddWithValue("@amb", fsheet.AmbWel);
                    cmd.Parameters.AddWithValue("@sen", fsheet.SenRes);
                    cmd.Parameters.AddWithValue("@rqdet", fsheet.ReqDetails);

                    cmd.ExecuteNonQuery();

                    query = "SELECT LAST_INSERT_ID() FROM FACESHEET;";
                    cmd.CommandText = query;
                    read = cmd.ExecuteReader();
                    read.Read();
                    fsheet.FID = UInt16.Parse(read.GetDecimal(0).ToString());

                    read.Close();

                    //insert values to case mgmt map

                    if (caseMgmtBox.CheckedItems.Count > 0)
                    {

                        string caseQuery = "SELECT CASEID FROM CASE_MGMT_REF WHERE DESCRIPTION IN (" + cmgmt + ");";
                        cmd = new MySqlCommand(caseQuery, conn);
                        UInt16[] ctmp = new UInt16[caseMgmtBox.CheckedItems.Count];

                        read = cmd.ExecuteReader();
                        int x = 0;
                        while (read.Read())
                        {

                            Console.WriteLine(read.GetDecimal(0).ToString());
                            ctmp[x] = UInt16.Parse(read.GetDecimal(0).ToString());
                            x++;
                        }
                        fsheet.addCaseMgmtIndex(ctmp);
                        read.Close();

                        query = "INSERT INTO CASE_MGMT_MAP VALUES (@fcID,@cmgmtID);";
                        cmd.CommandText = query;

                        for (int ccnt = 0; ccnt < ctmp.Length; ccnt++)
                        {
                            cmd.Parameters.Clear();
                            cmd.Parameters.AddWithValue("@fcID", fsheet.FID);
                            cmd.Parameters.AddWithValue("@cmgmtID", ctmp[ccnt]);
开发者ID:surplus1243,项目名称:introse-manlee-rep2,代码行数:67,代码来源:RegisterPatientTab.cs

示例11: GetLineaStock

 public static LineaStock GetLineaStock(MySqlDataReader rdr)
 {
     LineaStock ls = new LineaStock();
     ls.NumLinea = rdr.GetInt32("CODALMAC");
     ls.Almacen = rdr.GetString("NOMALMAC");
     ls.Stock = rdr.GetDecimal("CANSTOCK");
     return ls;
 }
开发者ID:rafaelgr,项目名称:ArigesMovil,代码行数:8,代码来源:CntAriGes.cs

示例12: GetArticulo

 public static Articulo GetArticulo(MySqlDataReader rdr)
 {
     if (rdr.IsDBNull(rdr.GetOrdinal("CODARTIC")))
         return null;
     Articulo a = new Articulo();
     a.CodArtic = rdr.GetString("CODARTIC");
     a.NomArtic = rdr.GetString("NOMARTIC");
     a.Preciove = rdr.GetDecimal("PRECIOVE");
     a.CodFamia = rdr.GetInt32("CODFAMIA");
     a.CodMarca = rdr.GetInt32("CODMARCA");
     return a;
 }
开发者ID:rafaelgr,项目名称:ArigesMovil,代码行数:12,代码来源:CntAriGes.cs

示例13: MapOption

        private static Option<Team> MapOption(MySqlDataReader dr)
        {
            var option = new Option<Team>
                {
                    CutOff = dr.GetDateTime("cutOffTime"),
                    GameId = dr.GetInt64("gameId"),
                    GroupId = dr.GetInt64("groupId"),
                    Id = dr.GetInt64("id"),
                    Team = new Team
                        {
                            Id = dr.GetInt32("teamId")
                        },
                    Type = (GameOptionType) dr.GetInt32("type")
                };

            if (dr["value"] != DBNull.Value)
            {
                option.Value = dr.GetDecimal("value");
            }

            if (dr["outcome"] != DBNull.Value)
            {
                option.Outcome = (OptionOutcome) dr.GetInt32("outcome");
                option.IsWinner = option.Outcome.Value == OptionOutcome.Won;
            }

            option.CutOff = option.CutOff.AddDays(ConfigSettings.GameTimeOffSetInDays);
            option.IsPastCutOff = DateTime.UtcNow >= option.CutOff;

            return option;
        }
开发者ID:hecubu5,项目名称:sportpicks,代码行数:31,代码来源:GameOptionRepository.cs

示例14: ds2purchase

        //
        //-------------------------------------------------------------------------------------------------
        //
        public bool ds2purchase(int cart_items, int[] prod_id_in, int[] qty_in, int customerid_out,
      ref int neworderid_out, ref bool IsRollback, ref double rt)
        {
            int i, j;
              bool success = false;
            #if (USE_WIN32_TIMER)
              long ctr0 = 0, ctr = 0, freq = 0;
            #else
              TimeSpan TS = new TimeSpan();
              DateTime DT0;
            #endif

              // Find total cost of purchase
              Decimal netamount_in = 0;
              string db_query = "select PROD_ID, PRICE from PRODUCTS where PROD_ID in (" + prod_id_in[0];
              for (i=1; i<cart_items; i++) db_query = db_query + "," + prod_id_in[i];
              db_query = db_query + ")";
              //Console.WriteLine(db_query);
              Purchase = new MySqlCommand(db_query, objConn);
              Rdr = Purchase.ExecuteReader();
              while (Rdr.Read())
            {
            j = 0;
            int prod_id = Rdr.GetInt32(0);
            while (prod_id_in[j] != prod_id) ++j; // Find which product was returned
            netamount_in = netamount_in + qty_in[j] * Rdr.GetDecimal(1);
            //Console.WriteLine(j + " " + prod_id + " " + Rdr.GetDecimal(1));
            }
              Rdr.Close();
              Decimal taxamount_in =  (Decimal) 0.0825 * netamount_in;
              Decimal totalamount_in = netamount_in + taxamount_in;

              // Insert new order into ORDERS table
              string currentdate = DateTime.Today.ToString("yyyy'-'MM'-'dd");
              MySqlTransaction trans = objConn.BeginTransaction(IsolationLevel.RepeatableRead);
              db_query = String.Format("INSERT into DS2.ORDERS (ORDERDATE, CUSTOMERID, NETAMOUNT, TAX, TOTALAMOUNT) VALUES" +
            "('{0}', {1}, {2:F2}, {3:F2}, {4:F2})", currentdate, customerid_out, netamount_in, taxamount_in, totalamount_in);

              Purchase = new MySqlCommand(db_query, objConn, trans);

            //    Console.WriteLine("Thread {0}: Calling Purchase w/ customerid = {1}  number_items= {2}",
            //      Thread.CurrentThread.Name, customerid_out, cart_items);

            #if (USE_WIN32_TIMER)
              QueryPerformanceFrequency(ref freq); // obtain system freq (ticks/sec)
              QueryPerformanceCounter(ref ctr0); // Start response time clock
            #else
              DT0 = DateTime.Now;
            #endif

              bool deadlocked = false;
              do
            {
            try
              {
              deadlocked = false;
              Purchase.ExecuteNonQuery();
              db_query = "select LAST_INSERT_ID();";
              Purchase = new MySqlCommand(db_query, objConn);
              neworderid_out = Convert.ToInt32(Purchase.ExecuteScalar().ToString());
            //        Console.WriteLine("Thread {0}: Purchase: neworderid_out= {1}", Thread.CurrentThread.Name, neworderid_out);
              if (neworderid_out > 0) success = true;

              // loop through purchased items and make inserts into orderdetails table
              // (o_insert_query) and cust_hist table (ch_insert_query)

              string o_insert_query = "INSERT into DS2.ORDERLINES (ORDERLINEID, ORDERID, PROD_ID, QUANTITY, ORDERDATE)" +
            " VALUES ";
              string c_insert_query = "INSERT into DS2.CUST_HIST (CUSTOMERID, ORDERID, PROD_ID) VALUES ";

              for (i=0; i<cart_items; i++)
            {
            j = i+1;
            db_query = "SELECT QUAN_IN_STOCK, SALES FROM DS2.INVENTORY WHERE PROD_ID=" + prod_id_in[i] + ";";
            Purchase = new MySqlCommand(db_query, objConn);
            Rdr = Purchase.ExecuteReader();
            Rdr.Read();
            int curr_quan = Rdr.GetInt32(0);
            int curr_sales = Rdr.GetInt32(1);
            Rdr.Close();
            int new_quan = curr_quan - qty_in[i];
            int new_sales = curr_sales + qty_in [i];
            if (new_quan < 0)
              {
              //Console.WriteLine("Insufficient quantity for product " + prod_id_in[i]);
              success = false;
              }
            else
              {
              db_query = "UPDATE DS2.INVENTORY SET QUAN_IN_STOCK=" + new_quan + ", SALES=" +
                new_sales + " WHERE PROD_ID=" + prod_id_in[i] + ";";
              Purchase = new MySqlCommand(db_query, objConn, trans);
              Purchase.ExecuteNonQuery();
              }

            o_insert_query = o_insert_query +
              "(" + j + "," +  neworderid_out + "," + prod_id_in[i] + "," + qty_in[i] + ",'" + currentdate + "'),";
//.........这里部分代码省略.........
开发者ID:wmkhairi,项目名称:pgsqlds2,代码行数:101,代码来源:ds2mysqlfns.cs

示例15: GetCobro

 public static Cobro GetCobro(MySqlDataReader rdr)
 {
     Cobro c = new Cobro();
     c.FechaVenci = rdr.GetDateTime("FECHAVENCI");
     c.FechaFact = rdr.GetDateTime("FECHAFACT");
     c.NumFact = rdr.GetString("NUMFACT");
     c.NomForpa = rdr.GetString("NOMFORPA");
     c.Total = rdr.GetDecimal("TOTAL");
     return c;
 }
开发者ID:rafaelgr,项目名称:ArigesMovil,代码行数:10,代码来源:CntAriGes.cs


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