/// <summary> /// 流程完成时的操作。 /// </summary> /// <returns></returns> public int Complete(Guid id) { RoadFlow.Data.Model.BuildingsModel model = Get(id.ToString()); #region 去除流程关联字段 model.State = null; model.CreateTime = null; model.UpdateTime = null; #endregion BuildingsDataBLL buildingsDataBLL = new BuildingsDataBLL(); if (buildingsDataBLL.Get(id) != null) //楼栋已存在,更新楼栋信息 { model.ID = null; model.UpdateTime = DateTime.Now; buildingsDataBLL.Update(model, id); } else { buildingsDataBLL.Add(model); } //更新合成表 BuildingsAndBuildingMonthInfoBLL buildingsAndBuildingMonthInfoBLL = new BuildingsAndBuildingMonthInfoBLL(); if (buildingsAndBuildingMonthInfoBLL.Get(id) != null) { model.ID = null; model.UpdateTime = DateTime.Now; buildingsAndBuildingMonthInfoBLL.Update(model, id); } else { buildingsAndBuildingMonthInfoBLL.Add(model); } return(1); }
public int Update(RoadFlow.Data.Model.BuildingMonthInfoModel model, Guid id) { if (baseDb.Update <RoadFlow.Data.Model.BuildingMonthInfoModel>(model, new KeyValuePair <string, object>("ID", id)) > 0) { 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>("TimeArea", RoadFlow.Data.Model.SQLFilterType.MINNotEqual), model.TimeArea); if (GetAll(where).Rows.Count == 0) //是否是最新的每月数据。 //更新合成表 { BuildingsAndBuildingMonthInfoBLL buildingsAndBuildingMonthInfoBLL = new BuildingsAndBuildingMonthInfoBLL(); Guid buildingID = model.BuildingID.Value; //排除不需要更新的字段。 model.ID = null; model.BuildingID = null; model.TimeArea = null; model.BuildingMonthInfoID = null; return(buildingsAndBuildingMonthInfoBLL.Update(model, buildingID)); } } return(0); }
public int Add(RoadFlow.Data.Model.BuildingMonthInfoModel model) { if (baseDb.Add <RoadFlow.Data.Model.BuildingMonthInfoModel>(model) > 0) { 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>("TimeArea", RoadFlow.Data.Model.SQLFilterType.MINNotEqual), model.TimeArea); if (GetAll(where).Rows.Count == 0)//是否是最新的每月数据。 //更新合成表 { BuildingsAndBuildingMonthInfoBLL buildingsAndBuildingMonthInfoBLL = new BuildingsAndBuildingMonthInfoBLL(); Guid id = model.BuildingID.Value; //排除不需要更新的字段。 model.ID = null; model.BuildingID = null; model.BuildingMonthInfoID = null; model.TimeArea = null; return(buildingsAndBuildingMonthInfoBLL.Update(model, id)); } #region 注释掉的代码 //RoadFlow.Data.Model.BuildingsAndBuildingMonthInfo monthModel = new RoadFlow.Data.Model.BuildingsAndBuildingMonthInfo(); //monthModel.SY_YSY_ZMJ = model.SY_YSY_ZMJ; //monthModel.SY_YSY_ZYMJ = model.SY_YSY_ZYMJ; //monthModel.SY_KZ_ZMJ = model.SY_KZ_ZMJ; //monthModel.SY_KZ_KZLMJ = model.SY_KZ_KZLMJ; //monthModel.SY_KZ_KXSMJ = model.SY_KZ_KXSMJ; //monthModel.SY_ZJ = model.SY_ZJ; //monthModel.SY_XSJJ = model.SY_XSJJ; //monthModel.SW_YSY_ZMJ = model.SW_YSY_ZMJ; //monthModel.SW_YSY_ZYMJ = model.SW_YSY_ZYMJ; //monthModel.SW_KZ_ZMJ = model.SW_KZ_ZMJ; //monthModel.SW_KZ_KZLMJ = model.SW_KZ_KZLMJ; //monthModel.SW_KZ_KXSMJ = model.SW_KZ_KXSMJ; //monthModel.SW_ZJ = model.SW_ZJ; //monthModel.SW_XSJJ = model.SW_XSJJ; #endregion } return(0); }