コード例 #1
0
        private void ClassRoomRemove_Click(object sender, EventArgs e)//删除按钮
        {
            var rows = ClassRoomList.SelectedRows;

            if (rows.Count > 0)
            {
                DialogResult result = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel);
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                string       clno         = rows[0].Cells[0].Value.ToString();
                ClassRoomBLL classRoomBLL = new ClassRoomBLL();
                if (classRoomBLL.Remove(clno))
                {
                    MessageBox.Show("删除成功");
                    LoadClassRoomList();
                }
                else
                {
                    MessageBox.Show("删除失败");
                }
            }
            else
            {
                MessageBox.Show("请选择要删除的行");
            }
        }
コード例 #2
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            TeachBuildingBLL mibll = new TeachBuildingBLL();
            string           bname = comboBox2.Text;
            ClassRoomBLL     miBll = new ClassRoomBLL();

            comboBox1.DataSource = miBll.bnoGetClno(mibll.BuildingsNameToNoumber(bname));
        }
コード例 #3
0
        private void clnoLoadList(string clno)
        {
            BorrowClassRoomBLL miBll = new BorrowClassRoomBLL();

            dgvList.DataSource = miBll.clnoGetList(clno);
            ClassRoomBLL classRoomBLL = new ClassRoomBLL();

            dataGridView5.DataSource = classRoomBLL.clnoGetList(clno);
            //dgvList.Columns["usestatus"].Visible = false;
        }
コード例 #4
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Int32 records = ClassRoomBLL.getInstance().delete(classRoom_id);

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirmMessage", "$('#confirmMessage').modal('toggle');", true);

            if (records > 0)
            {
                lblMessage.Text = "Sede eliminada correctamente.";
            }
            loadData();
        }
コード例 #5
0
        protected void loadData()
        {
            int code = oUser.oProgram.code;

            if (code == 1)
            {
                gvClassRoom.DataSource = ClassRoomBLL.getInstance().getAll();
            }
            else
            {
                gvClassRoom.DataSource = ClassRoomBLL.getInstance().getAllByProgram(code);
            }

            gvClassRoom.DataBind();
        }
コード例 #6
0
 private void Weekday_Period_LoadList()//通过星期和时间段的选择,跟新表的数据源
 {
     if (xq.Text != "" && jysj.Text != "")
     {
         TeacherCourseBLL   teacherCourseBLL   = new TeacherCourseBLL();
         BorrowClassRoomBLL borrowClassRoomBLL = new BorrowClassRoomBLL();
         ClassRoomBLL       classRoomBLL       = new ClassRoomBLL();
         List <string>      clnolist           = borrowClassRoomBLL.Weekday_Period_GetClnoList(xq.Text, jysj.Text);
         foreach (string clno in teacherCourseBLL.Weekday_Period_GetClnoList(xq.Text, jysj.Text))
         {
             clnolist.Add(clno);
         }
         dataGridView3.DataSource = classRoomBLL.GetListExptClno(clnolist);
         jyjs.DataSource          = classRoomBLL.GetClnoListExptClno(clnolist);
     }
 }
コード例 #7
0
        private void ClassRoomAdd_Click(object sender, EventArgs e)//添加、修改按钮
        {
            ClassRoom classRoom = new ClassRoom()
            {
                clno  = Clno.Text,
                bno   = Bno.Text,
                floor = Floor.Text
            };
            ClassRoomBLL classRoomBLL = new ClassRoomBLL();

            #region 添加
            if (ClassRoomAdd.Text.Equals("添加"))
            {
                if (classRoomBLL.Add(classRoom))
                {
                    MessageBox.Show("添加成功");

                    LoadClassRoomList();
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
            #endregion
            #region 修改
            else
            {
                if (classRoomBLL.Edit(classRoom))
                {
                    MessageBox.Show("修改成功");
                    LoadClassRoomList();
                    Clno.ReadOnly     = false;
                    ClassRoomAdd.Text = "添加";
                }
                else
                {
                    MessageBox.Show("修改失败");
                }
            }
            #endregion
            Clno.Text  = "";
            Bno.Text   = "";
            Floor.Text = "";
        }
コード例 #8
0
        protected void gvClassRoom_RowEditing(object sender, GridViewEditEventArgs e)
        {
            unlockControls();
            Int32 code = Convert.ToInt32(gvClassRoom.Rows[e.NewEditIndex].Cells[0].Text);

            Entities.ClassRoom oClassRoom = ClassRoomBLL.getInstance().getClassRoom(code);
            txtCode.Text           = oClassRoom.code.ToString();
            txtDescription.Text    = oClassRoom.num_room;
            txtSize.Text           = oClassRoom.size.ToString();
            cboState.SelectedValue = oClassRoom.state.ToString();

            try
            {
                cboClassRoomType.SelectedValue = oClassRoom.oClassRoomsType.code.ToString();
            }
            catch (Exception)
            {
                cboClassRoomType.SelectedValue = "0";
            }

            try
            {
                cboLocation.SelectedValue = oClassRoom.oLocation.code.ToString();
            }
            catch (Exception)
            {
                cboLocation.SelectedValue = "0";
            }

            try
            {
                cboprogram.SelectedValue = oClassRoom.oProgram.code.ToString();
            }
            catch (Exception)
            {
                cboprogram.SelectedValue = "0";
            }
            ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "$('html, body').animate({ scrollTop: $('body').offset().top });", true);
        }
コード例 #9
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            Int32 records = 0;

            if (validateData())
            {
                Entities.ClassRoom      oClassRoom      = new Entities.ClassRoom();
                Entities.ClassRoomsType oClassRoomsType = new Entities.ClassRoomsType();
                Entities.Location       oLocation       = new Entities.Location();
                Entities.Program        oProgram        = new Entities.Program();
                oClassRoom.code            = Convert.ToInt32(txtCode.Text);
                oClassRoom.num_room        = txtDescription.Text;
                oClassRoomsType.code       = Convert.ToInt32(cboClassRoomType.SelectedValue);
                oLocation.code             = Convert.ToInt32(cboLocation.SelectedValue);
                oClassRoom.size            = Convert.ToInt32(txtSize.Text);
                oProgram.code              = Convert.ToInt32(cboprogram.SelectedValue);
                oClassRoom.state           = Convert.ToInt16(cboState.SelectedValue);
                oClassRoom.oClassRoomsType = oClassRoomsType;
                oClassRoom.oLocation       = oLocation;
                oClassRoom.oProgram        = oProgram;

                if (ClassRoomBLL.getInstance().exists(oClassRoom.code))
                {
                    records = ClassRoomBLL.getInstance().modify(oClassRoom);
                }
                else
                {
                    records = ClassRoomBLL.getInstance().insert(oClassRoom);
                }

                blockControls();
                loadData();
                if (records > 0)
                {
                    lblMessage.Text = "Datos almacenados correctamente";
                }
            }
        }
