public List <GMPossibleDuplicate> GetPossibleDuplicates(int recordCounter)
        {
            List <GMPossibleDuplicate> possibleDuplicates = new List <GMPossibleDuplicate>();
            string jsonResult = string.Empty;
            GoldmineImportServiceDO goldmineImportServiceDO = new GoldmineImportServiceDO();

            string URL = string.Format("{0}GetPossibleDuplicates/{1}", goldmineImportServiceAddress, recordCounter.ToString());

            try
            {
                WebClient serviceRequest = new WebClient();
                jsonResult = serviceRequest.DownloadString(new Uri(URL));
                jsonResult = ConnectorHelper.ChangeArrayParentheses(jsonResult);
            }
            catch (Exception ex)
            {
                ClientLogger.WriteError(ex, "Error retrieving the possible duplicate list.\nMethod: GoldmineImportServiceConnector.GetPossibleDuplicates", ClientGlobalData.CurrentUser.SystemName);
                throw ex;
            }

            try
            {
                goldmineImportServiceDO = JsonConvert.DeserializeObject <GoldmineImportServiceDO>(jsonResult);
                possibleDuplicates      = goldmineImportServiceDO.GetPossibleDuplicatesResult;
            }
            catch (Exception ex)
            {
                ClientLogger.WriteError(ex, "Error deserializing the possible duplicate list.\nMethod: GoldmineImportServiceConnector.GetPossibleDuplicates", ClientGlobalData.CurrentUser.SystemName);
            }
            return(possibleDuplicates);
        }
Esempio n. 2
0
        private void _draw_connectors(RenderContext context)
        {
            var connector_nodes = this._shapes.OfType <Connector>().ToList();

            // if no dynamic connectors then do nothing
            if (connector_nodes.Count < 1)
            {
                return;
            }

            // Drop the number of connectors needed somewhere on the page
            var masters = connector_nodes.Select(i => i.Master.VisioMaster).ToArray();
            var origin  = new VisioAutomation.Geometry.Point(-2, -2);
            var points  = Enumerable.Range(0, connector_nodes.Count)
                          .Select(i => origin + new VisioAutomation.Geometry.Point(1.10, 0))
                          .ToList();
            var connector_shapeids = context.VisioPage.DropManyU(masters, points);
            var page_shapes        = context.VisioPage.Shapes;

            // Perform the connection
            for (int i = 0; i < connector_shapeids.Length; i++)
            {
                var connector_shapeid = connector_shapeids[i];
                var vis_connector     = page_shapes.ItemFromID[connector_shapeid];
                var dyncon_shape      = connector_nodes[i];

                var from_shape = context.GetShape(dyncon_shape.From.VisioShapeID);
                var to_shape   = context.GetShape(dyncon_shape.To.VisioShapeID);

                ConnectorHelper.ConnectShapes(from_shape, to_shape, vis_connector);
                dyncon_shape.VisioShape   = vis_connector;
                dyncon_shape.VisioShapeID = connector_shapeids[i];
            }
        }
        public int PossibleDuplicatesCount()
        {
            int    possibleDuplicateCount = 0;
            string jsonResult             = string.Empty;
            GoldmineImportServiceDO goldmineImportServiceDO = new GoldmineImportServiceDO();

            string URL = string.Format("{0}PossibleDuplicatesCount", goldmineImportServiceAddress);

            try
            {
                WebClient serviceRequest = new WebClient();
                jsonResult = serviceRequest.DownloadString(new Uri(URL));
                jsonResult = ConnectorHelper.ChangeArrayParentheses(jsonResult);
            }
            catch (Exception ex)
            {
                ClientLogger.WriteError(ex, "Error retrieving Possible Duplicate count.\nMethod: GoldmineImportServiceConnector.CreateHistoryRecordForRiftId", ClientGlobalData.CurrentUser.SystemName);
                throw ex;
            }

            try
            {
                goldmineImportServiceDO = JsonConvert.DeserializeObject <GoldmineImportServiceDO>(jsonResult);
                possibleDuplicateCount  = goldmineImportServiceDO.PossibleDuplicatesCountResult;
            }
            catch (Exception ex)
            {
                ClientLogger.WriteError(ex, "Error deserializing result from Possible Duplicate count.\nMethod: GoldmineImportServiceConnector.CreateHistoryRecordForRiftId", ClientGlobalData.CurrentUser.SystemName);
                HandleDeserializationException(ex);
            }
            return(possibleDuplicateCount);
        }
Esempio n. 4
0
        public static void ConnectorsToBack()
        {
            var doc   = SampleEnvironment.Application.ActiveDocument;
            var pages = doc.Pages;
            var page  = pages.Add();

            // based on this example: http://www.visguy.com/2009/06/17/send-all-connectors-to-back/

            var stencil   = SampleEnvironment.Application.Documents.OpenStencil("basic_u.vss");
            var master    = stencil.Masters["Dynamic Connector"];
            var r0        = page.DrawRectangle(3, 3, 5, 5);
            var r1        = page.DrawRectangle(0, 1, 2, 2);
            var r2        = page.DrawRectangle(7, 7, 8, 8);
            var connector = page.Drop(master, 0, 0);

            ConnectorHelper.ConnectShapes(r1, r2, connector);

            var con_layer = page.Layers["Connector"];

            var sel = page.CreateSelection(
                IVisio.VisSelectionTypes.visSelTypeByLayer,
                IVisio.VisSelectMode.visSelModeSkipSub,
                con_layer);

            sel.SendToBack();
        }
Esempio n. 5
0
        public FSelectFlowID()
        {
            InitializeComponent();

            clbFlowIDs.Items.Clear();
            clbFlowIDs.Items.AddRange(ConnectorHelper.GetCurrentFlowIDs());
        }
Esempio n. 6
0
 private void cbTagName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbTagName.Text == DAConst.DP_LinkTypeTag)
     {
         cbTagValue.Items.Clear();
         cbTagValue.Items.AddRange(Enum.GetNames(typeof(LinkType)));
     }
     else if (cbTagName.Text == DAConst.DP_ComponentLevelTag)
     {
         cbTagValue.Items.Clear();
         cbTagValue.Items.AddRange(Enum.GetNames(typeof(ComponentLevel)));
     }
     else if (cbTagName.Text == DAConst.DP_NodeGroupsTag)
     {
         cbTagValue.Items.Clear();
         cbTagValue.Items.AddRange(LibraryHelper.GetNodeGroupEnum().ToArray());
     }
     else if (cbTagName.Text == DAConst.DP_FlowIDTag)
     {
         cbTagValue.Items.Clear();
         cbTagValue.Items.AddRange(ConnectorHelper.GetCurrentFlowIDs());
     }
     else
     {
         cbTagValue.Items.Clear();
     }
 }
        private void connect(IVisio.Shape a, IVisio.Shape b, bool a_arrow, bool b_arrow)
        {
            var page = a.ContainingPage;
            var connectors_stencil = page.Application.Documents.OpenStencil("connec_u.vss");
            var connectors_masters = connectors_stencil.Masters;

            var dcm = connectors_masters["Dynamic Connector"];

            var drop_point = new VADRAW.Point(-2, -2);
            var c1         = page.Drop(dcm, drop_point);

            ConnectorHelper.ConnectShapes(a, b, c1);

            //a.AutoConnect(b, connect_dir_none, null);

            if (a_arrow || b_arrow)
            {
                var writer = new FormulaWriterSIDSRC();
                if (a_arrow)
                {
                    writer.SetFormula(c1.ID16, VASS.SRCConstants.BeginArrow, "13");
                }
                if (b_arrow)
                {
                    writer.SetFormula(c1.ID16, VASS.SRCConstants.EndArrow, "13");
                }
                writer.Commit(page);
            }
        }
        public string ImportContact(GMPossibleDuplicate possibleDuplicate, User user)
        {
            string                  returnedRecId           = string.Empty;
            string                  jsonResult              = string.Empty;
            ImportContactSO         importContactSO         = new ImportContactSO();
            GoldmineImportServiceDO goldmineImportServiceDO = new GoldmineImportServiceDO();
            string                  importContactSOAsJson   = string.Empty;

            // set importContactSO properties
            importContactSO = PropertyAddition.SetImportContactSOProperties(importContactSO, possibleDuplicate, user);

            // create URL and WebRequestObject
            string     URL            = string.Format("{0}ImportContact", goldmineImportServiceAddress);
            WebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(URL);

            httpWebRequest = ConnectorHelper.SetUpWebRequestObject(httpWebRequest);

            importContactSOAsJson = SerializationHelper.SerializeImportContactSO(importContactSO);

            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                // send request to service
                try
                {
                    streamWriter.Write(importContactSOAsJson);
                    streamWriter.Flush();
                    streamWriter.Close();
                }
                catch (Exception ex)
                {
                    ClientLogger.WriteError(ex, "Error importing contact.\nMethod: GoldmineImportServiceConnector.ImportContact", ClientGlobalData.CurrentUser.SystemName);
                    throw ex;
                }

                // get response object
                HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    jsonResult = streamReader.ReadToEnd();
                    jsonResult = ConnectorHelper.ChangeArrayParentheses(jsonResult);
                }

                // deserialize
                try
                {
                    goldmineImportServiceDO = JsonConvert.DeserializeObject <GoldmineImportServiceDO>(jsonResult);
                    returnedRecId           = goldmineImportServiceDO.ImportContactResult;
                }
                catch (Exception ex)
                {
                    ClientLogger.WriteError(ex, "Error deserializing result from importing contact.\nMethod: GoldmineImportServiceConnector.ImportContact", ClientGlobalData.CurrentUser.SystemName);
                    HandleDeserializationException(ex);
                }
            }

            return(returnedRecId);
        }
