public ModelInvokeResult <BuildingUnitBaseInfoPK> Nullify(string strUnitId) { ModelInvokeResult <BuildingUnitBaseInfoPK> result = new ModelInvokeResult <BuildingUnitBaseInfoPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); Guid?_UnitId = strUnitId.ToGuid(); if (_UnitId == null) { result.Success = false; result.ErrorCode = 59996; return(result); } BuildingUnitBaseInfo buildingUnitBaseInfo = new BuildingUnitBaseInfo { UnitId = _UnitId, Status = 0 }; /***********************begin 自定义代码*******************/ buildingUnitBaseInfo.OperatedBy = NormalSession.UserId.ToGuid(); buildingUnitBaseInfo.OperatedOn = DateTime.Now; buildingUnitBaseInfo.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = buildingUnitBaseInfo.GetUpdateMethodName(), ParameterObject = buildingUnitBaseInfo.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements); result.instance = new BuildingUnitBaseInfoPK { UnitId = _UnitId }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public InvokeResult NullifySelected(string strUnitIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); string[] arrUnitIds = strUnitIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrUnitIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } string statementName = new BuildingUnitBaseInfo().GetUpdateMethodName(); foreach (string strUnitId in arrUnitIds) { BuildingUnitBaseInfo buildingUnitBaseInfo = new BuildingUnitBaseInfo { UnitId = strUnitId.ToGuid(), Status = 0 }; /***********************begin 自定义代码*******************/ buildingUnitBaseInfo.OperatedBy = NormalSession.UserId.ToGuid(); buildingUnitBaseInfo.OperatedOn = DateTime.Now; buildingUnitBaseInfo.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = statementName, ParameterObject = buildingUnitBaseInfo.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE }); } BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public InvokeResult DeleteSelected(string strUnitIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); string[] arrUnitIds = strUnitIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrUnitIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } string statementName = new BuildingUnitBaseInfo().GetDeleteMethodName(); foreach (string strUnitId in arrUnitIds) { BuildingUnitBaseInfoPK pk = new BuildingUnitBaseInfoPK { UnitId = strUnitId.ToGuid() }; DeleteCascade(statements, pk); statements.Add(new IBatisNetBatchStatement { StatementName = statementName, ParameterObject = pk, Type = SqlExecuteType.DELETE }); } BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public ModelInvokeResult <BuildingUnitBaseInfoPK> Create(BuildingUnitBaseInfo buildingUnitBaseInfo) { ModelInvokeResult <BuildingUnitBaseInfoPK> result = new ModelInvokeResult <BuildingUnitBaseInfoPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); if (buildingUnitBaseInfo.UnitId == GlobalManager.GuidAsAutoGenerate) { buildingUnitBaseInfo.UnitId = Guid.NewGuid(); } /***********************begin 自定义代码*******************/ buildingUnitBaseInfo.OperatedBy = NormalSession.UserId.ToGuid(); buildingUnitBaseInfo.OperatedOn = DateTime.Now; buildingUnitBaseInfo.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = buildingUnitBaseInfo.GetCreateMethodName(), ParameterObject = buildingUnitBaseInfo.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements); result.instance = new BuildingUnitBaseInfoPK { UnitId = buildingUnitBaseInfo.UnitId }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }