public void SaveRoomDesigner() { using (ProxyBE p = new ProxyBE()) { try { if (Request["DesignNo"] == null) { throw new Exception("设计号不能为空"); } if (Request["DesignID"] == null) { throw new Exception("方案ID不能为空"); } SaveRoomDesignerKJLRelationArgs args = new SaveRoomDesignerKJLRelationArgs(); RoomDesignerKJLRelation model = new RoomDesignerKJLRelation(); model.DesignerNo = parm.DesignerNo; model.KJLDesignID = parm.KJLDesignID; args.RoomDesignerKJLRelation = model; RoomDesignerKJLRelation roomDesignerKJLRelation = p.Client.LoadRoomDesignerKJLRelatioByDesignID(SenderUser, args); if (roomDesignerKJLRelation != null) { throw new Exception("该方案已经被绑定"); } p.Client.SaveRoomDesignerKJLRelation(SenderUser, args); WriteSuccess(); } catch (Exception ex) { WriteError(ex.Message, ex); } } }
public void GetRoomDesignerKJLRelation() { try { if (string.IsNullOrEmpty(Request["DesignID"])) { throw new Exception("DesignID:调用参数无效。"); } using (ProxyBE op = new ProxyBE()) { SaveRoomDesignerKJLRelationArgs args = new SaveRoomDesignerKJLRelationArgs(); RoomDesignerKJLRelation model = new RoomDesignerKJLRelation(); model.KJLDesignID = Request["DesignID"].ToString(); args.RoomDesignerKJLRelation = model; RoomDesignerKJLRelation roomDesignerKJLRelation = op.Client.LoadRoomDesignerKJLRelatioByDesignID(SenderUser, args); if (roomDesignerKJLRelation != null) { Response.Write(JSONHelper.Object2JSON(roomDesignerKJLRelation)); } else { Response.Write(JSONHelper.Object2JSON(null)); } } } catch (Exception ex) { PLogger.LogError(ex); WriteError(ex.Message); } }
public void SaveRoomDesignerKJLRelation(Sender sender, SaveRoomDesignerKJLRelationArgs args) { try { using (ObjectProxy op = new ObjectProxy(true)) { //string designID = args.RoomDesignerKJLRelation.KJLDesignID; if (op.LoadRoomDesignerKJLRelatioByDesignID(args.RoomDesignerKJLRelation) == 0) { args.RoomDesignerKJLRelation.ID = Guid.NewGuid(); args.RoomDesignerKJLRelation.Status = false; args.RoomDesignerKJLRelation.Created = DateTime.Now; args.RoomDesignerKJLRelation.CreatedBy = sender.UserCode + "." + sender.UserName; op.InsertRoomDesignerKJLRelation(args.RoomDesignerKJLRelation); } //else //{ // args.RoomDesignerKJLRelation.KJLDesignID = designID; // op.UpdateRoomDesignerKJLRelationByDesignID(args.RoomDesignerKJLRelation); //} op.CommitTransaction(); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public RoomDesignerKJLRelation LoadRoomDesignerKJLRelatioByDesignID(Sender sender, SaveRoomDesignerKJLRelationArgs args) { try { using (ObjectProxy op = new ObjectProxy()) { RoomDesignerKJLRelation obj = new RoomDesignerKJLRelation(); obj.KJLDesignID = args.RoomDesignerKJLRelation.KJLDesignID; obj.DesignerNo = args.RoomDesignerKJLRelation.DesignerNo; if (op.LoadRoomDesignerKJLRelatioByDesignID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }