예제 #1
0
        /// <summary>
        /// 缓存预热,强制重新缓存
        /// </summary>
        /// <returns>影响行数</returns>
        public static int CachePreheating()
        {
            int result = 0;

            // 把所有的组织机构都缓存起来的代码
            BaseAreaManager manager = new BaseAreaManager();

            using (IDataReader dataReader = manager.ExecuteReader())
            {
                while (dataReader.Read())
                {
                    BaseAreaEntity entity = BaseEntity.Create <BaseAreaEntity>(dataReader, false);
                    if (entity != null && entity.Layer < 7)
                    {
                        BaseAreaManager.SetCache(entity);
                        result++;
                        System.Console.WriteLine(result.ToString() + " : " + entity.FullName);
                        // 把列表缓存起来
                        BaseAreaManager.GetListByParentByCache(entity.Id, true);
                        System.Console.WriteLine(result.ToString() + " : " + entity.Id + " " + entity.FullName + " List");
                    }
                }
                dataReader.Close();
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// 获取街道
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="districtId">县区主键</param>
        /// <returns>街道列表</returns>
        public List <BaseAreaEntity> GetStreetList(BaseUserInfo userInfo, string districtId)
        {
            List <BaseAreaEntity> result = null;
            var parameter = ServiceParameter.CreateWithMessage(userInfo
                                                               , MethodBase.GetCurrentMethod()
                                                               , this.serviceName
                                                               , AppMessage.OrganizeService_GetDistrict);

            System.Web.Caching.Cache cache = HttpRuntime.Cache;
            string cacheObject             = "AreaStreet" + districtId;

            if (cache == null || cache[cacheObject] == null)
            {
                lock (locker)
                {
                    if (cache == null || cache[cacheObject] == null)
                    {
                        ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
                        {
                            BaseAreaManager areaManager = new BaseAreaManager(dbHelper, userInfo);
                            result = areaManager.GetStreet(districtId);
                            cache.Add(cacheObject, result, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero, CacheItemPriority.Normal, null);
                            System.Console.WriteLine(System.DateTime.Now.ToString(BaseSystemInfo.DateTimeFormat) + " cache AreaStreet districtId " + districtId);
                        });
                    }
                }
            }
            result = cache[cacheObject] as List <BaseAreaEntity>;
            return(result);
        }
예제 #3
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">实体</param>
        /// <param name="statusCode">状态码</param>
        /// <param name="statusMessage">状态信息</param>
        /// <returns>影响行数</returns>
        public int Update(BaseUserInfo userInfo, BaseAreaEntity entity, out string statusCode, out string statusMessage)
        {
            int result = 0;

            string returnCode    = string.Empty;
            string returnMessage = string.Empty;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager   = new BaseAreaManager(dbHelper, userInfo);
                result        = manager.Update(entity, out returnCode);
                returnMessage = manager.GetStateMessage(returnCode);
            });
            statusCode    = returnCode;
            statusMessage = returnMessage;

            // 处理缓存优化性能
            System.Web.Caching.Cache cache = HttpRuntime.Cache;
            string cacheObject             = string.Empty;

            if (string.IsNullOrEmpty(entity.ParentId))
            {
                cacheObject = "AreaProvince";
            }
            else
            {
                cacheObject = "Area" + entity.ParentId;
            }
            cache.Remove(cacheObject);

            return(result);
        }
예제 #4
0
        /// <summary>
        /// 联络单可以按省看?
        /// </summary>
        /// <param name="contactId">联络单主键</param>
        /// <param name="areaId">省份主键</param>
        /// <returns>影响行数</returns>
        public void AddArea(string contactId, string areaId)
        {
            BaseContactTargetEntity entity = new BaseContactTargetEntity();

            entity.Id               = Guid.NewGuid().ToString("N");
            entity.ContactId        = contactId;
            entity.Category         = "Area";
            entity.ReceiverId       = areaId;
            entity.ReceiverRealName = BaseAreaManager.GetNameByByCache(areaId);
            this.Add(entity);
        }
예제 #5
0
        /// <summary>
        /// 获取街道
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="districtId">县区主键</param>
        /// <returns>街道列表</returns>
        public List <BaseAreaEntity> GetStreetList(BaseUserInfo userInfo, string districtId)
        {
            List <BaseAreaEntity> result = null;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                result = BaseAreaManager.GetListByParentByCache(districtId);
            });

            return(result);
        }
