public int ManageDelete(Guid id)
        {
            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                try
                {
                    BuildingsBLL                buildingsBLL                = new BuildingsBLL();
                    BuildingsDataBLL            buildingsDataBLL            = new BuildingsDataBLL();
                    BuildingMonthModifyCountBLL buildingMonthModifyCountBLL = new BuildingMonthModifyCountBLL();
                    BuildingMonthInfoDataBLL    buildingMonthInfoDataBLL    = new BuildingMonthInfoDataBLL();
                    BuildingMonthInfoBLL        buildingMonthInfoBLL        = new BuildingMonthInfoBLL();

                    buildingMonthModifyCountBLL.ManageDeleteByBuildingID(id);
                    buildingMonthInfoDataBLL.ManageDeleteByBuildingID(id);
                    buildingMonthInfoBLL.ManageDeleteByBuildingID(id);

                    buildingsBLL.ManageDelete(id);
                    buildingsDataBLL.ManageDelete(id);
                    BaseDb.Delete(id);
                    scope.Complete();
                    return(1);
                }
                catch (Exception ex)
                {
                    return(0);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 流程完成时的操作。
        /// </summary>
        /// <returns></returns>
        public void Complete(Guid id)
        {
            RoadFlow.Data.Model.BuildingMonthInfoModel model = Get(id);
            Guid buildingID = model.BuildingID.Value;
            int  timeArea   = DateTime.Now.Year * 100 + DateTime.Now.Month;

            #region 去除流程关联字段
            model.State          = null;
            model.CreateTime     = null;
            model.UpdateTime     = null;
            model.MissionDisplay = null;
            #endregion
            model.BuildingMonthInfoID = id;//设置BuildingMonthInfoData是buildingMonthInfo的哪条数据更新而来。
            #region 每月信息更新
            BuildingMonthInfoDataBLL buildingsDataBLL      = new BuildingMonthInfoDataBLL();
            RoadFlow.Data.Model.BuildingMonthInfoModel old = buildingsDataBLL.GetByBuildingIDAndTimeArea(buildingID, timeArea);
            if (old != null)  //已存在,更新每月信息
            {
                model.ID         = null;
                model.TimeArea   = timeArea;
                model.UpdateTime = DateTime.Now;
                buildingsDataBLL.Update(model, old.ID.Value);
            }
            else
            {
                model.ID       = Guid.NewGuid();
                model.TimeArea = timeArea;
                buildingsDataBLL.Add(model);
            }
            #endregion
            #region 每月更新次数及分数更新
            BuildingMonthModifyCountBLL buildingMonthModifyCountBLL = new BuildingMonthModifyCountBLL();
            var oldCount = buildingMonthModifyCountBLL.Get(buildingID, timeArea); //GetOperationType(buildingMonthModifyCountBLL, buildingID, timeArea,out countID);
            if (oldCount != null)                                                 //已存在,每月更新次数更新
            {
                RoadFlow.Data.Model.BuildingMonthModifyCountModel buildingMonthModifyCountModel = new Data.Model.BuildingMonthModifyCountModel();
                buildingMonthModifyCountModel.Count = GetCount(buildingID, timeArea, model);
                //buildingMonthModifyCountModel.Timeliness = GetTimeliness();  更新不算及时性评分
                buildingMonthModifyCountModel.Quality  = BLLCommon.GetQuality(buildingMonthModifyCountModel.Count.Value + oldCount.EnterpriseModifyCount.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.Count      = GetCount(buildingID, timeArea, model);
                buildingMonthModifyCountModel.Timeliness = BLLCommon.GetTimeliness();
                buildingMonthModifyCountModel.Quality    = BLLCommon.GetQuality(buildingMonthModifyCountModel.Count.Value);
                buildingMonthModifyCountModel.Accuracy   = GetAccuracy();
                buildingMonthModifyCountBLL.Add(buildingMonthModifyCountModel);
            }
            #endregion
        }
Esempio 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
        }