예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string dbfPath  = Server.MapPath("~/Data/Dbf/sysdbf/");
         string dbfTable = "schools.DBF";
         this.gvSchool.DataSource = DbfHelper.ToDataTable(dbfPath, dbfTable);
         this.gvSchool.DataBind();
     }
 }
예제 #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        StringBuilder errMsg = new StringBuilder();

        if (this.CurBmk != null)
        {
            string oldBmkJson = this.CurBmk.Json();
            this.CurBmk.bj = this.txtBj.Text.Trim();
            this.CurBmk.xh = this.txtBnbh.Text.Trim();
            if (IDCardChecker.CheckIDCard(this.txtsfzh.Text) && this.txtsfzh.Text != null)
            {
                if (this.txtsfzh.Text.Substring(6, 8) != this.txtCsny.Text)
                {
                    errMsg.Append("身份证号码中的出生年月日与你所填写的出生年月日不一致!");
                }
                string sexIDCard = this.txtsfzh.Text.Substring(16, 1);
                if ("02468Xx".Contains(sexIDCard) && (this.ddlSex.SelectedValue != "2"))
                {
                    errMsg.Append("身份证号码与所选性别不一致!");
                }
                else if ("13579".Contains(sexIDCard) && (this.ddlSex.SelectedValue != "1"))
                {
                    errMsg.Append("身份证号码与所选性别不一致!");
                }
                this.CurBmk.sfzh = this.txtsfzh.Text.Trim();
            }
            else
            {
                this.CurBmk.sfzh = this.txtsfzh.Text.Trim();//身份证错误也允许录入
                errMsg.Append("身份证号码已经保存但有错误!");
            }
            this.CurBmk.xstbh = this.txtXstbh.Text.Trim();
            this.CurBmk.xm    = this.txtXm.Text.Trim();
            this.CurBmk.Bm    = this.txtBm.Text.Trim();
            if (this.ddlSex.SelectedIndex > 0)
            {
                this.CurBmk.xb = this.ddlSex.SelectedValue;
            }
            else
            {
                errMsg.Append("性别没选择,");
            }

            if (Bmk.ValidateCsny(this.txtCsny.Text))
            {
                this.CurBmk.csny = this.txtCsny.Text.Trim();
            }
            else
            {
                errMsg.Append("出生年月日有误!必须是8位数字(如:19910805),");
            }

            if (this.ddlTy.SelectedIndex > 0)
            {
                this.CurBmk.ty = this.ddlTy.SelectedValue;//团员
            }
            else
            {
                errMsg.Append("是否团员未选择,");
            }

            if (this.ddlMz.SelectedIndex > 0)
            {
                this.CurBmk.mz = this.ddlMz.SelectedValue;//民族
            }
            else
            {
                errMsg.Append("民族未选择,");
            }

            if (this.ddlKslb.SelectedIndex > 0)
            {
                this.CurBmk.kslb = this.ddlKslb.SelectedValue;//考生类别
            }
            else
            {
                errMsg.Append("考生类别未选择,");
            }

            if (this.ddlHk.SelectedIndex > 0)
            {
                this.CurBmk.hk = this.ddlHk.SelectedValue;
            }
            else
            {
                errMsg.Append("户口未选择,");
            }

            if (this.txtTel.Text.IsNullOrEmpty())
            {
                errMsg.Append("联系电话未填写,");
            }
            else
            {
                this.CurBmk.tel = this.txtTel.Text.Trim();
            }

            if (this.txtJtzz.Text.IsNullOrEmpty())
            {
                errMsg.Append("家庭地址未填写,");
            }
            else
            {
                this.CurBmk.jtzz = this.txtJtzz.Text.Trim();
            }

            if (this.txtPost.Text.IsNullOrEmpty())
            {
                errMsg.Append("邮政编码未填写,");
            }
            else
            {
                this.CurBmk.post = this.txtPost.Text.Trim();
            }


            if (this.ddlSyqk.SelectedIndex > 0)
            {
                this.CurBmk.syqk = this.ddlSyqk.SelectedValue;
            }
            else
            {
                errMsg.Append("生源情况未选择,");
            }
            if (this.ddlHk.SelectedValue == "25" && this.ddlSyqk.SelectedValue != "0")
            {
                errMsg.Append("鹿城户籍学生只能选0,");
            }
            else if (this.ddlHk.SelectedValue != "25" && this.ddlSyqk.SelectedValue == "0")
            {
                errMsg.Append("非鹿城户籍学生只能选1或7,1表现在鹿城报考,7表示回原籍报考,报考幼师的同学只能回原籍报考,");
            }
            else if ("89".Contains(this.ddlSyqk.SelectedValue))
            {
                errMsg.Append("我们不能选择8或9,");
            }

            this.CurBmk.czhj = this.txtCzhj.Text.Trim();
            this.CurBmk.xqah = this.txtXqah.Text.Trim();

            this.CurBmk.father    = this.txtFather.Text.Trim();
            this.CurBmk.fatherdw  = this.txtFatherdw.Text.Trim();
            this.CurBmk.fatherzw  = this.txtFatherzw.Text.Trim();
            this.CurBmk.fathertel = this.txtFathertel.Text.Trim();
            this.CurBmk.mother    = this.txtMother.Text.Trim();
            this.CurBmk.motherdw  = this.txtMotherdw.Text.Trim();
            this.CurBmk.motherzw  = this.txtMotherzw.Text.Trim();
            this.CurBmk.mothertel = this.txtMothertel.Text.Trim();

            this.CurBmk.bz1 = this.txtBeizhu1.Text.Trim();
            this.CurBmk.bz2 = this.txtBeizhu2.Text.Trim();
            this.CurBmk.bz3 = this.txtBeizhu3.Text.Trim();
            this.CurBmk.bz4 = this.txtBeizhu4.Text.Trim();
            this.CurBmk.bz5 = this.txtBeizhu5.Text.Trim();
            this.CurBmk.bz6 = this.txtBeizhu6.Text.Trim();

            this.CurBmk.Bm = this.txtBm.Text.Trim();//别名

            //体测项目

            if (this.ddlTcxm1.SelectedIndex > 0 && this.ddlTcxm2.SelectedIndex > 0)
            {
                char tcxm1 = this.ddlTcxm1.SelectedValue[0];
                char tcxm2 = this.ddlTcxm2.SelectedValue[0];
                if (tcxm1 == tcxm2)
                {
                    errMsg.Append("体育两项选考必须不一样,");
                }
                else
                {
                    if (tcxm1 > tcxm2)
                    {
                        char temp = tcxm1;
                        tcxm1 = tcxm2;
                        tcxm2 = temp;
                    }
                    this.CurBmk.tcxm = tcxm1.ToString() + tcxm2.ToString();
                }
            }
            else
            {
                this.CurBmk.tcxm = "";
            }

            string byxxdm = this.txtByxxdm.Text;
            if (byxxdm.IsNullOrEmpty())
            {
                errMsg.Append("毕业学校代码未填写,");
            }
            else
            {
                string    dbfPath  = Server.MapPath("~/Data/Dbf/sysdbf/");
                string    dbfTable = "schools.DBF";
                DataTable dt       = DbfHelper.ToDataTable(dbfPath, dbfTable);
                var       rows     = dt.Select(string.Format("school = '{0}'", byxxdm));
                if (rows.Length == 1)
                {
                    this.CurBmk.byxxmc = rows[0]["mc"].ToString();
                    this.CurBmk.byxxdm = byxxdm;
                }
                else
                {
                    errMsg.Append("你所填写的就读学校代码有误");
                }
            }

            string newBmkJson = this.CurBmk.Json();
            if (newBmkJson == oldBmkJson)
            {
                JsUtil.MessageBox(this, "您没有改动任何数据!提示:" + errMsg.ToString());
            }
            else
            {
                ValidateHandler vh = new ValidateHandler(true);
                if (vh.ValidateObject(this.CurBmk))
                {
                    if (this.CurBmk.RecordGuid == Guid.Empty.ToString())
                    {
                        this.CurBmk.RecordGuid = Guid.NewGuid().ToString();
                    }
                    if (this.CurBmk.CurHistoryGuid == Guid.Empty.ToString())
                    {
                        this.CurBmk.CurHistoryGuid = Guid.NewGuid().ToString();
                    }
                    else
                    {
                        this.CurBmk.PreHistoryGuid = this.CurBmk.CurHistoryGuid;
                        this.CurBmk.CurHistoryGuid = Guid.NewGuid().ToString();
                    }
                    this.CurBmk.Save();
                    this.Save2File(this.CurBmk);
                    JsUtil.MessageBox(this, "数据保存成功!提示:" + errMsg.ToString());

                    BindData();
                }
                else
                {
                    JsUtil.MessageBox(this, "数据保存失败!提示:" + vh.ErrorMessages + errMsg.ToString());
                }
            }
        }
        else
        {
            throw new Exception("学生信息不存在!");
        }
    }
예제 #3
0
    /// <summary>
    /// 从~/Data/Dbf/userdbfs/bmk.dbf导入数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnImportFromDatapath_Click(object sender, EventArgs e)
    {
        string dbfPath  = Server.MapPath("~/Data/Dbf/userdbfs/");
        string dbfTable = "bmk.dbf";

        DataTable dt = DbfHelper.ToDataTable(dbfPath, dbfTable);

        foreach (DataRow dr in dt.Rows)
        {
            string bmxh = dr["bmxh"].ToString();
            Bmk    bmk  = Bmk.FindOne(p => p.bmxh == bmxh);
            if (bmk == null)
            {
                bmk            = new Bmk();
                bmk.RecordGuid = Guid.NewGuid().ToString();
                bmk.bmxh       = bmxh;
            }
            bmk.xm    = dr["xm"].ToString();
            bmk.xb    = dr["xb"].ToString();
            bmk.xstbh = dr["xstbh"].ToString();

            bmk.bmxh   = dr["bmxh"].ToString();
            bmk.zkzh   = dr["zkzh"].ToString();
            bmk.xm     = dr["xm"].ToString();
            bmk.sfzh   = dr["sfzh"].ToString();
            bmk.xb     = dr["xb"].ToString();
            bmk.mz     = dr["mz"].ToString();
            bmk.csny   = dr["csny"].ToString();
            bmk.ty     = dr["ty"].ToString();
            bmk.tcxm   = dr["tcxm"].ToString();
            bmk.hk     = dr["hk"].ToString();
            bmk.xz     = dr["xz"].ToString();
            bmk.kslb   = dr["kslb"].ToString();
            bmk.byxxdm = dr["byxxdm"].ToString();
            bmk.byxxmc = dr["byxxmc"].ToString();
            bmk.xh     = dr["xh"].ToString();
            bmk.bj     = dr["class"].ToString();

            bmk.kl    = dr["kl"].ToString();
            bmk.jtzz  = dr["jtzz"].ToString();
            bmk.tel   = dr["tel"].ToString();
            bmk.post  = dr["post"].ToString();
            bmk.bz1   = dr["bz1"].ToString();
            bmk.bz2   = dr["bz2"].ToString();
            bmk.bz3   = dr["bz3"].ToString();
            bmk.bz4   = dr["bz4"].ToString();
            bmk.xstbh = dr["xstbh"].ToString();
            bmk.kddm  = dr["kddm"].ToString();
            bmk.kdmc  = dr["kdmc"].ToString();
            bmk.scbm  = dr["scbm"].ToString();
            bmk.tbsch = dr["tbsch"].ToString();
            bmk.zwh   = dr["zwh"].ToString();
            bmk.scmh  = dr["scmh"].ToString();
            //bmk.km1 = dr["km1"].to();
            //bmk.km2 = dr["km2"].ToString();
            //bmk.km3 = dr["km3"].ToString();
            //bmk.km31 = dr["km31"].ToString();
            //bmk.km32 = dr["km32"].ToString();
            //bmk.km4 = dr["km4"].ToString();
            //bmk.km5 = dr["km5"].ToString();
            //bmk.km51 = dr["km51"].ToString();
            //bmk.km61 = dr["km61"].ToString();
            //bmk.km62 = dr["km62"].ToString();
            //bmk.km621 = dr["km621"].ToString();
            //bmk.km63 = dr["km63"].ToString();
            //bmk.km6 = dr["km6"].ToString();
            bmk.km71 = dr["km71"].ToString();
            bmk.km72 = dr["km72"].ToString();
            bmk.km73 = dr["km73"].ToString();
            bmk.km74 = dr["km74"].ToString();
            bmk.km81 = dr["km81"].ToString();
            //bmk.tyf = dr["tyf"].ToString();
            //bmk.tzf = dr["tzf"].ToString();
            //bmk.tcf = dr["tcf"].ToString();
            //bmk.zf = dr["zf"].ToString();
            //bmk.tot1 = dr["tot1"].ToString();
            //bmk.tot2 = dr["tot2"].ToString();
            //bmk.mch = dr["mch"].ToString();
            //bmk.tzdm = dr["tzdm"].ToString();
            //bmk.tzmc = dr["tzmc"].ToString();
            bmk.tcdm = dr["tcdm"].ToString();
            bmk.tcmc = dr["tcmc"].ToString();
            bmk.zy11 = dr["zy11"].ToString();
            bmk.zy12 = dr["zy12"].ToString();
            bmk.zy13 = dr["zy13"].ToString();
            bmk.zy21 = dr["zy21"].ToString();
            bmk.zy22 = dr["zy22"].ToString();
            bmk.zy23 = dr["zy23"].ToString();
            bmk.zy31 = dr["zy31"].ToString();
            bmk.zy32 = dr["zy32"].ToString();
            bmk.zy33 = dr["zy33"].ToString();
            bmk.zy41 = dr["zy41"].ToString();
            bmk.zy42 = dr["zy42"].ToString();
            bmk.zy43 = dr["zy43"].ToString();
            bmk.zy51 = dr["zy51"].ToString();
            bmk.zy52 = dr["zy52"].ToString();
            bmk.zy53 = dr["zy53"].ToString();
            bmk.fc   = dr["fc"].ToString();
            bmk.jb   = dr["jb"].ToString();
            bmk.syqk = dr["syqk"].ToString();

            bmk.Save();
        }
        this.Succeed("导入完毕!");
    }