コード例 #10
0
        private void LoadClassRoomList()//列表数据源显示所有教室数据
        {
            ClassRoomBLL classRoom = new ClassRoomBLL();

            ClassRoomList.DataSource = classRoom.GetList();
        }
コード例 #11
0
 protected void btnNew_Click(object sender, ImageClickEventArgs e)
 {
     unlockControls();
     txtCode.Text = ClassRoomBLL.getInstance().getNextCode().ToString();
 }
コード例 #12
0
        protected void btnReport_Click(object sender, EventArgs e)
        {
            try
            {
                int code = oUser.oProgram.code;
                List <Entities.ClassRoom> listRoom;
                if (code == 1)
                {
                    listRoom = ClassRoomBLL.getInstance().getAll();
                }
                else
                {
                    listRoom = ClassRoomBLL.getInstance().getAllByProgram(code);
                }
                System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                text::Document         pdfDoc       = new text::Document(text::PageSize.A4, 10, 10, 10, 10);
                pdfDoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
                PdfWriter.GetInstance(pdfDoc, memoryStream);
                pdfDoc.Open();

                String imagepath           = Server.MapPath("../../images/page-icons");
                iTextSharp.text.Image deas = iTextSharp.text.Image.GetInstance(imagepath + "/DEAS-logo.jpg");
                deas.ScaleToFit(140f, 120f);
                //Give space before image
                deas.SpacingBefore = 10f;
                //Give some space after the image
                deas.SpacingAfter = 1f;
                deas.Alignment    = text::Element.ALIGN_LEFT;
                pdfDoc.Add(deas);

                text::Paragraph title = new text::Paragraph();
                title.Font      = text::FontFactory.GetFont("dax-black", 32, new text::BaseColor(0, 51, 102));
                title.Alignment = text::Element.ALIGN_CENTER;
                title.Add("\n\n Reporte de Aulas\n\n\n\n");
                pdfDoc.Add(title);

                PdfPTable oPTable = new PdfPTable(6);
                oPTable.TotalWidth    = 100;
                oPTable.SpacingBefore = 20f;
                oPTable.SpacingAfter  = 30f;
                oPTable.AddCell("Descripción");
                oPTable.AddCell("Capacidad");
                oPTable.AddCell("Programa");
                oPTable.AddCell("Tipo de Aula");
                oPTable.AddCell("Localizacion");
                oPTable.AddCell("Estado");

                if (listRoom.Count > 0)
                {
                    foreach (Entities.ClassRoom pRoom in listRoom)
                    {
                        oPTable.AddCell(pRoom.num_room);
                        oPTable.AddCell(pRoom.size.ToString());
                        oPTable.AddCell(pRoom.oProgram.name);
                        oPTable.AddCell(pRoom.oClassRoomsType.description);
                        oPTable.AddCell(pRoom.oLocation.oHeadquarters.description + " - " + pRoom.oLocation.building + " - " + pRoom.oLocation.module);
                        oPTable.AddCell((pRoom.state == 1 ? "Activo" : "Inactivo"));
                    }
                }
                else
                {
                    PdfPCell cell = new PdfPCell(new text::Phrase("No existen aulas registrados."));
                    cell.Colspan             = 5;
                    cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    oPTable.AddCell(cell);
                }

                pdfDoc.Add(oPTable);
                pdfDoc.Close();

                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=Aulas.pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer      = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }