public JsonResult CreateProcedureLayoutAction(int Id, MesWeb.Model.T_LayoutPicture layout) { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); var retData = new VM_Result_Data(); var findLayout = bllLayout.GetModel(Id); if (layout == null || findLayout == null) { retData.Content = "上传内容为空"; log.Error("上传工序布局图为空或者该工序节点不存在"); return(Json(retData)); } findLayout.PicUrl = layout.PicUrl; var isUpdated = bllLayout.Update(findLayout); if (isUpdated == true) { retData.Code = RESULT_CODE.OK; retData.Content = "上传成功!"; } else { retData.Content = "上传失败!"; log.Error("上传工序图往数据库写入失败"); } return(Json(retData)); }
private VM_Result_Data createSubLayout(int Id, MesWeb.Model.T_LayoutPicture layout) { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); var retData = new VM_Result_Data(); var findLayout = bllLayout.GetModel(Id); if (layout == null || findLayout == null) { retData.Content = "上传内容为空"; retData.Appendix = "上传布局局图为空或者该节点不存在"; return(retData); } findLayout.PicUrl = layout.PicUrl; var isUpdated = bllLayout.Update(findLayout); if (isUpdated == true) { retData.Code = RESULT_CODE.OK; retData.Content = "上传成功!"; } else { retData.Content = "上传失败!"; retData.Appendix = "上传布局图往数据库写入失败"; } return(retData); }
public JsonResult CreateWorkshopLayoutAction(MesWeb.Model.T_LayoutPicture layout) { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); var retData = new VM_Result_Data(); if (layout == null) { retData.Content = "上传内容为空"; log.Error("上传总体布局图为空"); return(Json(retData)); } var topLayout = bllLayout.GetModelList("IsTop = 1").FirstOrDefault(); if (topLayout == null) { layout.IsTop = true; if (bllLayout.Add(layout) > 0) { retData.Code = RESULT_CODE.OK; retData.Content = "上传成功!"; } else { retData.Content = "系统错误!"; log.Error("写入数据库时发生错误"); } } else { retData.Content = "布局图已经存在!"; log.Fatal("总体布局图已经存在,但是还有人上传"); } return(Json(retData)); }
public JsonResult DeleteLayoutView(MesWeb.Model.T_LayoutPicture delayoutPic) { var retData = new VM_Result_Data(); if (delayoutPic != null) { var findLayoutPic = bllLayoutPic.GetModel(delayoutPic.LayoutPictureID); } return(Json(retData)); }
public JsonResult CreateMachineLayoutAction(int Id, MesWeb.Model.T_LayoutPicture layout) { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); var retData = createSubLayout(Id, layout); if (retData.Code == RESULT_CODE.ERROR) { log.Error(retData.Appendix); } return(Json(retData)); }
protected VM_LayoutPicture GetLayoutInfo(MesWeb.Model.T_LayoutPicture layoutPicture) { var vmLayoutView = new VM_LayoutPicture(layoutPicture); var subSpotItems = bllLayout.GetModelList("IsTop = 0 AND ParentLayoutPictureID = " + layoutPicture.LayoutPictureID); foreach (var item in subSpotItems) { var vmItem = new VM_LayoutPicture(item); vmLayoutView.SubSpotItems.Add(vmItem); } return(vmLayoutView); }
private bool deleteLayout(MesWeb.Model.T_LayoutPicture layout) { var findLayout = bllLayout.GetModel(layout.LayoutPictureID); if (findLayout.Equals(layout)) { if (bllLayout.Delete(findLayout.LayoutPictureID)) { return(true); } } return(false); }
public JsonResult AddLayoutView(MesWeb.Model.T_LayoutPicture layout) { var retData = new VM_Result_Data(); try { var isAdded = bllLayoutPic.Add(layout); if (isAdded != 0) { retData.Content = "添加成功!"; retData.Code = RESULT_CODE.OK; } } catch (Exception e) { retData.Content = "系统错误!"; log.Error("系统错误", e); } return(Json(retData)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(MesWeb.Model.T_LayoutPicture model) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@LayoutPictureID", SqlDbType.Int, 4), new SqlParameter("@PicWidth", SqlDbType.NVarChar, 50), new SqlParameter("@PicHeight", SqlDbType.NVarChar, 50), new SqlParameter("@PicUrl", SqlDbType.NVarChar, 50), new SqlParameter("@XPostion", SqlDbType.Int, 4), new SqlParameter("@YPostion", SqlDbType.Int, 4), new SqlParameter("@Title", SqlDbType.NVarChar, 50), new SqlParameter("@Message", SqlDbType.NVarChar, 50), new SqlParameter("@State", SqlDbType.Int, 4), new SqlParameter("@ParentLayoutPictureID", SqlDbType.Int, 4), new SqlParameter("@LayoutTypeID", SqlDbType.Int, 4), new SqlParameter("@TableRowID", SqlDbType.Int, 4), new SqlParameter("@IsTop", SqlDbType.Bit, 1), new SqlParameter("@Remark", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.LayoutPictureID; parameters[1].Value = model.PicWidth; parameters[2].Value = model.PicHeight; parameters[3].Value = model.PicUrl; parameters[4].Value = model.XPostion; parameters[5].Value = model.YPostion; parameters[6].Value = model.Title; parameters[7].Value = model.Message; parameters[8].Value = model.State; parameters[9].Value = model.ParentLayoutPictureID; parameters[10].Value = model.LayoutTypeID; parameters[11].Value = model.TableRowID; parameters[12].Value = model.IsTop; parameters[13].Value = model.Remark; DbHelperSQL.RunProcedure("T_LayoutPicture_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_LayoutPicture GetModel(int LayoutPictureID) { SqlParameter[] parameters = { new SqlParameter("@LayoutPictureID", SqlDbType.Int, 4) }; parameters[0].Value = LayoutPictureID; MesWeb.Model.T_LayoutPicture model = new MesWeb.Model.T_LayoutPicture(); DataSet ds = DbHelperSQL.RunProcedure("T_LayoutPicture_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public JsonResult AddLayoutAction(MesWeb.Model.T_LayoutPicture layout) { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); var retData = new VM_Result_Data(); try { var isAdded = bllLayout.Add(layout); if (isAdded != 0) { retData.Content = "添加成功!"; retData.Code = RESULT_CODE.OK; } else { log.Error("添加布局节点失败!"); } } catch (Exception e) { retData.Content = "系统错误!"; log.Error("系统错误", e); } return(Json(retData)); }
/// <summary> /// 得到一个对象实体 /// </summary> public MesWeb.Model.T_LayoutPicture DataRowToModel(DataRow row) { MesWeb.Model.T_LayoutPicture model = new MesWeb.Model.T_LayoutPicture(); if (row != null) { if (row["LayoutPictureID"] != null && row["LayoutPictureID"].ToString() != "") { model.LayoutPictureID = int.Parse(row["LayoutPictureID"].ToString()); } if (row["PicWidth"] != null) { model.PicWidth = row["PicWidth"].ToString(); } if (row["PicHeight"] != null) { model.PicHeight = row["PicHeight"].ToString(); } if (row["PicUrl"] != null) { model.PicUrl = row["PicUrl"].ToString(); } if (row["XPostion"] != null && row["XPostion"].ToString() != "") { model.XPostion = int.Parse(row["XPostion"].ToString()); } if (row["YPostion"] != null && row["YPostion"].ToString() != "") { model.YPostion = int.Parse(row["YPostion"].ToString()); } if (row["Title"] != null) { model.Title = row["Title"].ToString(); } if (row["Message"] != null) { model.Message = row["Message"].ToString(); } if (row["State"] != null && row["State"].ToString() != "") { model.State = int.Parse(row["State"].ToString()); } if (row["ParentLayoutPictureID"] != null && row["ParentLayoutPictureID"].ToString() != "") { model.ParentLayoutPictureID = int.Parse(row["ParentLayoutPictureID"].ToString()); } if (row["LayoutTypeID"] != null && row["LayoutTypeID"].ToString() != "") { model.LayoutTypeID = int.Parse(row["LayoutTypeID"].ToString()); } if (row["TableRowID"] != null && row["TableRowID"].ToString() != "") { model.TableRowID = int.Parse(row["TableRowID"].ToString()); } if (row["IsTop"] != null && row["IsTop"].ToString() != "") { if ((row["IsTop"].ToString() == "1") || (row["IsTop"].ToString().ToLower() == "true")) { model.IsTop = true; } else { model.IsTop = false; } } if (row["Remark"] != null) { model.Remark = row["Remark"].ToString(); } } return(model); }