示例#1
0
        /// <summary>
        /// 数据操作
        /// </summary>
        /// <param name="Mess">区别编辑还是新增还是删除</param>
        private void OpreationDB(string Mess)
        {
            BaseDataClass.DutyRecordInfoList DutyLIst = new DutyRecordInfoList();

            DutyLIst.DutyPerson = tbx_Name.Text.Trim();
            DutyLIst.PersonID   = tbx_ID.Text.Trim();
            DutyLIst.DutyDate   = TimePicker_DutyDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            DutyLIst.DutyEvent  = tbx_DutyEvent.Text;
            if (tbx_DutyEvent.Text == "")
            {
                DutyLIst.DutyEventTime = "";
            }
            DutyLIst.DutyEventTime = TimePicker_DutyEventTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
            DutyLIst.DutyRoute     = tbx_DutyRoute.Text;
            DutyLIst.Description   = tbx_descrip.Text;
            DutyLIst.Mark          = cbx_Plan.SelectedText;//预留字段MARK这里用来保存预案处置结果


            deviceInfo PersonInfo = new deviceInfo();
            string     Error      = "";
            bool       Result     = false;

            if (Mess == "添加")
            {
                Result = PersonInfo.AddBaseList(DutyLIst, ref Error);
            }
            if (Mess == "编辑")
            {
                DutyLIst.ID = Convert.ToInt32(infoList[0].ToString());
                Result      = PersonInfo.UpdateBaselist(DutyLIst, ref Error);
            }
            if (Mess == "删除")
            {
                DutyLIst.ID = Convert.ToInt32(infoList[0].ToString());
                Result      = PersonInfo.DeleteOneRecord(BaseDataClassNames.DutyRecordInfoList, DutyLIst.ID, ref Error);
            }
            if (Result == true)
            {
                MessageBox.Show("设备信息" + Mess + "成功");
                ClearText(this.Content);
                this.Close();
            }
            else
            {
                MessageBox.Show("设备信息" + Mess + "失败,请稍后再试!");
                ClearText(this.Content);
            }
        }
示例#2
0
        private void NewDuty(DutyRecordInfoList dutyRecordInfo)
        {
            string Error = string.Empty;

            MessageBox.Show("收到新的执勤信息");
            deviceInfo deviceInfo = new deviceInfo();

            try
            {
                bool Result = deviceInfo.AddBaseList(dutyRecordInfo, ref Error);
            }
            catch
            {
            }
            btn_Ok_Click(this, new EventArgs());
        }
示例#3
0
        private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (DataView.SelectedRows.Count < 1)
            {
                return;
            }
            DataGridViewRow row = DataView.SelectedRows[0];

            BaseDataClass.DutyRecordInfoList DutyList = new DutyRecordInfoList();
            DutyList.DutyPerson    = row.Cells[1].Value.ToString();
            DutyList.PersonID      = row.Cells[2].Value.ToString();
            DutyList.DutyDate      = row.Cells[3].Value.ToString();
            DutyList.DutyEvent     = row.Cells[4].Value.ToString();
            DutyList.DutyEventTime = row.Cells[5].Value.ToString();
            DutyList.DutyRoute     = row.Cells[6].Value.ToString();
            DutyList.Description   = row.Cells[7].Value.ToString();
            DutyList.Mark          = row.Cells[8].Value.ToString();
            string sendMsg = "SVMMsg" + " " + JsonConvert.SerializeObject(DutyList) + "\r\n";

            SVMServerCommunicate.SendMsgToServer(sendMsg);
        }