예제 #1
0
        //绑定所属实验室
        protected void LabDropdowlist()
        {
            LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
            List<LabMS.Model.Lab> ParLab = new List<LabMS.Model.Lab>();
            List<LabMS.Model.Lab> SonLab = new List<LabMS.Model.Lab>();
            List<LabMS.Model.Lab> LabTemp = new List<LabMS.Model.Lab>();

            ParLab = lab.GetModelList("Lab_ParentID is null");
            SonLab = lab.GetModelList("Lab_ParentID is not null");
            LabTemp = lab.GetModelList("Lab_ParentID is null");

            int count = ParLab.Count, count1 = SonLab.Count;
            for (int i = 0; i < count; i++)
            {
                int ID = ParLab[i].ID;
                int m = 0;
                for (int j = 0; j < count1; j++)
                {
                    LabMS.Model.Lab labModel = new LabMS.Model.Lab();
                    int ParentID = int.Parse(SonLab[j].Lab_ParentID.ToString());

                    if (ParentID == ID)
                    {
                        labModel.ID = SonLab[j].ID;
                        labModel.Lab_Name = "|-" + SonLab[j].Lab_Name;
                        LabTemp.Insert(i + m + 1, labModel);
                        m++;
                    }
                }
            }
            LabDDL.DataSource = LabTemp;
            LabDDL.DataBind();
            ListItem item = new ListItem("无", "0");
            LabDDL.Items.Insert(0, item);
        }
예제 #2
0
파일: Lab.cs 프로젝트: dalinhuang/labms
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public LabMS.Model.Lab GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ID,Lab_Code,Lab_Name,Lab_Category,Lab_Level,Lab_SetupTime,Lab_InCharge,Lab_ProjectNum,Lab_Phone,Lab_State,Lab_Curriculum,Lab_Summary,Lab_Investment,Lab_Type,Lab_Disciplines,Lab_AwardLevel,Lab_StAwardNum,Lab_EnglishName,Lab_ParentID,Lab_ApprovalCode,Lab_Professional,Lab_Statement from Lab ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)};
            parameters[0].Value = ID;

            LabMS.Model.Lab model=new LabMS.Model.Lab();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["ID"].ToString()!="")
                {
                    model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.Lab_Code=ds.Tables[0].Rows[0]["Lab_Code"].ToString();
                model.Lab_Name=ds.Tables[0].Rows[0]["Lab_Name"].ToString();
                model.Lab_Category=ds.Tables[0].Rows[0]["Lab_Category"].ToString();
                model.Lab_Level=ds.Tables[0].Rows[0]["Lab_Level"].ToString();
                if(ds.Tables[0].Rows[0]["Lab_SetupTime"].ToString()!="")
                {
                    model.Lab_SetupTime=DateTime.Parse(ds.Tables[0].Rows[0]["Lab_SetupTime"].ToString());
                }
                model.Lab_InCharge=ds.Tables[0].Rows[0]["Lab_InCharge"].ToString();
                if(ds.Tables[0].Rows[0]["Lab_ProjectNum"].ToString()!="")
                {
                    model.Lab_ProjectNum=int.Parse(ds.Tables[0].Rows[0]["Lab_ProjectNum"].ToString());
                }
                model.Lab_Phone=ds.Tables[0].Rows[0]["Lab_Phone"].ToString();
                model.Lab_State=ds.Tables[0].Rows[0]["Lab_State"].ToString();
                model.Lab_Curriculum=ds.Tables[0].Rows[0]["Lab_Curriculum"].ToString();
                if(ds.Tables[0].Rows[0]["Lab_Summary"].ToString()!="")
                {
                    model.Lab_Summary=int.Parse(ds.Tables[0].Rows[0]["Lab_Summary"].ToString());
                }
                model.Lab_Investment=ds.Tables[0].Rows[0]["Lab_Investment"].ToString();
                model.Lab_Type=ds.Tables[0].Rows[0]["Lab_Type"].ToString();
                model.Lab_Disciplines=ds.Tables[0].Rows[0]["Lab_Disciplines"].ToString();
                model.Lab_AwardLevel=ds.Tables[0].Rows[0]["Lab_AwardLevel"].ToString();
                if(ds.Tables[0].Rows[0]["Lab_StAwardNum"].ToString()!="")
                {
                    model.Lab_StAwardNum=int.Parse(ds.Tables[0].Rows[0]["Lab_StAwardNum"].ToString());
                }
                model.Lab_EnglishName=ds.Tables[0].Rows[0]["Lab_EnglishName"].ToString();
                if(ds.Tables[0].Rows[0]["Lab_ParentID"].ToString()!="")
                {
                    model.Lab_ParentID=int.Parse(ds.Tables[0].Rows[0]["Lab_ParentID"].ToString());
                }
                model.Lab_ApprovalCode=ds.Tables[0].Rows[0]["Lab_ApprovalCode"].ToString();
                model.Lab_Professional=ds.Tables[0].Rows[0]["Lab_Professional"].ToString();
                model.Lab_Statement=ds.Tables[0].Rows[0]["Lab_Statement"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }
예제 #3
0
        //��ȡʵ������ͨ��ID
        protected string GetLabNameByID(int ID)
        {
            LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
            LabMS.Model.Lab labModel = new LabMS.Model.Lab();

            labModel = lab.GetModel(ID);

            return labModel.Lab_Name;
        }
예제 #4
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");
        }
예제 #5
0
        //����ʵ�������Ϣ
        protected void Save_OnClick(object sender, EventArgs e)
        {
            if (LabNameTBX.Text.Trim() == "")
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('������ʵ��������!')</script>");
                return;
            }
            if (LabNumTBX.Text.Trim() == "")
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('������ʵ���ұ��!')</script>");
                return;
            }
            //�ж��Ƿ��Ѵ��ڸ�ʵ���ұ��
            if (IsCode(LabNumTBX.Text.ToString().Trim()))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('�Ѵ��ڸ�ʵ���ұ�ţ����������룡')</script>");
                return;
            }
            //��ȡʵ������Ϣ
            LabMS.Model.Lab lab = new LabMS.Model.Lab();//����һ��lab����
            LabMS.BLL.Lab labdata = new LabMS.BLL.Lab();

            lab.Lab_ParentID=int.Parse(LabDDL.SelectedValue); //��ȡ����ID
            lab.Lab_Code = LabNumTBX.Text.ToString().Trim();//��ȡʵ���ұ��
            lab.Lab_Name = LabNameTBX.Text.ToString().Trim();//��ȡʵ��������
            lab.Lab_Category = LabKindDDL.SelectedValue.Trim();//��ȡʵ�������
            lab.Lab_Level = LabLevelDDL.SelectedValue.Trim();//��ȡʵ���Ҽ���
            lab.Lab_Statement = StatementTBX.Text.Trim();//��ע
            if (SetUpDateTBX.Text != "")
            {
                lab.Lab_SetupTime = DateTime.Parse(SetUpDateTBX.Text);//��ȡʵ���ҽ������
            }
            lab.Lab_InCharge = ManagerTBX.Text.ToString().Trim();//��ȡʵ���Ҹ�����
            lab.Lab_Phone = TelTBX.Text.ToString().Trim();//��ȡ��ϵ�绰
            lab.Lab_State = StatusDDL.SelectedValue.Trim();//��ȡʹ��״̬
            lab.Lab_Curriculum = CurriculumTBX.Text.ToString().Trim();//��ȡ��Ҫ�е��γ�
            lab.Lab_Type = LabTypeDDL.SelectedValue.Trim();//��ȡʵ��������

            lab.Lab_AwardLevel = AwardLevelDDL.SelectedValue.Trim();//��ȡ��������
            lab.Lab_ApprovalCode = NumTXB.Text.ToString().Trim();//��ȡ��׼�ĺ�
            lab.Lab_Professional = ProfessionTBX.Text.ToString().Trim();//��ȡ����רҵ
            lab.Lab_Investment = InvestmentTBX.Text.ToString().Trim();//��ȡͶ�ʽ��
            //�ύ����
            if (ViewState["SubID"] != null)
            {
                lab.ID = int.Parse(ViewState["SubID"].ToString());
                labdata.Update(lab);
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('���³ɹ���');refreshParent();window.close();</script>");
            }
            else
            {
                labdata.Add(lab);
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('��ӳɹ���');refreshParent();window.close();</script>");
            }
        }
예제 #6
0
        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;
            }
        }
예제 #7
0
        //绑定所属实验室
        protected void LabDropdowlist()
        {
            //LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
            //List<LabMS.Model.Lab> ParLab = new List<LabMS.Model.Lab>();
            //List<LabMS.Model.Lab> SonLab = new List<LabMS.Model.Lab>();

            //ParLab = lab.GetModelList("Lab_ParentID is null");
            //SonLab = lab.GetModelList("Lab_ParentID is not null");
            //int count = ParLab.Count, count1 = SonLab.Count;

            //for (int i = 0; i < count; i++)
            //{
            //    int ID = ParLab[i].ID;
            //    for (int j = 0; j < count1; j++)
            //    {
            //        LabMS.Model.Lab labModel = new LabMS.Model.Lab();
            //        int ParentID = int.Parse(SonLab[j].Lab_ParentID.ToString());

            //        if (ParentID == ID)
            //        {
            //            labModel.ID = SonLab[j].ID;
            //            labModel.Lab_Name = "|-" + SonLab[j].Lab_Name;
            //            ParLab.Insert(i + 1, labModel);
            //        }
            //    }
            //}
            //LabDDL.DataSource = ParLab;
            //LabDDL.DataBind();
            LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
            List<LabMS.Model.Lab> ParLab = new List<LabMS.Model.Lab>();
            List<LabMS.Model.Lab> SonLab = new List<LabMS.Model.Lab>();
            List<LabMS.Model.Lab> Lab = new List<LabMS.Model.Lab>();

            Lab = lab.GetModelList("Lab_ParentID is null");
            ParLab = lab.GetModelList("Lab_ParentID is null");
            SonLab = lab.GetModelList("Lab_ParentID is not null");
            int count = ParLab.Count, count1 = SonLab.Count;

            for (int i = 0; i < count; i++)
            {
                int ID = ParLab[i].ID;
                for (int j = 0; j < count1; j++)
                {
                    LabMS.Model.Lab labModel = new LabMS.Model.Lab();
                    int ParentID = int.Parse(SonLab[j].Lab_ParentID.ToString());

                    if (ParentID == ID)
                    {
                        labModel.ID = SonLab[j].ID;
                        labModel.Lab_Name = "|-" + SonLab[j].Lab_Name;
                        Lab.Insert(i + j + 1, labModel);
                    }
                }
            }
            LabDDL.DataSource = Lab;
            LabDDL.DataBind();
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("ZJSYS");
            strPageUserType.Add("mana");
            if (Request.QueryString["ID"] == null)
            {
                concel.Visible = false;
                addsublab.Visible = false;
                tt1.Visible = false;
                LabName = "ʵ����";
                if (!IsPostBack)
                {
                    List<LabMS.Model.Dictionary> list = new List<LabMS.Model.Dictionary>();
                    //��ʵ�����
                    list = DictionaryDropdownlist("111");
                    LabKindDDL.DataSource = list;
                    LabKindDDL.DataBind();

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

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

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

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

                    //������ѧ��
                    //SubjectDropdownlist();

                }
            }
            else
            {
                if (!IsPostBack)
                {
                    int ID;
                    string strID = Request.QueryString["ID"].ToString();
                    if (int.TryParse(strID, out ID))
                    {
                        //if (Page.Request.QueryString["flag"] !=null )
                        //{
                        //    SaveBtn.Visible = false;
                        //    concel.Visible = true;
                        //}
                        //else
                        //{
                        //    concel.Visible = true;
                        //    addsublab.Visible = true;
                        //}

                        LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
                        LabMS.Model.Lab labModel = new LabMS.Model.Lab();
                        List<LabMS.Model.Dictionary> list = new List<LabMS.Model.Dictionary>();

                        IDHF.Value = ID.ToString();//�洢IDֵ
                        //��ȡʵ������Ϣ ͨ��ID
                        labModel = lab.GetModel(ID);

                        LabNumTBX.Text = labModel.Lab_Code;//���
                        LabNameTBX.Text = labModel.Lab_Name;//����
                        LabName = labModel.Lab_Name;
                        DateTBX.Text = string.Format("{0:d}", labModel.Lab_SetupTime.ToString());//����
                        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;//����רҵ
                        ProjectNumTBX.Text = labModel.Lab_ProjectNum.ToString();//����������
                        InvestmentTBX.Text = labModel.Lab_Investment.ToString();//Ͷ�ʶ�
                        SubjectTBX.Text = labModel.Lab_Disciplines;//����ѧ��
                        AwardNumTBX.Text = labModel.Lab_StAwardNum.ToString();//����

                        //��ȡ�ļ��б�
                        string strHTML = "";
                        if (labModel.Lab_Summary!= null)
                        {
                            AttachIDHF.Value = labModel.Lab_Summary.ToString();
                            LabMS.BLL.AttachmentItem attIte = new LabMS.BLL.AttachmentItem();
                            List<LabMS.Model.AttachmentItem> attIteModelList = new List<LabMS.Model.AttachmentItem>();

                            attIteModelList = attIte.GetModelList("Attach_ID=" + int.Parse(labModel.Lab_Summary.ToString()));
                            strHTML += "<table>";
                            for (int i = 0; i < attIteModelList.Count; i++)
                            {
                                strHTML += "<tr>";
                                strHTML += "<td style='display:none;'>";
                                strHTML += attIteModelList[i].ID;
                                strHTML += "</td>";
                                strHTML += "<td>";
                                strHTML += "<a>";
                                strHTML += "ɾ��";
                                strHTML += "</a>";
                                strHTML += "</td>";
                                strHTML += "<td>";
                                strHTML += attIteModelList[i].Item_Name;
                                strHTML += "</td>";
                                strHTML += "</tr>";
                            }
                            strHTML += "</table>";
                            filehtml.Value = strHTML;
                        }

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

                        //��ʵ������
                        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;

                        //������ѧ��
                        //SubjectDropdownlist();
                        //DepartmentDDL.SelectedValue = labModel.Lab_Curriculum;

                        //����ʵ������Ϣ
                        SubLabInfo_GridView(ID);
                        SubLabGridView.Visible = true;
                    }
                    else
                    {
                        SaveBtn.Visible = false;
                        ERRLbl.Text = "ϵͳ�쳣��IDֵ���Ϸ���";
                        ERRLbl.Visible = true;
                        addsublab.Visible = false;
                    }
                }
            }
            DateTBX.Attributes.Add("onclick", "c.showMoreDay = false;c.show(this);");
            DateTBX.Attributes.Add("readOnly", "-1");
            RoomAreaTBX.Attributes.Add("readOnly", "-1");
            SubjectTBX.Attributes.Add("readOnly", "-1");
        }