예제 #6
0
        /// <summary>
        /// 获取省份
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>省份列表</returns>
        public List <BaseAreaEntity> GetProvinceList(BaseUserInfo userInfo)
        {
            List <BaseAreaEntity> result = null;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                result = BaseAreaManager.GetProvinceByCache();
            });

            return(result);
        }
예제 #7
0
        /// <summary>
        /// 批量重新生成排序码
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <returns>影响行数</returns>
        public int BatchSetSortCode(BaseUserInfo userInfo, string[] ids)
        {
            int result = 0;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                result      = manager.BatchSetSortCode(ids);
            });
            return(result);
        }
예제 #8
0
        /// <summary>
        /// 移动数据
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主键</param>
        /// <param name="parentId">父主键</param>
        /// <returns>影响行数</returns>
        public int MoveTo(BaseUserInfo userInfo, string id, string parentId)
        {
            int result = 0;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                result      = manager.MoveTo(id, parentId);
            });
            return(result);
        }
예제 #9
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主键</param>
        /// <returns>实体</returns>
        public BaseAreaEntity GetObject(BaseUserInfo userInfo, string id)
        {
            BaseAreaEntity entity = null;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                entity      = manager.GetObject(id);
            });
            return(entity);
        }
예제 #10
0
        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="searchValue">查询</param>
        /// <returns>数据表</returns>
        public DataTable Search(BaseUserInfo userInfo, string searchValue)
        {
            DataTable result = null;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                result      = manager.Search(searchValue);
            });

            return(result);
        }
예제 #11
0
        /// <summary>
        /// 按主键数组获取列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">组织机构主键</param>
        /// <returns>数据表</returns>
        public DataTable GetDataTableByIds(BaseUserInfo userInfo, string[] ids)
        {
            var dt = new DataTable(BaseAreaEntity.TableName);

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                var manager  = new BaseAreaManager(dbHelper, userInfo);
                dt           = manager.GetDataTable(BaseAreaEntity.FieldId, ids, BaseAreaEntity.FieldSortCode);
                dt.TableName = BaseAreaEntity.TableName;
            });
            return(dt);
        }
예제 #12
0
        /// <summary>
        /// 批量重新生成排序码
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <returns>影响行数</returns>
        public int BatchSetSortCode(BaseUserInfo userInfo, string[] ids)
        {
            var parameter = ServiceParameter.CreateWithMessage(userInfo
                                                               , MethodBase.GetCurrentMethod()
                                                               , this.serviceName
                                                               , AppMessage.OrganizeService_BatchSetSortCode);
            int result = 0;

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                result      = manager.BatchSetSortCode(ids);
            });
            return(result);
        }
예제 #13
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主键</param>
        /// <returns>实体</returns>
        public BaseAreaEntity GetObject(BaseUserInfo userInfo, string id)
        {
            var parameter = ServiceParameter.CreateWithMessage(userInfo
                                                               , MethodBase.GetCurrentMethod()
                                                               , this.serviceName
                                                               , AppMessage.OrganizeService_GetObject);
            BaseAreaEntity entity = null;

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                entity      = manager.GetObject(id);
            });
            return(entity);
        }
예제 #14
0
        /// <summary>
        /// 移动数据
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主键</param>
        /// <param name="parentId">父主键</param>
        /// <returns>影响行数</returns>
        public int MoveTo(BaseUserInfo userInfo, string id, string parentId)
        {
            var parameter = ServiceParameter.CreateWithMessage(userInfo
                                                               , MethodBase.GetCurrentMethod()
                                                               , this.serviceName
                                                               , AppMessage.OrganizeService_MoveTo);
            int result = 0;

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                result      = manager.MoveTo(id, parentId);
            });
            return(result);
        }
예제 #15
0
        /// <summary>
        /// 1:默认从只读的缓存服务器获取数据
        /// 2:若读取不到,就会到接口上获取,接口会把数据缓存到只读服务器上,为下次阅读提高性能
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static BaseAreaEntity GetObjectByCache(BaseUserInfo userInfo, string id)
        {
            BaseAreaEntity result = null;

            string key = "Area:" + id;

            result = BaseAreaManager.GetCache(key);

            // 远程通过接口获取数据
            if (result == null)
            {
                result = GetObject(userInfo, id);
            }

            return(result);
        }
