Example #1
0
        private GraphicsPath RetrieveGraphicsPath()
        {
            GraphicsPath gp = new GraphicsPath();

            gp.FillMode = FillMode.Alternate;
            gp.AddPath(this.cCP, false);

            LogoHelper lh = new LogoHelper();
            gp
            lh.DestRectF = new RectangleF(this._location, new SizeF(this._width, this._height));

            lh.SrcGP = gp;
            GraphicsPath gpResult = lh.RetrievePath();

            gp.Dispose();

            return(gpResult);
        }
Example #2
0
        internal static void ExecutePayment(SqlDataAccess crmSda, IOrganizationService service)
        {
            List <PaymentLogo> paymentList = LogoHelper.GetPaymentsFromLogo();

            if (paymentList.Count > 0)
            {
                foreach (PaymentLogo item in paymentList)
                {
                    Console.Clear();
                    Console.WriteLine(paymentList.IndexOf(item) + 1 + " / " + paymentList.Count);
                    Console.WriteLine(item.VoucherNumber);
                    PaymentLogo crm = LogoHelper.GetPaymentFromCrm(crmSda, item.VoucherNumber);
                    try
                    {
                        if (!string.IsNullOrEmpty(crm.CrmId))
                        {
                            item.CrmId = crm.CrmId;
                            if (item.VoucherAmount == 0 || item.VoucherAmount != crm.VoucherAmount)//crm virgül
                            {
                                continue;
                            }
                            if (item.TransactionCurrencyName == string.Empty || (item.TransactionCurrencyName == "EUR" ? "Euro" : item.TransactionCurrencyName) != crm.TransactionCurrencyName)
                            {
                                continue;
                            }
                            if (item.BalanceAmount != crm.VoucherAmount - item.Amount)
                            {
                                continue;
                            }
                            LogoHelper.UpdatePaymentCrm(crmSda, item);
                        }
                    }
                    catch (Exception ex)
                    {
                        StreamWriter file2 = new StreamWriter(@"C:\Nef\LogoAktarimLog.txt", true);
                        file2.WriteLine("-----------------" + DateTime.Now.ToShortDateString() + "----------------------");
                        file2.WriteLine("SERİ NO:" + item.VoucherNumber);
                        file2.WriteLine(ex.Message);
                        file2.Close();
                    }
                }
            }
        }
Example #3
0
        public static MsCrmResult Process()
        {
            MsCrmResult returnValue = new MsCrmResult();

            try
            {
                service = MSCRM.GetOrgService(true);

                SqlDataAccess sda = new SqlDataAccess();
                sda.openConnection(Globals.ConnectionString);

                List <ExpenseCenter> expenseCenterList = LogoHelper.GetExpenseCenterList(sda);

                if (expenseCenterList.Count > 0)
                {
                    for (int i = 0; i < expenseCenterList.Count; i++)
                    {
                        List <LogoAccount> logoAccountList = LogoHelper.GetLogoFirmalar(expenseCenterList[i].ProjeID, sda);

                        if (logoAccountList.Count > 0)
                        {
                            for (int j = 0; j < logoAccountList.Count; j++)
                            {
                                LogoHelper.CreateExpenseCenter(expenseCenterList[i], logoAccountList[j]);
                            }
                        }

                        LogoHelper.LogoAktarimFalse(expenseCenterList[i].MasrafMerkezId, "product", service);
                    }
                }

                returnValue.Success = true;
                returnValue.Result  = "Masraf merkezi entegrasyonu tamamlandı.";
            }
            catch (Exception ex)
            {
                returnValue.Result = ex.Message;
            }

            return(returnValue);
        }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 private static void PrintLogo()
 {
     LogoHelper.Print();
 }