예제 #9
0
        //�ύ�½�ʵ��������
        protected void Save_OnClick(object sender, EventArgs e)
        {
            if (LabNameTBX.Text.Trim() == "")
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('������ʵ��������!')</script>");
                return;
            }
            if (LabNumTBX.Text.Trim() == "")
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('������ʵ���ұ��!')</script>");
                return;
            }
            //�ж��Ƿ��Ѵ��ڸ�ʵ���ұ��
            if (IsCode(LabNumTBX.Text.ToString().Trim()))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('�Ѵ��ڸ�ʵ���ұ�ţ����������룡')</script>");
                return;
            }
            //�ϴ��ļ���ȡ����IDֵ
            //int id = UpdateFile();
            //�ж��Ƿ񸽼�����
            //if (id == -1)
            //{
            //    Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('�ϴ�ʧ�ܣ��ϴ����ļ����ܴ���4M��')</script>");
            //    return;
            //}
            //��ȡʵ������Ϣ
            LabMS.Model.Lab lab = new LabMS.Model.Lab();//����һ��lab����
            //if (id != 0)
            //{
            //    lab.Lab_Summary = id;//��ȡ���ID
            //}
            lab.Lab_Code = LabNumTBX.Text.ToString().Trim();//��ȡʵ���ұ��
            lab.Lab_Name = LabNameTBX.Text.ToString().Trim();//��ȡʵ��������
            lab.Lab_Category = LabKindDDL.SelectedValue.Trim();//��ȡʵ�������
            lab.Lab_Level = LabLevelDDL.SelectedValue.Trim();//��ȡʵ���Ҽ���
            if (DateTBX.Text.Trim() != "")
            {
                lab.Lab_SetupTime = DateTime.Parse(DateTBX.Text.Trim());//��ȡʵ���ҽ������
            }
            lab.Lab_InCharge = ManagerTBX.Text.ToString().Trim();//��ȡʵ���Ҹ�����
            lab.Lab_Phone = TelTBX.Text.ToString().Trim();//��ȡ��ϵ�绰
            lab.Lab_State = StatusDDL.SelectedValue.Trim();//��ȡʹ��״̬
            lab.Lab_Curriculum = CurriculumTBX.Text.ToString().Trim();//��ȡ��Ҫ�е��γ�
            lab.Lab_Type = LabTypeDDL.SelectedValue.Trim();//��ȡʵ��������
            lab.Lab_Disciplines = SubjectTBX.Text.Trim();//��ȡ����ѧ��
            lab.Lab_AwardLevel = AwardLevelDDL.SelectedValue.Trim();//��ȡ��������
            lab.Lab_ApprovalCode = NumTXB.Text.ToString().Trim();//��ȡ��׼�ĺ�
            lab.Lab_Professional = ProfessionTBX.Text.ToString().Trim();//��ȡ����רҵ
            lab.Lab_Statement = StatementTBX.Text.Trim();//��ע
            //��ȡ���м���Ŀ������
            if (ProjectNumTBX.Text.ToString().Trim() != "")
            {
                int i;
                if (int.TryParse(ProjectNumTBX.Text.Trim(), out i))
                {
                    lab.Lab_ProjectNum = i;
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('���м���Ŀ������ֻ����������!')</script>");
                    return;
                }
            }
            lab.Lab_Investment = InvestmentTBX.Text.ToString().Trim();//��ȡͶ�ʽ��
            //ѧ������
            if (AwardNumTBX.Text.ToString().Trim() != "")
            {
                int i;
                if (int.TryParse(AwardNumTBX.Text.Trim(), out i))
                {
                    lab.Lab_StAwardNum = i;
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('ѧ������ֻ����������!')</script>");
                    return;
                }
            }

            //�ϴ�����
            LabMS.BLL.Attachment att = new LabMS.BLL.Attachment();
            LabMS.Model.Attachment attModel = new LabMS.Model.Attachment();
            int AttachID = 0;
            if (AttachIDHF.Value != "")
            {
                AttachID = int.Parse(AttachIDHF.Value);
            }
            HttpFileCollection uploads = HttpContext.Current.Request.Files;
            if (uploads.Count > 1)
            {
                if (AttachIDHF.Value == "")
                {
                    AttachID = att.Add(attModel);
                }
                for (int i = 1; i < uploads.Count; i++)
                {

                    HttpPostedFile upload = uploads[i];
                    Random objRand = new Random();
                    System.DateTime date = DateTime.Now;
                    int fileLength = upload.ContentLength;
                    string filename = upload.FileName;
                    string saveName = date.Year.ToString() + date.Month.ToString() + date.Day.ToString() + Convert.ToString(objRand.Next(99)) + upload.FileName;
                    //if (fileLength == 0)
                    //{
                    //    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script", "<script type='text/javascript'>alert('�ļ���" + filename + "�ϴ�ʧ�ܣ���Ϊ���ļ�Ϊ���ļ���')</script>");
                    //    continue;
                    //}
                    //�ж��ļ���С�Ƿ񳬹�2000K
                    if (fileLength > (2000 * 1024))
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script", "<script type='text/javascript'>alert('�ļ���" + filename + "�ϴ�ʧ�ܣ���Ϊ���ļ�̫��(���ܳ���2M)��')</script>");
                        return;
                    }
                    string fileURL = "Content/UploadFile/" + saveName;
                    try
                    {
                        upload.SaveAs(Server.MapPath("../Content/UploadFile") + "/" + saveName);

                        LabMS.BLL.AttachmentItem attIte = new LabMS.BLL.AttachmentItem();
                        LabMS.Model.AttachmentItem attIteModel = new LabMS.Model.AttachmentItem();

                        attIteModel.Attach_ID = AttachID;
                        attIteModel.Item_Address = fileURL;
                        attIteModel.Item_Name = filename;

                        attIte.Add(attIteModel);
                    }
                    catch
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script", "<script type='text/javascript'>alert('����ļ�ʧ�ܣ�');</script>");
                        return;
                    }
                }

            }
            if (AttachID == 0)
            {
                lab.Lab_Summary = null;//����
            }
            else
            {
                lab.Lab_Summary = AttachID;//����
            }

            //�ύ����
            if (IDHF.Value != "0")
            {
                DeleteAttach();//ɾ������
                lab.ID = int.Parse(IDHF.Value);
                LabMS.BLL.Lab labdata = new LabMS.BLL.Lab();
                labdata.Update(lab);
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('���³ɹ���');refreshParent();window.close();</script>");
            }
            else
            {
                LabMS.BLL.Lab labdata = new LabMS.BLL.Lab();
                labdata.Add(lab);
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('��ӳɹ���');window.location.href='AddNewLab.aspx';</script>");
            }
        }