예제 #16
0
        /// <summary>
        /// 批量移动数据
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <param name="parentId">父节点主键</param>
        /// <returns>影响行数</returns>
        public int BatchMoveTo(BaseUserInfo userInfo, string[] ids, string parentId)
        {
            int result = 0;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                for (int i = 0; i < ids.Length; i++)
                {
                    result += manager.MoveTo(ids[i], parentId);
                }
            });
            return(result);
        }
예제 #17
0
        /// <summary>
        /// 批量打删除标志
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <returns>影响行数</returns>
        public int SetDeleted(BaseUserInfo userInfo, string[] ids)
        {
            int result = 0;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                for (int i = 0; i < ids.Length; i++)
                {
                    // 设置为删除状态
                    result += manager.SetDeleted(ids[i]);
                }
            });
            return(result);
        }
예제 #18
0
        /// <summary>
        /// 获取省份
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>省份列表</returns>
        public List <BaseAreaEntity> GetProvinceList(BaseUserInfo userInfo)
        {
            List <BaseAreaEntity> result = null;
            var parameter = ServiceParameter.CreateWithMessage(userInfo
                                                               , MethodBase.GetCurrentMethod()
                                                               , this.serviceName
                                                               , AppMessage.OrganizeService_GetProvince);

            // System.Web.Caching.Cache cache = HttpRuntime.Cache;
            string cacheObject = "AreaProvince";
            string cacheValue  = string.Empty;

            using (var client = redisPool.GetClient())
            {
                cacheValue = client.GetValue(cacheObject);
            }
            if (string.IsNullOrEmpty(cacheValue))
            {
                lock (locker)
                {
                    if (string.IsNullOrEmpty(cacheValue))
                    {
                        ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
                        {
                            BaseAreaManager areaManager = new BaseAreaManager(dbHelper, userInfo);
                            result = areaManager.GetProvince();
                            using (var client = redisPool.GetClient())
                            {
                                JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                                cacheValue = javaScriptSerializer.Serialize(result);
                                client.SetEntry(cacheObject, cacheValue, new TimeSpan(0, 30, 0));
                            }
                            // cache.Add(cacheObject, result, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero, CacheItemPriority.Normal, null);
                            System.Console.WriteLine(System.DateTime.Now.ToString(BaseSystemInfo.DateTimeFormat) + " cache Province");
                        });
                    }
                }
            }
            if (string.IsNullOrEmpty(cacheValue))
            {
                JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                result = javaScriptSerializer.Deserialize <List <BaseAreaEntity> >(cacheValue);
            }
            // result = cache[cacheObject] as List<BaseAreaEntity>;
            return(result);
        }
예제 #19
0
        /// <summary>
        /// 批量打删除标志
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <returns>影响行数</returns>
        public int SetDeleted(BaseUserInfo userInfo, string[] ids)
        {
            var parameter = ServiceParameter.CreateWithMessage(userInfo
                                                               , MethodBase.GetCurrentMethod()
                                                               , this.serviceName
                                                               , AppMessage.OrganizeService_SetDeleted);
            int result = 0;

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                for (int i = 0; i < ids.Length; i++)
                {
                    // 设置部门为删除状态
                    result += manager.SetDeleted(ids[i]);
                    // 相应的用户也需要处理
                    var userManager = new BaseUserManager(dbHelper, userInfo);
                    List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldCompanyId, null));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldCompanyName, null));
                    userManager.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldCompanyId, ids[i]), parameters);
                    parameters = new List <KeyValuePair <string, object> >();
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldSubCompanyId, null));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldSubCompanyName, null));
                    userManager.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldSubCompanyId, ids[i]), parameters);
                    parameters = new List <KeyValuePair <string, object> >();
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldDepartmentId, null));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldDepartmentName, null));
                    userManager.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldDepartmentId, ids[i]), parameters);
                    parameters = new List <KeyValuePair <string, object> >();
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldWorkgroupId, null));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldWorkgroupName, null));
                    userManager.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldWorkgroupId, ids[i]), parameters);
                    // 相应的员工也需要处理
                    var staffManager = new BaseStaffManager(dbHelper, userInfo);
                    staffManager.SetProperty(new KeyValuePair <string, object>(BaseStaffEntity.FieldCompanyId, ids[i]), new KeyValuePair <string, object>(BaseStaffEntity.FieldCompanyId, null));
                    staffManager.SetProperty(new KeyValuePair <string, object>(BaseStaffEntity.FieldSubCompanyId, ids[i]), new KeyValuePair <string, object>(BaseStaffEntity.FieldSubCompanyId, null));
                    staffManager.SetProperty(new KeyValuePair <string, object>(BaseStaffEntity.FieldDepartmentId, ids[i]), new KeyValuePair <string, object>(BaseStaffEntity.FieldDepartmentId, null));
                    staffManager.SetProperty(new KeyValuePair <string, object>(BaseStaffEntity.FieldWorkgroupId, ids[i]), new KeyValuePair <string, object>(BaseStaffEntity.FieldWorkgroupId, null));
                }
                var folderManager = new BaseFolderManager(dbHelper, userInfo);
                folderManager.SetDeleted(ids);
            });
            return(result);
        }