Esempio n. 9
0
        public static ExecResult <ConnectorData> Execute(EA.DiagramObject firstDA, EA.DiagramObject secondDA)
        {
            ExecResult <ConnectorData> result = new ExecResult <ConnectorData>()
            {
                value = new ConnectorData()
            };

            try
            {
                var fCreateNewLink = new FCreateNewLink();

                EA.Element firstElement = Context.EARepository.GetElementByID(firstDA.ElementID);
                fCreateNewLink.tbSource.Text = Logger.DumpObject(firstElement);
                fCreateNewLink.tbSource.Tag  = firstElement;

                EA.Element secondElement = Context.EARepository.GetElementByID(secondDA.ElementID);
                fCreateNewLink.tbDestination.Text = Logger.DumpObject(secondElement);
                fCreateNewLink.tbDestination.Tag  = secondElement;

                fCreateNewLink.cbFlowID.Items.Clear();
                fCreateNewLink.cbFlowID.Items.AddRange(ConnectorHelper.GetCurrentFlowIDs());


                DialogResult res = fCreateNewLink.ShowDialog();

                if (res != DialogResult.OK)
                {
                    result.code = (int)res;
                }
                else
                {
                    if (fCreateNewLink.clbLinkType.CheckedItems.Count == 0)
                    {
                        result.code = (int)DialogResult.Cancel;
                    }
                    else
                    {
                        result.value.Name      = fCreateNewLink.tbFlowName.Text;
                        result.value.Notes     = fCreateNewLink.tbNotes.Text;
                        result.value.LinkType  = ((LinkType)fCreateNewLink.clbLinkType.CheckedItems[0]);
                        result.value.FlowID    = fCreateNewLink.cbFlowID.Text;
                        result.value.SegmentID = fCreateNewLink.cbSegmentID.Text;

                        result.value.SourceElementID = ((EA.Element)fCreateNewLink.tbSource.Tag).ElementID;
                        result.value.TargetElementID = ((EA.Element)fCreateNewLink.tbDestination.Tag).ElementID;
                        //result.value.tempLink = cbTempLink.Checked;
                        //result.value.tempLinkDiagramID = tbTempLinkDiagramID.Text;
                    }
                }
            }
            catch (Exception ex)
            {
                result.setException(ex);
            }

            return(result);
        }
Esempio n. 10
0
        public FEditConnectors()
        {
            InitializeComponent();

            LoadConnectorTypes();

            cbFlowID.Items.Clear();
            cbFlowID.Items.AddRange(ConnectorHelper.GetCurrentFlowIDs());
        }
Esempio n. 11
0
        public async Task <IActionResult> Thumb(string target)
        {
            SetupConnector();
            var thumb = await _connector.GetThumbAsync(target);

            var actionResult = ConnectorHelper.GetThumbResult(thumb);

            return(actionResult);
        }
        public MatchingDetails GetMatchingDetails(string lastname, string postCode, string PHONE1, string PHONE2, string UEMAILADDR)
        {
            MatchingDetails         matchingDetails            = new MatchingDetails();
            string                  jsonResult                 = string.Empty;
            GetMatchingDetailsSO    getMatchingDetailsSO       = new GetMatchingDetailsSO();
            GoldmineImportServiceDO goldmineImportServiceDO    = new GoldmineImportServiceDO();
            string                  getMatchingDetailsSOAsJson = string.Empty;

            // set getMatchingDetailSO Properties
            getMatchingDetailsSO = PropertyAddition.SetGetMatchingDetailsSOProperties(lastname, postCode, PHONE1, PHONE2, UEMAILADDR, getMatchingDetailsSO);

            // Create URL and WebRequest Object
            string     URL            = string.Format("{0}GetMatchingDetails", goldmineImportServiceAddress);
            WebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(URL);

            httpWebRequest = ConnectorHelper.SetUpWebRequestObject(httpWebRequest);

            getMatchingDetailsSOAsJson = SerializationHelper.SerializeGetMatchingDetailsSO(getMatchingDetailsSO);

            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                // send request to service
                try
                {
                    streamWriter.Write(getMatchingDetailsSOAsJson);
                    streamWriter.Flush();
                    streamWriter.Close();
                }
                catch (Exception ex)
                {
                    ClientLogger.WriteError(ex, "Error retrieving the matching details.\nMethod: GoldmineImportServiceConnector.GetMatchingDetails", ClientGlobalData.CurrentUser.SystemName);
                    throw ex;
                }

                // get response object
                HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    jsonResult = streamReader.ReadToEnd();
                    jsonResult = ConnectorHelper.ChangeArrayParentheses(jsonResult);
                }

                // deserialize
                try
                {
                    goldmineImportServiceDO = JsonConvert.DeserializeObject <GoldmineImportServiceDO>(jsonResult);
                    matchingDetails         = goldmineImportServiceDO.GetMatchingDetailsResult;
                }
                catch (Exception ex)
                {
                    ClientLogger.WriteError(ex, "Error deserializing the matching details.\nMethod: GoldmineImportServiceConnector.GetMatchingDetails", ClientGlobalData.CurrentUser.SystemName);
                    HandleDeserializationException(ex);
                }
            }
            return(matchingDetails);
        }