Example #5
0
        static void Main(string[] args)
        {
            Console.CancelKeyPress += Console_CancelKeyPress;
            AppDomain.CurrentDomain.ProcessExit          += CurrentDomain_ProcessExit;
            AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
            WindowConsolHelper.DisbleQuickEditMode();

            Runner3.RunInstance.Init();

            Console.WriteLine(Res.Get("WelcomeMsg"));
            PrintLogo();

            Console.WriteLine(Res.Get("HelpMsg"));

            if (args.Length > 0 && args[0] == "start")
            {
                Task.Run(() => {
                    StartMonitor(args.Length > 1 ? args[1] : "local");
                });

                if (args.Length > 1)
                {
                    int port = 14330;
                    if (args.Length > 2)
                    {
                        int.TryParse(args[2], out port);
                    }
                    Cdy.Tag.Runner3.RunInstance.StartAsync(args[1], port);
                    Console.Title = "DbInRun-" + args[1];
                }
                else
                {
                    Cdy.Tag.Runner3.RunInstance.Start();
                }
            }

            while (!mIsClosed)
            {
                Console.Write(">");

                while (!Console.KeyAvailable)
                {
                    if (mIsClosed)
                    {
                        break;
                    }
                    Thread.Sleep(100);
                }

                if (mIsClosed)
                {
                    break;
                }

                string smd = Console.ReadLine();

                if (string.IsNullOrEmpty(smd))
                {
                    LoggerService.Service.EnableLogger = !LoggerService.Service.EnableLogger;
                    if (LoggerService.Service.EnableLogger)
                    {
                        Console.WriteLine("Log is enabled.");
                    }
                    else
                    {
                        Console.WriteLine("Log is disabled.");
                    }
                    continue;
                }

                string[] cmd = smd.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

                if (cmd.Length == 0)
                {
                    continue;
                }

                string scmd = cmd[0].ToLower();
                switch (scmd)
                {
                case "exit":
                    if (Cdy.Tag.Runner3.RunInstance.IsStarted)
                    {
                        Cdy.Tag.Runner3.RunInstance.Stop();
                    }
                    mIsClosed = true;
                    break;

                case "start":
                    mStartTime = DateTime.Now;
                    string dbname = "local";
                    if (cmd.Length > 1)
                    {
                        Cdy.Tag.Runner3.RunInstance.StartAsync(cmd[1]);
                        Console.Title = "DbInRun-" + cmd[1];
                        dbname        = cmd[1];
                    }
                    else
                    {
                        Cdy.Tag.Runner3.RunInstance.Start();
                        Console.Title = "DbInRun-local";
                        dbname        = "local";
                    }
                    Task.Run(() => {
                        StartMonitor(dbname);
                    });
                    break;

                case "stop":
                    Cdy.Tag.Runner3.RunInstance.Stop();
                    break;

                case "switch":
                    LoggerService.Service.EnableLogger = true;
                    if (cmd.Length > 1)
                    {
                        var cd = cmd[1].ToLower();
                        if (cd == "primary")
                        {
                            if (!Cdy.Tag.Runner3.RunInstance.Switch(WorkState.Primary))
                            {
                                LoggerService.Service.Erro("RDDCManager", "Failed to switch to primary!");
                            }
                        }
                        else if (cd == "standby")
                        {
                            if (!Cdy.Tag.Runner3.RunInstance.Switch(WorkState.Standby))
                            {
                                LoggerService.Service.Erro("RDDCManager", "Failed to switch to standby!");
                            }
                        }
                    }
                    break;

                case "restart":
                    LoggerService.Service.EnableLogger = true;
                    Task.Run(() => {
                        Cdy.Tag.Runner3.RunInstance.ReStartDatabase();
                    });
                    break;

                case "dynamicload":
                    LoggerService.Service.EnableLogger = true;
                    Task.Run(() => {
                        Cdy.Tag.Runner3.RunInstance.DynamicLoadTags();
                    });
                    break;

                case "list":
                    ListDatabase();
                    break;

                case "setdatapath":
                    if (cmd.Length > 1)
                    {
                        SeriseEnginer4.HisDataPathPrimary = cmd[1];
                    }
                    break;

                case "setdatabackuppath":
                    if (cmd.Length > 1)
                    {
                        SeriseEnginer4.HisDataPathBack = cmd[1];
                    }
                    break;

                case "h":
                    Console.WriteLine(GetHelpString());
                    break;

                case "time":
                    Console.WriteLine((DateTime.Now - mStartTime).TotalSeconds);
                    break;

                case "**":
                    LogoHelper.PrintAuthor();
                    break;
                }
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            LogoHelper.Print();
            Console.WriteLine(Res.Get("WelcomeMsg"));

            Console.CancelKeyPress += Console_CancelKeyPress;
            AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;


            if (args.Length > 0)
            {
                mRunner = new SpiderRuntime.Runer()
                {
                    Name = args[1]
                };
                mRunner.Name = args[0];
                mRunner.Init();
                mRunner.Start();
            }

            Console.WriteLine(Res.Get("HelpMsg"));

            while (!mIsClosed)
            {
                Console.Write(">");
                while (!Console.KeyAvailable)
                {
                    if (mIsClosed)
                    {
                        break;
                    }
                    Thread.Sleep(100);
                }
                if (mIsClosed)
                {
                    break;
                }

                string   smd = Console.ReadLine();
                string[] cmd = smd.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                if (cmd.Length == 0)
                {
                    continue;
                }
                string scmd = cmd[0].ToLower();
                switch (scmd)
                {
                case "exit":
                    if (mRunner != null && mRunner.IsStarted)
                    {
                        mRunner.Stop();
                    }
                    mIsClosed = true;

                    break;

                case "stop":
                    if (mRunner != null && mRunner.IsStarted)
                    {
                        mRunner.Stop();
                    }
                    break;

                case "start":
                    if (cmd.Length > 0)
                    {
                        if (SpiderRuntime.Runer.CheckNameExit(cmd[1]))
                        {
                            if (mRunner == null)
                            {
                                mRunner = new SpiderRuntime.Runer()
                                {
                                    Name = cmd[1]
                                }
                            }
                            ;
                            if (!mRunner.IsStarted)
                            {
                                mRunner.Init();
                                mRunner.Start();
                            }
                        }
                        else
                        {
                            Console.WriteLine(cmd[1] + " is not exist!");
                        }
                    }
                    break;

                case "h":
                    Console.WriteLine(GetHelpString());
                    break;

                case "**":
                    LogoHelper.PrintAuthor();
                    break;
                }
            }
        }
Example #7
0
        public static MsCrmResult Process()
        {
            MsCrmResult returnValue = new MsCrmResult();

            try
            {
                IOrganizationService service = MSCRM.GetOrgService(true);

                SqlDataAccess sda = new SqlDataAccess();
                sda.openConnection(Globals.ConnectionString);

                List <Satislar> satisList = LogoHelper.GetSatisList(sda);

                if (satisList.Count > 0)
                {
                    foreach (Satislar item in satisList)
                    {
                        if (item.SatisDurumu != null)
                        {
                            if (item.SatisDurumu.Equals("İPTAL"))
                            {
                                if (!LogoHelper.ControlQuotePayment(item.SatisID))
                                {
                                    LogoHelper.UpdateLogoAktarimStatus(item.SatisID, "0");
                                    continue;
                                }
                            }
                        }


                        List <LogoAccount> logofirma = LogoHelper.GetLogoFirmalar(item.ProjeID, sda);

                        if (logofirma.Count > 0)
                        {
                            foreach (LogoAccount firma in logofirma)
                            {
                                if (LogoHelper.ExecuteCari(item, firma, sda))
                                {
                                    if (!LogoHelper.SatisKontrol(item))
                                    {
                                        LogoHelper.CreateSatis(item, firma);
                                    }
                                    else
                                    {
                                        LogoHelper.CreateSatis(item, firma);
                                    }

                                    LogoHelper.ExecuteSatisOdemePlani(item.SatisID, item.SatisRef, sda);
                                    LogoHelper.UpdateLogoAktarimStatus(item.SatisID, "0");
                                }
                            }
                        }
                        else if (LogoHelper.ExecuteCari(item, null, sda))
                        {
                            if (!LogoHelper.SatisKontrol(item))
                            {
                                LogoHelper.CreateSatis(item, null);
                            }
                            else
                            {
                                LogoHelper.CreateSatis(item, null);
                            }

                            LogoHelper.ExecuteSatisOdemePlani(item.SatisID, item.SatisRef, sda);
                            LogoHelper.UpdateLogoAktarimStatus(item.SatisID, "0");
                        }
                    }
                }

                returnValue.Success = true;
                returnValue.Result  = "Satış entegrasyonu tamamlandı.";
            }
            catch (Exception ex)
            {
                returnValue.Result = ex.Message;
            }

            return(returnValue);
        }
Example #8
0
        internal static void ExecutePayment(SqlDataAccess crmSda, IOrganizationService service)
        {
            string logFile  = AppDomain.CurrentDomain.BaseDirectory + "Aktarılan.txt";
            string filePath = AppDomain.CurrentDomain.BaseDirectory + "Logo.txt";
            string line;
            string condition = string.Empty;

            if (File.Exists(filePath))
            {
                StreamReader fileReader = new System.IO.StreamReader(filePath);
                while ((line = fileReader.ReadLine()) != null)
                {
                    if (fileReader.EndOfStream)
                    {
                        condition += "'" + line + "'";
                    }
                    else
                    {
                        condition += "'" + line + "'" + ",";
                    }
                }
            }

            List <PaymentLogo> paymentList = LogoHelper.GetPaymentsFromLogo(condition);

            if (paymentList.Count > 0)
            {
                if (!File.Exists(logFile))
                {
                    File.Create(logFile);
                }

                StreamWriter sw = new System.IO.StreamWriter(logFile);

                foreach (PaymentLogo item in paymentList)
                {
                    Console.Clear();
                    Console.WriteLine(paymentList.IndexOf(item) + 1 + " / " + paymentList.Count);
                    Console.WriteLine(item.VoucherNumber);
                    PaymentLogo crm = LogoHelper.GetPaymentFromCrm(crmSda, item.VoucherNumber);
                    try
                    {
                        if (!string.IsNullOrEmpty(crm.CrmId))
                        {
                            item.CrmId = crm.CrmId;
                            if (item.VoucherAmount == 0 || item.VoucherAmount != crm.VoucherAmount)//crm virgül
                            {
                                continue;
                            }
                            if (item.TransactionCurrencyName == string.Empty || (item.TransactionCurrencyName == "EUR" ? "Euro" : item.TransactionCurrencyName) != crm.TransactionCurrencyName)
                            {
                                continue;
                            }
                            if (item.BalanceAmount != crm.VoucherAmount - item.Amount)
                            {
                                continue;
                            }
                            LogoHelper.UpdatePaymentCrm(crmSda, item);
                            sw.WriteLine(item.VoucherNumber);
                        }
                    }
                    catch (Exception ex)
                    {
                        StreamWriter file2 = new StreamWriter(@"C:\Nef\LogoAktarimLog.txt", true);
                        file2.WriteLine("-----------------" + DateTime.Now.ToShortDateString() + "----------------------");
                        file2.WriteLine("SERİ NO:" + item.VoucherNumber);
                        file2.WriteLine(ex.Message);
                        file2.Close();
                    }
                }
                sw.Close();
            }
            else
            {
                Console.WriteLine("Aktarılacak kayıt bulunamadı.");
                Console.ReadLine();
            }
        }