예제 #20
0
        /// <summary>
        /// 批量移动数据
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <param name="parentId">父节点主键</param>
        /// <returns>影响行数</returns>
        public int BatchMoveTo(BaseUserInfo userInfo, string[] ids, string parentId)
        {
            var parameter = ServiceParameter.CreateWithMessage(userInfo
                                                               , MethodBase.GetCurrentMethod()
                                                               , this.serviceName
                                                               , AppMessage.OrganizeService_BatchMoveTo);
            int result = 0;

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseAreaManager(dbHelper, userInfo);
                for (int i = 0; i < ids.Length; i++)
                {
                    result += manager.MoveTo(ids[i], parentId);
                }
            });
            return(result);
        }
예제 #21
0
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">实体</param>
        /// <param name="statusCode">状态码</param>
        /// <param name="statusMessage">状态信息</param>
        /// <returns>主键</returns>
        public string Add(BaseUserInfo userInfo, BaseAreaEntity entity, out string statusCode, out string statusMessage)
        {
            string result = string.Empty;

            string returnCode    = string.Empty;
            string returnMessage = string.Empty;
            var    parameter     = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager   = new BaseAreaManager(dbHelper, userInfo);
                result        = manager.Add(entity, out returnCode);
                returnMessage = manager.GetStateMessage(returnCode);
            });
            statusCode    = returnCode;
            statusMessage = returnMessage;
            return(result);
        }
