Esempio n. 1
0
        public List <Model.BasicRotaryViewModel> CommonGetPagedList(string TrainingBaseCode, string ProfessionalBaseCode,
                                                                    string StudentsRealName, string Sex, string MinZu, string HighEducation, string HighSchool,
                                                                    string IdentityType, string SendUnit, string CollaborativeUnit, string TrainingTime, string PlanTrainingTime,
                                                                    string DeptName, string ProfessionalBaseName, string TeachersRealName,
                                                                    string RotaryBeginTime, string RotaryEndTime, string OutdeptStatus,
                                                                    int start, int end)
        {
            string sql = "select * from (select row_number() over(order by GP_Students_Rotary_register_date desc) as num,* from Basic_Rotary_View where GP_Students_Rotary_training_base_code like '%" + TrainingBaseCode + "%'";

            if (!string.IsNullOrEmpty(ProfessionalBaseCode))
            {
                sql += "and professional_base_code like '%" + ProfessionalBaseCode + "%'";
            }
            if (!string.IsNullOrEmpty(StudentsRealName))
            {
                sql += "and real_name like '%" + StudentsRealName + "%'";
            }
            if (!string.IsNullOrEmpty(Sex))
            {
                sql += "and sex ='" + Sex + "'";
            }
            if (!string.IsNullOrEmpty(MinZu))
            {
                sql += "and minzu like '%" + MinZu + "%'";
            }
            if (!string.IsNullOrEmpty(HighEducation))
            {
                sql += "and high_education like '%" + HighEducation + "%'";
            }
            if (!string.IsNullOrEmpty(HighSchool))
            {
                sql += "and high_school like '%" + HighSchool + "%'";
            }
            if (!string.IsNullOrEmpty(IdentityType))
            {
                sql += "and identity_type like '%" + IdentityType + "%'";
            }
            if (!string.IsNullOrEmpty(SendUnit))
            {
                sql += "and send_unit = '" + SendUnit + "'";
            }
            if (!string.IsNullOrEmpty(CollaborativeUnit))
            {
                sql += "and collaborative_unit like '%" + CollaborativeUnit + "%'";
            }
            if (!string.IsNullOrEmpty(TrainingTime))
            {
                sql += "and training_time like '%" + TrainingTime + "%'";
            }
            if (!string.IsNullOrEmpty(PlanTrainingTime))
            {
                sql += "and plan_training_time = '" + PlanTrainingTime + "'";
            }
            if (!string.IsNullOrEmpty(ProfessionalBaseName))
            {
                sql += "and GP_Students_Rotary_professional_base_name like '%" + ProfessionalBaseName + "%'";
            }
            if (!string.IsNullOrEmpty(DeptName))
            {
                sql += "and rotary_dept_name like '%" + DeptName + "%'";
            }
            if (!string.IsNullOrEmpty(TeachersRealName))
            {
                sql += "and instructor like '%" + TeachersRealName + "%'";
            }
            if (!string.IsNullOrEmpty(RotaryBeginTime))
            {
                sql += "and rotary_begin_time = '" + RotaryBeginTime + "'";
            }
            if (!string.IsNullOrEmpty(RotaryEndTime))
            {
                sql += "and rotary_end_time = '" + RotaryEndTime + "'";
            }
            if (!string.IsNullOrEmpty(OutdeptStatus))
            {
                sql += "and outdept_status like '%" + OutdeptStatus + "%'";
            }
            sql += ")as t where t.num>=@start and t.num<=@end";


            SqlParameter[] pars =
            {
                new SqlParameter("@start", SqlDbType.Int),
                new SqlParameter("@end",   SqlDbType.Int)
            };
            pars[0].Value = start;
            pars[1].Value = end;
            DataTable dt = db.RunDataTable(sql, pars);
            List <BasicRotaryViewModel> list = null;

            if (dt.Rows.Count > 0)
            {
                list = new List <BasicRotaryViewModel>();
                BasicRotaryViewModel model = null;
                foreach (DataRow row in dt.Rows)
                {
                    model = new BasicRotaryViewModel();
                    model = DataRowToModel(row);
                    list.Add(model);
                }
            }
            return(list);
        }
