private DetailActivityPlaceWindow() { InitializeComponent(); _model = this.DataContext as PartyActAreaModel; //ctlImage.ImgFile = "pack://application:,,,/Biz.PartyBuilding.YS.Client;component/Resources/村级活动场所.jpg"; }
public OptResult Save(PartyActAreaModel area) { OptResult rst = null; if (area == null) { rst = OptResult.Build(ResultCode.ParamError, "参数不能为空或格式不正确"); return(rst); } if (string.IsNullOrEmpty(area.id)) { area.id = GuidExtension.GetOne(); var tran = _rep.Begin(); try { _rep.Insert(area, tran); if (area.pic != null && area.pic.Count > 0) { //_picRep.InsertBatch(pics, tran); //保存图片数据(直接写到文件) UploadHelper.Upload(area.id, area.pic); } tran.Commit(); } catch (Exception ex) { LogHelper.LogError("新增area", ex); rst = OptResult.Build(ResultCode.DbError, "新增area"); return(rst); } } else { var oldArea = _rep.GetById(area.id); oldArea.town = area.town; oldArea.village = area.village; oldArea.floor_area = area.floor_area; oldArea.courtyard_area = area.courtyard_area; oldArea.levels = area.levels; oldArea.rooms = area.rooms; oldArea.location = area.location; oldArea.gps = area.gps; oldArea.levels = area.levels; _rep.Update(area); } rst = OptResult.Build(ResultCode.Success, "保存成功"); return(rst); }
public DetailActivityPlaceWindow(InfoOptType type, PartyActAreaModel area = null) : this() { _type = type; if (area != null) { area.CopyTo(_model); //设置图片 if (area.pic != null && area.pic.Count > 0) { System.Drawing.Image img = ImageUtils.Base64Decode(area.pic[0]); string file = AppDomain.CurrentDomain.BaseDirectory + "temp.jpg"; img.Save(file, ImageFormat.Jpeg); img.Dispose(); img = null; ctlImage.ImgFile = file; } } }