/// <summary>
        /// 旧方法调用。
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public DataTable OldGetAll(string query)
        {
            List <SqlParameter> parList = new List <SqlParameter>();

            //RoadFlow.Data.Model.Buildings temp = RoadFlow.Utility.ObjectExpand.JsonConvertModel<RoadFlow.Data.Model.Buildings>(query);
            RoadFlow.Data.Model.Buildings temp = query.JsonConvertModel <RoadFlow.Data.Model.Buildings>();
            StringBuilder where = new StringBuilder(" 1=1 and Status=" + (int)RoadFlow.Data.Model.Status.Normal);
            SingleLikeBuild("Name", temp.Name, parList, where);
            SingleBuild("SSJD", temp.SSJD, parList, where);                                          //所属街道
            SingleBuild("JSJD", temp.JSJD, parList, where);                                          //建设阶段
            SingleBuild("LYJB", temp.LYJB, parList, where);                                          //楼宇级别
            SingleBuild("LYLX", temp.LYLX, parList, where);                                          //楼宇类型
            //SingleBuild("LYDS", temp.LYDS, parList, where);//报送楼栋
            SingleBuild("TCZS", temp.TCZS, parList, where);                                          //统筹招商
            RangeBuild("SY_ZMJ", temp.SY_ZMJ, parList, where);                                       //商业总面积
            RangeBuild("SY_KZ_ZMJ", temp.SY_KZ_ZMJ, parList, where);                                 //商业空置总面积
            RangeBuild("SY_KZ_KXSMJ", temp.SY_KZ_KXSMJ, parList, where);                             //商业空置可销售面积
            RangeBuild("SY_KZ_KZLMJ", temp.SY_KZ_KZLMJ, parList, where);                             //商业空置可租赁面积
            RangeBuild("SW_ZMJ", temp.SW_ZMJ, parList, where);                                       //商务总面积
            RangeBuild("SW_KZ_ZMJ", temp.SW_KZ_ZMJ, parList, where);                                 //商务空置总面积
            RangeBuild("SW_KZ_KXSMJ", temp.SW_KZ_KXSMJ, parList, where);                             //商务空置可销售面积
            RangeBuild("SW_KZ_KZLMJ", temp.SW_KZ_KZLMJ, parList, where);                             //商务空置可租赁面积
            RangeBuild("JGSJ", temp.JGSJ, parList, where);                                           //竣工时间

            string sql = "select * from [V_BuildingsAndBuildingMonthInfo_Dictionary] where" + where; //RoadFlow.Utility.L.Tools.GetPaging("[Buildings]", where.ToString(), pageSize, pageIndex);
            //count = Int32.Parse(dbHelper.GetFieldValue("select Count(1) Count from [Buildings] where" + where, parList.ToArray()));
            ExecuteBLL executeBLL = new ExecuteBLL();

            return(executeBLL.GetDataTable(sql, parList.ToArray()));
        }
        /// <summary>
        /// 按楼盘统计
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public DataTable GetStatisticsByHouseName(string houseName)
        {
            ExecuteBLL executeBLL = new ExecuteBLL();
            string     sql        = "select [HouseName],sum(ZJZMJ) ZJZMJ from [dbo].[V_BuildingsAndBuildingMonthInfo_Dictionary] {0} group by [HouseName]";

            if (!string.IsNullOrWhiteSpace(houseName))
            {
                sql = string.Format(sql, "where CHARINDEX('" + houseName + "',[HouseName])>0");
            }
            else
            {
                sql = string.Format(sql, "");
            }
            return(executeBLL.GetDataTable(sql));
        }
示例#3
0
        /// <summary>
        /// 更新一个连接一个表一个字段的值
        /// </summary>
        /// <param name="connID"></param>
        /// <param name="table"></param>
        /// <param name="field"></param>
        /// <param name="value"></param>
        public void UpdateFieldValue(Guid connID, string table, string field, string value, string where)
        {
            string sql = string.Format("UPDATE {0} SET {1}=@value WHERE {2}", table, field, where);

            SqlParameter[] para = new SqlParameter[] {
                new SqlParameter("@value", value)
            };
            RoadFlow.Platform.ExecuteBLL executeBLL = new ExecuteBLL();
            executeBLL.ExecuteSQL(sql, para);

            //var conn = Get(connID);
            //if (conn == null)
            //{
            //    return;
            //}
            //switch (conn.Type)
            //{

            //    case "SqlServer":
            //        using (var dbconn = GetConnection(conn))
            //        {
            //            try
            //            {
            //                dbconn.Open();
            //            }
            //            catch(SqlException ex)
            //            {
            //                Platform.Log.Add(ex);
            //            }
            //            string sql = string.Format("UPDATE {0} SET {1}=@value WHERE {2}", table, field, where);
            //            SqlParameter par = new SqlParameter("@value", value);
            //            using (SqlCommand cmd = new SqlCommand(sql, (SqlConnection)dbconn))
            //            {
            //                cmd.Parameters.Add(par);
            //                try
            //                {
            //                    cmd.ExecuteNonQuery();
            //                }
            //                catch (SqlException ex)
            //                {
            //                    Platform.Log.Add(ex);
            //                }
            //            }
            //        }
            //        break;
            //    case "MySql":
            //        using (var dbconn = GetConnection(conn))
            //        {

            //            try
            //            {
            //                dbconn.Open();
            //            }
            //            catch (Exception ex)
            //            {
            //                Platform.Log.Add(ex);
            //            }
            //            string sql = string.Format("UPDATE {0} SET {1}=@value WHERE {2}", table, field, where);
            //            MySqlParameter par = new MySqlParameter("@value", value);
            //            using (MySqlCommand cmd = new MySqlCommand(sql, (MySqlConnection)dbconn))
            //            {
            //                cmd.Parameters.Add(par);
            //                try
            //                {
            //                    cmd.ExecuteNonQuery();
            //                }
            //                catch (MySqlException ex)
            //                {
            //                    Platform.Log.Add(ex);
            //                }
            //            }
            //        }
            //        break;


            //}
        }