Beispiel #1
0
        /// <summary>
        /// 读取合计信息。(县级公司)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static FDXXtbl_country GetTotalInfo(int id)
        {
            FDXXtbl_country fm    = new FDXXtbl_country();
            IDbConnection   mycon = DBhelper.OpenConnection();

            try
            {
                string     sql   = CompilationDocumentSQL.GetFDXXcountrytotalSQL(id);
                IDbCommand mycom = DBFactory.getSingleton().getCommand(sql, mycon);
                using (IDataReader myReader = mycom.ExecuteReader()) //执行command并得到相应的DataReader
                {
                    myReader.Read();                                 //把得到的值赋给fm对象

                    fm.ZDXX_ZDMJ = Math.Round((decimal)myReader["ZDMJ"], 0);
                    fm.ZMJ       = Math.Round((decimal)myReader["FCMJ"], 0);
                    fm.FCXX_DSMJ = Math.Round((decimal)myReader["DSMJ"], 0);
                    fm.FCXX_DXMJ = Math.Round((decimal)myReader["DXMJ"], 0);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(FDXXtbl_country), ex);
            }
            finally
            {
                mycon.Close();
            }
            return(fm);
        }
Beispiel #2
0
        /// <summary>
        /// 从数据库中获取一行行表格数据,并存入FDXXmodel中。(县级公司)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static List <FDXXtbl_country> GetInfo(int id)
        {
            List <FDXXtbl_country> lstFDXX = new List <FDXXtbl_country>();
            FDXXtbl_country        fm;
            IDbConnection          mycon = DBhelper.OpenConnection();

            try
            {
                string     sql   = CompilationDocumentSQL.GetFDXXcountrySQL(id);
                IDbCommand mycom = DBFactory.getSingleton().getCommand(sql, mycon);
                using (IDataReader myReader = mycom.ExecuteReader()) //执行command并得到相应的DataReader
                {
                    while (myReader.Read())                          //把得到的值赋给fm对象
                    {
                        fm           = new FDXXtbl_country();
                        fm.ZDXX_ID   = int.Parse(((decimal)myReader["ZDXX_ID"]).ToString());                       //(int)myReader["ZDXX_ID"];
                        fm.ZDXX_MC   = (string)myReader["ZDXX_MC"];
                        fm.ZDXX_ZDMJ = Decimal.Parse((((decimal)myReader["ZDXX_ZDMJ"]) * 2000 / 3).ToString("0")); //把单位统一为平方米
                        fm.FCXX_ID   = int.Parse(((decimal)myReader["FCXX_ID"]).ToString());                       //(int)myReader["FCXX_ID"];
                        fm.FCXX_JZMC = (string)myReader["FCXX_JZMC"];
                        fm.FCXX_DSCS = (decimal)myReader["FCXX_DSCS"];
                        fm.FCXX_DXCS = (decimal)myReader["FCXX_DXCS"];
                        fm.FCXX_JZJG = (string)myReader["FCXX_JZJG"];
                        fm.FCXX_JSND = (decimal)myReader["FCZK_JSND"];
                        fm.ZMJ       = Math.Round((decimal)myReader["ZMJ"], 2);
                        fm.FCXX_DSMJ = Math.Round((decimal)myReader["FCXX_DSMJ"], 2);
                        fm.FCXX_DXMJ = Math.Round((decimal)myReader["FCXX_DXMJ"], 2);
                        fm.FCZK_SYGN = (string)myReader["FCZK_SYGN"];
                        fm.FCZK_SYBM = (string)myReader["FCZK_SYBM"];
                        if (!DBNull.Value.Equals(myReader["FCXX_BZ"]))
                        {
                            fm.FCXX_BZ = (string)myReader["FCXX_BZ"];                                           //判断FCXX_BZ是否为空值(DBNull)
                        }
                        else
                        {
                            fm.FCXX_BZ = "";
                        }

                        lstFDXX.Add(fm);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(FDXXtbl_country), ex);
            }
            finally
            {
                mycon.Close();
            }
            return(lstFDXX);
        }