Example #1
0
        private void bt_Paint(object sender, PaintEventArgs e)
        {
            Button bt = (Button)((Control)sender);

            if (bt.Tag != null)
            {
                if (txtCarNo.Text != string.Empty)
                {
                    if (bt.Tag.ToString().ToLower().EndsWith(txtCarNo.Text.ToLower()))
                    {
                        int   borderWidth = 3;
                        Color borderColor = Color.Red;
                        ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, borderColor,
                                                borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid);
                    }
                }
            }

            string info = bt.ImageKey;

            string[] Strs        = info.Split(new Char[] { ',' });
            int      NewColindex = int.Parse(Strs[0]);

            Font ft1 = new Font("宋体", 14, FontStyle.Regular);
            Font ft2 = new Font("宋体", 11, FontStyle.Regular);

            StringFormat sf   = new StringFormat(StringFormat.GenericTypographic);
            SizeF        size = e.Graphics.MeasureString(Strs[2], ft1, 1000, sf);

            int xpoint = int.Parse(Convert.ToString(Math.Floor(bt.Width * 0.5)));
            int ypoint = int.Parse(Convert.ToString(Math.Floor(bt.Height * 0.6)));

            Color cl = Color.PowderBlue;

            //列序号,状态,车牌,维修类型,(进场时间/开始工作时间/中断时间/完工时间/洗车时间),时间差,停车位,计划完成时间,接待人,维修师傅
            //画字符
            e.Graphics.DrawString(Strs[2], ft1, Brushes.Black, 2, 2);  //车牌
            int    xleft = bt.Width * 4 / 10 + 5;
            string Time  = string.Empty;

            if (Strs[7] != string.Empty)
            {
                Time = DateTime.Parse(Strs[7]).ToString("MM-dd HH:mm");
            }
            if (NewColindex == 0)
            {
                e.Graphics.DrawString("SA:" + Strs[8], ft2, Brushes.Black, 5, size.Height + 3);       //维修类型
                e.Graphics.DrawString("进场时间:" + Strs[4], ft2, Brushes.Black, xleft, size.Height + 3); //时间
                if (Strs[1] == "延时到明天")                                                               //延时到明天的中断原因
                {
                    string delayreason = ClsBLL.DelayReason(int.Parse(bt.Name));
                    e.Graphics.DrawString("中断:" + delayreason, ft2, Brushes.Black, xleft, 5);  //计划完成时间
                }
                else
                {
                    e.Graphics.DrawString("计划完成:" + Time, ft2, Brushes.Black, xleft, 5);  //计划完成时间
                }
            }
            if (NewColindex == 1)
            {
                e.Graphics.DrawString("维修:" + Strs[9], ft2, Brushes.Black, 5, size.Height + 3);       //维修类型
                e.Graphics.DrawString("开始工作:" + Strs[4], ft2, Brushes.Black, xleft, size.Height + 3); //时间
                e.Graphics.DrawString("计划完成:" + Time, ft2, Brushes.Black, xleft, 5);                  //时间
            }
            if (NewColindex == 2)
            {
                e.Graphics.DrawString("维修:" + Strs[9], ft2, Brushes.Black, 5, size.Height + 3);       //维修类型
                e.Graphics.DrawString("中断:" + ClsBLL.PauseReason(int.Parse(bt.Name)), ft2, Brushes.Black, xleft, 5);
                e.Graphics.DrawString("中断时间:" + Strs[4], ft2, Brushes.Black, xleft, size.Height + 3); //时间
            }
            if (NewColindex == 3)
            {
                e.Graphics.DrawString("维修:" + Strs[9], ft2, Brushes.Black, 5, size.Height + 3);       //维修类型
                e.Graphics.DrawString("完工时间:" + Strs[4], ft2, Brushes.Black, xleft, size.Height + 3); //时间
                e.Graphics.DrawString("计划完成:" + Time, ft2, Brushes.Black, xleft, 5);                  //时间
            }
            if (NewColindex == 4)
            {
                e.Graphics.DrawString("SA:" + Strs[8], ft2, Brushes.Black, 5, size.Height + 3); //维修类型
                e.Graphics.DrawString("停车位:" + Strs[6], ft2, Brushes.Black, xleft, 5);          //停车位
                if (Strs[4] != string.Empty)
                {
                    e.Graphics.DrawString("送车时间:" + Strs[4], ft2, Brushes.Black, xleft, size.Height + 3);  //时间
                }
                else
                {
                    e.Graphics.DrawString("送车时间:", ft2, Brushes.Black, xleft, size.Height + 3);  //时间
                }
            }
            //画线
            e.Graphics.DrawLine(new Pen(Color.SkyBlue, 3), new Point(xleft - 5, bt.Height - 5), new Point(xleft - 5, 5));
        }
