Exemplo n.º 1
0
        /// <summary>
        /// 时间段里该楼栋的变动数据
        /// </summary>
        /// <param name="buildingID"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public DataTable GetAllByBuildingIDAndTimeArea(Guid buildingID, DateTime begin, DateTime end)
        {
            Dictionary <KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>, object> where = new Dictionary <KeyValuePair <string, Data.Model.SQLFilterType>, object>();
            where.Add(new KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>("CreateTime", RoadFlow.Data.Model.SQLFilterType.MINNotEqual), begin);
            where.Add(new KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>("CreateTime", RoadFlow.Data.Model.SQLFilterType.MAXNotEqual), end);
            //获取楼栋对应所有企业,包含被删除的。
            List <string> list = new List <string>();
            EnterpriseAndEnterpriseTaxBLL enterpriseAndEnterpriseTaxBLL = new EnterpriseAndEnterpriseTaxBLL();

            foreach (DataRow dr in enterpriseAndEnterpriseTaxBLL.GetAllContainDeleteByBuildingID(buildingID.ToString()).Rows)
            {
                list.Add(dr["ID"].ToString());
            }
            where.Add(new KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>("EnterpriseID", RoadFlow.Data.Model.SQLFilterType.IN), list);
            where.Add(new KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>("Status", RoadFlow.Data.Model.SQLFilterType.EQUAL), RoadFlow.Data.Model.Status.Normal);//正常的数据。
            return(BaseDb.GetAll(0, where));
        }
Exemplo n.º 2
0
        public RoadFlow.Data.Model.Result <object> Add(RoadFlow.Data.Model.EnterpriseTaxModel model)
        {
            model.ID = Guid.NewGuid();
            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                if (BaseDb.Add(model) > 0)
                {
                    var enterpriseAndEnterpriseTaxBLL = new EnterpriseAndEnterpriseTaxBLL();
                    var enterpriseAndEnterpriseTax    = enterpriseAndEnterpriseTaxBLL.Get(model.EnterpriseID.Value);
                    if (enterpriseAndEnterpriseTax.TaxArea == null || enterpriseAndEnterpriseTax.TaxArea <= model.TaxArea)
                    {//企业没有税收或者企业税收不是最新的,更新企业税收企业信息合成表
                        var enterpriseAndEnterpriseTaxUpdateModel = new RoadFlow.Data.Model.EnterpriseAndEnterpriseTaxModel
                        {
                            //enterpriseAndEnterpriseTaxUpdateModel.NationalTax = model.NationalTax;
                            //enterpriseAndEnterpriseTaxUpdateModel.LandTax = model.LandTax;
                            Tax     = model.Tax,
                            TaxArea = model.TaxArea
                        };
                        if (enterpriseAndEnterpriseTaxBLL.Update(enterpriseAndEnterpriseTaxUpdateModel, model.EnterpriseID.Value) > 0)
                        {
                            scope.Complete();
                            return(new Data.Model.Result <object>()
                            {
                                Success = true,
                                Data = model.ID
                            });
                        }
                    }

                    //不更新企业税收企业信息合成表
                    scope.Complete();
                    return(new Data.Model.Result <object>()
                    {
                        Success = true,
                        Data = model.ID
                    });
                }
            }
            return(new Data.Model.Result <object>()
            {
                Success = false,
            });
        }
Exemplo n.º 3
0
        /// <summary>
        /// 流程完成时的操作。
        /// </summary>
        /// <returns></returns>
        public void Complete(Guid id)
        {
            RoadFlow.Data.Model.EnterpriseModel model = Get(id);
            #region 去除流程关联字段
            model.State      = null;
            model.CreateTime = null;
            model.UpdateTime = null;
            #endregion
            EnterpriseAndEnterpriseTaxBLL enterpriseAndEnterpriseTaxBLL = new EnterpriseAndEnterpriseTaxBLL();
            if (enterpriseAndEnterpriseTaxBLL.Get(id) != null)
            {//企业已存在,更新信息
                model.ID         = null;
                model.UpdateTime = DateTime.Now;
                if (enterpriseAndEnterpriseTaxBLL.Update(model, id) > 0)
                {
                    //更新企业变更记录
                    EnterpriseUpdateRecordBLL recordBLL = new EnterpriseUpdateRecordBLL();
                    RoadFlow.Data.Model.EnterpriseUpdateRecordType type = Data.Model.EnterpriseUpdateRecordType.Modify;
                    if (model.Status == RoadFlow.Data.Model.Status.Deleted)
                    {//搬出
                        type = Data.Model.EnterpriseUpdateRecordType.Delete;
                    }
                    recordBLL.Add(id, type);
                }
            }
            else
            {
                model.CreateTime = DateTime.Now;
                model.UpdateTime = DateTime.Now;
                if (enterpriseAndEnterpriseTaxBLL.Add(model) > 0)
                {
                    //更新企业变更记录
                    EnterpriseUpdateRecordBLL recordBLL = new EnterpriseUpdateRecordBLL();
                    recordBLL.Add(id, RoadFlow.Data.Model.EnterpriseUpdateRecordType.Add);
                }
            }

            #region 每月更新次数及分数更新
            Guid buildingID = model.BuildingID.Value;
            int  timeArea   = DateTime.Now.Year * 100 + DateTime.Now.Month;
            BuildingMonthModifyCountBLL buildingMonthModifyCountBLL = new BuildingMonthModifyCountBLL();
            var oldCount = buildingMonthModifyCountBLL.Get(buildingID, timeArea);
            if (oldCount != null)
            {//已存在,每月更新次数更新
                RoadFlow.Data.Model.BuildingMonthModifyCountModel buildingMonthModifyCountModel = new Data.Model.BuildingMonthModifyCountModel();
                buildingMonthModifyCountModel.EnterpriseModifyCount = GetCount(buildingID);
                buildingMonthModifyCountModel.Quality  = BLLCommon.GetQuality(buildingMonthModifyCountModel.EnterpriseModifyCount.Value + oldCount.Count.Value);
                buildingMonthModifyCountModel.Accuracy = GetAccuracy();
                buildingMonthModifyCountBLL.Update(buildingMonthModifyCountModel, oldCount.ID.Value);
            }
            else
            {
                RoadFlow.Data.Model.BuildingMonthModifyCountModel buildingMonthModifyCountModel = new Data.Model.BuildingMonthModifyCountModel();
                buildingMonthModifyCountModel.TimeArea              = timeArea;
                buildingMonthModifyCountModel.BuildingID            = buildingID;
                buildingMonthModifyCountModel.EnterpriseModifyCount = GetCount(buildingID);
                buildingMonthModifyCountModel.Timeliness            = BLLCommon.GetTimeliness();
                buildingMonthModifyCountModel.Quality  = BLLCommon.GetQuality(buildingMonthModifyCountModel.EnterpriseModifyCount.Value);
                buildingMonthModifyCountModel.Accuracy = GetAccuracy();
                buildingMonthModifyCountBLL.Add(buildingMonthModifyCountModel);
            }
            #endregion
        }
