private MilkMastitisReport WrapMilkHallItem(DataRow milkMastitisReportRow) { MilkMastitisReport milkMastitisReportItem = new MilkMastitisReport(); if (milkMastitisReportRow != null) { milkMastitisReportItem.EarNum = Convert.ToInt32(milkMastitisReportRow["EarNum"]); milkMastitisReportItem.DetectionDate = Convert.ToDateTime(milkMastitisReportRow["DetectionDate"]); milkMastitisReportItem.Detector = milkMastitisReportRow["Detector"].ToString(); if (milkMastitisReportRow["LeftFront"] != null && string.IsNullOrWhiteSpace(milkMastitisReportRow["LeftFront"].ToString())) { milkMastitisReportItem.LeftFront = Convert.ToInt32(milkMastitisReportRow["LeftFront"]); } if (milkMastitisReportRow["RightFront"] != null && string.IsNullOrWhiteSpace(milkMastitisReportRow["RightFront"].ToString())) { milkMastitisReportItem.RightFront = Convert.ToInt32(milkMastitisReportRow["RightFront"]); } if (milkMastitisReportRow["LeftBack"] != null && string.IsNullOrWhiteSpace(milkMastitisReportRow["LeftBack"].ToString())) { milkMastitisReportItem.LeftBack = Convert.ToInt32(milkMastitisReportRow["LeftBack"]); } if (milkMastitisReportRow["RightBack"] != null && string.IsNullOrWhiteSpace(milkMastitisReportRow["RightBack"].ToString())) { milkMastitisReportItem.RightBack = Convert.ToInt32(milkMastitisReportRow["RightBack"]); } milkMastitisReportItem.Description = milkMastitisReportRow["Description"].ToString(); } return(milkMastitisReportItem); }
public List <MilkMastitisReport> GetMilkMastitisReportList() { List <MilkMastitisReport> lstMilkMastitisReport = new List <MilkMastitisReport>(); DataTable datMilkMastitisReport = this.dalMilkMastitisReport.GetMilkMastitisReportList(); foreach (DataRow drMilkMastitisReport in datMilkMastitisReport.Rows) { MilkMastitisReport milkMastitisReportItem = WrapMilkHallItem(drMilkMastitisReport); lstMilkMastitisReport.Add(milkMastitisReportItem); } return(lstMilkMastitisReport); }
public int InsertMilkMastitisReportInfo(MilkMastitisReport milkMastitisReport) { StringBuilder sql = new StringBuilder(); sql.Append(@"insert into [Milk_MastitisReport] values ( '" + milkMastitisReport.EarNum + "','" + milkMastitisReport.DetectionDate + "','" + milkMastitisReport.Detector + "'," + milkMastitisReport.LeftFront + "," + milkMastitisReport.RightFront + "," + milkMastitisReport.LeftBack + "," + milkMastitisReport.RightBack + ",'" + milkMastitisReport.Description + "')"); return(dataProvider1mutong.ExecuteNonQuery(sql.ToString(), CommandType.Text)); }
public ActionResult Save() { MilkMastitisReport milkMastitisReport = new MilkMastitisReport(); UpdateModel <MilkMastitisReport>(milkMastitisReport); Cow cow = bllCow.GetCowInfo(milkMastitisReport.EarNum); //if (cow.FarmCode == 0) //{ // //弹框提示此牛不存在 // return Json(new { state = 1 }); //} //else //{ bllMilkMastitisReport.InsertMilkMastitisReportInfo(milkMastitisReport); return(Json(new { state = 2 })); // } }
public int InsertMilkMastitisReportInfo(MilkMastitisReport milkMastitisReport) { return(dalMilkMastitisReport.InsertMilkMastitisReportInfo(milkMastitisReport)); }