Пример #1
0
        /// <summary>
        /// 获取计划完成时间
        /// </summary>
        /// <returns></returns>
        public static string GetPlanComplete(int recordid)
        {
            string sqlstring = "Select PlanCompleteTime From Booking Where ID=" + recordid;
            object obj       = SQLDbHelper.ExecuteScalar(sqlstring);

            if (obj == null)
            {
                return(string.Empty);
            }
            else
            {
                return(obj.ToString());
            }
        }
Пример #2
0
        /// <summary>
        /// 获取维修工时
        /// </summary>
        /// <returns></returns>
        public static decimal GetServiceHour(int recordid)
        {
            string sqlstring = "Select ServiceHour From Booking Where ID=" + recordid;
            object obj       = SQLDbHelper.ExecuteScalar(sqlstring);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(decimal.Parse(obj.ToString()));
            }
        }
Пример #3
0
        private void nUDMonth_ValueChanged(object sender, EventArgs e)
        {
            labYearMonth.Text = nUDYear.Value.ToString() + "年" + nUDMonth.Value.ToString() + "月";

            string     sqlstring = "Select * from WorkerPlan where Wyear=" + nUDYear.Value + " and Wmonth=" + nUDMonth.Value;
            SqlCommand mycmd     = SQLDbHelper.connection.CreateCommand();

            mycmd.CommandText  = sqlstring;
            Myda.SelectCommand = mycmd;
            DtPlan             = new DataTable("WorkerPlan");
            Myda.Fill(DtPlan);
            DtPlan = SQLDbHelper.Query(sqlstring).Tables[0];
            LoadDate();
        }
