Пример #1
0
        /// <summary>
        /// 从数据库中得到土地总面积、用房总面积、地上面积、地下面积并存入provinceFDXXsentence1对象中。
        /// </summary>
        /// <returns></returns>
        public static provinceFDXXsentence1 GetInfo()
        {
            provinceFDXXsentence1 fs    = new provinceFDXXsentence1();
            IDbConnection         mycon = DBhelper.OpenConnection();

            try
            {
                string     sql   = CompilationDocumentSQL.GetprovinceFDXXsentence1SQL();
                IDbCommand mycom = DBFactory.getSingleton().getCommand(sql, mycon);
                using (IDataReader myReader = mycom.ExecuteReader())//执行command并得到相应的DataReader
                {
                    myReader.Read();
                    fs.ZDMJ = Decimal.Parse((((decimal)myReader["ZDMJ"]) * (decimal)0.0015).ToString("0"));    //把单位统一为亩
                    fs.FCMJ = (decimal)myReader["FCMJ"];
                    fs.DSMJ = (decimal)myReader["DSMJ"];
                    fs.DXMJ = (decimal)myReader["DXMJ"];
                }
            }
            catch (System.Exception ex)
            {
                LogHelper.WriteLog(typeof(provinceFDXXsentence1), ex);
            }
            finally
            {
                mycon.Close();
            }
            return(fs);
        }
Пример #2
0
        public static provinceFDXXsentence2 GetInfo()
        {
            provinceFDXXsentence1 fs1 = new provinceFDXXsentence1();
            provinceFDXXsentence2 fs  = new provinceFDXXsentence2();
            string        temp;
            decimal       ZMJ;
            IDbConnection mycon = DBhelper.OpenConnection();

            try
            {
                fs1 = provinceFDXXsentence1.GetInfo();
                ZMJ = fs1.FCMJ;

                string     sql   = CompilationDocumentSQL.GetprovinceFDXXsentence2SQL();
                IDbCommand mycom = DBFactory.getSingleton().getCommand(sql, mycon);
                using (IDataReader myReader = mycom.ExecuteReader()) //执行command并得到相应的DataReader
                {
                    while (myReader.Read())                          //把得到的值赋给fm对象
                    {
                        temp = (string)myReader["MC"];
                        if (temp == "危房")
                        {
                            fs.WFZMJ  = (decimal)myReader["ZMJ"];
                            fs.WFZMJB = (Math.Round(fs.WFZMJ / ZMJ * 100, 2)).ToString() + "%";
                        }
                        else if (temp == "拆除")
                        {
                            fs.CCZMJ  = (decimal)myReader["ZMJ"];
                            fs.CCZMJB = (Math.Round(fs.CCZMJ / ZMJ * 100, 2)).ToString() + "%";
                        }
                        else if (temp == "未办权证")
                        {
                            fs.NQZZMJ  = (decimal)myReader["ZMJ"];
                            fs.NQZZMJB = (Math.Round(fs.NQZZMJ / ZMJ * 100, 2)).ToString() + "%";
                        }
                        else if (temp == "2013年以前")
                        {
                            fs.BF2013ZMJ  = (decimal)myReader["ZMJ"];
                            fs.BF2013ZMJB = (Math.Round(fs.BF2013ZMJ / ZMJ * 100, 2)).ToString() + "%";
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                LogHelper.WriteLog(typeof(provinceFDXXsentence2), ex);
            }
            finally
            {
                mycon.Close();
            }
            return(fs);
        }