public void CopyFrom(WidgetParam other) { sortingOrderOffset = other.sortingOrderOffset; group = other.group; bindNode = other.bindNode; defaultActive = other.defaultActive; }
public object AddWidget([FromBody] WidgetParam obj) { try { WidgetBusiness save = new WidgetBusiness(); var result = save.SaveWidget(obj); return(result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public void AddWidgetParam(string name, WidgetParam param) { if (widgetParams == null) { widgetParams = new Dictionary <string, WidgetParam>(); } if (widgetParams.ContainsKey(name) == false) { widgetParams.Add(name, param); } else { widgetParams[name] = param; } }
public object SaveWidget(WidgetParam b) { if (b.WidgetName == null) { return(new Error() { IsError = true, Message = "Required WidgetName" }); } var data = db.Tbl_Widget_Master.FirstOrDefault(r => r.WidgetName == b.WidgetName); if (data != null) { return(new Error() { IsError = true, Message = "Duplicate Entry Not Allowed" }); } try { Tbl_Widget_Master obj = new Tbl_Widget_Master(); obj.WidgetName = b.WidgetName; obj.ActionName = b.ActionName; obj.Status = 1; obj.CreatedBy = 1; obj.CreatedDate = System.DateTime.Today.Date; obj.ModifiedBy = null; obj.ModifiedDate = System.DateTime.Today.Date; db.Tbl_Widget_Master.Add(obj); db.SaveChanges(); return(new Result() { IsSucess = true, ResultData = "Widget Created Successfully!" }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public void ParseXml(XmlElement node, Func <string, WidgetContext> func) { ParseXml(node); if (func != null) { var it = node.ChildNodes.GetEnumerator(); while (it.MoveNext()) { var child = it.Current as XmlElement; if (child.Name == "WidgetContext") { string name = child.GetAttribute("ref"); var param = new WidgetParam(); WidgetContext widget = func(name); if (widget != null) { param.CopyFrom(widget.defaultParam); bool clone = false; string s = child.GetAttribute("clone"); if (string.IsNullOrEmpty(s) == false) { clone = bool.Parse(s); } if (!clone) { AddFixedWidget(widget); } else { WidgetContext cloneWidget = new WidgetContext(); cloneWidget.CopyFrom(widget); cloneWidget.AddComponent(child); AddFixedWidget(cloneWidget); } } param.ParseXml(child); AddWidgetParam(name, param); } } } }