Exemple #1
0
 /// <summary>
 /// Method to write log
 /// </summary>
 /// <param name="ex"></param>
 public virtual void Logging(Exception ex)
 {
     // log exception in the application
     Logger.WriteLine("AgilePoint.Azure.ServiceBindingFactory.AgilePointEasyAuth, Exception: {0} \nInner Exception: {1}",
                      ShUtil.GetSoapMessage(ex),
                      (ex.InnerException == null ? string.Empty : ShUtil.GetSoapMessage(ex.InnerException)));
 }
Exemple #2
0
 private string DTFormat(DateTime t)
 {
     if (t.Ticks == 0)
     {
         return("");
     }
     return(ShUtil.FnDateTime(t));
 }
Exemple #3
0
        public Result Execute(ExternalCommandData commandData,
                              ref string message, ElementSet elements)
        {
            _uiapp    = commandData.Application;
            _uidoc    = _uiapp.ActiveUIDocument;
            _document = _uidoc.Document;

            _DBMgr = new ShDbMgr(commandData);

            string TransactionDesc = AppStrings.R_ButtonNameTop + " " + AppStrings.R_ButtonNameBott;

            if (_DBMgr.SheetCount > 0)
            {
                // determine if we can proceed
                using (Transaction tx = new Transaction(_document))
                {
                    tx.Start(TransactionDesc);

                    WpfSelViewSheetWin = new WpfSelViewSheet(commandData);

                    //				AppStrings.Culture = new CultureInfo("fr");
                    //				Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr");

                    // this works
                    //				Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr");
                    //				Debug.WriteLine("hello? " + AppStrings.Hello);

                    try
                    {
                        if ((WpfSelViewSheetWin.ShowDialog() ?? false) == false)
                        {
                            // user canceled the operation - return canceled result
                            tx.Dispose();
                            return(Result.Cancelled);
                        }

                        tx.Commit();
                    }
                    catch (Exception e)
                    {
                        tx.Dispose();

                        ShUtil.ShowExceptionDialog(e, USet.Basic, _DBMgr.ParentLeft, _DBMgr.ParentTop);

                        return(Result.Cancelled);
                    }
                }
            }
            else
            {
                ShUtil.ShowErrorDialog(AppStrings.R_ErrNoSheetsTitle,
                                       AppStrings.R_ErrNoSheetsMainMsg_DupShts, AppStrings.R_ErrNoSheetsContent);

                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
Exemple #4
0
//		// method to add a pushbutton to the ribbon
//		private bool AddPushButton(RibbonPanel Panel,
//			string ButtonName,
//			string ButtonText,
//			string Image16,
//			string Image32,
//			string dllPath,
//			string dllClass,
//			string ToolTip)
//		{
//			try
//			{
//				PushButtonData m_pdData = new PushButtonData(ButtonName,
//					ButtonText, dllPath, dllClass);
//				// if we have a path for a small image, try to load the image
//				if (Image16.Length != 0)
//				{
//					try
//					{
//						// load the image
//						m_pdData.Image = ShUtil.GetBitmapImage(Image16);
//					}
//					catch
//					{
//						// could not locate the image
//					}
//				}
//
//				// if have a path for a large image, try to load the image
//				if (Image32.Length != 0)
//				{
//					try
//					{
//						// load the image
//						m_pdData.LargeImage = ShUtil.GetBitmapImage(Image32);
//					}
//					catch
//					{
//						// could not locate the image
//					}
//				}
//
//				// set the tooltip
//				m_pdData.ToolTip = ToolTip;
//
//				// add it to the panel
//				PushButton m_pb = Panel.AddItem(m_pdData) as PushButton;
//
//				return true;
//			}
//			catch
//			{
//				return false;
//			}
//		}

        // method to make a pushbutton for the ribbon
        private PushButtonData MakePushButton(RibbonPanel Panel,
                                              string ButtonName,
                                              string ButtonText,
                                              string Image16,
                                              string Image32,
                                              string dllPath,
                                              string dllClass,
                                              string ToolTip)
        {
            try
            {
                PushButtonData pdData = new PushButtonData(ButtonName,
                                                           ButtonText, dllPath, dllClass);
                // if we have a path for a small image, try to load the image
                if (Image16.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.Image = ShUtil.GetBitmapImage(Image16);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // if have a path for a large image, try to load the image
                if (Image32.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.LargeImage = ShUtil.GetBitmapImage(Image32);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // set the tooltip
                pdData.ToolTip = ToolTip;

//				ContextualHelp cHelp = new ContextualHelp(ContextualHelpType.Url,
//					AppStrings.R_CyberStudioAddr);
//
//				pdData.SetContextualHelp(cHelp);

                return(pdData);
            }
            catch
            {
                return(null);
            }
        }
        // method to make a pushbutton for the ribbon
        private PushButtonData MakePushButton(RibbonPanel Panel,
                                              string ButtonName,
                                              string ButtonText,
                                              string Image16,
                                              string Image32,
                                              string dllPath,
                                              string dllClass,
                                              string ToolTip)
        {
            try
            {
                PushButtonData pdData = new PushButtonData(ButtonName,
                                                           ButtonText, dllPath, dllClass);
                // if we have a path for a small image, try to load the image
                if (Image16.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.Image = ShUtil.GetBitmapImage(Image16);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // if have a path for a large image, try to load the image
                if (Image32.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.LargeImage = ShUtil.GetBitmapImage(Image32);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // set the tooltip
                pdData.ToolTip = ToolTip;

                return(pdData);
            }
            catch
            {
                return(null);
            }
        }
Exemple #6
0
        public Result Execute(ExternalCommandData commandData,
                              ref string message, ElementSet elements)
        {
            _uiapp = commandData.Application;
            UIDocument _uidoc    = _uiapp.ActiveUIDocument;
            Document   _document = _uidoc.Document;

            _DBMgr = new ShDbMgr(commandData);

            string TransactionDesc = AppStrings.R_ButtonNameTop + " " + AppStrings.R_ButtonNameBott;

            if (_DBMgr.SheetCount > 0)
            {
                using (Transaction tx = new Transaction(_document))
                {
                    tx.Start(TransactionDesc);

                    OneClick oneClick = new OneClick();

                    try
                    {
                        if (!oneClick.Process(commandData))
                        {
                            tx.Dispose();

                            return(Result.Failed);
                        }

                        tx.Commit();
                    }
                    catch (Exception e)
                    {
                        tx.Dispose();

                        ShUtil.ShowExceptionDialog(e, USet.OneClick, _DBMgr.ParentLeft, _DBMgr.ParentTop);

                        return(Result.Failed);
                    }
                }
            }
            else
            {
                ShUtil.ShowErrorDialog(AppStrings.R_ErrNoSheetsTitle,
                                       AppStrings.R_ErrNoSheetsMainMsg_OneClick, AppStrings.R_ErrNoSheetsContent);

                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
Exemple #7
0
        public static void ReleaseProcDef(string processTemplateID)
        {
            try
            {
                IWFWorkflowService svc = Common.GetWorkFlowAPI();
                //string processDefinitionID = "";
                svc.ReleaseProcDef(processTemplateID);
            }

            catch (Exception ex)
            {
                Console.WriteLine("Failed! " + ShUtil.GetSoapMessage(ex));
            }
        }
        public static void UnCheckOutProcDef(string pID)
        {
            try
            {
                IWFWorkflowService svc = Common.GetWorkFlowAPI();
                string             processTemplateID = pID;
                svc.UncheckoutProcDef(processTemplateID);
            }

            catch (Exception ex)
            {
                Console.WriteLine("Message:\n" + ShUtil.GetSoapMessage(ex));
            }
        }
        public static string CheckoutProcDef(string pID)
        {
            IWFWorkflowService svc = Common.GetWorkFlowAPI();
            string             processDefinitionXML = string.Empty;

            try
            {
                string processDefinitionID = pID; // process definition to be checked out
                processDefinitionXML = svc.CheckoutProcDef(processDefinitionID);
            }

            catch (Exception ex)
            {
                Console.WriteLine("Failed! " + ShUtil.GetSoapMessage(ex));
            }

            return(processDefinitionXML);
        }
        public static WFBaseActivityInstance[] QueryActivityInsts(WFQueryExpr expr)
        {
            IWFWorkflowService svc = Common.GetWorkFlowAPI();

            //string processInstanceID = "";
            //WFAny any = WFAny.Create(processInstanceID);
            //WFQueryExpr expr = new WFQueryExpr("PROC_INST_ID", SQLExpr.IN, any, true);
            WFBaseActivityInstance[] ais = null;
            try
            {
                ais = svc.QueryActivityInsts(expr);
            }

            catch (Exception ex)
            {
                Console.WriteLine("Failed! " + ShUtil.GetSoapMessage(ex));
            }
            return(ais);
        }
Exemple #11
0
        private void SelViewSheetForm_Load(object sender, EventArgs e)
        {
            // setup the list of title blocks
            SetupTitleBlockList();

            // configure based on current operation type
            SetOperation();
            // confiture based on current format type
            SetNewViewNameFormat();

            SelTitleBlock();

            // setup and populate the Sheet ListView
            if (!SetupSheetList())
            {
                // no sheets available - disable some controls
                // the list view is disabled
                listViewSheets.Enabled = false;
                // the group box get disabled
                gbSheets.Enabled = false;
                // the radio button to duplicate sheets gets disabled
                rbOppDuplicateSheets.Enabled = false;
                // track - no sheets
                //gotSheets = false;
            }

            // setup the Copies ComboBox
            SetupCopies();



            // pre-set the message to no message
            labCopyMessage.Text = "";

            // need to load the image into the picture box
            pbBanner.Image = ShUtil.GetImage("AO-LOGO-Bar-Sm.png");
        }
Exemple #12
0
        public static WFBaseProcessDefinition[] GetProcDefs()
        {
            IWFWorkflowService svc = Common.GetWorkFlowAPI();

            WFBaseProcessDefinition[] processDefinitions = null;
            try
            {
                //Returns Array of WFBaseProcessDefinition type.
                processDefinitions = svc.GetProcDefs();
                for (int i = 0; i < processDefinitions.Length; i++)
                {
                    Console.WriteLine("Definition ID: '" +
                                      processDefinitions[i].DefID + "' ");
                    Console.WriteLine("Definition Name: '" +
                                      processDefinitions[i].DefName + "' ");
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine(ShUtil.GetSoapMessage(ex));
            }
            return(processDefinitions);
        }
        public static string GetProcDefGraphics(string pID)
        {
            IWFWorkflowService svc = Common.GetWorkFlowAPI();
            //process definition ID or process instance ID
            string procesID           = pID;// for example,
            string procDefGraphicsXML = string.Empty;

            try
            {
                //returns an image of a process definition as string.
                procDefGraphicsXML = svc.GetProcDefGraphics(procesID);
                GraphicImage g = new GraphicImage();
                g.FromXml(procDefGraphicsXML);
                byte[]           images = g.Image; // process image
                NamedRectangle[] shapes = g.Shapes;
            }

            catch (Exception ex)
            {
                Console.WriteLine(ShUtil.GetSoapMessage(ex));
            }

            return(procDefGraphicsXML);
        }