Esempio n. 1
0
 public Shield()
 {
     Front frontPanel = new Front();
     Rear rearPanel = new Rear();
     Top topPanel = new Top();
     Bottom bottomPanel = new Bottom();
     Right rightPanel = new Right();
     Left leftPanel = new Left();
 }
Esempio n. 2
0
 /// <summary>
 /// Horizontal concat
 /// </summary>
 /// <param name="first"></param>
 /// <param name="second"></param>
 /// <returns></returns>
 public static IWavyBorder<IEnumerable<Point>> Merge(
     this IWavyBorder<IEnumerable<Point>> first,
     IWavyBorder<IEnumerable<Point>> second)
 {
     var left = first.Bottoms.Last();
     var right = second.Bottoms.First();
     var middle = new Bottom<IEnumerable<Point>>(left.Start, right.Finish); 
     var bottoms = (first.Bottoms.Init())
         .Concat(new[]{middle})
         .Concat(second.Bottoms.Tail());
     var waves = first.Waves.Concat(second.Waves);
     return new WavyBorder<IEnumerable<Point>>(waves,bottoms);
 }
Esempio n. 3
0
 public override string ToString()
 {
     return($"L:{Left.ToString(".00")} T:{Top.ToString(".00")} R:{Right.ToString(".00")} B:{Bottom.ToString(".00")}");
 }
Esempio n. 4
0
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     return(Left.GetHashCode() ^ 1 + Top.GetHashCode() ^ 2 + Front.GetHashCode() ^ 3 + Right.GetHashCode() ^ 4 + Bottom.GetHashCode() ^ 5 + Behind.GetHashCode());
 }
Esempio n. 5
0
 public override int GetHashCode()
 {
     return(Left.GetHashCode() ^ Right.GetHashCode() ^ Top.GetHashCode() ^ Bottom.GetHashCode());
 }
Esempio n. 6
0
 bool Equals(Thickness other)
 {
     return(Left.Equals(other.Left) && Top.Equals(other.Top) && Right.Equals(other.Right) && Bottom.Equals(other.Bottom));
 }
Esempio n. 7
0
 public override string ToString()
 {
     return("{Left=" + Left.ToString() + ",Top=" + Top.ToString() + ",Right=" + Right.ToString() + ",Bottom=" + Bottom.ToString() + "}");
 }
Esempio n. 8
0
 public override string ToString()
 {
     return(Left.ToString() + ", " + Top.ToString() + ", " + Right.ToString() + ", " + Bottom.ToString());
 }
Esempio n. 9
0
        public string ToString(int mode = 0)
        {
            if (mode == 1)
            {
                double width  = Right - Left;
                double height = Bottom - Top;
                return(string.Format("{0},{1},{2},{3}", Left.ToString(), Top.ToString(), width.ToString(), height.ToString()));
            }
            else if (mode == 2)
            {
                string mode_1 = Mode_1 == 0 ? "left" : Mode_1 == 1 ? "center" : Mode_1 == 2 ? "right" : "normal";
                string mode_2 = Mode_2 == 0 ? "left" : Mode_2 == 1 ? "center" : Mode_2 == 2 ? "right" : "normal";

                if (Mode_1 == Mode_2)
                {
                    return(string.Format("{0},{1},{2},{3},{4}", Left.ToString(), Top.ToString(), Right.ToString(), Bottom.ToString(), mode_1));
                }
                else
                {
                    return(string.Format("{0},{1},{2},{3},{4},{5}", Left.ToString(), Top.ToString(), mode_1, Right.ToString(), Bottom.ToString(), mode_2));
                }
            }
            else
            {
                return(string.Format("{0},{1},{2},{3}", Left.ToString(), Top.ToString(), Right.ToString(), Bottom.ToString()));
            }
        }
 public bool Equals(Fraction other)
 {
     return
         (Top.Equals(other.Top) &&
          Bottom.Equals(other.Bottom));
 }
Esempio n. 11
0
 public override int GetHashCode()
 {
     return(Top.GetHashCode() ^ Leading.GetHashCode() ^ Trailing.GetHashCode() ^ Bottom.GetHashCode());
 }
Esempio n. 12
0
 public bool Contains(Point p)
 {
     return Left.ApproxLessOrEqualTo(p.X) && p.X.ApproxLessOrEqualTo(Right) &&
            Bottom.ApproxLessOrEqualTo(p.Y) && p.Y.ApproxLessOrEqualTo(Top);
 }
Esempio n. 13
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Left.GetHashCode() * 397) ^ (Right.GetHashCode() * 397) ^ (Top.GetHashCode() * 397) ^ Bottom.GetHashCode());
     }
 }
Esempio n. 14
0
 public Block GetBottomBlock()
 {
     return(Bottom.GetOther(this));
 }