Esempio n. 13
0
        public async Task <IActionResult> Connector()
        {
            SetupConnector();
            var cmd       = ConnectorHelper.ParseCommand(Request);
            var conResult = await _connector.ProcessAsync(cmd);

            var actionResult = conResult.ToActionResult();

            return(actionResult);
        }
        public bool DeletePossibleDuplicate(GMPossibleDuplicate selectedPossibleDuplicate, User user)
        {
            bool   deletionSuccess = false;
            string jsonResult      = string.Empty;
            string deletePossibleDuplicateSOAsJson = string.Empty;
            DeletePossibleDuplicateSO deletePossibleDuplicateSO = new DeletePossibleDuplicateSO();
            GoldmineImportServiceDO   goldmineImportServiceDO   = new GoldmineImportServiceDO();

            deletePossibleDuplicateSO = PropertyAddition.SetDeletePossibleDuplicateSOProperties(deletePossibleDuplicateSO, selectedPossibleDuplicate, user);

            string     URL            = string.Format("{0}DeletePossibleDuplicate", goldmineImportServiceAddress);
            WebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(URL);

            httpWebRequest = ConnectorHelper.SetUpWebRequestObject(httpWebRequest);

            deletePossibleDuplicateSOAsJson = SerializationHelper.SerializeDeletePossibleDuplicateSO(deletePossibleDuplicateSO);

            using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                try
                {
                    streamWriter.Write(deletePossibleDuplicateSOAsJson);
                    streamWriter.Flush();
                    streamWriter.Close();
                }
                catch (Exception ex)
                {
                    ClientLogger.WriteError(ex, "Error deleteing Possible Duplicate.\nMethod: GoldmineImportServiceConnector.CreateHistoryRecordForRiftId", ClientGlobalData.CurrentUser.SystemName);
                    throw ex;
                }
            }

            // get response
            HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

            using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                jsonResult = streamReader.ReadToEnd();
                jsonResult = ConnectorHelper.ChangeArrayParentheses(jsonResult);
            }

            // deserialize
            try
            {
                goldmineImportServiceDO = JsonConvert.DeserializeObject <GoldmineImportServiceDO>(jsonResult);
                deletionSuccess         = goldmineImportServiceDO.DeletePossibleDuplicateResult;
            }
            catch (Exception ex)
            {
                ClientLogger.WriteError(ex, "Error deserializing result for deleteing Possible Duplicate.\nMethod: GoldmineImportServiceConnector.CreateHistoryRecordForRiftId", ClientGlobalData.CurrentUser.SystemName);
                HandleDeserializationException(ex);
            }
            return(deletionSuccess);
        }
        public List <DatColStockModel> MapToDatCol(Int32 vendorId, List <Model.WehkampStockMutation> mutations)
        {
            using (var pDb = new PetaPoco.Database(Environments.Current.Connection, "System.Data.SqlClient"))
            {
                int connectorID = pDb.FirstOrDefault <int>(@"select connectorid from contentproduct where vendorid = @0 and isassortment = 1", vendorId);

                int    shopNumber           = ConnectorHelper.GetStoreNumber(connectorID);
                int    differenteShopNumber = VendorHelper.GetDifferenceShopNumber(vendorId);
                string employeeNumber       = VendorHelper.GetEmployeeNumber(vendorId);
                var    salesSlipNumber      = ReceiptHelper.GetSlipNumber(vendorId);

                int _receiptIndex       = GenericSlipNumberHelper.GetSlipNumberForTransfer(vendorId, ReceiptHelper.STOCK_SALESSLIP_RECEIPT_NUMBER_SETTING_KEY);
                int _receiptIndexSurplu = GenericSlipNumberHelper.GetSlipNumberForTransfer(vendorId, ReceiptHelper.STOCK_SALESSLIP_RECEIPT_NUMBER_SETTING_KEY_SURPLUS);
                mutations.ForEach(mutation =>
                {
                    _index += 200;

                    var line = new DatColStockModel
                    {
                        StoreNumber                    = (mutation.MutationQuantity > 0 ? differenteShopNumber : shopNumber).ToString("D3") + " 01",
                        EmployeeNumber                 = employeeNumber,
                        ReceiptNumber                  = salesSlipNumber,
                        TransactionType                = "20",
                        DateNotified                   = mutation.MutationDate.ToString("yyyyMMddHHmm"),
                        RecordType                     = "01",
                        SubType                        = "00",
                        NumberOfSkus                   = Math.Abs(mutation.MutationQuantity),
                        MancoOrSurplus                 = mutation.MutationQuantity > 0 ? shopNumber : differenteShopNumber,
                        FixedField1                    = "000000000+",
                        RecordSequence                 = _index,
                        FixedField2                    = "000",
                        FixedField3                    = "000000000+",
                        FixedField4                    = "000",
                        FixedField5                    = "000000000+",
                        FixedField6                    = "000",
                        OriginalSellingPrice           = (int)Math.Round(PriceHelper.GetPrice(mutation.ProductID, vendorId) * 100),
                        FixedField7                    = "00",
                        ArticleNumberColorCodeSizeCode = ProductHelper.GetPFAItemNumber(mutation.Articlenumber, mutation.Colorcode, mutation.ProductID),
                        Barcode                        = BarcodeHelper.GetBarcode(mutation.ProductID),
                        Receipt                        = string.Format("{0}{1}{2}", 0, mutation.MutationQuantity > 0 ? differenteShopNumber.ToString("D3") : shopNumber.ToString(), _receiptIndex.ToString().PadLeft(4, '0')),
                        TaxCode                        = "1",
                        EmployeeNumber2                = employeeNumber,
                        ScannedWithBarcodeReader       = 0
                    };

                    _list.Add(line);
                });
                ReceiptHelper.IncrementSalesSlipNumber(ref salesSlipNumber, vendorId, ReceiptHelper.STOCK_SALESSLIP_NUMBER_SETTINGKEY);

                return(_list);
            }
        }
