Exemplo n.º 1
0
        static void Main(string[] args)
        {
            PrintData pd = new PrintData(); // create PrintData type and use its method Print

            pd.Print(100);                  // This is integer
            pd.Print(100.5M);               // Overloading on the same method, just for decimals



            List <string> list = new List <string> ()
            {
                "Igor", "Dejan"
            };

            pd.Print(list);

            Dictionary <int, string> dictionary = new Dictionary <int, string>
            {
                { 24, "Dimitar" }, { 27, "Dejan" }, { 23, "Stefan" }
            };

            pd.Print(dictionary);


            Console.ReadLine();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Метод записывает массив в файл перезаписью имеющихся данных
 /// </summary>
 /// <param name="path">Путь к целевому файлу</param>
 /// <param name="arr">Входящий массив для записи в файл</param>
 public static void WriteToFile(string path, int[] arr)
 {
     try
     {
         StreamWriter sw = new StreamWriter(path);
         for (int i = 0; i < arr.Length; i++)
         {
             if (i == 0)
             {
                 sw.Write(arr[i]);
             }
             else
             {
                 sw.Write($"\n{arr[i]}");
             }
         }
         sw.Close();
         Console.WriteLine($"В файл \"{path.Replace("..\\"," ").Trim()}\" произведена запись массива");
         PrintData.ArrPrint(arr, 5);
         Console.WriteLine();
     }
     catch (Exception e)
     {
         Console.WriteLine($"Ошибка: {e.Message} Запись в файл не произведена");
     }
 }
Exemplo n.º 3
0
        public static void DisplayData(PrintData PMethod)
        {
            Console.WriteLine("Enter your Name");
            string str = Console.ReadLine();

            PMethod(str + " should go to the ");    //Calling the deleagte with a string as a parameter
        }
Exemplo n.º 4
0
        static int SearchCouples(int[] array)
        {
            int cost = 0;


            for (int i = 0; i < array.Length - 1; i++)
            {
                if (array[i + 1] == 0 && (array[i] % 3) == 0)
                {
                    cost++;
                }
                else if ((array[i] % 3) == 0 && (array[i + 1] % 3) != 0)
                {
                    cost++;
                }
                else if ((array[i + 1] % 3) == 0 && (array[i] % 3) != 0)
                {
                    cost++;
                }
            }
            ;

            PrintData.Print("Количесто пар ", cost);
            return(cost);
        }
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="sender">触发控件</param>
        /// <param name="e">事件参数</param>
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (grdOrderList.Rows.Count > 0)
            {
                List <PrintData> iGroupIdList = new List <PrintData>();
                DataTable        dt           = grdOrderList.DataSource as DataTable;
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["checked"].ToString().Equals("1"))
                    {
                        PrintData printData = new PrintData();
                        printData.groupId  = Convert.ToInt32(dr["GroupID"]);
                        printData.execDate = Convert.ToDateTime(dr["ExecDate"]);

                        if (!iGroupIdList.Exists(x => x.groupId == printData.groupId && x.execDate == printData.execDate))
                        {
                            iGroupIdList.Add(printData);
                        }
                    }
                }

                if (iGroupIdList.Count <= 0)
                {
                    MessageBox.Show("无可打印的执行单!");
                }

                PrinterExeCard(iGroupIdList);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 以DataRelation實作DataTable中的Sum運算
        /// </summary>
        /// <param name="ds"></param>
        private static void ComputeSum(DataSet ds)
        {
            DataTable orderDt = ds.Tables["OrderDetail"];

            DataTable sumDt = new DataTable();

            sumDt.TableName = "GruopSum";
            sumDt.Columns.Add("ProductId", typeof(int));
            sumDt.Columns.Add("Discount", typeof(decimal));
            sumDt.Columns.Add("Sum", typeof(int));

            //寫入group by的兩個欄位
            foreach (DataRow dr in orderDt.Rows)
            {
                if (sumDt.Select(string.Format("productId = {0} and discount = {1}", dr["ProductId"], dr["Discount"])).Length == 0)
                {
                    sumDt.Rows.Add(new object[] { dr["ProductId"], dr["Discount"] });
                }
            }

            ds.Tables.Add(sumDt);

            //指定group by欄位對應, 加入relation
            ds.Relations.Add("GroupSumRelation",
                             new DataColumn[] { sumDt.Columns["ProductId"], sumDt.Columns["Discount"] },
                             new DataColumn[] { orderDt.Columns["ProductId"], orderDt.Columns["Discount"] });

            //指定彙總函數運算使用的relation及欄位
            sumDt.Columns["Sum"].Expression = "Sum(Child(GroupSumRelation).Quantity)";

            PrintData.PrintDataSet(ds);
        }
