public bool IsExistBuildByEstate(string estateId, string buildId, string buildName)
        {
            string funMsg = "function: IsExistBuildByEstate(string estateId, string buildId, string buildName)" + FileUtility.NewLine + _ClassMsg;

            try
            {
                DataTable             table = _DbService.GetBuildByEstate(estateId);
                List <CentaBuildType> build = ConvertUtility.Table2Model <CentaBuildType>(table).ToList();
                object rs = null;
                if (string.IsNullOrEmpty(buildId))
                {
                    rs = build.Find(m => m.BuildName == buildName);
                }
                else
                {
                    rs = build.Find(m => m.BuildId != buildId && m.BuildName == buildName);
                }

                if (rs != null)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                string exMsg = "Exception: " + ex.Message + FileUtility.NewLine + funMsg;
                throw new Exception(exMsg, ex.InnerException);
            }
        }
        public IList <T> GetBuildByEstate <T>(string estateId, int pageIndex, int pageSize, out int recordCount) where T : CentaBuildType
        {
            string funMsg = "function: GetBuildByEstate<T>(string estateId, int pageIndex, int pageSize, out int recordCount)" + _ClassMsg;

            try
            {
                DataTable table = _DbService.GetBuildByEstate(estateId, pageIndex, pageSize, out recordCount);
                return(ConvertUtility.Table2Model <T>(table));
            }
            catch (Exception ex)
            {
                string exMsg = "Exception: " + ex.Message + FileUtility.NewLine + funMsg;
                throw new Exception(exMsg, ex.InnerException);
            }
        }
 private void LoadData()
 {
     try
     {
         ScopeDbService    scopeDbService = new ScopeDbService();
         IList <DataTable> table          = scopeDbService.ListScope();
         this.CityCollection   = ConvertUtility.Table2Model <CityType>(table[0]).ToList();
         this.RegionCollection = ConvertUtility.Table2Model <RegionType>(table[1]).ToList();
         this.ScopeCollection  = ConvertUtility.Table2Model <ScopeType>(table[2]).ToList();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public IList <T> GetUnitByBuild <T>(string buildId, out List <string> rows, out List <string> cols) where T : CentaUnitType
        {
            string funMsg = "function: GetUnitByBuild<T>(string buildId)" + FileUtility.NewLine + _ClassMsg;

            try
            {
                IList <DataTable> table = _DbService.GetUnitByBuild(buildId);
                DataTable         room  = table[0];
                List <string>     rs    = new List <string>();
                if (room != null && room.Rows.Count > 0)
                {
                    foreach (DataRow row in room.Rows)
                    {
                        rs.Add(ConvertUtility.Trim(row[0]));
                    }
                    UnitColSort sort = new UnitColSort();
                    rs.Sort(sort.Compare);
                    cols = rs;
                }
                else
                {
                    cols = rs;
                }
                DataTable floor = table[1];
                if (floor != null && floor.Rows.Count > 0)
                {
                    rs = new List <string>();
                    foreach (DataRow row in floor.Rows)
                    {
                        rs.Add(ConvertUtility.Trim(row[0]));
                    }
                    UnitRowSort sort = new UnitRowSort();
                    rs.Sort(sort.Compare);
                    rows = rs;
                }
                else
                {
                    rows = rs;
                }
                DataTable all = table[2];
                return(ConvertUtility.Table2Model <T>(all));
            }
            catch (Exception ex)
            {
                string exMsg = "Exception: " + ex.Message + FileUtility.NewLine + funMsg;
                throw new Exception(exMsg, ex.InnerException);
            }
        }
        public IList <string> GetUnitRoomByBuild(string buildId)
        {
            string funMsg = "function: GetUnitRoomByBuild(string buildId)" + FileUtility.NewLine + _ClassMsg;

            try
            {
                DataTable     table = _DbService.GetUnitRoomByBuild(buildId);
                List <string> rs    = ConvertUtility.Table2Model <string>(table).ToList();
                if (rs != null && rs.Count > 0)
                {
                    UnitColSort sort = new UnitColSort();
                    rs.Sort(sort.Compare);
                }
                return(rs);
            }
            catch (Exception ex)
            {
                string exMsg = "Exception: " + ex.Message + FileUtility.NewLine + funMsg;
                throw new Exception(exMsg, ex.InnerException);
            }
        }
        public IList <T> GetEstateByKeyword <T>(string[] key, int pageIndex, int pageSize, out int recordCount) where T : CentaEstateType
        {
            string funMsg = "function: GetEstateByKeyword<T>(string[] key, int pageIndex, int pageSize, out int recordCount);" + FileUtility.NewLine + _ClassMsg;

            try
            {
                string keyword, type = string.Empty, code = string.Empty;
                keyword = key[0];
                if (key.Length > 1)
                {
                    type = key[1];
                    code = key[2];
                }
                DataTable table = _DbService.GetEstateByKeyword(keyword, type, code, pageIndex, pageSize, out recordCount);
                return(ConvertUtility.Table2Model <T>(table));
            }
            catch (Exception ex)
            {
                string exMsg = "Exception: " + ex.Message + FileUtility.NewLine + funMsg;
                throw new Exception(exMsg, ex.InnerException);
            }
        }