Esempio n. 15
0
        // This function got messy.  Sorry.
        public void DigRiver(River river, int size)
        {
            SetRiverTile(river);
            TerrainData.RiverSize = size;

            if (size == 1)
            {
                if (Bottom != null)
                {
                    Bottom.SetRiverTile(river);
                    if (Bottom.Right != null)
                    {
                        Bottom.Right.SetRiverTile(river);
                    }
                }
                if (Right != null)
                {
                    Right.SetRiverTile(river);
                }
            }

            if (size == 2)
            {
                if (Bottom != null)
                {
                    Bottom.SetRiverTile(river);
                    if (Bottom.Right != null)
                    {
                        Bottom.Right.SetRiverTile(river);
                    }
                }
                if (Right != null)
                {
                    Right.SetRiverTile(river);
                }
                if (Top != null)
                {
                    Top.SetRiverTile(river);
                    if (Top.Left != null)
                    {
                        Top.Left.SetRiverTile(river);
                    }
                    if (Top.Right != null)
                    {
                        Top.Right.SetRiverTile(river);
                    }
                }
                if (Left != null)
                {
                    Left.SetRiverTile(river);
                    if (Left.Bottom != null)
                    {
                        Left.Bottom.SetRiverTile(river);
                    }
                }
            }

            if (size == 3)
            {
                if (Bottom != null)
                {
                    Bottom.SetRiverTile(river);
                    if (Bottom.Right != null)
                    {
                        Bottom.Right.SetRiverTile(river);
                    }
                    if (Bottom.Bottom != null)
                    {
                        Bottom.Bottom.SetRiverTile(river);
                        if (Bottom.Bottom.Right != null)
                        {
                            Bottom.Bottom.Right.SetRiverTile(river);
                        }
                    }
                }
                if (Right != null)
                {
                    Right.SetRiverTile(river);
                    if (Right.Right != null)
                    {
                        Right.Right.SetRiverTile(river);
                        if (Right.Right.Bottom != null)
                        {
                            Right.Right.Bottom.SetRiverTile(river);
                        }
                    }
                }
                if (Top != null)
                {
                    Top.SetRiverTile(river);
                    if (Top.Left != null)
                    {
                        Top.Left.SetRiverTile(river);
                    }
                    if (Top.Right != null)
                    {
                        Top.Right.SetRiverTile(river);
                    }
                }
                if (Left != null)
                {
                    Left.SetRiverTile(river);
                    if (Left.Bottom != null)
                    {
                        Left.Bottom.SetRiverTile(river);
                    }
                }
            }

            if (size == 4)
            {
                if (Bottom != null)
                {
                    Bottom.SetRiverTile(river);
                    if (Bottom.Right != null)
                    {
                        Bottom.Right.SetRiverTile(river);
                    }
                    if (Bottom.Bottom != null)
                    {
                        Bottom.Bottom.SetRiverTile(river);
                        if (Bottom.Bottom.Right != null)
                        {
                            Bottom.Bottom.Right.SetRiverTile(river);
                        }
                    }
                }
                if (Right != null)
                {
                    Right.SetRiverTile(river);
                    if (Right.Right != null)
                    {
                        Right.Right.SetRiverTile(river);
                        if (Right.Right.Bottom != null)
                        {
                            Right.Right.Bottom.SetRiverTile(river);
                        }
                    }
                }
                if (Top != null)
                {
                    Top.SetRiverTile(river);
                    if (Top.Right != null)
                    {
                        Top.Right.SetRiverTile(river);
                        if (Top.Right.Right != null)
                        {
                            Top.Right.Right.SetRiverTile(river);
                        }
                    }
                    if (Top.Top != null)
                    {
                        Top.Top.SetRiverTile(river);
                        if (Top.Top.Right != null)
                        {
                            Top.Top.Right.SetRiverTile(river);
                        }
                    }
                }
                if (Left != null)
                {
                    Left.SetRiverTile(river);
                    if (Left.Bottom != null)
                    {
                        Left.Bottom.SetRiverTile(river);
                        if (Left.Bottom.Bottom != null)
                        {
                            Left.Bottom.Bottom.SetRiverTile(river);
                        }
                    }

                    if (Left.Left != null)
                    {
                        Left.Left.SetRiverTile(river);
                        if (Left.Left.Bottom != null)
                        {
                            Left.Left.Bottom.SetRiverTile(river);
                        }
                        if (Left.Left.Top != null)
                        {
                            Left.Left.Top.SetRiverTile(river);
                        }
                    }

                    if (Left.Top != null)
                    {
                        Left.Top.SetRiverTile(river);
                        if (Left.Top.Top != null)
                        {
                            Left.Top.Top.SetRiverTile(river);
                        }
                    }
                }
            }
        }
Esempio n. 16
0
 /// <summary>Returns a String that represents the current BoundingFrustum.</summary>
 public override string ToString()
 {
     return(string.Format(CultureInfo.CurrentCulture, "{{Near:{0} Far:{1} Left:{2} Right:{3} Top:{4} Bottom:{5}}}", new object[] { Near.ToString(), Far.ToString(), Left.ToString(), Right.ToString(), Top.ToString(), Bottom.ToString() }));
 }