Esempio n. 16
0
        private void cbFlowID_SelectedIndexChanged(object sender, EventArgs e)
        {
            // При изменении FlowID перезагружаем комбо с сегментами

            string flowID = cbFlowID.Text;

            cbSegmentID.Items.Clear();

            if (flowID != "")
            {
                cbSegmentID.Items.AddRange(ConnectorHelper.GetSegmentsForFlowID(flowID));
            }
        }
Esempio n. 17
0
        public void Connect1()
        {
            var page1     = this.GetNewPage();
            var s1        = page1.DrawRectangle(1, 1, 2, 2);
            var s2        = page1.DrawRectangle(5, 5, 6, 6);
            var stencil   = page1.Application.Documents.OpenStencil("connec_u.vss");
            var master    = stencil.Masters["Dynamic Connector"];
            var connector = page1.Drop(master, 0, 0);

            ConnectorHelper.ConnectShapes(s1, s2, connector);

            page1.Delete(0);
        }
Esempio n. 18
0
        private void tsbEditProperties_Click(object sender, EventArgs e)
        {
            if (lvConnectors.SelectedItems.Count > 0)
            {
                var editResult = FEditConnector.Execute((ConnectorData)lvConnectors.SelectedItems[0].Tag);
                if (editResult.code == 0)
                {
                    ConnectorHelper.UpdateConnectorByData(editResult.value);
                }


                LoadConnectorList();
            }
        }
Esempio n. 19
0
        public List <IVisio.Shape> ConnectShapes(IList <IVisio.Shape> fromshapes, IList <IVisio.Shape> toshapes, IVisio.Master master)
        {
            var cmdtarget = this._client.GetCommandTargetPage();

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(ConnectShapes)))
            {
                if (master == null)
                {
                    var connectors = ConnectorHelper.ConnectShapes(cmdtarget.ActivePage, fromshapes, toshapes, null, false);
                    return(connectors);
                }
                else
                {
                    var connectors = ConnectorHelper.ConnectShapes(cmdtarget.ActivePage, fromshapes, toshapes, master);
                    return(connectors);
                }
            }
        }
Esempio n. 20
0
        public List <IVisio.Shape> ConnectShapes(VisioScripting.TargetPage target_page, IList <IVisio.Shape> fromshapes, IList <IVisio.Shape> toshapes, IVisio.Master master)
        {
            target_page = target_page.ResolveToPage(this._client);

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(ConnectShapes)))
            {
                if (master == null)
                {
                    var connectors = ConnectorHelper.ConnectShapes(target_page.Page, fromshapes, toshapes, null, false);
                    return(connectors);
                }
                else
                {
                    var connectors = ConnectorHelper.ConnectShapes(target_page.Page, fromshapes, toshapes, master);
                    return(connectors);
                }
            }
        }
        public User GetUser(string systemName)
        {
            User          currentUser   = new User();
            string        jsonResult    = string.Empty;
            UserServiceDO userServiceDO = new UserServiceDO();

            string URL = string.Format("{0}GetUser/{1}", userServiceAddress, systemName);

            try
            {
                WebClient serviceRequest = new WebClient();
                jsonResult = serviceRequest.DownloadString(new Uri(URL));
                jsonResult = ConnectorHelper.ChangeArrayParentheses(jsonResult);
            }
            catch (Exception ex) { ClientLogger.WriteError(ex, "Error getting user\nMethod: UserConnector.GetUser", systemName); }

            userServiceDO = JsonConvert.DeserializeObject <UserServiceDO>(jsonResult);
            currentUser   = userServiceDO.GetUserResult;
            return(currentUser);
        }
        public bool CheckAccessToRGI2(string systemName)
        {
            bool          allowed       = false;
            string        jsonResult    = string.Empty;
            UserServiceDO userServiceDO = new UserServiceDO();

            string URL = string.Format("{0}CheckAccessToRGI2/{1}", userServiceAddress, systemName);

            try
            {
                WebClient serviceRequest = new WebClient();
                jsonResult = serviceRequest.DownloadString(new Uri(URL));
                jsonResult = ConnectorHelper.ChangeArrayParentheses(jsonResult);
            }
            catch (Exception ex) { ClientLogger.WriteError(ex, "Error getting access for user\nMethod: UserConnector.CheckAccessToRGI2", systemName); }

            userServiceDO = JsonConvert.DeserializeObject <UserServiceDO>(jsonResult);
            allowed       = userServiceDO.CheckAccessToRGI2Result;
            return(allowed);
        }
Esempio n. 23
0
        public IList <IVisio.Shape> Connect(IList <IVisio.Shape> fromshapes, IList <IVisio.Shape> toshapes, IVisio.Master master)
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            var active_page = this.Client.VisioApplication.ActivePage;

            using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, undoname_connectShapes))
            {
                if (master == null)
                {
                    var connectors = ConnectorHelper.ConnectShapes(active_page, fromshapes, toshapes, null, false);
                    return(connectors);
                }
                else
                {
                    var connectors = ConnectorHelper.ConnectShapes(active_page, fromshapes, toshapes, master);
                    return(connectors);
                }
            }
        }
Esempio n. 24
0
        public List <IVisio.Shape> Connect(IList <IVisio.Shape> fromshapes, IList <IVisio.Shape> toshapes, IVisio.Master master)
        {
            this._client.Application.AssertApplicationAvailable();
            this._client.Document.AssertDocumentAvailable();

            var application = this._client.Application.Get();
            var active_page = application.ActivePage;

            using (var undoscope = this._client.Application.NewUndoScope("Connect Shapes"))
            {
                if (master == null)
                {
                    var connectors = ConnectorHelper.ConnectShapes(active_page, fromshapes, toshapes, null, false);
                    return(connectors);
                }
                else
                {
                    var connectors = ConnectorHelper.ConnectShapes(active_page, fromshapes, toshapes, master);
                    return(connectors);
                }
            }
        }
        public static void ConnectorsToBack()
        {
            var doc   = SampleEnvironment.Application.ActiveDocument;
            var pages = doc.Pages;
            var page  = pages.Add();

            // get the data and the labels to use
            var data = new double[] { 1, 2, 3, 4, 5, 6 };

            var radius = 3.0;
            var center = new VA.Drawing.Point(4, 4);
            var slices = VA.Models.Charting.PieSlice.GetSlicesFromValues(center, radius, data);

            foreach (var slice in slices)
            {
                slice.Render(page);
            }

            // based on this example: http://www.visguy.com/2009/06/17/send-all-connectors-to-back/

            var stencil   = SampleEnvironment.Application.Documents.OpenStencil("basic_u.vss");
            var master    = stencil.Masters["Dynamic Connector"];
            var connector = page.Drop(master, 0, 0);
            var r1        = page.DrawRectangle(0, 1, 2, 2);
            var r2        = page.DrawRectangle(7, 7, 8, 8);

            ConnectorHelper.ConnectShapes(connector, r1, r2);

            var con_layer = page.Layers["Connector"];

            var sel = page.CreateSelection(
                IVisio.VisSelectionTypes.visSelTypeByLayer,
                IVisio.VisSelectMode.visSelModeSkipSub,
                con_layer);

            sel.SendToBack();
        }
Esempio n. 26
0
        private void tsbEditSelected_Click(object sender, EventArgs e)
        {
            if (lvConnectors.SelectedItems.Count > 0)
            {
                List <ConnectorData> connectorDatas = new List <ConnectorData>();

                foreach (ListViewItem item in lvConnectors.SelectedItems)
                {
                    connectorDatas.Add((ConnectorData)item.Tag);
                }


                var editResult = FEditConnectors.Execute(connectorDatas);
                if (editResult.code == 0)
                {
                    foreach (var connectorData in editResult.value)
                    {
                        ConnectorHelper.UpdateConnectorByData(connectorData);
                    }
                }

                LoadConnectorList();
            }
        }
Esempio n. 27
0
 public static IEnumerable <IVisio.Connect> ToEnumerable(this IVisio.Connects connects)
 {
     return(ConnectorHelper.ToEnumerable(connects));
 }
        protected override void Process()
        {
            using (var unit = GetUnitOfWork())
            {
                var vendors = unit.Scope.Repository <Vendor>().GetAll().ToList().Where(c => ((VendorType)c.VendorType).Has(VendorType.SupportsPFATransferOrders)).ToList();

                var orderLedgerRepo = unit.Scope.Repository <OrderLedger>();

                foreach (var vendor in vendors)
                {
                    var rule = vendor.ContentProducts.FirstOrDefault(c => c.IsAssortment);

                    rule.ThrowIfNull("Publication rule with IsAssortment is missing for vendor " + vendor.Name);

                    IQueryable <OrderLine> lines = unit.Scope.Repository <OrderLine>().GetAll(x => x.Order.OrderType == (int)OrderTypes.ReturnOrder && x.Order.ConnectorID == rule.ConnectorID && x.OrderLedgers.Any(y => y.Status == (int)OrderLineStatus.StockReturnRequestConfirmation));

                    IQueryable <OrderLine> processed = unit.Scope.Repository <OrderLine>().GetAll(x => x.Order.OrderType == (int)OrderTypes.ReturnOrder && x.Order.ConnectorID == rule.ConnectorID && x.OrderLedgers.Any(y => y.Status == (int)OrderLineStatus.ProcessedStockReturnRequestConfirmation));

                    var ledgerRepo = unit.Scope.Repository <OrderLedger>();

                    var storeID              = ConnectorHelper.GetStoreNumber(rule.ConnectorID);
                    var employeeNumber       = VendorHelper.GetEmployeeNumber(vendor.VendorID);
                    int differenceShopNumber = VendorHelper.GetReturnDifferenceShopNumber(vendor.VendorID);

                    lines = lines.Except(processed);

                    var toProcess = lines.GroupBy(line => line.Order).ToList().Select(c => new
                    {
                        Order      = c.Key,
                        OrderLines = c.ToList()
                    }).ToList();

                    foreach (var order in toProcess)
                    {
                        int recordSequenceDetail          = 0;
                        int recordSequeceCompleteShipment = 200;

                        //get all three different shop numbers
                        var salesSlipNumber = GenericSlipNumberHelper.GetSlipNumberForTransfer(vendor.VendorID, ReceiptHelper.STOCK_SALESSLIP_RECEIPT_NUMBER_SETTING_KEY);
                        int salesSlipNumber_OtherFilials = 0; //used for any line with warehouse code != 982


                        var salesSlipNumberComplete = salesSlipNumber;
                        var salesSlipNumberShop     = salesSlipNumberComplete;

                        var fileEngine = new FileHelperEngine(typeof(ReturnOrderDatcolModel));
                        var returns    = new List <ReturnOrderDatcolModel>();

                        var fileName = String.Format("{0}{1}", "returnOrders", DateTime.Now.ToString("yyyyMMddHHmmss"));

                        //process contents
                        DateTime messageTime = order.OrderLines.FirstOrDefault().OrderLedgers.FirstOrDefault(c => c.Status == (int)OrderLineStatus.StockReturnRequestConfirmation).LedgerDate.ToLocalTime();
                        int      totalSkus   = 0;

                        if (order.OrderLines.Any(c => c.WareHouseCode != differenceShopNumber.ToString()))
                        {
                            salesSlipNumber_OtherFilials = GenericSlipNumberHelper.GetSlipNumberForTransfer(vendor.VendorID, ReceiptHelper.STOCK_SALESSLIP_RECEIPT_NUMBER_SETTING_KEY);
                        }

                        foreach (var orderLine in order.OrderLines)
                        {
                            var detailSalesSlipNumber = salesSlipNumber;

                            var ledger = orderLine.OrderLedgers.FirstOrDefault(c => c.Status == (int)OrderLineStatus.StockReturnRequestConfirmation);
                            totalSkus += ledger.Quantity.Value;

                            recordSequenceDetail += 200;

                            if (orderLine.WareHouseCode != differenceShopNumber.ToString())
                            {
                                returns.Add(GetDetailLevel(storeID, employeeNumber, salesSlipNumber, salesSlipNumber_OtherFilials, ledger.LedgerDate.ToLocalTime(), ledger.Quantity.Value, differenceShopNumber, recordSequenceDetail, orderLine.ProductID.Value, vendor.VendorID));
                            }

                            else
                            {
                                returns.Add(GetDetailLevel(storeID, employeeNumber, salesSlipNumber, salesSlipNumber, ledger.LedgerDate.ToLocalTime(), ledger.Quantity.Value, differenceShopNumber, recordSequenceDetail, orderLine.ProductID.Value, vendor.VendorID));
                            }
                        }

                        var codes = order.OrderLines.Select(c => c.WareHouseCode).Where(c => !string.IsNullOrEmpty(c));

                        if (codes.Any(c => c != differenceShopNumber.ToString()))
                        {
                            returns.Add(GetCompleteLevel(storeID, employeeNumber, salesSlipNumberComplete, salesSlipNumber_OtherFilials, messageTime, totalSkus, differenceShopNumber));
                        }

                        foreach (var orderLineFilial in order.OrderLines.Where(c => !string.IsNullOrEmpty(c.WareHouseCode) && c.WareHouseCode != differenceShopNumber.ToString()).GroupBy(c => c.WareHouseCode).ToList())
                        {
                            var salesSlipNumber_Difference = GenericSlipNumberHelper.GetSlipNumberForTransfer(vendor.VendorID, ReceiptHelper.STOCK_SALESSLIP_RECEIPT_NUMBER_SETTING_KEY_SURPLUS);
                            foreach (var orderLine in orderLineFilial)
                            {
                                recordSequenceDetail += 200;
                                var ledger = orderLine.OrderLedgers.FirstOrDefault(c => c.Status == (int)OrderLineStatus.StockReturnRequestConfirmation);

                                returns.Add(GetDetailLevelForStore(int.Parse(orderLine.WareHouseCode), employeeNumber, salesSlipNumberShop, salesSlipNumber_Difference, messageTime, ledger.Quantity.Value, differenceShopNumber, recordSequenceDetail, orderLine.ProductID.Value, vendor.VendorID));
                            }
                        }

                        if (returns.Count > 0)
                        {
                            var file = fileEngine.WriteString(returns);
                            var path = CommunicatorService.GetMessagePath(vendor.VendorID, PfaCommunicator.Objects.Models.MessageTypes.WehkampReturn);
                            File.WriteAllText(Path.Combine(path.MessagePath, fileName), file);
                        }

                        foreach (var line in order.OrderLines)
                        {
                            line.SetStatus(OrderLineStatus.ProcessedStockReturnRequestConfirmation, ledgerRepo);
                        }
                    }
                    unit.Save();
                }
            }
        }
Esempio n. 29
0
        protected override void Process()
        {
            using (var unit = GetUnitOfWork())
            {
                var vendors           = unit.Scope.Repository <Vendor>().GetAll().ToList().Where(c => ((VendorType)c.VendorType).Has(VendorType.SupportsPFATransferOrders)).ToList();
                int transferOrderType = (int)OrderTypes.TransferOrder;
                var ledgerRepo        = unit.Scope.Repository <OrderLedger>();


                vendors.ForEach((vendor, indexer) =>
                {
                    var mutationEngine = new FileHelperEngine(typeof(ReceivedTransferMutation));

                    var fileName = String.Format("{0}{1}", "mancosurplus", DateTime.Now.ToString("yyyyMMddHHmmss"));

                    var mutations = new List <ReceivedTransferMutation>();

                    var rule = vendor.ContentProducts.FirstOrDefault(c => c.IsAssortment);

                    rule.ThrowIfNull("Publication rule with IsAssortment is missing for vendor " + vendor.Name);

                    List <OrderLine> lines = unit
                                             .Scope
                                             .Repository <OrderLine>()
                                             .GetAll(x => x.Order.OrderType == transferOrderType &&
                                                     x.Order.ConnectorID == rule.ConnectorID &&
                                                     x.OrderLedgers.Any(y => y.Status == (int)OrderLineStatus.ReceivedTransfer) &&
                                                     !x.OrderLedgers.Any(y => y.Status == (int)OrderLineStatus.ProcessedReceivedTransfer)).ToList();

                    var storeID        = ConnectorHelper.GetStoreNumber(rule.ConnectorID);
                    var employeeNumber = VendorHelper.GetEmployeeNumber(vendor.VendorID);

                    var salesSlipNumber = ReceiptHelper.GetSlipNumber(vendor.VendorID);
                    //ReceiptHelper.IncrementSalesSlipNumber(ref salesSlipNumber);

                    var toProcess = lines.GroupBy(k => k.Order).ToList().Select(c => new
                    {
                        Order           = c.Key,
                        OrderLines      = c.ToList(),
                        ExtraOrderLines = c.Key.OrderLines.Except(c.ToList())
                    }).ToList();

                    foreach (var order in toProcess)
                    {
                        PfaOrderHelper helper = new PfaOrderHelper(vendor.VendorID);

                        if (order.OrderLines.Count == 0)
                        {
                            continue;
                        }

                        order.OrderLines.AddRange(order.ExtraOrderLines);

                        var receivedByWehkampDate = order.OrderLines.FirstOrDefault().OrderLedgers.FirstOrDefault(c => c.Status == (int)OrderLineStatus.ReceivedTransfer).LedgerDate.ToLocalTime();

                        List <TransferOrderModel> list = helper.GetShippedQuantitiesForOrder(order.Order.WebSiteOrderNumber, order.Order.ConnectorID);
                        if (list.Count > 0)
                        {
                            List <TransferOrderLine> orderLinesToBeProcessed = GetOrderLineStatus(order.OrderLines, list, order.Order.OrderID, vendor.VendorID, unit);

                            if (list.Count > order.OrderLines.Count())
                            {
                                //more lines are in PFA than in the Concentrator
                                log.AuditInfo(string.Format("For order {0} there are {1} order lines in Concentrator and {2} in PFA. Difference found of {3} lines."
                                                            , order.Order.WebSiteOrderNumber, order.OrderLines.Count(), list.Count, order.ExtraOrderLines.Count()));
                            }

                            if (orderLinesToBeProcessed.Any(c => c.ShippedFromPFA != c.ReceivedFromWehkamp))
                            {
                                var differences = orderLinesToBeProcessed.Where(c => c.ShippedFromPFA != c.ReceivedFromWehkamp);

                                //add each quantity unmatched product
                                differences.ForEach((difference, index) =>
                                {
                                    var unmatchedQuantityLine = GetDifferenceRuleForIncompleteShipping(difference, orderLinesToBeProcessed.Sum(x => x.ReceivedFromWehkamp), orderLinesToBeProcessed.Sum(x => x.ShippedFromPFA), storeID, employeeNumber, vendor.VendorID, receivedByWehkampDate, salesSlipNumber);

                                    mutations.Add(unmatchedQuantityLine);
                                });

                                //add the total rule
                                mutations.AddRange(GetTotalRuleForIncompleteShipping(order.Order, orderLinesToBeProcessed.Sum(x => x.ReceivedFromWehkamp), orderLinesToBeProcessed.Sum(x => x.ShippedFromPFA), storeID, employeeNumber, vendor.VendorID, receivedByWehkampDate, salesSlipNumber));
                            }
                            else
                            {
                                //add quantity matched list
                                mutations.AddRange(GetCompletelyShippedRule(order.Order, orderLinesToBeProcessed.Sum(x => x.ReceivedFromWehkamp), storeID, employeeNumber, vendor.VendorID, receivedByWehkampDate, salesSlipNumber));
                            }
                        }
                        else
                        {
                            log.AuditError("Ignoring order " + order.Order.WebSiteOrderNumber + ": No lines found in PFA");
                        }
                        foreach (var line in order.OrderLines)
                        {
                            line.SetStatus(OrderLineStatus.ProcessedReceivedTransfer, ledgerRepo);
                        }
                        ReceiptHelper.IncrementSalesSlipNumber(ref salesSlipNumber, vendor.VendorID);
                    }

                    if (mutations.Count > 0)
                    {
                        var file = mutationEngine.WriteString(mutations);

                        var path = CommunicatorService.GetMessagePath(vendor.VendorID, MessageTypes.TransferOrderConfirmation);

                        File.WriteAllText(Path.Combine(path.MessagePath, fileName), file);
                    }
                    unit.Save();
                });
            }
        }