Esempio n. 2
0
        public BasicRotaryViewModel DataRowToModel(DataRow row)
        {
            BasicRotaryViewModel model = new BasicRotaryViewModel();

            if (row != null)
            {
                if (row["id"] != null)
                {
                    model.id = row["id"].ToString();
                }
                if (row["name"] != null)
                {
                    model.name = row["name"].ToString();
                }
                if (row["real_name"] != null)
                {
                    model.real_name = row["real_name"].ToString();
                }
                if (row["sex"] != null)
                {
                    model.sex = row["sex"].ToString();
                }
                if (row["age"] != null)
                {
                    model.age = row["age"].ToString();
                }
                if (row["datebirth"] != null)
                {
                    model.datebirth = row["datebirth"].ToString();
                }
                if (row["minzu"] != null)
                {
                    model.minzu = row["minzu"].ToString();
                }
                if (row["province"] != null)
                {
                    model.province = row["province"].ToString();
                }
                if (row["city"] != null)
                {
                    model.city = row["city"].ToString();
                }
                if (row["area"] != null)
                {
                    model.area = row["area"].ToString();
                }
                if (row["detail_address"] != null)
                {
                    model.detail_address = row["detail_address"].ToString();
                }
                if (row["id_number"] != null)
                {
                    model.id_number = row["id_number"].ToString();
                }
                if (row["telephon"] != null)
                {
                    model.telephon = row["telephon"].ToString();
                }
                if (row["mail"] != null)
                {
                    model.mail = row["mail"].ToString();
                }
                if (row["bk_school"] != null)
                {
                    model.bk_school = row["bk_school"].ToString();
                }
                if (row["bk_major"] != null)
                {
                    model.bk_major = row["bk_major"].ToString();
                }
                if (row["graduation_time"] != null)
                {
                    model.graduation_time = row["graduation_time"].ToString();
                }
                if (row["high_education"] != null)
                {
                    model.high_education = row["high_education"].ToString();
                }
                if (row["high_school"] != null)
                {
                    model.high_school = row["high_school"].ToString();
                }
                if (row["high_major"] != null)
                {
                    model.high_major = row["high_major"].ToString();
                }
                if (row["high_education_time"] != null)
                {
                    model.high_education_time = row["high_education_time"].ToString();
                }
                if (row["identity_type"] != null)
                {
                    model.identity_type = row["identity_type"].ToString();
                }
                if (row["send_unit"] != null)
                {
                    model.send_unit = row["send_unit"].ToString();
                }
                if (row["training_base_province_code"] != null)
                {
                    model.training_base_province_code = row["training_base_province_code"].ToString();
                }
                if (row["training_base_province_name"] != null)
                {
                    model.training_base_province_name = row["training_base_province_name"].ToString();
                }
                if (row["training_base_code"] != null)
                {
                    model.training_base_code = row["training_base_code"].ToString();
                }
                if (row["training_base_name"] != null)
                {
                    model.training_base_name = row["training_base_name"].ToString();
                }
                if (row["collaborative_unit"] != null)
                {
                    model.collaborative_unit = row["collaborative_unit"].ToString();
                }
                if (row["professional_base_name"] != null)
                {
                    model.professional_base_name = row["professional_base_name"].ToString();
                }
                if (row["professional_base_code"] != null)
                {
                    model.professional_base_code = row["professional_base_code"].ToString();
                }
                if (row["training_time"] != null)
                {
                    model.training_time = row["training_time"].ToString();
                }
                if (row["plan_training_time"] != null)
                {
                    model.plan_training_time = row["plan_training_time"].ToString();
                }
                if (row["writor"] != null)
                {
                    model.writor = row["writor"].ToString();
                }
                if (row["register_date"] != null)
                {
                    model.register_date = row["register_date"].ToString();
                }
                if (row["GP_Students_Rotary_id"] != null)
                {
                    model.GP_Students_Rotary_id = row["GP_Students_Rotary_id"].ToString();
                }
                if (row["GP_Students_Rotary_name"] != null)
                {
                    model.GP_Students_Rotary_name = row["GP_Students_Rotary_name"].ToString();
                }
                if (row["GP_Students_Rotary_real_name"] != null)
                {
                    model.GP_Students_Rotary_real_name = row["GP_Students_Rotary_real_name"].ToString();
                }
                if (row["rotary_begin_time"] != null)
                {
                    model.rotary_begin_time = row["rotary_begin_time"].ToString();
                }
                if (row["rotary_end_time"] != null)
                {
                    model.rotary_end_time = row["rotary_end_time"].ToString();
                }
                if (row["GP_Students_Rotary_training_base_code"] != null)
                {
                    model.GP_Students_Rotary_training_base_code = row["GP_Students_Rotary_training_base_code"].ToString();
                }
                if (row["GP_Students_Rotary_training_base_name"] != null)
                {
                    model.GP_Students_Rotary_training_base_name = row["GP_Students_Rotary_training_base_name"].ToString();
                }
                if (row["GP_Students_Rotary_professional_base_code"] != null)
                {
                    model.GP_Students_Rotary_professional_base_code = row["GP_Students_Rotary_professional_base_code"].ToString();
                }
                if (row["GP_Students_Rotary_professional_base_name"] != null)
                {
                    model.GP_Students_Rotary_professional_base_name = row["GP_Students_Rotary_professional_base_name"].ToString();
                }
                if (row["rotary_dept_code"] != null)
                {
                    model.rotary_dept_code = row["rotary_dept_code"].ToString();
                }
                if (row["rotary_dept_name"] != null)
                {
                    model.rotary_dept_name = row["rotary_dept_name"].ToString();
                }
                if (row["instructor"] != null)
                {
                    model.instructor = row["instructor"].ToString();
                }
                if (row["instructor_tag"] != null)
                {
                    model.instructor_tag = row["instructor_tag"].ToString();
                }
                if (row["GP_Students_Rotary_register_date"] != null)
                {
                    model.GP_Students_Rotary_register_date = row["GP_Students_Rotary_register_date"].ToString();
                }
                if (row["GP_Students_Rotary_writor"] != null)
                {
                    model.GP_Students_Rotary_writor = row["GP_Students_Rotary_writor"].ToString();
                }
                if (row["outdept_status"] != null)
                {
                    model.outdept_status = row["outdept_status"].ToString();
                }
                if (row["outdept_application"] != null)
                {
                    model.outdept_application = row["outdept_application"].ToString();
                }
                if (row["questionnaire_status"] != null)
                {
                    model.questionnaire_status = row["questionnaire_status"].ToString();
                }
                if (row["urgent"] != null)
                {
                    model.urgent = row["urgent"].ToString();
                }
                if (row["urgent_telephon"] != null)
                {
                    model.urgent_telephon = row["urgent_telephon"].ToString();
                }
                if (row["image_path"] != null)
                {
                    model.image_path = row["image_path"].ToString();
                }
                if (row["province_code"] != null)
                {
                    model.province_code = row["province_code"].ToString();
                }
                if (row["city_code"] != null)
                {
                    model.city_code = row["city_code"].ToString();
                }
                if (row["area_code"] != null)
                {
                    model.area_code = row["area_code"].ToString();
                }
            }
            return(model);
        }