예제 #22
0
        /// <summary>
        /// 刷新列表
        /// 2015-07-17 吉日嘎拉 刷新缓存功能优化
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">父亲节点主键</param>
        /// <returns>数据表</returns>
        public void Refresh(BaseUserInfo userInfo, string id)
        {
            string cacheKey = string.Empty;

            // 把列表的缓存更新掉
            cacheKey = "Area" + id;
            BaseAreaManager.RemoveCache(cacheKey);

            // 重新获取本身的缓存
            // cacheKey = "AreaList" + id;
            BaseAreaManager.GetCache(cacheKey);

            /*
             * System.Web.Caching.Cache cache = HttpRuntime.Cache;
             * string cacheKey = "Area";
             * if (!string.IsNullOrEmpty(parentId))
             * {
             *  cacheKey = "Area" + parentId;
             * }
             * cache.Remove(cacheKey);
             */
        }
        /// <summary>
        /// 设置按省路由大头笔
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="dtAreaRouteMark">路由设置</param>
        /// <returns>影响行数</returns>
        public int SetAreaRouteMark(string areaId, DataTable dtAreaRouteMark)
        {
            int    result   = 0;
            string areaName = string.Empty;

            BaseAreaEntity areaEntity = BaseAreaManager.GetObjectByCache(areaId);

            if (areaEntity != null)
            {
                areaName = areaEntity.FullName;
            }

            if (string.IsNullOrEmpty(areaName))
            {
                return(result);
            }

            IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType, BaseSystemInfo.UserCenterDbConnection);

            foreach (DataRow dr in dtAreaRouteMark.Rows)
            {
                // BaseAreaProvinceMarkEntity entity = null;
                if (string.IsNullOrWhiteSpace(dr["Id"].ToString()))
                {
                    /*
                     * entity = new BaseAreaProvinceMarkEntity();
                     * BaseEntity.Create<BaseAreaProvinceMarkEntity>(dr);
                     * entity.Province = dr["AREANAME"].ToString();
                     * entity.ProvinceId = dr["AREAID"].ToString();
                     * entity.Mark = dr["MARK"].ToString();
                     * entity.Description = dr["DESCRIPTION"].ToString();
                     * entity.CreateBy = this.UserInfo.RealName;
                     * entity.CreateUserId = this.UserInfo.Id;
                     * entity.CreateOn = DateTime.Now;
                     * this.AddObject(entity);
                     */

                    SQLBuilder sqlBuilder = new SQLBuilder(dbHelper);
                    sqlBuilder.BeginInsert("BASEAREA_PROVINCEMARK");
                    sqlBuilder.SetFormula("Id", "SEQ_BASEAREA_PROVINCEMARK.NEXTVAL");
                    sqlBuilder.SetValue("MARK", dr["MARK"].ToString());
                    sqlBuilder.SetValue("DESCRIPTION", dr["DESCRIPTION"].ToString());
                    sqlBuilder.SetValue("AREAID", areaId);
                    sqlBuilder.SetValue("AREA", areaName);
                    sqlBuilder.SetValue("ProvinceID", dr["AREAID"].ToString());
                    sqlBuilder.SetValue("Province", dr["AREANAME"].ToString());
                    sqlBuilder.SetValue("CreateUserId", this.UserInfo.Id);
                    sqlBuilder.SetValue("CreateBy", this.UserInfo.RealName);
                    sqlBuilder.SetDBNow("CreateOn");
                    sqlBuilder.SetValue("Enabled", 1);
                    sqlBuilder.EndInsert();
                    // sqlBuilder.PrepareCommand();
                    // dotNetService.AreaService.ExecuteNonQuery(UserInfo, sqlBuilder.CommandText, sqlBuilder.DbParameters, CommandType.Text.ToString());
                }
                else
                {
                    /*
                     * if (string.IsNullOrWhiteSpace(dr["MARK"].ToString()) && string.IsNullOrWhiteSpace(dr["DESCRIPTION"].ToString()))
                     * {
                     *  this.Delete(dr["Id"].ToString());
                     * }
                     * else
                     * {
                     *  entity = this.GetObject(dr["Id"].ToString());
                     *  // entity = BaseEntity.Create<BaseAreaProvinceMarkEntity>(dr);
                     *  entity.Mark = dr["MARK"].ToString();
                     *  entity.Description = dr["DESCRIPTION"].ToString();
                     *  entity.ModifiedBy = this.UserInfo.RealName;
                     *  entity.ModifiedUserId = this.UserInfo.Id;
                     *  entity.ModifiedOn = DateTime.Now;
                     *  this.Update(entity);
                     * }
                     */
                    SQLBuilder sqlBuilder = new SQLBuilder(dbHelper);
                    if (string.IsNullOrWhiteSpace(dr["MARK"].ToString()) && string.IsNullOrWhiteSpace(dr["DESCRIPTION"].ToString()))
                    {
                        sqlBuilder.BeginDelete("BASEAREA_PROVINCEMARK");
                        sqlBuilder.SetWhere("Id", dr["Id"].ToString());
                        sqlBuilder.EndDelete();
                        // sqlBuilder.PrepareCommand();
                        // dotNetService.AreaService.ExecuteNonQuery(UserInfo, sqlBuilder.CommandText, sqlBuilder.DbParameters, CommandType.Text.ToString());
                    }
                    else
                    {
                        sqlBuilder.BeginUpdate("BASEAREA_PROVINCEMARK");
                        sqlBuilder.SetValue("MARK", dr["MARK"].ToString());
                        sqlBuilder.SetValue("DESCRIPTION", dr["DESCRIPTION"].ToString());
                        sqlBuilder.SetValue("ModifiedUserId", this.UserInfo.Id);
                        sqlBuilder.SetValue("ModifiedBy", this.UserInfo.RealName);
                        sqlBuilder.SetDBNow("ModifiedOn");
                        sqlBuilder.SetWhere("ID", dr["Id"].ToString());
                        sqlBuilder.EndUpdate();
                        // sqlBuilder.PrepareCommand();
                        // dotNetService.AreaService.ExecuteNonQuery(UserInfo, sqlBuilder.CommandText, sqlBuilder.DbParameters, CommandType.Text.ToString());
                    }
                }
            }

            return(result);
        }