예제 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("SYSXX");
            if (UserType == "student" || UserType == "teacher")
            {
                modeify.Visible = false;
                DeleteBtn.Visible = false;
                addsublab.Visible = false;
            }
            if (Request.QueryString["ID"] == null)
            {
                ERRLbl.Text = "系统异常,URL参数为空!";
                ERRLbl.Visible = true;
                modeify.Visible = false;
                DeleteBtn.Visible = false;
                addsublab.Visible = false;
            }
            else
            {
                if (Page.Request.QueryString["flag"] != null)
                {
                    modeify.Visible = false;
                    DeleteBtn.Visible = false;
                    addsublab.Visible = false;
                }
                if (!IsPostBack)
                {
                    int ID;
                    string strID = Request.QueryString["ID"].ToString();
                    if (int.TryParse(strID, out ID))
                    {

                        LabMS.BLL.Lab lab = new LabMS.BLL.Lab();
                        LabMS.Model.Lab labModel = new LabMS.Model.Lab();
                        List<LabMS.Model.Dictionary> list = new List<LabMS.Model.Dictionary>();
                        string[] strArray = new string[2];

                        IDHF.Value = ID.ToString();//存储ID值
                        //获取实验室信息 通过ID
                        labModel = lab.GetModel(ID);

                        LabNumLbl.Text = labModel.Lab_Code;//编号
                        LabNameLbl.Text = labModel.Lab_Name;//名字
                        LabName = labModel.Lab_Name;
                        DateLbl.Text = string.Format("{0:d}", labModel.Lab_SetupTime.ToString());//日期
                        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;//面向专业
                        ProjectNumLbl.Text = labModel.Lab_ProjectNum.ToString();//科研任务数
                        InvestmentLbl.Text = labModel.Lab_Investment.ToString();//投资额
                        SubjectLbl.Text = labModel.Lab_Disciplines;//所属学科
                        AwardNumLbl.Text = labModel.Lab_StAwardNum.ToString();//获奖数
                        StatementLbl.Text = labModel.Lab_Statement;//备注

                        //获取文件列表
                        string strHTML = "";
                        if (labModel.Lab_Summary != null)
                        {
                            LabMS.BLL.AttachmentItem attIte = new LabMS.BLL.AttachmentItem();
                            List<LabMS.Model.AttachmentItem> attIteModelList = new List<LabMS.Model.AttachmentItem>();

                            attIteModelList = attIte.GetModelList("Attach_ID=" + int.Parse(labModel.Lab_Summary.ToString()));
                            for (int i = 0; i < attIteModelList.Count; i++)
                            {
                                strHTML += "<a onclick='downloadfile("+attIteModelList[i].ID+")'>";
                                strHTML += attIteModelList[i].Item_Name;
                                strHTML += "</a>";
                                strHTML += "<br/>";
                            }
                            filehtml.InnerHtml = strHTML;
                        }

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

                        //绑定实验类型
                        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;

                        //绑定子实验室信息
                        SubLabInfo_GridView(ID);
                        SubLabGridView.Visible = true;
                    }
                    else
                    {
                        ERRLbl.Text = "系统异常,ID值不合法!";
                        ERRLbl.Visible = true;
                        modeify.Visible = false;
                        DeleteBtn.Visible = false;
                        addsublab.Visible = false;
                    }
                }
            }
        }