/// <summary>
        /// 根据状态查找排班修改记录
        /// </summary>
        /// <param name="_status">string 状态</param>
        /// <returns></returns>
        public DTO4ChangeRecord[] selectAllByStatus(string _status)
        {
            String  sql = "select * from changeRecord where status = '" + _status + "'";
            DataSet dt  = DBOperater.selectSql(sql);

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                DTO4ChangeRecord[] dto4cArray = new DTO4ChangeRecord[dt.Tables[0].Rows.Count];

                for (int i = 0; i < dt.Tables[0].Rows.Count; i++)
                {
                    dto4cArray[i]    = new DTO4ChangeRecord();
                    dto4cArray[i].Id = dt.Tables[0].Rows[i]["id"].ToString();
                    dto4cArray[i].ArrangementId_self   = dt.Tables[0].Rows[i]["arrangementId_self"].ToString();
                    dto4cArray[i].ArrangementId_others = dt.Tables[0].Rows[i]["arrangementId_others"].ToString();
                    dto4cArray[i].Status  = (string)dt.Tables[0].Rows[i]["status"];
                    dto4cArray[i].Remark  = (string)dt.Tables[0].Rows[i]["remark"];
                    dto4cArray[i].Operate = dt.Tables[0].Rows[i]["operate"].ToString();
                }
                return(dto4cArray);
            }
            else
            {
                DTO4ChangeRecord[] dto4cArray = new DTO4ChangeRecord[1];
                return(dto4cArray);
            }
        }
Example #2
0
        public string[] ShowChangeRecord(DataGridView dataGridView1, ComboBox comboBox1, int z)       //显示申请记录
        {
            string[] ChangeRecordIds = new string[20];
            dataGridView1.Rows.Clear();
            string status;

            if (comboBox1.Text.ToString() == "已处理的申请")
            {
                status = "processed";
            }
            else
            {
                status = "untreated";
            }

            Barrangement  ba = new Barrangement();
            Bchangerecord bc = new Bchangerecord();

            DTO4ChangeRecord[] dto4c = new DTO4ChangeRecord[20];
            DTO4Arrangement    dto4a = new DTO4Arrangement();

            dto4c = bc.QueryChangerecordByStatus(status);
            int j = 0;

            for (int i = 0; i < dto4c.Count(); i++)
            {
                if (dto4c[i].ArrangementId_others == "0" && z == 1)
                {
                    int index = dataGridView1.Rows.Add(1);
                    dto4a = ba.QueryArrangementById(dto4c[i].ArrangementId_self);
                    dataGridView1.Rows[j].Cells[0].Value = dto4a.DoctorName;
                    dataGridView1.Rows[j].Cells[1].Value = dto4a.BeginTime;
                    dataGridView1.Rows[j].Cells[2].Value = dto4c[i].Remark;
                    ChangeRecordIds[j] = dto4c[i].Id;
                    j++;
                }
                if (dto4c[i].ArrangementId_others != "0" && z == 0)
                {
                    int             index        = dataGridView1.Rows.Add(1);
                    DTO4Arrangement dto4a_others = new DTO4Arrangement();
                    dto4a        = ba.QueryArrangementById(dto4c[i].ArrangementId_self);
                    dto4a_others = ba.QueryArrangementById(dto4c[i].ArrangementId_others);
                    dataGridView1.Rows[j].Cells[0].Value = dto4a.DoctorName;
                    dataGridView1.Rows[j].Cells[1].Value = dto4a_others.DoctorName;
                    dataGridView1.Rows[j].Cells[2].Value = dto4a.BeginTime;
                    dataGridView1.Rows[j].Cells[3].Value = dto4a_others.BeginTime;
                    dataGridView1.Rows[j].Cells[4].Value = dto4c[i].Remark;
                    ChangeRecordIds[j] = dto4c[i].Id;
                    j++;
                }
            }
            return(ChangeRecordIds);
        }
        //根据排班表id查找排班修改记录
        /// <summary>
        /// 根据排班表id查找排班修改记录
        /// </summary>
        /// <param name="_arrangementId">string 排班表id</param>
        /// <returns></returns>
        public DTO4ChangeRecord selectAllByArrangementId(string _arrangementId_self)
        {
            String           sql   = "select * from changeRecord where arrangementId_self = " + _arrangementId_self;
            DataSet          dt    = DBOperater.selectSql(sql);
            DTO4ChangeRecord dto4c = new DTO4ChangeRecord();

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                dto4c.Id = dt.Tables[0].Rows[0]["id"].ToString();
                dto4c.ArrangementId_self = (string)dt.Tables[0].Rows[0]["arrangementId_self"];
                dto4c.Status             = (string)dt.Tables[0].Rows[0]["status"];
                dto4c.Remark             = (string)dt.Tables[0].Rows[0]["remark"];
                dto4c.Operate            = (string)dt.Tables[0].Rows[0]["operate"];
            }
            return(dto4c);
        }