Esempio n. 17
0
 public string ToString(string format, IFormatProvider provider)
 {
     return($"Left={Left.ToString(format, provider)} Top={Top.ToString(format, provider)} Right={Right.ToString(format, provider)} Bottom={Bottom.ToString(format, provider)}");
 }
Esempio n. 18
0
        public static IWavyBorder<double> Normalize(this IWavyBorder<Point> border)
        {
            var length = border.Length();

            var waves = border.Waves.ToArray();
            var bottoms = border.Bottoms.ToArray();

            var resultBottoms = new List<IBottom<double>>();
            var resultWaves = new List<IWave<double>>();

            var current = 0.0;

            for (var i = 1; i <= waves.Length && i < bottoms.Length; i++)
            {
                var wave = waves[i - 1];
                var left = bottoms[i - 1];
                var rigth = bottoms[i];

                if (!resultBottoms.Any())
                {
                    current += left.Length();
                }

                var distance = (left.Finish).DistanceTo(rigth.Start);

                var leftB = new Bottom<double>(current - left.Length(), current)
                    .Transform(t => t/length);
                var rigthB = new Bottom<double>(current + distance, current + distance + rigth.Length())
                    .Transform(t => t/length);

                if (!resultBottoms.Any())
                {
                    resultBottoms.Add(leftB);
                }

                resultBottoms.Add(rigthB);

                var w = wave
                    .Transform(p => p.Projection(left.Middle(), rigth.Middle()))
                    .Transform(t => leftB.Middle() + (rigthB.Middle() - leftB.Middle())*t);

                resultWaves.Add(w);

                current +=  distance + rigth.Length();
            }
            return new WavyBorder<double>(resultWaves, resultBottoms);
        }
Esempio n. 19
0
 public BottomResizer(Bottom bottom)
 {
     this.bottom = bottom;
 }
 public override string ToString()
 {
     return("DataGridViewAdvancedBorderStyle { All=" + All.ToString() + ", Left=" + Left.ToString() + ", Right=" + Right.ToString() + ", Top=" + Top.ToString() + ", Bottom=" + Bottom.ToString() + " }");
 }
Esempio n. 21
0
 /// <summary>
 /// Calculate the boundary coordinate of the wire-frame.
 /// </summary>
 /// <param name="origin">Origin coordinate</param>
 /// <param name="vX">X Vector</param>
 /// <param name="vY">Y Vector</param>
 public void Boundary(out XYZ origin, out XYZ vX, out XYZ vY)
 {
     origin = Vertical.GetEndPoint(1);
     vX     = Bottom.GetEndPoint(1) - Bottom.GetEndPoint(0);
     vY     = Vertical.GetEndPoint(0) - Vertical.GetEndPoint(1);
 }