Example #2
0
        private void ShowGrid(string PauseReason)
        {
            string wherestrr = "1=1";

            if (cmbReceiver.Text != "--全部--" && cmbReceiver.Text != string.Empty)
            {
                wherestrr = " Receiver='" + cmbReceiver.Text + "'";
            }
            string sqlstring = "Select * from Booking Where " + wherestrr + " And (State='正式' Or State='延时到明天' OR StartServiceTime between '" + DateTime.Today.ToString() + "' and '" + DateTime.Today.AddDays(1).ToShortDateString() + "')";

            sqlstring += " Union all Select * from Booking Where " + wherestrr + " And (State='维修进行中' Or State='中断' Or State='过时') And StartServiceTime between '" + DateTime.Today.AddDays(-7).ToShortDateString() + "' and '" + DateTime.Today.ToShortDateString() + "'";
            sqlstring += " Union all Select * from Booking Where " + wherestrr + " And State='完工' And EndServiceTime between '" + DateTime.Today.AddDays(-1).ToShortDateString() + "' and '" + DateTime.Today.ToShortDateString() + "'";

            DataTable RoDt1 = SQLDbHelper.Query(sqlstring).Tables[0];

            RoDt1.DefaultView.Sort = "StartServiceTime Desc";
            RoDt = RoDt1.DefaultView.Table;
            foreach (DataRow Dr in RoDt.Rows)
            {
                string time = string.Empty;
                switch (Dr["State"].ToString())
                {
                case "正式":
                case "延时到明天":
                    Colindex = 0;
                    time     = Dr["ComeTime"].ToString();
                    break;

                case "维修进行中":
                case "过时":
                    Colindex = 1;
                    time     = Dr["StartServiceTime"].ToString();
                    break;

                case "中断":
                    Colindex = 2;
                    time     = ClsBLL.PauseTime(int.Parse(Dr["ID"].ToString())).ToString();
                    break;

                case "完工":
                    Colindex = 3;
                    time     = Dr["EndServiceTime"].ToString();
                    break;

                case "洗车":
                    Colindex = 4;
                    time     = Dr["ClearCarTime"].ToString();
                    break;

                default:
                    break;
                }
                try
                {
                    string Time     = string.Empty;
                    string Spantime = string.Empty;
                    if (time == string.Empty && Colindex != 4)
                    {
                        time = DateTime.Now.ToString();
                    }
                    if (time != string.Empty)
                    {
                        TimeSpan ts = DateTime.Now.Subtract(DateTime.Parse(time));
                        Spantime = ts.Hours.ToString() + "°" + ts.Minutes.ToString() + "'";
                        Time     = DateTime.Parse(time).ToString("MM-dd HH:mm");
                    }
                    //在等待列判断中断原因,不显示等待时间
                    if (Dr["State"].ToString() == "正式" || Dr["State"].ToString() == "延时到明天")
                    {
                        string delayreason = ClsBLL.DelayReason(int.Parse(Dr["ID"].ToString()));
                        if (delayreason != string.Empty)
                        {
                            Spantime = delayreason;
                        }
                    }
                    //列序号,状态,车牌,维修类型,(进场时间/开始工作时间/中断时间/完工时间/洗车时间),时间差,停车位,计划完成时间
                    string info = Colindex.ToString() + "," + Dr["State"].ToString() + "," + Dr["CarNo"].ToString() + "," + Dr["ServiceType"].ToString() + "," + Time + "," + Spantime + "," + Dr["ParkSite"].ToString() + "," + Dr["PlanOutTime"].ToString() + "," + Dr["Receiver"].ToString() + "," + Dr["Worker"].ToString() + "," + Dr["Remark"].ToString();
                    if (Dr["State"].ToString() == "正式" || Dr["State"].ToString() == "延时到明天")
                    {
                        if (PauseReason != string.Empty && PauseReason != Spantime)
                        {
                        }
                        else
                        {
                            AddCarCard(Dr["ID"].ToString(), info);
                        }
                    }
                    else
                    {
                        if (Dr["State"].ToString() == "中断" && PauseReason != string.Empty)
                        {
                            if (ClsBLL.PauseReason(int.Parse(Dr["ID"].ToString())) == PauseReason)
                            {
                                AddCarCard(Dr["ID"].ToString(), info);
                            }
                        }
                        else
                        {
                            AddCarCard(Dr["ID"].ToString(), info);
                        }
                    }
                }
                catch (Exception Err)
                {
                    MessageBox.Show(Err.Message);
                }
            }
            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                if (dataGridView1.Columns[i].HeaderText.IndexOf("[") > 0)
                {
                    string header = dataGridView1.Columns[i].HeaderText;
                    header = header.Substring(0, header.IndexOf("["));
                    dataGridView1.Columns[i].HeaderText = header + "[" + Cards[i].ToString() + "]";
                }
                else
                {
                    dataGridView1.Columns[i].HeaderText = dataGridView1.Columns[i].HeaderText + "[" + Cards[i].ToString() + "]";
                }
            }
            dataGridView1.ClearSelection();
        }
