コード例 #1
0
        public ModelInvokeResult <OldManLocateInfoPK> Update(string strId, OldManLocateInfo oldManLocateInfo)
        {
            ModelInvokeResult <OldManLocateInfoPK> result = new ModelInvokeResult <OldManLocateInfoPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                int _Id = Convert.ToInt32(strId);
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = oldManLocateInfo.GetUpdateMethodName(), ParameterObject = oldManLocateInfo.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new OldManLocateInfoPK {
                    Id = _Id
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
コード例 #2
0
        public InvokeResult CreateLocateByCall(LocateInfo locateInfo)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };
            CollectionInvokeResult <StringObjectDictionary> result2 = new CollectionInvokeResult <StringObjectDictionary> {
                Success = true
            };

            locateInfo.CallNo = base.GetHttpHeader("MobileNo");
            try
            {
                StringObjectDictionary filters = new { LocateTime = locateInfo.LocateTime, CallNo = locateInfo.CallNo, OrderByClause = " LocateTime desc" }.ToStringObjectDictionary(false);
                result2.rows = BuilderFactory.DefaultBulder().ListStringObjectDictionary("OldManLocateInfo_By_CallNo_List", filters);

                OldManLocateInfo oldManLocateInfo = new OldManLocateInfo();
                foreach (var item in result2.rows)
                {
                    oldManLocateInfo.OldManId       = Guid.Parse(item["OlderId"].ToString());
                    oldManLocateInfo.HomeLatitudeS  = TypeConverter.ChangeString(item["LatitudeS"]);
                    oldManLocateInfo.HomeLongitudeS = TypeConverter.ChangeString(item["LongitudeS"]);
                    oldManLocateInfo.Id             = item["Id"] == null ? 0 : Int32.Parse(item["Id"].ToString());
                }
                oldManLocateInfo.LocateTime       = DateTime.Parse(locateInfo.LocateTime);
                oldManLocateInfo.LocateLatitudeS  = locateInfo.LatitudeS;
                oldManLocateInfo.LocateLongitudeS = locateInfo.LongitudeS;

                if (oldManLocateInfo.Id > 0)
                {
                    result.Success = false;
                }
                else
                {
                    oldManLocateInfo.Id = null;
                    List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = oldManLocateInfo.GetCreateMethodName(), ParameterObject = oldManLocateInfo.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                    });
                    BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                }
            }
            catch (Exception e) {
                result.Success      = false;
                result.ErrorMessage = e.Message;
            }
            return(result);
        }