public ModelInvokeResult <ServiceStationPK> Create(ServiceStation serviceStation) { ModelInvokeResult <ServiceStationPK> result = new ModelInvokeResult <ServiceStationPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); if (serviceStation.StationId == GlobalManager.GuidAsAutoGenerate) { serviceStation.StationId = Guid.NewGuid(); } /***********************begin 自定义代码*******************/ serviceStation.OperatedBy = NormalSession.UserId.ToGuid(); serviceStation.OperatedOn = DateTime.Now; serviceStation.DataSource = GlobalManager.DIKey_00012_ManualEdit; var param = serviceStation.ToStringObjectDictionary(false); if (string.IsNullOrEmpty(serviceStation.AreaId2)) { param["AreaId2"] = DBNull.Value; } if (string.IsNullOrEmpty(serviceStation.AreaId3)) { param["AreaId3"] = DBNull.Value; } /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = serviceStation.GetCreateMethodName(), ParameterObject = param, Type = SqlExecuteType.INSERT }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); result.instance = new ServiceStationPK { StationId = serviceStation.StationId }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Charset = "utf-8"; HttpPostedFile file = context.Request.Files["Filedata"]; if (file != null) { string AreaId = context.Request.Form["AreaId"]; IList <StringObjectDictionary> datas = NPOIManager.GetSheetData(file.InputStream, 0, true); List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); ServiceStation station = new ServiceStation() { DataSource = GlobalManager.DIKey_00012_UploadFile, OperatedBy = NormalSession.UserId.ToGuid(), OperatedOn = DateTime.Now, AreaId = AreaId }; foreach (var data in datas) { station.StationId = Guid.NewGuid(); station.StationType = context.Request.Form["StationType"]; StringObjectDictionary sod = station.ToStringObjectDictionary(false); IDictionary <string, object> dataItem = sod.MixInObject(data, false, e0571.web.core.Other.CaseSensitive.NORMAL); statements.Add(new IBatisNetBatchStatement { StatementName = station.GetCreateMethodName(), ParameterObject = dataItem, Type = SqlExecuteType.INSERT }); } BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); //下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失 context.Response.Write("1"); } else { context.Response.Write("0"); } }