Example #3
0
        private void wbt_Paint(object sender, PaintEventArgs e)
        {
            DoubleClickButton bt = (DoubleClickButton)((Control)sender);

            if (bt.Tag != null)
            {
                if (txtCarNo.Text != string.Empty)
                {
                    if (bt.Tag.ToString().ToLower().EndsWith(txtCarNo.Text.ToLower()) && bt.Left == 1)
                    {
                        int   borderWidth = 3;
                        Color borderColor = Color.Red;
                        ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, borderColor,
                                                borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid);
                    }
                    else if (bt.Left == 1)
                    {
                        int   borderWidth = 3;
                        Color borderColor = Color.Transparent;
                        ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, borderColor,
                                                borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid);
                    }
                }
            }
            string info = bt.ImageKey;

            string[] Strs = info.Split(new Char[] { ',' });

            Font ft1 = new Font("宋体", 11, FontStyle.Regular);
            Font ft2 = new Font("宋体", 10, FontStyle.Regular);

            StringFormat sf   = new StringFormat(StringFormat.GenericTypographic);
            SizeF        size = e.Graphics.MeasureString(Strs[2], ft1, 1000, sf);

            int    xpoint = int.Parse(Convert.ToString(Math.Floor(bt.Width * 0.5)));
            int    ypoint = int.Parse(Convert.ToString(Math.Floor(bt.Height * 0.5)));
            string isbook = "自";

            if (Convert.ToBoolean(Strs[7]))
            {
                isbook = "预";
            }
            if (Strs[9].IndexOf("迟到") > -1)
            {
                isbook = "迟";
            }
            e.Graphics.DrawString(Strs[2] + "  " + isbook, ft1, Brushes.Black, 10, 5);                                                //车牌
            e.Graphics.DrawString("进场时间:" + DateTime.Parse(Strs[5]).ToString("MM-dd HH:mm"), ft2, Brushes.Black, 5, size.Height + 5); //时间差
            if (Strs[1] == "延时到明天")
            {
                string delayreason = ClsBLL.DelayReason(int.Parse(bt.Name));
                e.Graphics.DrawString("中断:" + delayreason, ft2, Brushes.Black, 5, size.Height + 20); //维修类型
            }
            else
            {
                if (Strs[6] != string.Empty)
                {
                    e.Graphics.DrawString("计划完成:" + DateTime.Parse(Strs[6]).ToString("MM-dd HH:mm"), ft2, Brushes.Black, 5, size.Height + 20);  //时间差
                }
            }
        }