Пример #4
0
        private void frmCarTop_Load(object sender, EventArgs e)
        {
            string sqlstring = "Select ServiceHour From Booking Where ID=" + RecordID;

            try
            {
                double hours = double.Parse(SQLDbHelper.ExecuteScalar(sqlstring).ToString());
                numericUpDown1.Value = DateTime.Now.AddHours(hours).Hour;
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
            textBox1.Focus();
        }
Пример #5
0
        /// <summary>
        /// 维修时长
        /// </summary>
        public static string ServiceTime(int id)
        {
            string sqlstring = "Select StartServiceTime from Booking Where ID=" + id;
            object obj       = SQLDbHelper.ExecuteScalar(sqlstring);

            if (obj == null)
            {
                return(string.Empty);
            }
            else
            {
                TimeSpan ts     = DateTime.Now.Subtract(DateTime.Parse(obj.ToString()));
                string   retstr = ts.Hours.ToString() + "°" + ts.Minutes + "'";
                return(retstr);
            }
        }
Пример #6
0
        /// <summary>
        /// 维修中断原因
        /// </summary>
        public static string PauseTimeStr(int id)
        {
            string sqlstring = "Select PauseTime From ServicePause Where ID in (Select Max(ID) as MaxID from ServicePause Where BookID=" + id + ")";
            object obj       = SQLDbHelper.ExecuteScalar(sqlstring);

            if (obj == null)
            {
                return(string.Empty);
            }
            else
            {
                TimeSpan ts     = DateTime.Now.Subtract(DateTime.Parse(obj.ToString()));
                string   retstr = ts.Hours.ToString() + "°" + ts.Minutes + "'";
                return(retstr);
            }
        }
Пример #7
0
 private void txtCarNo_TextChanged(object sender, EventArgs e)
 {
     if (txtCarNo.Text.Length == 8)
     {
         string    sqlstring = "Select * from Booking where CarNo='" + txtCarNo.Text + "'";
         DataTable DtCar     = SQLDbHelper.Query(sqlstring).Tables[0];
         if (DtCar.Rows.Count > 0)
         {
             txtVIN.Text     = DtCar.Rows[0]["VIN"].ToString();
             cmbCarType.Text = DtCar.Rows[0]["CarType"].ToString();
             txtLinkMan.Text = DtCar.Rows[0]["LinkMan"].ToString();
             txtTel.Text     = DtCar.Rows[0]["Tel"].ToString();
             txtEmail.Text   = DtCar.Rows[0]["Email"].ToString();
         }
     }
 }
Пример #8
0
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string workercode = dataGridView1.SelectedRows[0].Cells["Column3"].Value.ToString();

            try
            {
                if (SQLDbHelper.ExecuteSql("Delete from Worker where Workercode='" + workercode + "'") > 0)
                {
                    dataGridView1.Rows.Remove(dataGridView1.SelectedRows[0]);
                }
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #9
0
 //查询
 private void button19_Click(object sender, EventArgs e)
 {
     try
     {
         string    servicename  = gridView3.GetRowCellValue(selectrow, "维修工人").ToString();
         string    sqlstring    = "Exec WorkerList2 '" + dateTimePicker3.Value.ToShortDateString() + "','" + dateTimePicker4.Value.AddDays(1).ToShortDateString() + "','" + servicename + "'";
         DataTable WorkerListDt = SQLDbHelper.Query(sqlstring).Tables[0];
         WorkerListDt.DefaultView.Sort = " 开始维修时间 Desc";
         gridControl15.DataSource      = WorkerListDt.DefaultView.Table;
         button18.Enabled = true;
     }
     catch (Exception Err)
     {
         MessageBox.Show(Err.Message);
     }
 }
Пример #10
0
        private void LoadSysSet()
        {
            DataTable DtSet = SQLDbHelper.Query("Select * from Setting").Tables[0];

            foreach (Control ct in tabPage3.Controls)
            {
                if (ct.Name.StartsWith("txtSet"))
                {
                    DataRow[] Drs = DtSet.Select("KeyWord='" + ct.Name + "'");
                    if (Drs.Length > 0)
                    {
                        ct.Text = Drs[0]["KeyWord_Value"].ToString();
                    }
                }
            }
        }
Пример #11
0
        /// <summary>
        /// 获取分单数量
        /// </summary>
        /// <returns></returns>
        public static int GetFendanNum(int recordid)
        {
            string sqlstring = @"Select Count(*) from Booking A,(Select CarNo,VIN,CreateDate From Booking Where ID=" + recordid + ")B";

            sqlstring += " Where A.CarNo=B.CarNo And A.VIN=B.VIN And A.CreateDate=B.CreateDate and A.State='延时到明天'";
            object obj = SQLDbHelper.ExecuteScalar(sqlstring);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(int.Parse(obj.ToString()));
            }
        }
Пример #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sqlstring = "Select UserName from SysUser where UserID='" + textBox1.Text + "' and Pwd='" + textBox2.Text + "'";

            try
            {
                object obj = SQLDbHelper.ExecuteScalar(sqlstring);
                if (obj == null)
                {
                    MessageBox.Show("用户名不存在或者密码错误!");
                    textBox1.Focus();
                    return;
                }
                else
                {
                    //将计算机名称保存到数据库中
                    if (int.Parse(SQLDbHelper.ExecuteScalar("Select count(*) from VersionUser where Computer='" + Environment.MachineName + "'").ToString()) == 0)
                    {
                        SQLDbHelper.ExecuteSql("Insert into VersionUser(Computer,Ver)values('" + Environment.MachineName + "',0)");
                    }
                    else
                    {
                        int userver = int.Parse(SQLDbHelper.ExecuteScalar("Select ver from VersionUser where Computer='" + Environment.MachineName + "'").ToString());
                        int sysver  = int.Parse(SQLDbHelper.ExecuteScalar("Select ver from VersionSys").ToString());
                        if (userver < sysver)
                        {
                            if (MessageBox.Show("软件有新的版本可以升级!你需要升级吗?", "软件升级", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                SQLDbHelper.ExecuteSql("Update VersionUser Set Ver=" + sysver + " where Computer='" + Environment.MachineName + "'");
                                System.Diagnostics.Process.Start(Application.StartupPath + @"\Update.exe");
                                Application.Exit();
                            }
                        }
                    }
                    ClsBLL.UserID    = textBox1.Text;
                    ClsBLL.UserName  = obj.ToString();
                    ClsBLL.UserGroup = ClsBLL.GetUserGroup(ClsBLL.UserName);
                    AppConfig.ConfigSetValue(Application.ExecutablePath, "LastUserID", textBox1.Text);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #13
0
        public XrCars(string combox)
        {
            InitializeComponent();
            this.PaperKind = System.Drawing.Printing.PaperKind.A4Rotated;
            int years  = int.Parse(combox.Substring(0, 4));
            int months = int.Parse(combox.Substring(combox.IndexOf("年") + 1, combox.IndexOf("月") - combox.IndexOf("年") - 1));

            try
            {
                string    sqlstring = "select *,datepart(d,BookTime) as bookday,datepart(d,ComeTime) as comeday from Booking Where datepart(yyyy,CreateDate)=" + years + " and datepart(MM,CreateDate)=" + months;
                DataTable Dt        = SQLDbHelper.Query(sqlstring).Tables[0];
                //ChartControl barChart = new ChartControl();
                barChart.Titles[0].Text = combox + "预约情况统计表";
                barChart.Series.Clear();
                Series series1 = new Series("预约车辆", ViewType.Bar);
                Series series2 = new Series("到场车辆", ViewType.Bar);

                for (int i = 1; i < 32; i++)
                {
                    string datewhere = years.ToString() + "-" + months.ToString().PadLeft(2, char.Parse("0")) + "-" + i.ToString().PadLeft(2, char.Parse("0"));

                    DataRow[] Dr1 = Dt.Select("bookday=" + i);
                    double    db1 = 0;
                    if (Dr1.Length > 0)
                    {
                        db1 = double.Parse(Dr1.Length.ToString());
                    }

                    DataRow[] Dr2 = Dt.Select("comeday=" + i);
                    double    db2 = 0;
                    if (Dr2.Length > 0)
                    {
                        db2 = double.Parse(Dr2.Length.ToString());
                    }
                    series1.Points.Add(new SeriesPoint(i.ToString() + "日", new double[] { db1 }));
                    series2.Points.Add(new SeriesPoint(i.ToString() + "日", new double[] { db2 }));
                }
                barChart.Width  = PageWidth - 20;
                barChart.Height = 500;
                barChart.Series.Add(series1);
                barChart.Series.Add(series2);
            }
            catch (Exception Err)
            {
                throw Err;
            }
        }
Пример #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            decimal servicehours = 0;
            string  sqlstring    = string.Empty;

            if (state == "中断" || state == "过时")
            {
                ClsBLL.ServicePauseStart(RecordID);//如果是中断则结束中断
            }
            if (txtHours.Text != string.Empty)
            {
                servicehours = decimal.Parse(txtHours.Text);
                if (servicehours < 50)
                {
                    MessageBox.Show("维修工时错误!");
                    return;
                }
                else
                {
                    servicehours = decimal.Parse(servicehours.ToString()) / 100;
                }
            }
            decimal hours = servicehours + decimal.Parse(textBox1.Text) / 100;
            //新的计划完成时间=当前时间+追加工时
            DateTime plancompletetime = DateTime.Now.AddMinutes(double.Parse(Convert.ToString(servicehours * 60)));

            try
            {
                sqlstring  = "Insert Into Reservice(BookID,Worker,PlanCompleteTime,StartServiceTime,EndServiceTime,AddHours)Select ID,Worker,PlanCompleteTime,StartServiceTime,EndServiceTime," + servicehours + " From Booking Where ID=" + RecordID;
                sqlstring += ";Update booking set State='维修进行中',ServiceHour=" + hours + ",StartServiceTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "',EndServiceTime=Null,PlanCompleteTime='" + plancompletetime + "',Worker='" + comboBox1.Text + "',Remark=isnull(Remark,'')+',返修' where ID=" + RecordID;
                if (txtHours.Text != string.Empty)
                {
                    sqlstring += ";Insert Into ServiceAddHours(BookID,OldHours,AddHours,Worker,AddTime)values(" + RecordID + "," + decimal.Parse(textBox1.Text) / 100 + "," + decimal.Parse(txtHours.Text) / 100 + ",'" + comboBox1.Text + "','" + DateTime.Today.ToShortTimeString() + "')";
                }
                if (SQLDbHelper.ExecuteSql(sqlstring) > 0)
                {
                    DialogResult = DialogResult.OK;
                    ClsBLL.AddMsg(RecordID, "车牌号码:" + this.Text + txtHours.Text + "TU--" + ClsBLL.UserName);
                    this.Close();
                }
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #15
0
        public static int GetDoubleID(int recordid, DateTime booktime)
        {
            int    year      = booktime.Year;
            int    month     = booktime.Month;
            int    day       = booktime.Day;
            string sqlstring = "Select A.ID from Booking A,(Select ID,CarNo,Substring(convert(nvarchar(50),Booktime,120),1,10) as BookDay From Booking Where year(BookTime)=" + year + " and month(BookTime)=" + month + " and day(BookTime)=" + day + " and ID=" + recordid + ") B Where A.CarNo=B.CarNo and substring(convert(nvarchar(50),A.booktime,120),1,10)=B.BookDay And A.ID<>B.ID";
            object obj       = SQLDbHelper.ExecuteScalar(sqlstring);

            if (obj == null)
            {
                return(-1);
            }
            else
            {
                return(int.Parse(obj.ToString()));
            }
        }
Пример #16
0
        private void frmReport_Load(object sender, EventArgs e)
        {
            this.Top    = 0;
            this.Left   = 0;
            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;

            sqlstring = @"select distinct cast(datepart(yy,EndServiceTime) as nvarchar(50)) + '年'+ cast(datepart(MM,EndServiceTime) as nvarchar(50)) + '月' as 年月 from Booking
                        where EndServiceTime is not null order by 年月 desc";
            CmbDt     = SQLDbHelper.Query(sqlstring).Tables[0];
            foreach (Control ct in this.panel2.Controls)
            {
                if (ct.Name.StartsWith("btnRt"))
                {
                    if (!ClsBLL.IsPower(ct.Text))
                    {
                        ct.Enabled = false;
                    }
                }
            }
            if (!ClsBLL.IsPower("工单明细"))
            {
                btnQuery.Enabled = false;
                button10.Enabled = false;
                button20.Enabled = false;
                button21.Enabled = false;
                button22.Enabled = false;
                button23.Enabled = false;
            }
            if (!ClsBLL.IsPower("异常单查询"))
            {
                button20.Enabled = false;
            }
            if (!ClsBLL.IsPower("修改状态"))
            {
                button21.Enabled = false;
            }
            if (!ClsBLL.IsPower("操作日志"))
            {
                button22.Enabled = false;
            }
            if (!ClsBLL.IsPower("删除工单"))
            {
                button23.Enabled = false;
            }
        }
Пример #17
0
 private void 修改ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         string    workercode = dataGridView1.SelectedRows[0].Cells["Column3"].Value.ToString();
         DataTable Dt         = SQLDbHelper.Query("Select * from Worker where Workercode='" + workercode + "'").Tables[0];
         comboBox1.Text   = Dt.Rows[0]["WorkerGroup"].ToString();
         comboBox2.Text   = Dt.Rows[0]["Position"].ToString();
         textBox1.Text    = workercode;
         textBox2.Text    = Dt.Rows[0]["WorkerName"].ToString();
         textBox3.Text    = Dt.Rows[0]["HourRate"].ToString();
         textBox1.Enabled = false;
     }
     catch (Exception Err)
     {
         MessageBox.Show(Err.Message);
     }
 }
Пример #18
0
        /// <summary>
        /// 功能名称
        /// </summary>
        /// <param name="functionname"></param>
        /// <returns></returns>
        public static bool IsPower(string functionname)
        {
            if (UserID.ToLower() == "admin" || UserID.ToLower() == "liquanchun")
            {
                return(true);
            }
            string sqlstring = "Select FunName from SysPower Inner join SysFunction on SysPower.FunID=SysFunction.ID where FunName='" + functionname + "' And UserID='" + ClsBLL.UserID + "'";
            object obj       = SQLDbHelper.ExecuteScalar(sqlstring);

            if (obj != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #19
0
        //检查是否已经存在
        private bool CheckExsit()
        {
            DateTime BookTime  = DateTime.Parse(dateTimePicker1.Value.ToShortDateString() + " " + numericUpDown1.Value.ToString() + ":" + numericUpDown2.Value.ToString());
            string   sqlstring = "Select count(*) from Booking where (VIN='" + txtVIN.Text + "' Or CarNo='" + txtCarNo.Text + "') and Booktime between '" + BookTime.ToShortDateString() + "' and '" + BookTime.AddDays(1).ToShortDateString() + "'";

            try
            {
                if (int.Parse(SQLDbHelper.ExecuteScalar(sqlstring).ToString()) > 0)
                {
                    if (MessageBox.Show("车牌号:" + txtCarNo.Text + "或者车架号: " + txtVIN.Text + " 在" + BookTime.ToShortDateString() + "已经预约过!你还要增加吗?", "", MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        return(true);
                    }
                    else
                    {
                        string stype = "车身维修";
                        if (chkJD.Checked)
                        {
                            stype = "机电维修";
                        }
                        sqlstring = "Select count(*) from Booking where (VIN='" + txtVIN.Text + "' Or CarNo='" + txtCarNo.Text + "') and Booktime between '" + BookTime.ToShortDateString() + "' and '" + BookTime.AddDays(1).ToShortDateString() + "' And Servicetype='" + stype + "'";
                        if (int.Parse(SQLDbHelper.ExecuteScalar(sqlstring).ToString()) > 0)
                        {
                            MessageBox.Show("车牌号:" + txtCarNo.Text + "或者车架号: " + txtVIN.Text + " 在" + BookTime.ToShortDateString() + "已经预约过同类型的维修,不能预约");
                            return(true);
                        }
                    }
                }
                sqlstring = "Select Count(*) from Booking where booktime='" + BookTime + "' and ServiceType='" + ServiceType + "'";
                int rs     = int.Parse(SQLDbHelper.ExecuteScalar(sqlstring).ToString());
                int maxnum = int.Parse(ClsBLL.GetSet("txtSet6"));
                if (rs > maxnum)
                {
                    MessageBox.Show("在同一时间点只能预约" + maxnum + "辆车!");
                    return(true);
                }
                return(false);
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
                return(false);
            }
        }
Пример #20
0
        private void button1_Click(object sender, EventArgs e)
        {
            decimal addhours   = 0;
            decimal newhours   = 0;
            decimal starthours = 0;

            if (state == "中断" || state == "过时")
            {
                ClsBLL.ServicePauseStart(RecordID);//如果是中断则结束中断
            }
            if (txtAddHours.Text != string.Empty)
            {
                addhours = decimal.Parse(txtAddHours.Text);
                addhours = decimal.Parse(addhours.ToString()) / 100;
            }
            newhours = addhours + decimal.Parse(txtHours.Text) / 100;
            //新的计划完成时间=当前时间+追加工时
            starthours = ClsBLL.GetFactHours(RecordID);
            if (newhours > starthours)
            {
                starthours = newhours - starthours;  //预计维修工时减实际做过
            }
            DateTime plancompletetime = DateTime.Now.AddMinutes(double.Parse(Convert.ToString(starthours * 60)));

            try
            {
                string sqlstring = "Update booking set State='维修进行中',StartServiceTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "',Worker='" + comboBox1.Text + "' ,ServiceHour=" + newhours + ",PlanCompleteTime='" + plancompletetime + "',Remark=isnull(Remark,'')+'," + this.Text + txtAddHours.Text + "TU' where ID=" + RecordID;
                if (txtAddHours.Text != string.Empty)
                {
                    sqlstring += ";Insert Into ServiceAddHours(BookID,OldHours,AddHours,Worker,AddTime)values(" + RecordID + "," + decimal.Parse(txtHours.Text) / 100 + "," + decimal.Parse(txtAddHours.Text) / 100 + ",'" + comboBox1.Text + "','" + DateTime.Today.ToShortTimeString() + "')";
                }
                if (SQLDbHelper.ExecuteSql(sqlstring) > 0)
                {
                    DialogResult = DialogResult.OK;
                    ClsBLL.AddMsg(RecordID, "车牌号码:" + this.Text + txtAddHours.Text + "TU--" + ClsBLL.UserName);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #21
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox1.Text == string.Empty || textBox1.Text == string.Empty || textBox2.Text == string.Empty || textBox3.Text == string.Empty)
     {
         MessageBox.Show("请填写完整!");
         return;
     }
     if (textBox1.Enabled)
     {
         string sqlstring = "Select count(*) from Worker where WorkerCode='" + textBox1.Text + "'";
         int    rs        = int.Parse(SQLDbHelper.ExecuteScalar(sqlstring).ToString());
         if (rs > 0)
         {
             MessageBox.Show("工号:" + textBox1.Text + "已经存在!");
             return;
         }
         sqlstring = "Insert Into Worker(WorkerGroup,WorkerCode,WorkerName,Position,HourRate) values('" + comboBox1.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + comboBox2.Text + "'," + textBox3.Text + ")";
         try
         {
             SQLDbHelper.ExecuteSql(sqlstring);
             MessageBox.Show("保存成功!");
             ShowGrid();
             textBox1.Text = string.Empty;
             textBox2.Text = string.Empty;
             //AddWorkerPlan();
         }
         catch (Exception Err)
         {
             MessageBox.Show(Err.Message);
         }
     }
     else   //修改
     {
         string sqlstring = "Update Worker Set WorkerGroup='" + comboBox1.Text + "',WorkerName='" + textBox2.Text + "',HourRate=" + textBox3.Text + ",Position='" + comboBox2.Text + "' Where WorkerCode='" + textBox1.Text + "'";
         if (SQLDbHelper.ExecuteSql(sqlstring) > 0)
         {
             ShowGrid();
             textBox1.Text = string.Empty;
             textBox2.Text = string.Empty;
             textBox3.Text = "1";
         }
     }
 }
Пример #22
0
        private void comboBox5_SelectedValueChanged(object sender, EventArgs e)
        {
            if (comboBox5.Text == string.Empty || comboBox5.Text.StartsWith("System"))
            {
                return;
            }
            int    years     = int.Parse(comboBox5.Text.Substring(0, 4));
            int    months    = int.Parse(comboBox5.Text.Substring(comboBox5.Text.IndexOf("年") + 1, comboBox5.Text.IndexOf("月") - comboBox5.Text.IndexOf("年") - 1));
            string sqlstring = "exec BookHourStat " + years + "," + months;

            try
            {
                gridControl10.DataSource = SQLDbHelper.Query(sqlstring).Tables[0];
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #23
0
        private void frmCarTop_Load(object sender, EventArgs e)
        {
            string sqlstring = "Select Distinct State From Booking";

            try
            {
                DataTable Dt = SQLDbHelper.Query(sqlstring).Tables[0];
                for (int i = 0; i < Dt.Rows.Count; i++)
                {
                    comboBox2.Items.Add(Dt.Rows[i]["State"].ToString());
                }
                sqlstring     = "Select State From Booking Where ID=" + RecordID;
                textBox1.Text = SQLDbHelper.ExecuteScalar(sqlstring).ToString();
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #24
0
        //业绩汇总
        private void button4_Click(object sender, EventArgs e)
        {
            if (comboBox2.Text.StartsWith("System"))
            {
                return;
            }
            int years  = int.Parse(comboBox2.Text.Substring(0, 4));
            int months = int.Parse(comboBox2.Text.Substring(comboBox2.Text.IndexOf("年") + 1, comboBox2.Text.IndexOf("月") - comboBox2.Text.IndexOf("年") - 1));

            try
            {
                string sqlstring = "Exec WorkerStat " + years + "," + months + "";
                gridControl2.DataSource = SQLDbHelper.Query(sqlstring).Tables[0];
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #25
0
 private void 取消预约ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (CureentCt != null)
     {
         if (CureentCt.Tag.ToString() == "正式")
         {
             MessageBox.Show("预约状态是“正式”,不能转为正式!");
             return;
         }
         if (MessageBox.Show("你确定取消该预约吗?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             if (CureentCt.Name != string.Empty)
             {
                 try
                 {
                     int    recordid  = int.Parse(CureentCt.Name);
                     string sqlstring = "Update Booking set State='取消',Success=0 where ID=" + recordid;
                     SQLDbHelper.ExecuteSql(sqlstring);
                     CureentCt.Tag       = "取消";
                     CureentCt.BackColor = Color.Gray;
                     int doubleid = ClsBLL.GetDoubleID(recordid, DateTime.Parse(labDateTime.Text));
                     if (doubleid > -1)
                     {
                         foreach (Control ct in dataGridView1.Controls)
                         {
                             if (ct.Name == doubleid.ToString())
                             {
                                 sqlstring = "Update Booking set State='取消',Success=0 where ID=" + doubleid;
                                 SQLDbHelper.ExecuteSql(sqlstring);
                                 ct.Tag       = "取消";
                                 ct.BackColor = Color.Gray;
                             }
                         }
                     }
                 }
                 catch (Exception Err)
                 {
                     MessageBox.Show(Err.Message);
                 }
             }
         }
     }
 }
Пример #26
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            dataGridView1.Visible = false;
            dataGridView2.Visible = false;
            panDate.Visible       = false;
            panel2.Visible        = true;
            panel2.Top            = panel1.Height + panel4.Height;
            panel2.Height         = this.Height - panel1.Height - panel4.Height - 3;
            try
            {
                if (comboBox1.Items.Count == 0)
                {
                    string    sqlstring = "Select Distinct Creator from Booking";
                    DataTable Dt        = SQLDbHelper.Query(sqlstring).Tables[0];
                    comboBox1.Items.Add("--全部--");
                    foreach (DataRow dr in Dt.Rows)
                    {
                        comboBox1.Items.Add(dr[0].ToString());
                    }

                    sqlstring = "Select Distinct State from Booking";
                    DataTable Dt1 = SQLDbHelper.Query(sqlstring).Tables[0];
                    comboBox2.Items.Add("--全部--");
                    foreach (DataRow dr in Dt1.Rows)
                    {
                        comboBox2.Items.Add(dr[0].ToString());
                    }

                    sqlstring = "Select Items from SysDictionary where ItemName='SA'";
                    DataTable Dt2 = SQLDbHelper.Query(sqlstring).Tables[0];
                    comboBox3.Items.Add("--全部--");
                    foreach (DataRow dr in Dt2.Rows)
                    {
                        comboBox3.Items.Add(dr[0].ToString());
                    }
                }
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #27
0
 private void  除预约ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (CureentCt != null)
     {
         if (CureentCt.Tag.ToString() == "正式")
         {
             MessageBox.Show("预约状态是“正式”,不能转为正式!");
             return;
         }
         if (MessageBox.Show("你确定删除该预约吗?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             if (CureentCt.Name != string.Empty)
             {
                 try
                 {
                     int    recordid  = int.Parse(CureentCt.Name);
                     string sqlstring = "Delete from Booking where ID=" + recordid;
                     if (SQLDbHelper.ExecuteSql(sqlstring) > 0)
                     {
                         dataGridView1.Controls.Remove(CureentCt);
                     }
                     int doubleid = ClsBLL.GetDoubleID(recordid, DateTime.Parse(labDateTime.Text));
                     if (doubleid > -1)
                     {
                         foreach (Control ct in dataGridView1.Controls)
                         {
                             if (ct.Name == doubleid.ToString())
                             {
                                 sqlstring = "Delete From Booking where ID=" + doubleid;
                                 dataGridView1.Controls.Remove(ct);
                             }
                         }
                     }
                 }
                 catch (Exception Err)
                 {
                     MessageBox.Show(Err.Message);
                 }
             }
         }
     }
 }
Пример #28
0
        private void AddCarCardNew(int recordid)
        {
            string sqlstring = "Select * from Booking where ID=" + recordid;

            try
            {
                DataTable DtBook = SQLDbHelper.Query(sqlstring).Tables[0];
                foreach (DataRow dr in DtBook.Rows)
                {
                    DateTime TempT = DateTime.Parse(dr["BookTime"].ToString());
                    CheckRowindex(TempT);
                    AddCarCard(dr);
                }
                SumWorkHours(0, 0);
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #29
0
        //预约等待响应统计
        private void button8_Click(object sender, EventArgs e)
        {
            if (comboBox7.Text == string.Empty)
            {
                return;
            }
            int    years     = int.Parse(comboBox7.Text.Substring(0, 4));
            int    months    = int.Parse(comboBox7.Text.Substring(comboBox7.Text.IndexOf("年") + 1, comboBox7.Text.IndexOf("月") - comboBox7.Text.IndexOf("年") - 1));
            string sqlstring = "exec Sp_SABookDays " + years + "," + months;

            try
            {
                DataTable Dt = SQLDbHelper.Query(sqlstring).Tables[0];
                gridControl17.DataSource = Dt;
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }
        }
Пример #30
0
        private bool CheckExsit(string svrtype)
        {
            DateTime BookTime  = DateTime.Parse(dateTimePicker1.Value.ToShortDateString() + " " + numericUpDown1.Value.ToString() + ":" + numericUpDown2.Value.ToString());
            string   sqlstring = "Select count(*) from Booking where (VIN='" + txtVIN.Text + "' Or CarNo='" + txtCarNo.Text + "') and Booktime between '" + BookTime.ToShortDateString() + "' and '" + BookTime.AddDays(1).ToShortDateString() + "' And Servicetype='" + svrtype + "'";

            try
            {
                if (int.Parse(SQLDbHelper.ExecuteScalar(sqlstring).ToString()) > 0)
                {
                    MessageBox.Show("车牌号:" + txtCarNo.Text + "或者车架号: " + txtVIN.Text + " 在" + BookTime.ToShortDateString() + "已经预约过同类型的维修,不能预约");
                    return(true);
                }
                return(false);
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
                return(false);
            }
        }