コード例 #1
0
ファイル: Staff.cs プロジェクト: dalinhuang/labms
        public List<ExtendModule.StaffAndOther> StaffLabList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select Staff.*, Lab_Code,Lab_Name, a.[Name] as Sex,b.[Name] as Subject,c.[Name] as Title,d.[Name] as Education,e.[Name] as PartTime ");
            strSql.Append(" from Staff left outer join Dictionary As A on Staff_Sex=A.Code and A.DClass ='201'");
            strSql.Append(" left join Dictionary as B on Staff_Subject=B.Code and B.DClass = 'Subject'");
            strSql.Append(" left join Dictionary as C on Staff_Title=C.Code and C.DClass = 'Position'");
            strSql.Append(" left join Dictionary as D on Staff_Education=D.Code and D.DClass = 'education'");
            strSql.Append(" left join Dictionary as E on Staff_PartTime=E.Code and E.DClass = 'parttimetype'");
            strSql.Append(" left join Lab on Staff_Lab=Lab.ID ");

            if (!string.IsNullOrEmpty(strWhere))
            {
                strSql.Append(" where " + strWhere);
            }
            DataSet ds = new DataSet();
            ds = DbHelperSQL.Query(strSql.ToString());

            List<ExtendModule.StaffAndOther> modelList = new List<ExtendModule.StaffAndOther>();
            int rowCount = ds.Tables[0].Rows.Count;
            if(rowCount > 0)
            {
                ExtendModule.StaffAndOther model;
                for (int n = 0; n < rowCount; n++ )
                {
                    model = new ExtendModule.StaffAndOther();
                    if (ds.Tables[0].Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(ds.Tables[0].Rows[n]["ID"].ToString());
                    }
                    model.Staff_Code = ds.Tables[0].Rows[n]["Staff_Code"].ToString();
                    model.Staff_Name = ds.Tables[0].Rows[n]["Staff_Name"].ToString();
                    model.Staff_Sex = ds.Tables[0].Rows[n]["Staff_Sex"].ToString();
                    if (ds.Tables[0].Rows[n]["Staff_Birth"].ToString() != "")
                    {
                        model.Staff_Birth = DateTime.Parse(ds.Tables[0].Rows[n]["Staff_Birth"].ToString());
                    }
                    if (ds.Tables[0].Rows[n]["Staff_Lab"].ToString() != "")
                    {
                        model.Staff_Lab = int.Parse(ds.Tables[0].Rows[n]["Staff_Lab"].ToString());
                    }
                    model.Staff_Education = ds.Tables[0].Rows[n]["Staff_Education"].ToString();
                    if (ds.Tables[0].Rows[n]["Staff_GraduteTime"].ToString() != "")
                    {
                        model.Staff_GraduteTime = DateTime.Parse(ds.Tables[0].Rows[n]["Staff_GraduteTime"].ToString());
                    }
                    model.Staff_GradInstution = ds.Tables[0].Rows[n]["Staff_GradInstution"].ToString();
                    if (ds.Tables[0].Rows[n]["Staff_TakeInJob"].ToString() != "")
                    {
                        model.Staff_TakeInJob = DateTime.Parse(ds.Tables[0].Rows[n]["Staff_TakeInJob"].ToString());
                    }
                    model.Staff_Subject = ds.Tables[0].Rows[n]["Staff_Subject"].ToString();
                    model.Staff_Professional = ds.Tables[0].Rows[n]["Staff_Professional"].ToString();
                    if (ds.Tables[0].Rows[n]["Staff_LabSeniority"].ToString() != "")
                    {
                        model.Staff_LabSeniority = int.Parse(ds.Tables[0].Rows[n]["Staff_LabSeniority"].ToString());
                    }
                    model.Staff_Title = ds.Tables[0].Rows[n]["Staff_Title"].ToString();
                    model.Staff_Disciplines = ds.Tables[0].Rows[n]["Staff_Disciplines"].ToString();
                    if (ds.Tables[0].Rows[n]["Staff_PositionTime"].ToString() != "")
                    {
                        model.Staff_PositionTime = DateTime.Parse(ds.Tables[0].Rows[n]["Staff_PositionTime"].ToString());
                    }
                    model.Staff_Employ = ds.Tables[0].Rows[n]["Staff_Employ"].ToString();
                    if (ds.Tables[0].Rows[n]["Staff_LabTime"].ToString() != "")
                    {
                        model.Staff_LabTime = DateTime.Parse(ds.Tables[0].Rows[n]["Staff_LabTime"].ToString());
                    }
                    if (ds.Tables[0].Rows[n]["Staff_PaperNum"].ToString() != "")
                    {
                        model.Staff_PaperNum = int.Parse(ds.Tables[0].Rows[n]["Staff_PaperNum"].ToString());
                    }
                    model.Staff_PaperLevel = ds.Tables[0].Rows[n]["Staff_PaperLevel"].ToString();
                    if (ds.Tables[0].Rows[n]["Staff_PublicationsNum"].ToString() != "")
                    {
                        model.Staff_PublicationsNum = int.Parse(ds.Tables[0].Rows[n]["Staff_PublicationsNum"].ToString());
                    }
                    model.Staff_PublicationsLevel = ds.Tables[0].Rows[n]["Staff_PublicationsLevel"].ToString();
                    model.Staff_Work = ds.Tables[0].Rows[n]["Staff_Work"].ToString();
                    model.Staff_Workload = ds.Tables[0].Rows[n]["Staff_Workload"].ToString();
                    model.Staff_ForeignLanguage = ds.Tables[0].Rows[n]["Staff_ForeignLanguage"].ToString();
                    model.Staff_ForeignLevel = ds.Tables[0].Rows[n]["Staff_ForeignLevel"].ToString();
                    model.Staff_ResearchSub = ds.Tables[0].Rows[n]["Staff_ResearchSub"].ToString();
                    model.Staff_SubjectLevel = ds.Tables[0].Rows[n]["Staff_SubjectLevel"].ToString();
                    model.Staff_Award = ds.Tables[0].Rows[n]["Staff_Award"].ToString();
                    model.Staff_Level = ds.Tables[0].Rows[n]["Staff_Level"].ToString();
                    model.Staff_PartTime = ds.Tables[0].Rows[n]["Staff_PartTime"].ToString();
                    model.Staff_ExpertLevel = ds.Tables[0].Rows[n]["Staff_ExpertLevel"].ToString();
                    if (ds.Tables[0].Rows[n]["Staff_Photo"].ToString() != "")
                    {
                        model.Staff_Photo = (byte[])ds.Tables[0].Rows[n]["Staff_Photo"];
                    }
                    model.Staff_Summary = ds.Tables[0].Rows[n]["Staff_Summary"].ToString();
                    model.Lab_Code = ds.Tables[0].Rows[n]["Lab_Code"].ToString();
                    model.Lab_Name = ds.Tables[0].Rows[n]["Lab_Name"].ToString();
                    model.Sex = ds.Tables[0].Rows[n]["Sex"].ToString();
                    model.Subject = ds.Tables[0].Rows[n]["Subject"].ToString();
                    model.Title = ds.Tables[0].Rows[n]["Title"].ToString();
                    model.Education = ds.Tables[0].Rows[n]["Education"].ToString();
                    model.PartTime = ds.Tables[0].Rows[n]["PartTime"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }
コード例 #2
0
ファイル: Staff.cs プロジェクト: dalinhuang/labms
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ExtendModule.StaffAndOther GetStaffModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select Staff.*, Lab_Code,Lab_Name, a.[Name] as Sex,b.[Name] as Subject,c.[Name] as Title,d.[Name] as Education,e.[Name] as PartTime ");
            strSql.Append(" from Staff left outer join Dictionary As A on Staff_Sex=A.Code and A.DClass ='201'");
            strSql.Append(" left join Dictionary as B on Staff_Subject=B.Code and B.DClass = 'Subject'");
            strSql.Append(" left join Dictionary as C on Staff_Title=C.Code and C.DClass = 'Position'");
            strSql.Append(" left join Dictionary as D on Staff_Education=D.Code and D.DClass = 'education'");
            strSql.Append(" left join Dictionary as E on Staff_PartTime=E.Code and E.DClass = 'parttimetype'");
            strSql.Append(" left join Lab on Staff_Lab=Lab.ID ");
            strSql.Append(" where Staff.ID=@ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)};
            parameters[0].Value = ID;

            ExtendModule.StaffAndOther model = new ExtendModule.StaffAndOther();
            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.Staff_Code = ds.Tables[0].Rows[0]["Staff_Code"].ToString();
                model.Staff_Name = ds.Tables[0].Rows[0]["Staff_Name"].ToString();
                model.Staff_Sex = ds.Tables[0].Rows[0]["Staff_Sex"].ToString();
                if (ds.Tables[0].Rows[0]["Staff_Birth"].ToString() != "")
                {
                    model.Staff_Birth = DateTime.Parse(ds.Tables[0].Rows[0]["Staff_Birth"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Staff_Lab"].ToString() != "")
                {
                    model.Staff_Lab = int.Parse(ds.Tables[0].Rows[0]["Staff_Lab"].ToString());
                }
                model.Staff_Education = ds.Tables[0].Rows[0]["Staff_Education"].ToString();
                if (ds.Tables[0].Rows[0]["Staff_GraduteTime"].ToString() != "")
                {
                    model.Staff_GraduteTime = DateTime.Parse(ds.Tables[0].Rows[0]["Staff_GraduteTime"].ToString());
                }
                model.Staff_GradInstution = ds.Tables[0].Rows[0]["Staff_GradInstution"].ToString();
                if (ds.Tables[0].Rows[0]["Staff_TakeInJob"].ToString() != "")
                {
                    model.Staff_TakeInJob = DateTime.Parse(ds.Tables[0].Rows[0]["Staff_TakeInJob"].ToString());
                }
                model.Staff_Subject = ds.Tables[0].Rows[0]["Staff_Subject"].ToString();
                model.Staff_Professional = ds.Tables[0].Rows[0]["Staff_Professional"].ToString();
                if (ds.Tables[0].Rows[0]["Staff_LabSeniority"].ToString() != "")
                {
                    model.Staff_LabSeniority = int.Parse(ds.Tables[0].Rows[0]["Staff_LabSeniority"].ToString());
                }
                model.Staff_Title = ds.Tables[0].Rows[0]["Staff_Title"].ToString();
                model.Staff_Disciplines = ds.Tables[0].Rows[0]["Staff_Disciplines"].ToString();
                if (ds.Tables[0].Rows[0]["Staff_PositionTime"].ToString() != "")
                {
                    model.Staff_PositionTime = DateTime.Parse(ds.Tables[0].Rows[0]["Staff_PositionTime"].ToString());
                }
                model.Staff_Employ = ds.Tables[0].Rows[0]["Staff_Employ"].ToString();
                if (ds.Tables[0].Rows[0]["Staff_LabTime"].ToString() != "")
                {
                    model.Staff_LabTime = DateTime.Parse(ds.Tables[0].Rows[0]["Staff_LabTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Staff_PaperNum"].ToString() != "")
                {
                    model.Staff_PaperNum = int.Parse(ds.Tables[0].Rows[0]["Staff_PaperNum"].ToString());
                }
                model.Staff_PaperLevel = ds.Tables[0].Rows[0]["Staff_PaperLevel"].ToString();
                if (ds.Tables[0].Rows[0]["Staff_PublicationsNum"].ToString() != "")
                {
                    model.Staff_PublicationsNum = int.Parse(ds.Tables[0].Rows[0]["Staff_PublicationsNum"].ToString());
                }
                model.Staff_PublicationsLevel = ds.Tables[0].Rows[0]["Staff_PublicationsLevel"].ToString();
                model.Staff_Work = ds.Tables[0].Rows[0]["Staff_Work"].ToString();
                model.Staff_Workload = ds.Tables[0].Rows[0]["Staff_Workload"].ToString();
                model.Staff_ForeignLanguage = ds.Tables[0].Rows[0]["Staff_ForeignLanguage"].ToString();
                model.Staff_ForeignLevel = ds.Tables[0].Rows[0]["Staff_ForeignLevel"].ToString();
                model.Staff_ResearchSub = ds.Tables[0].Rows[0]["Staff_ResearchSub"].ToString();
                model.Staff_SubjectLevel = ds.Tables[0].Rows[0]["Staff_SubjectLevel"].ToString();
                model.Staff_Award = ds.Tables[0].Rows[0]["Staff_Award"].ToString();
                model.Staff_Level = ds.Tables[0].Rows[0]["Staff_Level"].ToString();
                model.Staff_PartTime = ds.Tables[0].Rows[0]["Staff_PartTime"].ToString();
                model.Staff_ExpertLevel = ds.Tables[0].Rows[0]["Staff_ExpertLevel"].ToString();
                if (ds.Tables[0].Rows[0]["Staff_Photo"].ToString() != "")
                {
                    model.Staff_Photo = (byte[])ds.Tables[0].Rows[0]["Staff_Photo"];
                }
                model.Staff_Summary = ds.Tables[0].Rows[0]["Staff_Summary"].ToString();
                model.Lab_Code = ds.Tables[0].Rows[0]["Lab_Code"].ToString();
                model.Lab_Name = ds.Tables[0].Rows[0]["Lab_Name"].ToString();
                model.Sex = ds.Tables[0].Rows[0]["Sex"].ToString();
                model.Subject = ds.Tables[0].Rows[0]["Subject"].ToString();
                model.Title = ds.Tables[0].Rows[0]["Title"].ToString();
                model.Education = ds.Tables[0].Rows[0]["Education"].ToString();
                model.PartTime = ds.Tables[0].Rows[0]["PartTime"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }
コード例 #3
0
ファイル: EditStaff.aspx.cs プロジェクト: dalinhuang/labms
        //绑定人员信息
        protected void BindData(int ID)
        {
            ExtendBLL.Staff staff = new ExtendBLL.Staff();
            ExtendModule.StaffAndOther staffInfo = new ExtendModule.StaffAndOther();

            staffInfo = staff.GetStaffModel(ID);
            StaffPhoto.ImageUrl = "~/LabPersonnel/picShow.aspx?ID=" + ID;
            StaffIDTBX.Text = staffInfo.ID.ToString();//ID
            StaffID.Text = staffInfo.Staff_Code.ToString();//人员编号
            StaffName.Text = staffInfo.Staff_Name.ToString();//姓名
            StaffSexDDL.SelectedValue = staffInfo.Sex.ToString();//性别
            StaffBirth.Text = staffInfo.Staff_Birth.Value.ToShortDateString();//出生日期
            StaffLabDDL.SelectedValue = staffInfo.Staff_Lab.ToString();//所属实验室
            StaffEducationDDL.SelectedValue = staffInfo.Education.ToString();//文化程度
            if (!string.IsNullOrEmpty(staffInfo.Staff_GraduteTime.ToString()))
            {
                StaffGraduteTime.Text = staffInfo.Staff_GraduteTime.Value.ToShortDateString();//毕业时间
            }
            StaffGradInstitution.Text = staffInfo.Staff_GradInstution.ToString();//毕业院校
            if (!string.IsNullOrEmpty(staffInfo.Staff_TakeInJob.ToString()))
            {
                StaffTakeInJob.Text = staffInfo.Staff_TakeInJob.Value.ToShortDateString();//参加工作时间
            }
            if (!string.IsNullOrEmpty(staffInfo.Staff_PositionTime.ToString()))
            {
                StaffPositionTime.Text = staffInfo.Staff_PositionTime.Value.ToShortDateString();//评职时间
            }
            if (!string.IsNullOrEmpty(staffInfo.Staff_LabTime.ToString()))
            {
                StaffLabTime.Text = staffInfo.Staff_LabTime.Value.ToShortDateString();//实验室工作时间
            }
            StaffSubject.Text = staffInfo.Subject.ToString();//所属学科
            tbSubjectCode.Text = staffInfo.Staff_Subject.ToString();//所属学科代码
            StaffProfessional.Text = staffInfo.Staff_Professional.ToString();//专业方向
            StaffLabSeniority.Text = staffInfo.Staff_LabSeniority.ToString();//实验室工龄
            StaffTitle.Text = staffInfo.Title.ToString();//职称
            tbStaffTitleCode.Text = staffInfo.Staff_Title.ToString();//职称代码

            tbDesciplineCode.Text = staffInfo.Staff_Disciplines.ToString();//主讲课程代码
            string staffDisipCode = staffInfo.Staff_Disciplines.ToString();
            string staffDisipName = "";
            if (!staffDisipCode.Equals(""))
            {
                string[] staffDisipArray = staffDisipCode.Split(';');
                for (int i = 0; i < staffDisipArray.Length; i++)
                {
                    staffDisipName += staff.GetDescipline(staffDisipArray[i]) + ";";//主讲课程
                }
                StaffDisciplines.Text = staffDisipName.Substring(0, staffDisipName.Length - 1);
            }
            else
            {
                StaffDisciplines.Text = staffDisipName;
            }

            StaffEmployDDL.SelectedValue = staffInfo.Staff_Employ.ToString();//任聘情况

            StaffPaperNum.Text = staffInfo.Staff_PaperNum.ToString();//论文数量
            StaffPaperLevelDDL.SelectedValue = staffInfo.Staff_PaperLevel.ToString();//论文级别
            StaffPublicationsNum.Text = staffInfo.Staff_PublicationsNum.ToString();//著作数量
            StaffPublicationsLevelDDL.SelectedValue = staffInfo.Staff_PublicationsLevel.ToString();//著作级别
            StaffWorkDDL.SelectedValue = staffInfo.Staff_Work.ToString();//主要工作
            StaffWorkload.Text = staffInfo.Staff_Workload.ToString();//工作量
            StaffForeignLanguage.Text = staffInfo.Staff_ForeignLanguage.ToString();//一外语种
            StaffForeignLevel.Text = staffInfo.Staff_ForeignLevel.ToString();//一外级别
            StaffResearchSub.Text = staffInfo.Staff_ResearchSub.ToString();//在研课题
            StaffSubjectLevel.Text = staffInfo.Staff_SubjectLevel.ToString();//课题级别
            StaffAward.Text = staffInfo.Staff_Award.ToString();//成果奖励
            StaffPartTimeDDL.SelectedValue = staffInfo.Staff_PartTime.ToString();//人员类别
            StaffLevelDDL.SelectedValue = staffInfo.Staff_Level.ToString();//人员类别等级
            StaffSummary.Text = staffInfo.Staff_Summary.ToString();//备注
            //专家类别
            //string expertLevelString = staffInfo.Staff_ExpertLevel.ToString();
            //if (!expertLevelString.Equals(""))
            //{
            //    string[] expertLevelArray = expertLevelString.Split(';');
            //    for (int i = 0; i < expertLevelArray.Length; i++)
            //    {
            //        for (int j = 0; j < StaffExpertLevel.Items.Count; j++)
            //        {
            //            if (StaffExpertLevel.Items[j].Value == expertLevelArray[i])
            //            {
            //                StaffExpertLevel.Items[j].Selected = true;
            //            }
            //        }
            //    }
            //}
        }