public object Updatefeedinglocation(MM_FEEDING_LOCATION definitions) { definitions.UpdatedOn = DateTime.Now; try { definitionBO.Update(definitions); return("OK"); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "修改失败:" + e.Message)); } }
public object GetFeedingLocationByTerminalID(string terminalID) { IList <MM_FEEDING_LOCATION> list = new List <MM_FEEDING_LOCATION>(); ICO_BSC_BO co_BSC_BO = ObjectContainer.BuildUp <ICO_BSC_BO>(); string sql; if (terminalID.Length > 7) { terminalID = terminalID.Substring(0, 7); sql = @"SELECT * FROM dbo.MM_FEEDING_LOCATION WHERE FeedingLocation like '{0}_%'"; sql = string.Format(sql, terminalID); } else { sql = @"SELECT * FROM dbo.MM_FEEDING_LOCATION "; sql = string.Format(sql); } DataTable dtMaterial = co_BSC_BO.GetDataTableBySql(sql); if (dtMaterial == null) { sql = @"SELECT * FROM dbo.MM_FEEDING_LOCATION "; sql = string.Format(sql); dtMaterial = co_BSC_BO.GetDataTableBySql(sql); } foreach (DataRow dr in dtMaterial.Rows) { MM_FEEDING_LOCATION model = new MM_FEEDING_LOCATION(); model.ID = Convert.ToInt32(dr["ID"]); model.FeedingLocation = dr["FeedingLocation"].ToString(); model.Note = dr["Note"].ToString(); model.FeedingLocationDesc = dr["FeedingLocationDesc"].ToString(); list.Add(model); } return(list); }
public HttpResponseMessage Addfeedinglocation(MM_FEEDING_LOCATION definitions) { definitions.UpdatedOn = DateTime.Now; try { MM_FEEDING_LOCATION_QueryParam feeQueray = new MM_FEEDING_LOCATION_QueryParam(); feeQueray.FeedingLocation = definitions.FeedingLocation; IList <MM_FEEDING_LOCATION> list = definitionBO.GetEntities(feeQueray); if (list.Count != 0) { //return Request.CreateResponse(HttpStatusCode.OK, "投料口ID已经存在"); return(Request.CreateResponse(HttpStatusCode.InternalServerError, "投料口ID已经存在")); } else { MM_FEEDING_LOCATION mmExt = definitionBO.Insert(definitions); return(Request.CreateResponse(HttpStatusCode.OK, "新增成功")); } } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "新增失败:" + e.Message)); } }