private void BindControls() { try { var toDo = workitem.GetProperty(Entity.ToDoProperty); if (toDo != null) { txtToDo.Text = ((double)toDo).ToString("0.00", CultureInfo.CurrentCulture); } var statuses = dataLayer.GetListPropertyValues(workitem.TypePrefix + Entity.StatusProperty); cboStatus.Items.AddRange(statuses.ToArray()); cboStatus.SelectedItem = workitem.GetProperty(Entity.StatusProperty); Text = "Close " + workitem.TypePrefix; } catch (DataLayerException ex) { MessageBox.Show("Failed to close. \n" + ex.Message, "Server communication error", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.Cancel; Close(); } }
internal Asset CreateAssetForSecondaryWorkitem(string typeToken, Workitem parent) { var type = ResolveAssetTypeFor(typeToken); try { var asset = new Asset(type); SetupAssetAttributes(asset, typeToken); SetAssetAttribute(asset, "Parent", parent.Asset.Oid); LoadAssetAttribute(asset, "Scope.Name", currentProject.GetProperty(Entity.NameProperty)); LoadAssetAttribute(asset, "Parent.Name", parent.GetProperty(Entity.NameProperty)); LoadAssetAttribute(asset, "Timebox.Name", parent.GetProperty("Timebox.Name")); parent.Asset.Children.Add(asset); return(asset); } catch (MetaException ex) { throw new DataLayerException("Cannot create new " + typeToken, ex); } catch (APIException ex) { throw new DataLayerException("Cannot create new " + typeToken, ex); } }