Пример #1
0
        /*如果传递过来的批次不是本科批次,并且目前还没有专业相关的数据,就只保存院校信息,然后直接返回zhineng1.aspx页面*/
        void SaveZhuanKeZhiYuanWithoutZhuanYe(DataTable dt)
        {
            //删除旧数据
            DAL.TengXB.StudentZhiYuan.StudentZhiYuanDel(ProvincePiCiId, userinfo.StudentId);
            //循环添加新数据
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int    intZhiYuanId  = GetZhiYuanId(i);                                              //ProvinceZhiYuan表中的 id
                int    intSchoolId   = Basic.TypeConverter.StrToInt(dt.Rows[i]["Id"].ToString(), 0); //学校id
                string strSchoolName = dt.Rows[i]["SchoolName"].ToString();                          //学校名称
                int    intIsTiaoJi   = 1;                                                            //是否服从调剂
                string strMajorList  = "";                                                           //所报专业
                int    intIsAllMajor = 0;

                //构造实体,将志愿存入数据库中
                Entity.StudentZhiYuan infoZhiYuan = new Entity.StudentZhiYuan();
                //新建
                infoZhiYuan.IsAllMajor        = intIsAllMajor;//是否选择了本院校全部的专业
                infoZhiYuan.IsTiaoJi          = intIsTiaoJi;
                infoZhiYuan.MajorCount        = intZhiYuanCount;
                infoZhiYuan.MajorList         = strMajorList;
                infoZhiYuan.Memo              = "暂无本科专业";
                infoZhiYuan.ProvincePcId      = ProvincePiCiId;
                infoZhiYuan.ProvinceZhiYuanId = intZhiYuanId;
                infoZhiYuan.SchoolId          = intSchoolId;
                infoZhiYuan.SchoolName        = strSchoolName;
                infoZhiYuan.StudentId         = userinfo.StudentId;

                if (DAL.StudentZhiYuan.StudentZhiYuanAdd(infoZhiYuan) > 0)
                {
                    // Basic.MsgHelper.AlertUrlMsg("保存成功", "zhineng1.aspx");
                }
                else
                {
                    Basic.MsgHelper.AlertBackMsg("保存失败");
                }
            }
            Basic.MsgHelper.AlertUrlMsg("保存成功", "zhineng1.aspx");
        }
Пример #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strList = hidZhiYuan.Value;//获取填报的志愿数据  json格式的数据:{pczyid:111,schoolid:11,schoolname:北京大学,zyid:11,zyname:fsdf,tj:1},{schoolid:11,zyid:11,zyname:'fsdf',tj:1},

            string[] arr = strList.Split(new string[] { "}," }, StringSplitOptions.RemoveEmptyEntries);
            if (arr.Length == 0)
            {
                Basic.MsgHelper.AlertBackMsg("请选报专业1");
            }
            else
            {
                //删除旧数据
                DAL.TengXB.StudentZhiYuan.StudentZhiYuanDel(ProvincePiCiId, userinfo.StudentId);
                //循环添加新数据
                for (int i = 0; i < arr.Length; i++)
                {
                    int    intZhiYuanId  = 0;  //ProvinceZhiYuan表中的 id
                    int    intSchoolId   = 0;  //学校id
                    string strSchoolName = ""; //学校名称
                    int    intIsTiaoJi   = 0;  //是否服从调剂
                    string strMajorList  = ""; //所报专业
                    int    intIsAllMajor = 0;

                    string   ZhiYuanList = arr[i].Replace("{", "").Replace("}", "");
                    string[] arrZhiYuan  = ZhiYuanList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    if (arrZhiYuan.Length >= 7)
                    {
                        //ProvinceZhiYuan表中的 id
                        intZhiYuanId = Basic.TypeConverter.StrToInt(arrZhiYuan[0].Replace("pczyid:", "").Replace(" ", ""), 0);
                        //学校id
                        intSchoolId = Basic.TypeConverter.StrToInt(arrZhiYuan[1].Replace("schoolid:", "").Replace(" ", ""), 0);
                        //学校名称
                        strSchoolName = arrZhiYuan[2].Replace("schoolname:", "").Replace(" ", "");
                        //是否选择了本院校全部的专业
                        intIsAllMajor = Basic.TypeConverter.StrToInt(arrZhiYuan[(arrZhiYuan.Length - 2)].Replace("isallmajor:", "").Replace(" ", ""), 0);
                        //是否服从调剂
                        intIsTiaoJi = Basic.TypeConverter.StrToInt(arrZhiYuan[(arrZhiYuan.Length - 1)].Replace("tj:", "").Replace(" ", ""), 0);

                        //所报专业:   1:哲学,2:经济学,3:心理学,
                        for (int j = 3; j < arrZhiYuan.Length - 2; j++)
                        {
                            if (j % 2 == 1)
                            {
                                int intZhuanYeId = Basic.TypeConverter.StrToInt(arrZhiYuan[j].Replace("zyid:", "").Replace(" ", ""), 0);
                                if (intZhuanYeId > 0)
                                {
                                    strMajorList += intZhuanYeId + ":";//专业id
                                }
                            }
                            else
                            {
                                string strZhuanYeName = arrZhiYuan[j].Replace("zyname:", "").Replace(" ", "");
                                if (strZhuanYeName != "''")
                                {
                                    strMajorList += strZhuanYeName + ",";//专业名称
                                }
                            }
                        }

                        //构造实体,将志愿存入数据库中
                        Entity.StudentZhiYuan infoZhiYuan = new Entity.StudentZhiYuan();
                        //新建
                        infoZhiYuan.IsAllMajor        = intIsAllMajor;//是否选择了本院校全部的专业
                        infoZhiYuan.IsTiaoJi          = intIsTiaoJi;
                        infoZhiYuan.MajorCount        = intZhiYuanCount;
                        infoZhiYuan.MajorList         = strMajorList;
                        infoZhiYuan.Memo              = "";
                        infoZhiYuan.ProvincePcId      = ProvincePiCiId;
                        infoZhiYuan.ProvinceZhiYuanId = intZhiYuanId;
                        infoZhiYuan.SchoolId          = intSchoolId;
                        infoZhiYuan.SchoolName        = strSchoolName;
                        infoZhiYuan.StudentId         = userinfo.StudentId;

                        if (DAL.StudentZhiYuan.StudentZhiYuanAdd(infoZhiYuan) > 0)
                        {
                            // Basic.MsgHelper.AlertUrlMsg("保存成功", "zhineng1.aspx");
                        }
                        else
                        {
                            Basic.MsgHelper.AlertBackMsg("保存失败");
                        }
                    }
                    else
                    {
                        Basic.MsgHelper.AlertBackMsg("请选报专业2");
                    }
                }
                Basic.MsgHelper.AlertUrlMsg("保存成功", "zhineng1.aspx");
            }
        }