Example #1
0
        public void addNewRecord()
        {
            string fio               = dtWorker.Rows[0]["fio"].ToString();
            string date              = _Date.convert(date_AddRecord.DateTime);
            string time_start        = tmEdt_start.TimeSpan.ToString();
            string time_end          = tmEdt_end.TimeSpan.ToString();
            string time_span         = (TimeSpan.Parse(time_end) - TimeSpan.Parse(time_start)).ToString();
            string time_add          = DateTime.Now.ToShortTimeString().ToString();
            string id_tn             = dtWorker.Rows[0]["id_tn"].ToString();
            string subunit           = lUp_subunit.Text;
            string work              = lUp_work.Text;
            string id_work           = lUp_work.GetColumnValue("id_work").ToString();
            string id_subunit_worker = dtWorker.Rows[0]["id_subunit"].ToString();
            string position          = dtWorker.Rows[0]["position"].ToString();
            string other             = memoOther.Text;
            string comand            = comandInsert(fio, position, subunit, id_work, work, date, time_start, time_end, other, time_add, id_tn, time_span, id_subunit_worker);

            if (_Sql.UpdateComand(comand))
            {
                //msgbox.msg = "Запись добавлена успешно.";
                XtraMessageBox.Show("Запись добавлена успешно.", "Добавление записи");
            }
        }
Example #2
0
        private void btn_delete_Click(object sender, EventArgs e)
        {
            GridView view = (GridView)grid_total.FocusedView;

            try
            {
                string totalId = view.GetFocusedRowCellValue("id").ToString();
                string comand  = "delete total where id=" + totalId;
                if (_sql.UpdateComand(comand))
                {
                    XtraMessageBox.Show("Запись успешно удалена.", "Внимание");
                }
            }
            catch { XtraMessageBox.Show("Ошибка, запись не выделена.", "Ошибка"); }
        }