public bool SaveBasicInfo(Misp.Kernel.Domain.Design item) { DesignDimension central = item.central; DesignDimension row = item.rows; DesignDimension column = item.columns; item.central = null; item.rows = null; item.columns = null; try { System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); var request = new RestRequest(ResourcePath + "/save_basic", Method.POST); request.RequestFormat = DataFormat.Json; serializer.MaxJsonLength = int.MaxValue; string json = serializer.Serialize(item); request.AddParameter("application/json", json, ParameterType.RequestBody); var response = RestClient.ExecuteTaskAsync(request); RestResponse queryResult = (RestResponse)response.Result; bool valid = ValidateResponse(queryResult); System.Web.Script.Serialization.JavaScriptSerializer Serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); Serializer.MaxJsonLength = int.MaxValue; Boolean result = Serializer.Deserialize <Boolean>(queryResult.Content); return(result); } catch (Exception e) { throw new BcephalException("Unable to save Table.", e); } finally{ item.central = central; item.rows = row; item.columns = column; } }
/// <summary> /// Save the given item. /// </summary> /// <param name="item"></param> /// <returns></returns> public override Misp.Kernel.Domain.Design Save(Misp.Kernel.Domain.Design item) { if (item == null) { return(item); } if (item.oid == null || !item.oid.HasValue) { return(base.Save(item)); } if (!SaveBasicInfo(item)) { throw new BcephalException("Unable to save Item."); } SaveDimensions(item); try { if (FileService != null) { FileService.SaveCurrentFile(); } } catch (Exception) { } return(item); }
public Design getCopy(String name) { Design design = new Design(); design.name = name; design.typeName = this.typeName; design.group = this.group; design.columns = this.columns; design.rows = this.rows; design.central = this.central; design.addTotalColumnRight = this.addTotalColumnRight; design.addTotalRowBelow = this.addTotalRowBelow; design.concatenateColumnHearder = this.concatenateColumnHearder; design.concatenateRowHearder = this.concatenateRowHearder; return(design); }