Пример #1
0
        private void CmdQueryBtn_Click(object sender, EventArgs e)
        {
            string strWhe = string.Empty;

            try
            {
                string strSql = "select Cmd_Sno, Cmd_Mode, Cmd_Sts, Stn_No, Loc, New_Loc, Height, substring(Crt_Date,1,10) as Crt_Dte, substring(Crt_Date,12,8) as Crt_Tim," +
                                "User_Id, Plt_ID, Trace  from Cmd_Mst where Cmd_Sts in ('0','1') ";
                if (cmbCmdMode.SelectedIndex != 0)
                {
                    strWhe += string.Format(" and Cmd_Mode='{0}'", cmbCmdMode.Text.Split("-".ToCharArray())[0]);
                }
                if (CmdSnoCtl.Text != "命令号")
                {
                    strWhe += string.Format(" and Cmd_Sno='{0}'", GCtrl.C5Sno(int.Parse(CmdSnoCtl.Text)));
                }
                strSql = strSql + strWhe;
                dtCmdQuery.Clear();
                Globals.DB.ExecGetTable(strSql, ref dtCmdQuery);
                dgvCmdMst.ClearSelection();
            }
            catch (Exception ex)
            {
                Log.WriteLog(ex);
            }
        }
Пример #2
0
 private void CmdSnoCtl_Leave(object sender, EventArgs e)
 {
     try
     {
         CmdSnoCtl.Text = GCtrl.C5Sno(int.Parse(CmdSnoCtl.Text));
     }
     catch (Exception)
     {
         CmdSnoCtl.Text = "命令号";
     }
 }
Пример #3
0
        private void modCmdBtn_Click(object sender, EventArgs e)
        {
            DataRow drCmd = null;

            //if (!Globals.bLogin) { MsgBox.Warning("请先到用户登录模块登录,谢谢!"); return; }
            if (!Globals.CtlValidate(cStnNoCtl, cTraceCtl, cPriCtl, cmbCSts))
            {
                MsgBox.Warning(StrTables.MSG_NOT_FULL);
                return;
            }
            if (MsgBox.Question("是否确认执行?") == DialogResult.No)
            {
                return;
            }

            try
            {
                string sSql = string.Format("select * from Cmd_Mst where Cmd_Sno='{0}'", GCtrl.C5Sno(cmbCmdSno.Text));
                if (!Globals.DB.ExecGetRow(sSql, ref drCmd) || drCmd == null)
                {
                    MsgBox.Warning("查无记录!");
                    return;
                }

                MakeSql mSql = new MakeSql("Cmd_Mst", SqlType.Update);
                mSql.AddStrWhere(drCmd, "Cmd_Sno");
                mSql.SetStrValue("Cmd_Sts", cmbCSts.Text.Split("-".ToCharArray())[0]);
                mSql.SetStrValue("Stn_No", cStnNoCtl.Text.Trim());
                mSql.SetStrValue("Trace", cTraceCtl.Text.Trim());
                mSql.SetStrValue("Prty", cPriCtl.Text.Trim());
                sSql = mSql.GetSql();

                if (Globals.DB.ExecSql(sSql))
                {
                    MsgBox.Information("操作成功!");
                }
            }
            catch (Exception ex)
            {
                Log.WriteLog(ex);
            }
            finally
            {
                flushCmdBtn_Click(null, null);
            }
        }