示例#1
0
        private static int Update(Model.Lcgl.Lc_jjfzmd xm)
        {
            //xm.Ztdm = (int)TStar.Web.Globals.SystemSetting.Status.Submitted;
            int r = Update <Model.Lcgl.Lc_jjfzmd>(xm);

            // 写日志

            return(r);
        }
示例#2
0
        private static int Insert(Model.Lcgl.Lc_jjfzmd xm)
        {
            xm.Xq   = BLL.Globals.SystemSetting.Dqxq;
            xm.Ztdm = (int)TStar.Web.Globals.SystemSetting.Status.Draft;
            int r = Insert <Model.Lcgl.Lc_jjfzmd>(xm);

            // 写日志

            return(r);
        }
示例#3
0
        /// <summary>
        /// 保存名单
        /// </summary>
        public static bool Save(Model.Lcgl.Lc_jjfzmd xm)
        {
            try
            {
                int r = 0;
                if (String.IsNullOrEmpty(xm.Pkid)) // 新增
                {
                    r = Insert(xm);
                }
                else // 保存
                {
                    r = Update(xm);
                }

                return(r > 0);
            }
            catch (Exception err)
            {
                if (err.Message.IndexOf("Xh") > 0)
                {
                    throw new Exception("该学号重复。");
                }
                if (err.Message.IndexOf("Sfzh") > 0)
                {
                    throw new Exception("该身份证号重复。");
                }
                if (err.Message.IndexOf("Lxdh") > 0)
                {
                    throw new Exception("该手机号码重复。");
                }
                if (err.Message.IndexOf("jjfzmd") > 0)
                {
                    throw new Exception("该学生名单已存在。");
                }
                throw err;
            }
        }