Exemplo n.º 7
0
 public PrintData(PrintData data)
 {
     Builder            = data.Builder;
     WasPtrExpression   = data.WasPtrExpression;
     IsConstModified    = data.IsConstModified;
     IsVolatileModified = data.IsVolatileModified;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Метод записывает массив в файл добавлением к имеющимся данным
        /// </summary>
        /// <param name="path">Путь к целевому файлу</param>
        /// <param name="arr">Входящий массив для записи в файл</param>
        public static void AppendToFile(string path, int[] arr)
        {
            try
            {
                StreamReader sr      = new StreamReader(path, true);
                string       initStr = sr.ReadLine();
                sr.Close();
                StreamWriter sw = new StreamWriter(path, true);

                for (int i = 0; i < arr.Length; i++)
                {
                    if (i == 0 && (initStr == null || initStr.Trim().Length == 0))
                    {
                        sw.Write($"{arr[i]}");
                    }
                    else
                    {
                        sw.Write($"\n{arr[i]}");
                    };
                }
                sw.Close();
                Console.WriteLine($"В файл \"{path.Replace("..\\", " ").Trim()}\" произведена запись массива");
                PrintData.ArrPrint(arr, 5);
                Console.WriteLine("\n");
            }
            catch (Exception e)
            {
                Console.WriteLine($"Ошибка: {e.Message} Запись в файл не произведена");
            }
        }
Exemplo n.º 9
0
        void DrawStage()
        {
            if (m_stageselector == null)
            {
                return;
            }

            PrintData pd = (m_blinkval > 0) ? m_stagefont1 : m_stagefont2;

            if (m_stageselected)
            {
                pd = m_stagedonefont;
            }

            StageProfile sp = (m_currentstage >= 0 && m_currentstage < StageProfiles.Count) ? StageProfiles[m_currentstage] : null;

            m_stagedisplaybuilder.Length = 0;
            if (sp != null)
            {
                m_stagedisplaybuilder.AppendFormat("Stage {0}: {1}", m_currentstage + 1, sp.Name);
            }
            else
            {
                m_stagedisplaybuilder.Append("Stage: Random");
            }

            Print(pd, (Vector2)m_stageposition, m_stagedisplaybuilder.ToString(), null);
        }
Exemplo n.º 10
0
        static void Main()
        {
            string path = @"..\..\..\FileToRead.txt";

            string[] arr = FileRead.ReadFileToArr(path);
            PrintData.ArrPrint(arr, 50);
            Console.ReadLine();
        }
Exemplo n.º 11
0
        public Object RegisterPrintModel(string parameters)
        {
            ParameterHelper ph     = new ParameterHelper(parameters);
            int             billid = ph.GetParameterValue <int>("billid");

            DBHelper db       = new DBHelper();
            var      bill     = db.First("bill", billid);
            var      employee = db.First("employee", bill.content.Value <int>("employeeid"));
            var      maker    = db.First("employee", bill.content.Value <int>("makerid"));
            var      vendor   = db.First("vendor", bill.content.Value <int>("vendorid"));

            decimal total = bill.content.Value <decimal>("total");

            PrintData pd = new PrintData();

            pd.HeaderField = new List <string>()
            {
                "公司名称",
                "单据编号",
                "单据日期",
                "经手人",
                "供应商名称",
                "供应商联系人",
                "供应商电话",
                "供应商地址",
                "备注",
                "系统日期",
                "系统时间",
                "应付调整金额",
                "应付调整金额大写"
            };

            pd.HeaderValue = new Dictionary <string, string>()
            {
                { "公司名称", PluginContext.Current.Account.CompanyName },
                { "单据编号", bill.content.Value <string>("billcode") },
                { "单据日期", bill.content.Value <string>("billdate") },
                { "经手人", employee.content.Value <string>("name") },
                { "供应商名称", vendor.content.Value <string>("name") },
                { "供应商联系人", vendor.content.Value <string>("linkman") },
                { "供应商电话", vendor.content.Value <string>("linkmobile") },
                { "供应商地址", vendor.content.Value <string>("address") },
                { "备注", bill.content.Value <string>("comment") },
                { "系统日期", DateTime.Now.ToString("yyyy-MM-dd") },
                { "系统时间", DateTime.Now.ToString("yyyy-MM-dd HH:mm") },
                { "应付调整金额", total.ToString("n2") },
                { "应付调整金额大写", MoneyHelper.ConvertSum(total) }
            };

            pd.DetailField = new List <string>();
            pd.DetailValue = new List <Dictionary <string, string> >();

            PrintManager pm      = new PrintManager(PluginContext.Current.Account.ApplicationId);
            int          modelid = pm.RegisterPrintModel(pd);

            return(new { modelid = modelid });
        }
Exemplo n.º 12
0
        public void Print(PrintData printdata, Vector2 location, String text, Rectangle?scissorrect)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }

            MenuSystem.FontMap.Print(printdata, location, text, scissorrect);
        }
