Exemplo n.º 1
0
        public static bool Save(Model.Jcgl.Jd_zy m)
        {
            int r = 0;

            try
            {
                if (String.IsNullOrEmpty(m.Pkid))
                {
                    m.Pkid = ("Zy" + Guid.NewGuid().ToString().Replace("-", "").ToUpper()).Substring(0, 32);
                    r      = BLL.Dmgl.Insert <Model.Jcgl.Jd_zy>(m);
                }
                else
                {
                    r = BLL.Dmgl.Update <Model.Jcgl.Jd_zy>(m);
                }
                return(r > 0);
            }
            catch (Exception err)
            {
                if (err.Message.IndexOf("唯一") > 0)
                {
                    throw new Exception("专业名称已存在 !");
                }
                else
                {
                    throw err;
                }
            }
        }
Exemplo n.º 2
0
 private void ShowUI()
 {
     if (!IsAdd)
     {
         Model.Jcgl.Jd_zy m = BLL.Dmgl.GetEntity <Model.Jcgl.Jd_zy>(Pkid);
         if (String.IsNullOrEmpty(m.Pkid))
         {
             PageContext.RegisterStartupScript(Alert.GetShowInParentReference("页面参数不正确 !", "打开失败", MessageBoxIcon.Error) + ActiveWindow.GetHideReference());
             return;
         }
         this.hfdPkid.Text           = Pkid;
         this.ddlDzbbh.SelectedValue = m.Dzbbh;
         this.tbxZymc.Text           = m.Zymc;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 依据传入参数TableName导入数据
        /// </summary>
        protected override int ImportData(DataRowView drv)
        {
            int cnt = 0;

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

            if (string.IsNullOrEmpty(dzbmc))
            {
                throw new Exception("党支部名称为空。");
            }

            string dzbbh = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtJd_dzb, "Bmbh='" + bmbh + "'", "Dzbmc", "Pkid", dzbmc, "");

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

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

            if (string.IsNullOrEmpty(zymc))
            {
                throw new Exception("专业名称为空。");
            }

            Model.Jcgl.Jd_zy m = new Model.Jcgl.Jd_zy();
            m.Bmbh  = bmbh;
            m.Dzbbh = dzbbh;
            m.Zymc  = zymc;
            if (BLL.Jcgl.Jd_zy.Save(m))
            {
                cnt        = 1;
                drv["Del"] = 1;
            }

            return(cnt);
        }
Exemplo n.º 4
0
        protected bool Save()
        {
            try
            {
                string bmbh   = TStar.Web.Globals.Account.DeptPkid;
                string dzbbh  = this.ddlDzbbh.SelectedValue;
                string zymc   = this.tbxZymc.Text.Trim();
                string errMsg = "";

                if (this.ddlDzbbh.SelectedIndex == 0)
                {
                    errMsg += "请选择党支部名称 !\n";
                }
                if (String.IsNullOrEmpty(zymc))
                {
                    errMsg += "请输入" + Title + "名称 !\n";
                }
                if (errMsg.Length > 0)
                {
                    Alert.Show(errMsg, "保存提示", MessageBoxIcon.Warning);
                    return(false);
                }

                Model.Jcgl.Jd_zy m = TU.Common.ConvertHelper.ConvertToEntity <Model.Jcgl.Jd_zy>();
                if (BLL.Jcgl.Jd_zy.Save(m))
                {
                    BLL.Globals.SystemCode.RefreshDtJd_zy();
                }
                //ShowNotify("保存成功 !");

                return(true);
            }
            catch (Exception err)
            {
                Alert.Show(err.Message, "保存失败", MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 导入党员名单
        /// </summary>
        protected int ImportDymd(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().Replace("_", "");

            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().Trim();

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

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

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

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

            if (string.IsNullOrEmpty(sj))
            {
                throw new Exception("手机不能为空。");
            }
            if (sj.Length != 11)
            {
                throw new Exception("该手机号长度不正确。");
            }

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

            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().Trim();

            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 jyrq = drv[columns[13]].ToString().Trim();

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

            string filter = string.Format("Zbbh='{0}'", TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtJd_khzbLocal, "Zbmc", "Pkid", "党校培训", ""));
            string djmc   = drv[columns[14]].ToString();
            string djbh   = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtJd_xmdjLocal, filter, "Djmc", "Pkid", djmc, "");

            if (djbh == "")
            {
                throw new Exception(columns[14] + "不正确。");
            }

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

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

            string rdrq = drv[columns[16]].ToString().Trim();

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

            string zysbh = drv[columns[17]].ToString().Trim();

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

            string zzrq = drv[columns[18]].ToString().Trim();

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

            string lxrgh = drv[columns[19]].ToString().Trim();
            string lxrxm = drv[columns[20]].ToString().Trim();

            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[21]].ToString().Trim();

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

            Model.Lcgl.Lc_dymd m = new Model.Lcgl.Lc_dymd();
            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.Dxkhztdm = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtDm_khzt, "Mc", "Dm", djmc, "1");
            m.Dxjyrq   = jyrq;
            m.Fzdxrq   = fzdxqdrq;
            m.Rdrq     = rdrq;
            m.Zysbh    = zysbh;
            m.Zzrq     = zzrq;
            m.Lxrbh    = lxr.Pkid;
            m.Jtdz     = jtdz;
            m.Drsj     = drsj;
            if (BLL.Lcgl.Lc_dymd.Save(m))
            {
                cnt        = 1;
                drv["Del"] = 1;
            }

            return(cnt);
        }