示例#4
0
        //protected override void Page_Init(object sender, EventArgs e)
        //{
        //    Columns10Widths = new int[] { 110, 100, 140, 80, 80, 80, 100, 120, 200, 120 };
        //    base.Page_Init(sender, e);
        //}

        /// <summary>
        /// 导入积极分子
        /// </summary>
        protected int ImportJjfzmd(DataRowView drv, string drsj)
        {
            int cnt = 0;

            string[] columns = Columns;
            string   bmbh    = TStar.Web.Globals.Account.DeptPkid;
            string   dzbmc   = drv[columns[0]].ToString().Trim();

            Model.Jcgl.Jd_dzb dzb = BLL.Jcgl.Jd_dzb.GetEntity(bmbh, dzbmc);
            if (string.IsNullOrEmpty(dzb.Pkid))
            {
                throw new Exception("该党支部信息不存在。");
            }

            string zymc = drv[columns[1]].ToString().Trim();

            Model.Jcgl.Jd_zy zy = BLL.Jcgl.Jd_zy.GetEntity(bmbh, dzb.Pkid, zymc);
            if (string.IsNullOrEmpty(zy.Pkid))
            {
                throw new Exception("该专业信息不存在。");
            }

            string zybh = zy.Pkid;
            string bjmc = drv[columns[2]].ToString().Trim();

            Model.Jcgl.Jd_bj bj = BLL.Jcgl.Jd_bj.GetEntity(bmbh, zybh, bjmc);
            if (string.IsNullOrEmpty(bj.Pkid))
            {
                throw new Exception("该班级信息不存在。");
            }

            string xh = drv[columns[3]].ToString().Trim();

            if (string.IsNullOrEmpty(xh))
            {
                throw new Exception("学号不能为空。");
            }
            if (BLL.Jcgl.Jc_xs.IsRepeated("Xh", xh))
            {
                throw new Exception("该学生已存在。");
            }

            string xm = drv[columns[4]].ToString().Trim();

            if (string.IsNullOrEmpty(xm))
            {
                throw new Exception("姓名不能为空。");
            }

            string xb   = drv[columns[5]].ToString().Trim();
            string xbdm = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtDm_xb, "Mc", "Dm", xb, "");

            if (string.IsNullOrEmpty(xbdm))
            {
                throw new Exception("性别不正确。");
            }

            string sfzh = drv[columns[6]].ToString().Trim();

            if (sfzh.Length != 18)
            {
                throw new Exception("该身份证号长度不正确。");
            }
            if (BLL.Jcgl.Jc_xs.IsRepeated("Sfzh", sfzh))
            {
                throw new Exception("该身份证号已存在。");
            }

            int jcxb = int.Parse(sfzh[16].ToString());

            if (xb == "男" && jcxb % 2 == 0 || xb == "女" && jcxb % 2 == 1)
            {
                throw new Exception("该身份证号的性别位不正确。");
            }

            DateTime dt;
            string   csrq = string.Format("{0}-{1}-{2}", sfzh.Substring(6, 4), sfzh.Substring(10, 2), sfzh.Substring(12, 2));

            if (!DateTime.TryParse(csrq, out dt))
            {
                throw new Exception("该身份证号的出生日期位不正确。");
            }

            string jg = drv[columns[7]].ToString();

            if (string.IsNullOrEmpty(jg))
            {
                throw new Exception("籍贯不能为空。");
            }

            string mz = drv[columns[8]].ToString();

            if (string.IsNullOrEmpty(mz))
            {
                throw new Exception("民族不能为空。");
            }

            string zw = drv[columns[9]].ToString();
            string sj = drv[columns[10]].ToString();

            if (string.IsNullOrEmpty(mz))
            {
                throw new Exception("手机不能为空。");
            }

            string sqrq = drv[columns[11]].ToString();

            if (sqrq.Length < 8)
            {
                throw new Exception(columns[11] + "不正确。");
            }
            sqrq = string.Format("{0}-{1}-{2}", sqrq.Substring(0, 4), sqrq.Substring(4, 2), sqrq.Substring(6, 2));
            if (!DateTime.TryParse(sqrq, out dt))
            {
                throw new Exception(columns[11] + "不正确。");
            }

            string qdrq = drv[columns[12]].ToString();

            if (qdrq.Length < 8)
            {
                throw new Exception(columns[12] + "不正确。");
            }
            qdrq = string.Format("{0}-{1}-{2}", qdrq.Substring(0, 4), qdrq.Substring(4, 2), qdrq.Substring(6, 2));
            if (!DateTime.TryParse(qdrq, out dt))
            {
                throw new Exception(columns[12] + "不正确。");
            }

            string lxrgh = drv[columns[13]].ToString();
            string lxrxm = drv[columns[14]].ToString();

            Model.Jcgl.V_jc_lxr lxr = BLL.Jcgl.Jc_lxr.GetEntity(bmbh, dzb.Pkid, lxrgh, lxrxm);
            if (string.IsNullOrEmpty(lxr.Pkid))
            {
                throw new Exception("该联系人信息不存在。");
            }

            string jtdz = drv[columns[15]].ToString();

            if (string.IsNullOrEmpty(jtdz))
            {
                throw new Exception(columns[11] + "不能为空。");
            }

            Model.Lcgl.Lc_jjfzmd m = new Model.Lcgl.Lc_jjfzmd();
            m.Bmbh   = bmbh;
            m.Zybh   = zybh;
            m.Bjbh   = bj.Pkid;
            m.Dzbbh  = dzb.Pkid;
            m.Xh     = xh;
            m.Xm     = xm;
            m.Xbdm   = xbdm;
            m.Sfzh   = sfzh;
            m.Jg     = jg;
            m.Mz     = mz;
            m.Lxdh   = sj;
            m.Zw     = zw;
            m.Sqrdrq = sqrq;
            m.Jjfzrq = qdrq;
            m.Lxrbh  = lxr.Pkid;
            m.Jtdz   = jtdz;
            m.Drsj   = drsj;
            if (BLL.Lcgl.Lc_jjfzmd.Save(m))
            {
                cnt        = 1;
                drv["Del"] = 1;
            }

            return(cnt);
        }