Exemplo n.º 4
0
        public int Update(RoadFlow.Data.Model.EnterpriseTaxModel model, Guid id)
        {
            model.ID         = null;
            model.UpdateTime = DateTime.Now;
            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                if (BaseDb.Update(model, new KeyValuePair <string, object>("ID", id)) > 0)
                {
                    var oldTax = Get(id);
                    var enterpriseAndEnterpriseTaxBLL = new EnterpriseAndEnterpriseTaxBLL();
                    var enterpriseAndEnterpriseTax    = enterpriseAndEnterpriseTaxBLL.Get(oldTax.EnterpriseID.Value);
                    if (enterpriseAndEnterpriseTax.TaxArea == null || model.TaxArea == null || enterpriseAndEnterpriseTax.TaxArea <= model.TaxArea)
                    {     //企业没有税收或者企业税收不是最新的,更新企业税收企业信息合成表
                        if (model.Status == RoadFlow.Data.Model.Status.Deleted)
                        { //税收删除
                            //查询企业最新税收
                            var lastTax = GetLastTaxByEnterpristID(oldTax.EnterpriseID.Value);
                            if (lastTax == null)
                            {//没有最新税收
                                //更新合成表税收为初始值。
                                var enterpriseAndEnterpriseTaxUpdateModel = new RoadFlow.Data.Model.EnterpriseAndEnterpriseTaxModel
                                {
                                    //enterpriseAndEnterpriseTaxUpdateModel.NationalTax = 0;
                                    //enterpriseAndEnterpriseTaxUpdateModel.LandTax = 0;
                                    Tax     = 0,
                                    TaxArea = 0
                                };
                                if (enterpriseAndEnterpriseTaxBLL.Update(enterpriseAndEnterpriseTaxUpdateModel, oldTax.EnterpriseID.Value) > 0)
                                {
                                    scope.Complete();
                                    return(1);
                                }
                            }
                            else
                            {//有最新税收,更新合成表税收为最新税收
                                var enterpriseAndEnterpriseTaxUpdateModel = new RoadFlow.Data.Model.EnterpriseAndEnterpriseTaxModel
                                {
                                    //enterpriseAndEnterpriseTaxUpdateModel.NationalTax = lastTax.NationalTax;
                                    //enterpriseAndEnterpriseTaxUpdateModel.LandTax = lastTax.LandTax;
                                    Tax     = lastTax.Tax,
                                    TaxArea = lastTax.TaxArea
                                };
                                if (enterpriseAndEnterpriseTaxBLL.Update(enterpriseAndEnterpriseTaxUpdateModel, oldTax.EnterpriseID.Value) > 0)
                                {
                                    scope.Complete();
                                    return(1);
                                }
                            }
                        }
                        else
                        {//税收更新
                            var enterpriseAndEnterpriseTaxUpdateModel = new RoadFlow.Data.Model.EnterpriseAndEnterpriseTaxModel
                            {
                                //enterpriseAndEnterpriseTaxUpdateModel.NationalTax = model.NationalTax;
                                //enterpriseAndEnterpriseTaxUpdateModel.LandTax = model.LandTax;
                                Tax     = model.Tax,
                                TaxArea = model.TaxArea
                            };
                            if (enterpriseAndEnterpriseTaxBLL.Update(enterpriseAndEnterpriseTaxUpdateModel, oldTax.EnterpriseID.Value) > 0)
                            {
                                scope.Complete();
                                return(1);
                            }
                        }
                    }

                    //不更新企业税收企业信息合成表
                    scope.Complete();
                    return(1);
                }
            }

            return(0);
        }