Exemplo n.º 13
0
 public void clone(PrintData src)
 {
     Cmd = src.Cmd;
     F   = src.F;
     X   = src.X;
     Y   = src.Y;
     Z   = src.Z;
     E   = src.E;
 }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            PrintData obj = new PrintData();

            obj.print(5);
            obj.print(5.25);
            obj.print("C#");
            Console.ReadLine();
        }
Exemplo n.º 15
0
 public FormDeliveryGoods(SalesOrder salesOrder, PrintData printData, string telephone, string customerName, string address)
 {
     _salesOrder   = salesOrder;
     _printData    = printData;
     _telephone    = telephone;
     _customerName = customerName;
     _address      = address;
     InitializeComponent();
 }
Exemplo n.º 16
0
        public static void Main()
        {
            //Initializing the Delegate object
            PrintData Cn = new PrintData(WriteConsole);
            PrintData Fl = new PrintData(WriteFile);

            //Invoking the DisplayData method with the Delegate object as the argument Using Delegate
            DisplayData(Cn);
            DisplayData(Fl);
            Console.ReadLine();
        }
Exemplo n.º 17
0
 public Form_Input_fs(string tm, string pm, string sj)
 {
     InitializeComponent();
     this.textBox1_副本份数.Select();
     this.textBox1_副本份数.SelectAll();
     _printdata    = new PrintData();
     _printdata.tm = this.textBo_条码.Text = tm;
     _printdata.pm = this.textBox_品名.Text = pm;
     _printdata.sj = this.textBox1_售价.Text = sj;
     _printdata.fs = "1";
     _printdata.hh = "";
 }
Exemplo n.º 18
0
        //ctor
        public DocManagement(Action <string> dataMsg, int minWord = 5, int maxWord = 10, int delateAfterSeconds = 10)
        {
            DataPrinter  = new PrintData(dataMsg);
            this.minWord = minWord; this.maxWord = maxWord;
            DocHash      = new Hash <string, Document>(9);
            DateQueue    = new Queue <TimeData>();

            timeS = new TimeSpan(0, 0, 0, delateAfterSeconds);

            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            aTimer.Interval = delateAfterSeconds * 1000;
            aTimer.Enabled  = true;
        }
Exemplo n.º 19
0
        public static bool Render(Node n, out string expression, CancellationToken cancel)
        {
            var data    = new PrintData();
            var success = new SuccessToken();

            Factory.Instance.ToAST(n).Compute <PrintData, bool>(
                data,
                (m, d) => Unfold(m, d, success),
                (m, v, children) => true,
                cancel);
            expression = data.Builder.ToString().Trim();
            return(success.Succeeded);
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            PrintData p = new PrintData();
            int       x = Convert.ToInt32(Console.ReadLine());
            double    y = Convert.ToDouble(Console.ReadLine());
            string    z = Console.ReadLine();

            p.print(x);
            p.print("");
            p.print(4.76875);

            Console.ReadKey();
        }
Exemplo n.º 21
0
 public Form_Input_fs(string tm, string pm, string sj)
 {
     InitializeComponent();
     this.StartPosition = FormStartPosition.CenterParent;
     this.Icon = Properties.Resources.yuan;
     this.textBox1_副本份数.Select();
     this.textBox1_副本份数.SelectAll();
     _printdata = new PrintData();
     _printdata.tm = this.textBo_条码.Text = tm;
     _printdata.pm = this.textBox_品名.Text = pm;
     _printdata.sj = this.textBox1_售价.Text = sj;
     _printdata.fs = "1";
     _printdata.hh = "";
 }
 public IHttpActionResult Cancel(PrintData item)
 {
     try
     {
         var service = BartenderService.Service;
         service.Cancel(item.PrintCommand);
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.NotFound, String.Empty)));
     }
     catch (Exception ex)
     {
         ex.Data.Add("PrintController.Operation", "Cancel");
         _log.Error(ex.Message, ex);
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
Exemplo n.º 23
0
 /// <summary>
 /// Returns a file number based on the number of lines in the file with the given name.
 /// </summary>
 /// <param name="fileName"></param>
 /// <returns></returns>
 private static int GetTrialNumber(string fileName)
 {
     // if the file does not exist
     // i.e., there have never been any trials
     if (!PrintData.FileExists(fileName))
     {
         // reset trial number
         return(1);
     }
     else
     {
         // trial number is the number of lines in the file
         return(PrintData.LineCount(fileName));
     }
 }
Exemplo n.º 24
0
        static int[] CreateArray(int sizeArray)
        {
            int[] arr = new int[sizeArray];

            Random r = new Random();

            for (int i = 0; i < sizeArray; i++)
            {
                arr[i] = r.Next(-10_000, 10_000);
            }
            ;

            PrintData.Print("Изначальный массив", arr);
            return(arr);
        }
Exemplo n.º 25
0
        public ActionResult QueryFieldNameByType(string fieldtype, int modelid)
        {
            var          account = User.Identity.GetAccount();
            PrintManager pm      = new PrintManager(account.ApplicationId);
            PrintData    pd      = pm.GetPrintModel(modelid);

            if (fieldtype == "header")
            {
                return(Json(pd.HeaderField, "text/plain", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(pd.DetailField, "text/plain", JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 26
0
        public static void Main()
        {
            //Initializing the Delegate object
            PrintData Cn = new PrintData(WriteConsole);
            PrintData Fl = new PrintData(WriteFile);

            //Invoking the DisplayData method with the Delegate object as the argument
            //Using Delegate
            DisplayData(Cn);
            DisplayData(Fl);
            WriteConsole("Hello");
            WriteFile("This is saved permanently");

            Console.ReadLine();
        }
        public IHttpActionResult SendPrint(PrintData item)
        {
            try
            {
                var service = BartenderService.Service;
                var message = service.Print(item);

                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.NotFound, message)));
            }
            catch (Exception ex)
            {
                ex.Data.Add("PrintController.Operation", "SendPrint");
                _log.Error(ex.Message, ex);
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Exemplo n.º 28
0
 public void DoPrintPaidOrder(PrintData printData)
 {
     if (printData != null)
     {
         _printLayoutPath = _printPaidOrderLayoutPath;
         _printData       = printData;
         try
         {
             _printDocument.Print();
         }
         catch (Exception exception)
         {
             LogHelper.GetInstance().Error("DriverOrderPrint.DoPrintPaidOrder error.", exception);
         }
     }
 }
Exemplo n.º 29
0
        static void Main()
        {
            //byte step = 2;
            OneDimArray arr = new OneDimArray(50, 1, 15);

            PrintData.ArrPrint(arr.GetArr(), 15);
            Console.WriteLine();
            PrintData.ArrPrint(arr.GetArrReversed(), 15);
            Console.WriteLine();
            arr.Multi(5);
            PrintData.ArrPrint(arr.GetArr(), 5);
            Console.WriteLine($"\n{arr.ToString()}");
            Console.WriteLine();
            PrintData.DictPrint(arr.EachElCount);
            Console.ReadLine();
        }
Exemplo n.º 30
0
        static void Main(string[] args)
        {
            DataSet ds;

            //ds = GetDataByAdapter();
            ds = GetDataByReader();

            //資料來源須配合GetDataByAdapter()
            //UpdateProductName(ds);

            PrintData.PrintDataSet(ds);

            //資料來源須配合GetDataByAdapter()
            //BulkCopy(ds);

            Console.ReadKey();
        }
Exemplo n.º 31
0
        static void Main()
        {
            string str = "Особенности производительности Методы Split выделяют память для возвращаемого объекта массива и объект "
                         + "String для каждого элемента массива. Если приложению требуется оптимальная производительность или управление "
                         + "выделением памяти является критически важным в приложении, рассмотрите возможность использования метода IndexOf "
                         + "или IndexOfAny и, при необходимости, метода Compare для нахождение подстроки в строке";

            Massage.WordLettersMoreThan(str, 6);                   // Метод №1
            Console.WriteLine();
            Massage.DeleteWordsEndingChar(str, 'а');               // Метод №2
            Console.WriteLine();
            Massage.LongestWord(str);                              // Метод №3
            Console.WriteLine();
            Massage.StrBuilderLgstWord(str);                       // Метод №4
            Console.WriteLine();
            PrintData.DictPrint(Massage.FrequencyDictionary(str)); // Метод №
            Console.ReadLine();
        }