Esempio n. 22
0
 public override int GetHashCode() => Left.GetHashCode() ^ Right.GetHashCode() ^ Bottom.GetHashCode() ^ Top.GetHashCode();
        protected override void WndProc(ref Message message)
        {
            try
            {
                if (message.Msg == WM_SYSCOMMAND && (message.WParam.ToInt32() & 0xfff0) == SC_SIZE)
                {
                    if (FormResizable)
                    {
                        GetSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, out int isDragFullWindow, 0);

                        if (isDragFullWindow != 0)
                        {
                            SetSystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 0, 0, 0);
                        }

                        base.WndProc(ref message);

                        if (isDragFullWindow != 0)
                        {
                            SetSystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 1, 0, 0);
                        }
                    }
                }
                else
                {
                    if (message.Msg == 0x84) // WM_NCHITTEST
                    {
                        if (FormResizable)
                        {
                            // Always add grid styles regardless of border type

                            var cursor = PointToClient(Cursor.Position);

                            if (TopLeft.Contains(cursor))
                            {
                                message.Result = (IntPtr)HTTOPLEFT;
                            }
                            else if (TopRight.Contains(cursor))
                            {
                                message.Result = (IntPtr)HTTOPRIGHT;
                            }
                            else if (BottomLeft.Contains(cursor))
                            {
                                message.Result = (IntPtr)HTBOTTOMLEFT;
                            }
                            else if (BottomRight.Contains(cursor))
                            {
                                message.Result = (IntPtr)HTBOTTOMRIGHT;
                            }
                            else if (Top.Contains(cursor))
                            {
                                message.Result = (IntPtr)HTTOP;
                            }
                            else if (Left.Contains(cursor))
                            {
                                message.Result = (IntPtr)HTLEFT;
                            }
                            else if (Right.Contains(cursor))
                            {
                                message.Result = (IntPtr)HTRIGHT;
                            }
                            else if (Bottom.Contains(cursor))
                            {
                                message.Result = (IntPtr)HTBOTTOM;
                            }
                        }
                        else
                        {
                            Cursor.Current = Cursors.Arrow;
                            message.Result = (IntPtr)1;  // Processed6
                            return;
                        }
                    }

                    base.WndProc(ref message);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(
                    "The application encountered a fatal error and must be restarted. Please contact the service desk with this message: " +
                    e.Message, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="retailCostume"></param>
        /// <param name="times">打印次数</param>
        public void Print(RetailCostume retailCostume, int times, DataGridView dataGridView)
        {
            this.retailCostume = retailCostume;
            InteractResult <RetailPrintType> rPrintType = CommonGlobalCache.ServerProxy.GetRetailPrintType();

            if (rPrintType.ExeResult == ExeResult.Success)
            {
                if (rPrintType.Data == RetailPrintType.SmallTickets)
                {
                    InteractResult <PrintTemplateInfo> result = CommonGlobalCache.ServerProxy.GetPrintTemplateInfo(PrintTemplateType.Retail);
                    if (result.ExeResult == ExeResult.Success)
                    {
                        PrintTemplateInfo PTemplateInfo = result.Data;
                        this.CurrentPTemplate = PTemplateInfo;
                        PrintHelper printer = new PrintHelper(RetailCostume_PrintPage2);
                        printer.printDocument.DefaultPageSettings.Margins   = new Margins(1, 1, 5, 1);
                        printer.printDocument.DefaultPageSettings.PaperSize = new PaperSize(retailCostume.RetailOrder.ID, PrintHelper.GetInch(8), 600);
                        printer.DirectlyPrint(this.CurrentPTemplate.PrintCount);
                    }
                }
                else
                {
                    setPrintDataGridView(retailCostume, dataGridView, PrintTemplateType.RetailOrder);
                }
            }
            else
            {
            }
            /**/
        }

        private static void setPrintDataGridView(RetailCostume item, DataGridView dataGridView2, PrintTemplateType type)
        {
            InteractResult <PrintTemplateInfo> result = CommonGlobalCache.ServerProxy.GetPrintTemplateInfo(type);

            //行列数基本不受限制,但超过一页失去意义,因为以Body为主,以其它为辅
            //   Header header = new Header(4, 2);
            //可以指定每页是否重复打印
            if (result.ExeResult == ExeResult.Success)
            {
                PrintTemplateInfo CurrentPTemplate = result.Data;
                for (int c = 0; c < CurrentPTemplate.PrintCount; c++)
                {
                    MisGoldPrinterOfReWrite misGoldPrinter = new MisGoldPrinterOfReWrite(false, new PrinterMargins(20, 20, 20, 20, 800, 1129));


                    misGoldPrinter.Title = CurrentPTemplate.OrderName; //主标题(C#用\n表示换行)	}

                    misGoldPrinter.Caption = "";

                    double headRow = Math.Round(Convert.ToSingle(CurrentPTemplate.SystemVariables.Count / 2));

                    Header header = new Header(Convert.ToInt32(headRow) + 1, 2);
                    // CommonGlobalUtil.WriteLog("变量总数=" + CurrentPTemplate.SystemVariables.Count + "\r\n" + "应显示行号=" + headRow);
                    header.IsDrawAllPage = true;
                    #region
                    Member _member = null;
                    if (item.RetailOrder.MemeberID != null)
                    {
                        _member = CommonGlobalCache.ServerProxy.GetOneMember(item.RetailOrder.MemeberID);
                    }
                    for (int i = 0; i < CurrentPTemplate.SystemVariables.Count; i++)
                    {
                        int curR = 0;
                        if (i < 2)
                        {
                            curR = 0;
                        }
                        else
                        {
                            double resRow = i / 2;
                            curR = Convert.ToInt32(Math.Round(resRow));
                        }
                        string KeyStr = "";
                        if (CurrentPTemplate.SystemVariables[i] == "销售单号")
                        {
                            KeyStr = "销售单号:";
                            header.SetText(curR, i % 2, CurrentPTemplate.SystemVariables[i] + ":" + item.RetailOrder.ID);
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "单据日期")
                        {
                            KeyStr = "单据日期:";
                            header.SetText(curR, i % 2, KeyStr + item.RetailOrder.CreateTime.GetDateTimeFormats('f')[0].ToString());
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "客户名称")
                        {
                            KeyStr = "客户名称:";
                            if (_member != null)
                            {
                                header.SetText(curR, i % 2, KeyStr + _member.Name);
                            }
                            else
                            {
                                header.SetText(curR, i % 2, KeyStr);
                            }
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "客户电话")
                        {
                            KeyStr = "客户电话:";
                            if (_member != null)
                            {
                                header.SetText(curR, i % 2, KeyStr + _member.PhoneNumber);
                            }
                            else
                            {
                                header.SetText(curR, i % 2, KeyStr);
                            }
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "客户地址")
                        {
                            KeyStr = "客户地址:";
                            if (_member != null)
                            {
                                header.SetText(curR, i % 2, KeyStr + _member.DetailAddress);
                            }
                            else
                            {
                                header.SetText(curR, i % 2, KeyStr);
                            }
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "操作人")
                        {
                            KeyStr = "操 作 人:";
                            header.SetText(curR, i % 2, KeyStr + CommonGlobalCache.GetUserName(item.RetailOrder.GuideID));
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "单据备注")
                        {
                            KeyStr = "备    注:";
                            header.SetText(curR, i % 2, KeyStr + item.RetailOrder.Remarks.ToString());
                        }
                    }
                    #endregion

                    misGoldPrinter.Header = header;

                    // List<PrintColumnInfo> allPrintColumnInfos=new List<PrintColumnInfo>();

                    List <PrintColumnInfo> dataGV           = new List <PrintColumnInfo>();
                    PrintColumnInfo        prinAutoIDColumn = new PrintColumnInfo();
                    prinAutoIDColumn.Name = "序列号";
                    prinAutoIDColumn.Rate = 5;
                    dataGV.Add(prinAutoIDColumn);
                    dataGV.AddRange(CurrentPTemplate.PrintColumnInfos);
                    //  allPrintColumnInfos = dataGV;

                    string ColumnsList = string.Empty;
                    foreach (PrintColumnInfo itemC in dataGV)
                    {
                        ColumnsList += itemC.Name + ",";
                    }
                    CommonGlobalUtil.WriteLog("模板设置打印列表头为=" + ColumnsList + "\r\n");
                    //表格是否为零条记录
                    bool isflag = false;
                    if (dataGV.Count == 0)
                    {
                        isflag = true;
                    }

                    List <int> columnCount         = new List <int>();
                    int        pinrtColNum         = 0;
                    string     dataGridColumnsList = string.Empty;
                    if (dataGridView2.Columns.Count > 0)
                    {
                        for (int i = 0; i < dataGridView2.Columns.Count; i++)
                        {
                            DataGridViewColumn column = dataGridView2.Columns[i];

                            if (dataGV.FindAll(t => t.Name == column.HeaderText).Count > 0)
                            {
                                columnCount.Add(i);
                                dataGridColumnsList += column.HeaderText + ",";
                                pinrtColNum++;
                            }
                            else
                            {
                                if (dataGV.FindAll(t => t.Name == column.DataPropertyName).Count > 0)
                                {
                                    columnCount.Add(i);
                                    column.HeaderText    = column.HeaderText.Replace("\r\n", " ");
                                    dataGridColumnsList += column.DataPropertyName + ",";
                                    pinrtColNum++;
                                }
                                else
                                {
                                    if (column.DataPropertyName.Contains("XL"))
                                    {
                                        string name = column.DataPropertyName;  //XL3
                                                                                //3XL
                                        string newname  = name.Replace("XL", "");
                                        string checkstr = newname + "XL";
                                        if (dataGV.FindAll(t => t.Name == checkstr).Count > 0)
                                        {
                                            columnCount.Add(i);
                                            column.HeaderText    = column.HeaderText.Replace("\r\n", " ");
                                            dataGridColumnsList += column.DataPropertyName + ",";
                                            pinrtColNum++;
                                        }
                                        else
                                        {
                                            column.Visible = false;
                                        }
                                    }
                                    else
                                    {
                                        column.Visible = false;
                                    }
                                }
                            }
                            if (isflag)
                            {
                                if (i == 0)
                                {
                                    //打印设置模板不设置任何列,但由于MisGoldPrinter这个类的打印主体为DataGridView,所有必须设置一列默认空的
                                    columnCount.Add(i);
                                    column.Visible    = true;
                                    column.HeaderText = "";

                                    DataTable  dt = new DataTable();
                                    DataColumn c1 = new DataColumn();
                                    c1.ColumnName = "HeaderText";

                                    dt.Columns.Add(c1);
                                    dataGridView2.DataSource = null;
                                    dataGridView2.DataSource = dt;
                                }
                            }
                            //}
                        }

                        CommonGlobalUtil.WriteLog("DataGridView能打印的列为=" + dataGridColumnsList);


                        MultiHeader multiHeader = new MultiHeader(1, dataGV.Count);
                        for (int a = 0; a < dataGV.Count; a++)
                        {
                            multiHeader.SetText(0, a, dataGV[a].Name);
                        }

                        misGoldPrinter.IsTotalIsDrawAllPage = false;


                        misGoldPrinter.DataSource = DataGridViewUtil.ToStringArray(dataGridView2, false, true);

                        misGoldPrinter.RowsPerPage       = CurrentPTemplate.Rows + 1; //根据设置传值
                        misGoldPrinter.IsSubTotalPerPage = true;

                        int footerRowsNum = 0;
                        if (((GoldPrinter.Body)(misGoldPrinter.Body)).Rows >= 2)
                        {
                            footerRowsNum = ((GoldPrinter.Body)(misGoldPrinter.Body)).Rows;
                        }
                        else
                        {
                            footerRowsNum = 2;
                        }

                        Footer footer         = new Footer(footerRowsNum, dataGV.Count);
                        int    colIndex       = -1;
                        int    colIndexSecond = -1;
                        for (int b = 0; b < dataGV.Count; b++)
                        {
                            if (dataGV[b].Name == "金额")
                            {
                                colIndex = b;
                            }
                            if (dataGV[b].Name == "数量")
                            {
                                colIndexSecond = b;
                            }
                        }

                        string addressStr = string.Empty;
                        for (int a = 0; a < CurrentPTemplate.SystemVariables.Count; a++)
                        {
                            //if (dataGridView2.Rows.Count >= 2)
                            //{
                            if (CurrentPTemplate.SystemVariables[a] == "店铺地址")
                            {
                                Shop curShop = CommonGlobalCache.GetShop(item.RetailOrder.ShopID);
                                if (curShop != null)
                                {
                                    footer.SetText(0, 0, "店铺地址:" + curShop.Address);
                                }
                            }
                            if (CurrentPTemplate.SystemVariables[a] == "联系电话")
                            {
                                Shop curShop = CommonGlobalCache.GetShop(item.RetailOrder.ShopID);
                                if (curShop != null)
                                {
                                    footer.SetText(1, 0, "联系电话:" + curShop.PhoneNumber);
                                }
                            }
                            //}
                            //else if(dataGridView2.Rows.Count >= 1)
                            //{
                            //    if (CurrentPTemplate.SystemVariables[a] == "店铺地址")
                            //    {
                            //        if (item.RetailOrder.ShopID != null && item.RetailOrder.ShopID != "_online")
                            //        {
                            //            addressStr += "店铺地址:" + CommonGlobalCache.GetShop(item.RetailOrder.ShopID).Address;
                            //        }
                            //    }
                            //    if (CurrentPTemplate.SystemVariables[a] == "联系电话")
                            //    {
                            //        if (addressStr != string.Empty)
                            //        {
                            //            addressStr += "       ";
                            //        }
                            //        if (item.RetailOrder.ShopID != null && item.RetailOrder.ShopID != "_online")
                            //        {
                            //            addressStr += "联系电话:" + CommonGlobalCache.GetShop(item.RetailOrder.ShopID).PhoneNumber;
                            //        }
                            //    }
                            //}
                        }
                        //if (dataGridView2.Rows.Count == 1)
                        //{
                        //    footer.SetText(0, 0, addressStr);
                        //}

                        MoneyConvertChinese MConvertC = new MoneyConvertChinese();

                        /*  if (dataGridView2.Rows.Count > 1)
                         * {
                         *    footer.SetText(0, 0, "合计 金额大写 " + MConvertC.MoneyToChinese(item.RetailOrder.TotalMoneyReceived.ToString()));
                         *
                         * }
                         * else
                         * {
                         *    footer.SetText(0, 0, addressStr + " 合计 金额大写 " + MConvertC.MoneyToChinese(item.RetailOrder.TotalMoneyReceived.ToString()));
                         *
                         * }*/
                        misGoldPrinter.EndSubTotalColsList = MConvertC.MoneyToChinese(item.RetailOrder.TotalMoneyReceived.ToString()) + ":" + item.RetailOrder.TotalMoneyReceived.ToString();
                        // footer.SetText(0, 1, "合计:" + item.RetailOrder.TotalMoneyReceived);

                        //  PrinterBase pbase = footer.CalculatePageInfo();

                        /* if (Math.Ceiling((decimal)dataGridView2.Rows.Count / CurrentPTemplate.Rows) > 1)
                         * {
                         *     footer.IsDrawAllPage = false;
                         * }
                         * else
                         * {
                         *
                         *     footer.IsDrawAllPage = true;
                         * }*/

                        footer.IsDrawAllPage = false;

                        Bottom bottom = new Bottom();

                        bottom.IsDrawAllPage            = true;
                        misGoldPrinter.SubTotalColsList = (colIndex).ToString() + ";" + (colIndexSecond).ToString();      //用分号分隔的要求小计的列

                        /*   if (!Directory.Exists(CommonGlobalUtil.SystemDir + "EXPORTS\\"))
                         * {
                         *  Directory.CreateDirectory(CommonGlobalUtil.SystemDir + "EXPORTS\\");
                         * }
                         *  misGoldPrinter.FileName = CommonGlobalUtil.SystemDir + "EXPORTS\\" + item.RetailOrder.ID + ".jpg";*/
                        ((GoldPrinter.Body)(misGoldPrinter.Body)).Font = dataGridView2.Font;

                        int[] widths = new int[dataGV.Count];
                        for (int j = 0; j < dataGV.Count; j++)
                        {
                            widths[j] = Convert.ToInt32(dataGV[j].Rate);
                        }

                        List <int> widthList = new List <int>();

                        /*   for (int i = 0; i < dataGV.Count; i++)
                         * {
                         *     DataGridViewColumn column = dataGridView2.Columns[columnCount[i]];
                         *     if (column.Visible && !String.IsNullOrEmpty(column.HeaderText))
                         *     {
                         *         widthList.Add(widths[i]);
                         *     }
                         *
                         * }*/
                        if (isflag)
                        {
                            widths    = new int[1];
                            widths[0] = 100;
                            // widthList.Add(widths[0]);
                        }

                        //   widths = widthList.ToArray();
                        int newWidth = 800;

                        /*  int totalWidth = 0;
                         * for (int i = 0; i < widths.Length; i++)
                         * {
                         *    totalWidth += widths[i];
                         * }*/
                        //if (dataGridView2.Columns.Count > 0)
                        //{
                        for (int i = 0; i < widths.Length; i++)
                        {
                            widths[i] = decimal.ToInt32(Math.Round((widths[i] * newWidth * (decimal)0.1), 0, MidpointRounding.AwayFromZero));
                            // widths[i] = decimal.ToInt32(Math.Round((widths[i] * newWidth * (decimal)1.0 / totalWidth), 0, MidpointRounding.AwayFromZero));
                        }
                        CommonGlobalUtil.WriteLog("实际打印数量=" + pinrtColNum + "\r\n" + "设置能打印的列数量=" + widths.Length.ToString());

                        /*   bottomFooter.ColsWidth = widths;*/
                        footer.ColsWidth      = widths;
                        misGoldPrinter.Footer = footer;
                        /*  misGoldPrinter.BottomFooter = bottomFooter;*/
                        misGoldPrinter.Bottom      = bottom;
                        multiHeader.ColsWidth      = widths;
                        misGoldPrinter.MultiHeader = multiHeader;
                        multiHeader.ColsWidth      = widths;
                        ((GoldPrinter.Body)(misGoldPrinter.Body)).IsAverageColsWidth = false;
                        ((GoldPrinter.Body)(misGoldPrinter.Body)).ColsWidth          = widths;
                        misGoldPrinter.Preview();
                        misGoldPrinter.Dispose();
                        misGoldPrinter = null;
                    }
Esempio n. 25
0
 public override string ToString()
 {
     return(string.Format(CultureInfo.CurrentCulture, "Left: {0}, Top: {0}, Right: {0}, Bottom: {0}", Left.ToString(CultureInfo.CurrentCulture), Top.ToString(CultureInfo.CurrentCulture), Right.ToString(CultureInfo.CurrentCulture), Bottom.ToString(CultureInfo.CurrentCulture)));
 }
 public Bottom AddBottom(Bottom bottom)
 {
     database.Bottom.Add(bottom);
     database.SaveChanges();
     return(bottom);
 }
Esempio n. 27
0
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     return(Left.GetHashCode() ^ 1 + Top.GetHashCode() ^ 2 + Right.GetHashCode() ^ 3 + Bottom.GetHashCode());
 }
Esempio n. 28
0
 public override int GetHashCode() =>
 13 * 17 + Top.GetHashCode()
 * 17 + Left.GetHashCode()
 * 17 + Bottom.GetHashCode()
 * 17 + Right.GetHashCode();
Esempio n. 29
0
        public override string ToString()
        {
            var enUS = new System.Globalization.CultureInfo("en-US");

            return("%%BoundingBox: " + Left.ToString(enUS) + " " + Bottom.ToString(enUS) + " " + Right.ToString(enUS) + " " + Top.ToString(enUS));
        }
Esempio n. 30
0
 public override string ToString()
 {
     return("All = " + All.ToString() + " Top = " + Top.ToString() + " Left = " + Left.ToString() + " Bottom = " + Bottom.ToString() + " Right = " + Right.ToString());
 }
Esempio n. 31
0
 /// <include file='doc\Padding.uex' path='docs/doc[@for="Padding.ToString"]/*' />
 public override string ToString()
 {
     return("{Left=" + Left.ToString(CultureInfo.CurrentCulture) + ",Top=" + Top.ToString(CultureInfo.CurrentCulture) + ",Right=" + Right.ToString(CultureInfo.CurrentCulture) + ",Bottom=" + Bottom.ToString(CultureInfo.CurrentCulture) + "}");
 }
Esempio n. 32
0
        public async Task Delete_UsingSelectIncludeIdOnly()
        {
            using (var connection = new SqliteConnection("DataSource=:memory:"))
            {
                connection.Open();

                var options = new DbContextOptionsBuilder <SampleDbContext>()
                              .UseSqlite(connection)
                              .Options;

                using (var context = new SampleDbContext(options))
                {
                    await context.Database.EnsureCreatedAsync();
                }

                using (var context = new SampleDbContext(options))
                {
                    var top = new Top()
                    {
                        Name = "name1"
                    };
                    var mid1 = new Mid()
                    {
                        Name = "mid1", Top = top
                    };
                    var mid2 = new Mid()
                    {
                        Name = "mid2", Top = top
                    };

                    var bot1 = new Bottom()
                    {
                        Name = "bot1", Top = top, Mid = mid1
                    };
                    var bot2 = new Bottom()
                    {
                        Name = "bot2", Top = top, Mid = mid1
                    };
                    var bot3 = new Bottom()
                    {
                        Name = "bot3", Top = top, Mid = mid2
                    };
                    var bot4 = new Bottom()
                    {
                        Name = "bot4", Top = top, Mid = mid2
                    };

                    context.Add(top);
                    context.Add(mid1);
                    context.Add(mid2);
                    context.Add(bot1);
                    context.Add(bot2);
                    context.Add(bot3);
                    context.Add(bot4);
                    await context.SaveChangesAsync();
                }

                using (var context = new SampleDbContext(options))
                {
                    Assert.Equal(1, context.Tops.Count());
                    Assert.Equal(2, context.Mids.Count());
                    Assert.Equal(4, context.Bottoms.Count());
                }

                using (var context = new SampleDbContext(options))
                {
                    var top = await context.Tops
                              .Include(x => x.Mids)
                              .ThenInclude(x => x.Bottoms)
                              .Select(x => new Top
                    {
                        Id   = x.Id,
                        Mids = x.Mids.Select(y => new Mid
                        {
                            Id      = y.Id,
                            Bottoms = y.Bottoms.Select(z => new Bottom
                            {
                                Id = z.Id
                            }).ToList()
                        }).ToList()
                    })
                              .FirstOrDefaultAsync();

                    Assert.Empty(context.ChangeTracker.Entries());
                    if (top != null)
                    {
                        context.RemoveRange(top.Mids.SelectMany(x => x.Bottoms));
                        context.RemoveRange(top.Mids);
                        context.Remove(top);
                    }
                    Assert.Equal(7, context.ChangeTracker.Entries().Count());
                    await context.SaveChangesAsync();
                }

                using (var context = new SampleDbContext(options))
                {
                    Assert.False(context.Tops.Any());
                    Assert.False(context.Mids.Any());
                    Assert.False(context.Bottoms.Any());
                }
            }
        }
Esempio n. 33
0
        protected override void AfterDeserialize(XElement xml)
        {
            base.AfterDeserialize(xml);

            // At one point, a field called "ConvertedFromOld" was introduced instead of increasing Version to 2. The following is a fix for this.
            if (xml.Element("ConvertedFromOld") != null && xml.Element("ConvertedFromOld").Value == "True")
            {
                SavedByVersion = 2;
            }

            // Upgrade to v2
            if (SavedByVersion < 2)
            {
                SavedByVersion = 2;
                AnchorRaw anchor;

                if (LeftAnchor && RightAnchor)
                {
                    X      = ((Left + Right) / 2).ToString();
                    anchor = AnchorRaw.Center;
                }
                else if (LeftAnchor)
                {
                    X      = (Left).ToString();
                    anchor = AnchorRaw.Left;
                }
                else if (RightAnchor)
                {
                    X      = (Right).ToString();
                    anchor = AnchorRaw.Right;
                }
                else
                {
                    X      = (80 / 2).ToString(); // ok to hard-code 80 because that was the IconWidth of all styles as old as this one
                    anchor = AnchorRaw.Center;
                }

                if (TopAnchor && BottomAnchor)
                {
                    Y       = ((Top + Bottom) / 2).ToString();
                    anchor |= AnchorRaw.Mid;
                }
                else if (TopAnchor)
                {
                    Y       = Top.ToString();
                    anchor |= AnchorRaw.Top;
                }
                else if (BottomAnchor)
                {
                    Y       = Bottom.ToString();
                    anchor |= AnchorRaw.Bottom;
                }
                else
                {
                    Y       = (24 / 2).ToString(); // ok to hard-code 24 because that was the IconHeight of all styles as old as this one
                    anchor |= AnchorRaw.Mid;
                }

                Anchor = (Anchor)anchor;

                switch (SizeMode)
                {
                case SizeModeOld.NoChange:
                    SizeMode2 = SizeMode2.NoChange;
                    break;

                case SizeModeOld.ByPercentage:
                    SizeMode2 = SizeMode2.ByPercentage;
                    break;

                case SizeModeOld.BySizeWidthOnly:
                    SizeMode2 = SizeMode2.BySizeWidthOnly;
                    break;

                case SizeModeOld.BySizeHeightOnly:
                    SizeMode2 = SizeMode2.BySizeHeightOnly;
                    break;

                case SizeModeOld.BySizeWidthHeightStretch:
                    SizeMode2 = SizeMode2.BySizeStretch;
                    break;

                case SizeModeOld.ByPosLeftRight:
                    SizeMode2 = SizeMode2.BySizeWidthOnly;
                    Width     = (Right - Left + 1).ToString();
                    break;

                case SizeModeOld.ByPosTopBottom:
                    SizeMode2 = SizeMode2.BySizeHeightOnly;
                    Height    = (Bottom - Top + 1).ToString();
                    break;

                case SizeModeOld.ByPosAllFit:
                    SizeMode2 = SizeMode2.BySizeFit;
                    Width     = (Right - Left + 1).ToString();
                    Height    = (Bottom - Top + 1).ToString();
                    break;

                case SizeModeOld.ByPosAllStretch:
                    SizeMode2 = SizeMode2.BySizeStretch;
                    Width     = (Right - Left + 1).ToString();
                    Height    = (Bottom - Top + 1).ToString();
                    break;
                }
            }

            Left       = Right = Top = Bottom = 0;
            LeftAnchor = RightAnchor = TopAnchor = BottomAnchor = false;
            SizeMode   = default(SizeModeOld);
        }