Пример #1
0
        private void QueryOperateData()
        {
            var queryStr  = "";
            var startTime = this.dateTimePickerStartTime.Text;
            var endTime   = this.datePickerEndTime.Text;

            if (this.tb_queryCondition.Text.Trim() != "")
            {
                queryStr = $"where OperateUser like '%{this.tb_queryCondition.Text.Trim()}%' and OperateDate >= '{startTime}' and OperateDate <= '{endTime}'";
            }
            else
            {
                queryStr = $"where OperateDate >= '{startTime}' and OperateDate <= '{endTime}'";
            }
            var dt = operationRecordManager.GetDataSetByWhere(queryStr).Tables[0];

            RadGridViewProperties.ClearGridView(this.radGridView1, null);
            foreach (DataRow dr in dt.Rows)
            {
                this.radGridView1.Rows.AddNew();
                var rowCount = this.radGridView1.RowCount;
                this.radGridView1.Rows[rowCount - 1].Cells[0].Value = rowCount;
                this.radGridView1.Rows[rowCount - 1].Cells[1].Value = dr["OperateUser"].ToString();
                this.radGridView1.Rows[rowCount - 1].Cells[2].Value = dr["OperateContent"].ToString();
                this.radGridView1.Rows[rowCount - 1].Cells[3].Value = dr["OperateDate"].ToString();
            }
        }
        public static long InsertOperateRecordPID()
        {
            long id = -1;
            TOperateRecordManager objManager = new TOperateRecordManager();
            var dt = objManager.GetDataSetByWhere("order by ID DESC limit 1").Tables[0];

            if (dt.Rows.Count < 1)
            {
                return(0);
            }
            if (long.TryParse(dt.Rows[0]["ID"].ToString(), out id))
            {
                return(id + 1);
            }
            return(id);
        }