Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("SYSXX");
            strPageUserType.Add("mana");
            if (Request.QueryString["ID"] != null)
            {
                LabName = "ʵ����";
                if (!IsPostBack)
                {
                    int ID;
                    if (int.TryParse(Request.QueryString["ID"].ToString(), out ID))
                    {
                        List<LabMS.Model.Dictionary> list = new List<LabMS.Model.Dictionary>();
                        LabMS.Model.Lab labModel = new LabMS.Model.Lab();
                        try
                        {
                            //��ȡ����ʵ������Ϣ
                            LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
                            labModel = lab.GetModel(ID);
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }

                        //��ʵ�����
                        list = DictionaryDropdownlist("111");
                        LabKindDDL.DataSource = list;
                        LabKindDDL.DataBind();
                        LabKindDDL.SelectedValue = labModel.Lab_Type;

                        //��ʵ������
                        list = DictionaryDropdownlist("112");
                        LabTypeDDL.DataSource = list;
                        LabTypeDDL.DataBind();
                        LabTypeDDL.SelectedValue = labModel.Lab_Type;

                        //��ʵ�鼶��
                        list = DictionaryDropdownlist("113");
                        LabLevelDDL.DataSource = list;
                        LabLevelDDL.DataBind();
                        LabLevelDDL.SelectedValue = labModel.Lab_Level;

                        //�󶨽�������
                        list = DictionaryDropdownlist("114");
                        AwardLevelDDL.DataSource = list;
                        AwardLevelDDL.DataBind();
                        AwardLevelDDL.SelectedValue = labModel.Lab_AwardLevel;

                        //��ʵ����״̬
                        list = DictionaryDropdownlist("115");
                        StatusDDL.DataSource = list;
                        StatusDDL.DataBind();
                        StatusDDL.SelectedValue = labModel.Lab_State;

                        //������ʵ����
                        LabDropdownlist();
                        LabDDL.SelectedValue = ID.ToString();
                    }
                    else
                    {
                        SaveBtn.Visible = false;
                        ERRLbl.Text = "ϵͳ�쳣��URL�������Ϸ���";
                        ERRLbl.Visible = true;
                    }
                }
            }
            else if (Request.QueryString["SubID"] != null)
            {
                if (!IsPostBack)
                {
                    int SubID;
                    if (int.TryParse(Request.QueryString["SubID"].ToString(), out SubID))
                    {
                        ViewState["SubID"] = SubID;
                        LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
                        List<LabMS.Model.Dictionary> list = new List<LabMS.Model.Dictionary>();
                        LabMS.Model.Lab labModel = new LabMS.Model.Lab();
                        LabMS.BLL.Location loc = new LabMS.BLL.Location();
                        List<LabMS.Model.Location> locModel = new List<LabMS.Model.Location> ();
                        try
                        {
                            labModel = lab.GetModel(SubID);
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }

                        LabNumTBX.Text = labModel.Lab_Code;//���
                        LabNameTBX.Text = labModel.Lab_Name;//����
                        LabName = labModel.Lab_Name;
                        SetUpDateTBX.Text = string.Format("{0:d}",labModel.Lab_SetupTime);//����
                        ManagerTBX.Text = labModel.Lab_InCharge;//������
                        TelTBX.Text = labModel.Lab_Phone;//�绰
                        CurriculumTBX.Text = labModel.Lab_Curriculum;//�γ�
                        NumTXB.Text = labModel.Lab_ApprovalCode;//��׼�ĺ�
                        ProfessionTBX.Text = labModel.Lab_Professional;//����רҵ
                        InvestmentTBX.Text = labModel.Lab_Investment.ToString(); ;//Ͷ�ʶ�
                        StatementTBX.Text = labModel.Lab_Statement;//��ע

                        locModel = loc.GetModelList(" LabID=" + SubID);
                        float f = 0;
                        for (int i = 0; i < locModel.Count; i++)
                        {
                            if (locModel[i].Location_Area.ToString().Trim() != "")
                            {
                                f += float.Parse(locModel[i].Location_Area);
                            }
                        }
                        if (f == 0)
                        {
                            UsingAreaTBX.Text = "";//ʹ�����
                        }
                        else
                        {
                            UsingAreaTBX.Text = f.ToString();//ʹ�����
                        }

                        //��ʵ�����
                        list = DictionaryDropdownlist("111");
                        LabKindDDL.DataSource = list;
                        LabKindDDL.DataBind();
                        LabKindDDL.SelectedValue = labModel.Lab_Type;

                        //��ʵ������
                        list = DictionaryDropdownlist("112");
                        LabTypeDDL.DataSource = list;
                        LabTypeDDL.DataBind();
                        LabTypeDDL.SelectedValue = labModel.Lab_Type;

                        //��ʵ�鼶��
                        list = DictionaryDropdownlist("113");
                        LabLevelDDL.DataSource = list;
                        LabLevelDDL.DataBind();
                        LabLevelDDL.SelectedValue = labModel.Lab_Level;

                        //�󶨽�������
                        list = DictionaryDropdownlist("114");
                        AwardLevelDDL.DataSource = list;
                        AwardLevelDDL.DataBind();
                        AwardLevelDDL.SelectedValue = labModel.Lab_AwardLevel;

                        //��ʵ����״̬
                        list = DictionaryDropdownlist("115");
                        StatusDDL.DataSource = list;
                        StatusDDL.DataBind();
                        StatusDDL.SelectedValue = labModel.Lab_State;

                        //������ʵ����
                        LabDropdownlist();
                        LabDDL.SelectedValue = labModel.Lab_ParentID.ToString();
                    }
                    else
                    {
                        SaveBtn.Visible = false;
                        ERRLbl.Text = "ϵͳ�쳣��URL�������Ϸ���";
                        ERRLbl.Visible = true;
                    }
                }
            }
            else
            {
                SaveBtn.Visible = false;
                ERRLbl.Text = "ϵͳ�쳣��URL�������Ϸ���";
                ERRLbl.Visible = true;
            }
            SetUpDateTBX.Attributes.Add("onclick", "c.showMoreDay = false;c.show(this);");
            SetUpDateTBX.Attributes.Add("readOnly", "-1");
            UsingAreaTBX.Attributes.Add("readOnly", "-1");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("SYSXX");
            if (UserType == "student" || UserType == "teacher")
            {
                modifybtn.Visible = false;
                DeletBtn.Visible = false;
            }
            if (Request.QueryString["SubID"] != null)
            {
                if (!IsPostBack)
                {
                    int SubID;
                    if (int.TryParse(Request.QueryString["SubID"].ToString(), out SubID))
                    {
                        IDHF.Value = SubID.ToString();
                        LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
                        List<LabMS.Model.Dictionary> list = new List<LabMS.Model.Dictionary>();
                        LabMS.Model.Lab labModel = new LabMS.Model.Lab();
                        LabMS.BLL.Location loc = new LabMS.BLL.Location();
                        List<LabMS.Model.Location> locModel = new List<LabMS.Model.Location>();
                        try
                        {
                            labModel = lab.GetModel(SubID);
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }

                        LabNumLbl.Text = labModel.Lab_Code;//编号
                        LabNameLbl.Text = labModel.Lab_Name;//名称
                        SetUpDateLbl.Text = string.Format("{0:d}", labModel.Lab_SetupTime);//日期
                        ManagerLbl.Text = labModel.Lab_InCharge;//负责人
                        TelLbl.Text = labModel.Lab_Phone;//电话
                        CurriculumLbl.Text = labModel.Lab_Curriculum;//课程
                        NumLbl.Text = labModel.Lab_ApprovalCode;//批准文号
                        ProfessionLbl.Text = labModel.Lab_Professional;//面向专业
                        InvestmentLbl.Text = labModel.Lab_Investment.ToString();//投资额
                        StatementLbl.Text = labModel.Lab_Statement;//备注

                        locModel = loc.GetModelList(" LabID=" + SubID);
                        float f = 0;
                        for (int i = 0; i < locModel.Count; i++)
                        {
                            if (locModel[i].Location_Area.ToString().Trim() != "")
                            {
                                f += float.Parse(locModel[i].Location_Area);
                            }
                        }
                        if (f == 0)
                        {
                            UsingAreaLbl.Text = "";//使用面积
                        }
                        else
                        {
                            UsingAreaLbl.Text = f.ToString();//使用面积
                        }

                        //绑定实验类别
                        list = DictionaryDropdownlist("111");
                        LabKindDDL.DataSource = list;
                        LabKindDDL.DataBind();
                        LabKindDDL.SelectedValue = labModel.Lab_Type;

                        //绑定实验类型
                        list = DictionaryDropdownlist("112");
                        LabTypeDDL.DataSource = list;
                        LabTypeDDL.DataBind();
                        LabTypeDDL.SelectedValue = labModel.Lab_Type;

                        //绑定实验级别
                        list = DictionaryDropdownlist("113");
                        LabLevelDDL.DataSource = list;
                        LabLevelDDL.DataBind();
                        LabLevelDDL.SelectedValue = labModel.Lab_Level;

                        //绑定奖励级别
                        list = DictionaryDropdownlist("114");
                        AwardLevelDDL.DataSource = list;
                        AwardLevelDDL.DataBind();
                        AwardLevelDDL.SelectedValue = labModel.Lab_AwardLevel;

                        //绑定实验室状态
                        list = DictionaryDropdownlist("115");
                        StatusDDL.DataSource = list;
                        StatusDDL.DataBind();
                        StatusDDL.SelectedValue = labModel.Lab_State;

                        //绑定所属实验室
                        LabDropdownlist();
                        LabDDL.SelectedValue = labModel.Lab_ParentID.ToString();
                    }
                    else
                    {
                        ERRLbl.Text = "系统异常,URL参数不合法!";
                        ERRLbl.Visible = true;
                        modifybtn.Visible = false;
                        DeletBtn.Visible = false;
                    }
                }
            }
            else
            {
                ERRLbl.Text = "系统异常,URL参数不合法!";
                ERRLbl.Visible = true;
                modifybtn.Visible = false;
                DeletBtn.Visible = false;
            }
        }