コード例 #1
0
        public ModelInvokeResult <ServiceStationPK> Update(string strStationId, ServiceStation serviceStation)
        {
            ModelInvokeResult <ServiceStationPK> result = new ModelInvokeResult <ServiceStationPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                Guid?_StationId = strStationId.ToGuid();
                if (_StationId == null)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                serviceStation.StationId = _StationId;
                /***********************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.GetUpdateMethodName(), ParameterObject = param, Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new ServiceStationPK {
                    StationId = _StationId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
コード例 #2
0
        public InvokeResult NullifySelected(string strStationIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrStationIds = strStationIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrStationIds.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new ServiceStation().GetUpdateMethodName();
                foreach (string strStationId in arrStationIds)
                {
                    ServiceStation serviceStation = new ServiceStation {
                        StationId = strStationId.ToGuid(), Status = 0
                    };
                    /***********************begin 自定义代码*******************/
                    serviceStation.OperatedBy = NormalSession.UserId.ToGuid();
                    serviceStation.OperatedOn = DateTime.Now;
                    serviceStation.DataSource = GlobalManager.DIKey_00012_ManualEdit;
                    /***********************end 自定义代码*********************/
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = serviceStation.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                    });
                }
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
コード例 #3
0
        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");
            }
        }