/// <summary> /// 新撰写 /// </summary> private static void Add(Model.Xmgl.Xm_sxhbmx mx, string xsbh, bool isSubmit) { // 计算提交序号Tjxh和提交截止时间Tjjzrq Model.Jcgl.Jc_xs xs = GetEntity <Model.Jcgl.Jc_xs>(xsbh); int fzztdm = int.Parse(xs.Fzztdm); string qsrq = ""; int tjxh = 1, month = 2; DateTime dtTjjzrq; switch (fzztdm) { default: case 2: // 积极分子 qsrq = xs.Jjfzrq; break; case 5: // 预备党员 qsrq = xs.Rdrq; month = 3; break; case 6: // 正式党员 qsrq = xs.Zzrq; month = 3; break; } CalculateTjxhsj(qsrq, month, out tjxh, out dtTjjzrq); // 新增Xm_sxhb string czsj = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); Model.Xmgl.Xm_sxhb hb = new Model.Xmgl.Xm_sxhb(); hb.Fzrbh = xsbh; hb.Fzztdm = fzztdm.ToString(); hb.Tjxh = tjxh; hb.Yf = (DateTime.Now < dtTjjzrq ? DateTime.Now : dtTjjzrq.AddDays(-1)).ToString("yyyy年MM月"); hb.Tbsj = czsj; hb.Tjjzsj = dtTjjzrq.ToString("yyyy-MM-dd 00:00:00"); // 显示的是1号,实际为上月末(即前一秒) hb.Tjtxsj = dtTjjzrq.AddDays(-16).ToString("yyyy-MM-dd 23:59:59"); hb.Ztdm = (int)TG.SystemSetting.Status.Draft; Insert <Model.Xmgl.Xm_sxhb>(hb); // 新增Xm_sxhbmx mx.Hbbh = hb.Pkid; Insert <Model.Xmgl.Xm_sxhbmx>(mx); // 提交 if (isSubmit) { Submit(xsbh, hb.Pkid); } }
public static void Insert(Model.Jcgl.Jc_xs m) { Model.Account_user au = new Model.Account_user(); au.DeptID = TU.Globals.BindSystemCode(Globals.SystemCode.DtJd_bm, "Pkid", "Bmdm", m.Bmbh, ""); au.UserID = m.Xh;// ("Xs" + DateTime.Now.Ticks.ToString() + Guid.NewGuid().ToString().Replace("-", "")).Substring(0, 32); au.UserName = m.Xm; au.Level = "00"; try { Insert <Model.Account_user>(au); m.Pkid = au.Pkid; m.Sfzh = DateTime.Now.Ticks.ToString(); Insert <Model.Jcgl.Jc_xs>(m); } catch (Exception err) { string s = err.Message; } }
public static bool Update(Model.Jcgl.Jc_xs m, bool modUser) { try { if (modUser) { Model.Account_user au = new Model.Account_user(); au.Pkid = m.Pkid; au.UserID = m.Xh; au.UserName = m.Xm; au.Mobile = m.Sjhm; UpdateFields <Model.Account_user>(au, "UserId", "UserName", "Mobile"); } return(Update <Model.Jcgl.Jc_xs>(m) > 0); } catch (Exception err) { throw err; } }
public static void Moni() { DataView dvBj = GetList <Model.Jcgl.Jd_bj>(null, "Pkid").DefaultView; int cntDzb = dvBj.Count; int count = 100; foreach (DataRowView drv in dvBj) { for (int i = 0; i < count; i++) { Model.Jcgl.Jc_xs m = new Model.Jcgl.Jc_xs(); m.Bmbh = drv["Bmbh"].ToString(); m.Bjbh = drv["Pkid"].ToString(); m.Xh = m.Xm = "2017" + m.Bjbh + (i + 1).ToString("D3"); string dzbbh = drv["Dzbbh"].ToString(); m.Rdlxrbh1 = GetEntity <Model.Jcgl.Jc_lxr>("Dzbbh", dzbbh).Pkid; m.Sqrdrq = "20160101"; m.Jjfzrq = "20170101"; Insert(m); } } }
/// <summary> /// 导入转正对象 /// </summary> protected int ImportZzmd(DataRowView drv, string drsj) { int cnt = 0; string[] columns = Columns; string xh = drv[columns[0]].ToString().Trim(); string xm = drv[columns[1]].ToString().Trim(); string bmbh = TStar.Web.Globals.Account.DeptPkid; string dzbbh = BLL.Globals.SystemSetting.IsCommittee ? null : TStar.Web.Globals.Account.UserInfo.Dzbbh; Model.Jcgl.Jc_xs xs = BLL.Jcgl.Jc_xs.GetEntity(bmbh, dzbbh, xh, xm); if (string.IsNullOrEmpty(xs.Pkid)) { throw new Exception("该学生信息不存在。"); } if (BLL.Lcgl.Lc_zzmd.Exist(xs.Pkid)) { throw new Exception("该名单已导入。"); } if (int.Parse(xs.Fzztdm) != (int)TStar.Web.Globals.SystemSetting.Fzzt.Ybdy) { throw new Exception("该学生不是预备党员。"); } string bjjg = drv[columns[2]].ToString().Trim(); string bjjgdm = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtDm_jgzt, null, "Mc", "Dm", bjjg, ""); if (bjjgdm == "") { throw new Exception(columns[2] + "不正确。"); } DateTime dt; string yqzzrq = ""; if (bjjgdm == "0") { yqzzrq = drv[columns[3]].ToString().Trim(); if (yqzzrq.Length < 8) { throw new Exception(columns[3] + "不正确。"); } yqzzrq = string.Format("{0}-{1}-{2}", yqzzrq.Substring(0, 4), yqzzrq.Substring(4, 2), yqzzrq.Substring(6, 2)); if (!DateTime.TryParse(yqzzrq, out dt)) { throw new Exception(columns[3] + "不正确。"); } if (dt <= DateTime.Now) { throw new Exception("延期转正日期应大于当前日期。"); } } string zbdhrq = drv[columns[4]].ToString().Trim(); if (zbdhrq.Length < 8) { throw new Exception(columns[4] + "不正确。"); } zbdhrq = string.Format("{0}-{1}-{2}", zbdhrq.Substring(0, 4), zbdhrq.Substring(4, 2), zbdhrq.Substring(6, 2)); if (!DateTime.TryParse(zbdhrq, out dt)) { throw new Exception(columns[4] + "不正确。"); } string fdwshrq = drv[columns[5]].ToString().Trim(); if (fdwshrq.Length < 8) { throw new Exception(columns[5] + "不正确。"); } fdwshrq = string.Format("{0}-{1}-{2}", fdwshrq.Substring(0, 4), fdwshrq.Substring(4, 2), fdwshrq.Substring(6, 2)); if (!DateTime.TryParse(fdwshrq, out dt)) { throw new Exception(columns[5] + "不正确。"); } string shyj = drv[columns[6]].ToString().Trim(); string bz = drv[columns[7]].ToString().Trim(); Model.Lcgl.Lc_zzmd m = new Model.Lcgl.Lc_zzmd(); m.Bmbh = bmbh; m.Dzbbh = xs.Dzbbh; m.Xsbh = xs.Pkid; m.Bjjgdm = bjjgdm; m.Yqzzrq = yqzzrq; m.Zbdhrq = zbdhrq; m.Fdwshrq = fdwshrq; m.Shyj = shyj; m.Bz = bz; m.Drsj = drsj; if (BLL.Lcgl.Lc_zzmd.Save(m)) { cnt = 1; drv["Del"] = 1; } return(cnt); }
/// <summary> /// 导入拟发展对象 /// </summary> protected int ImportNfzmd(DataRowView drv, string drsj) { int cnt = 0; string[] columns = Columns; string xh = drv[columns[0]].ToString().Trim(); string xm = drv[columns[1]].ToString().Trim(); string bmbh = TStar.Web.Globals.Account.DeptPkid; string dzbbh = BLL.Globals.SystemSetting.IsCommittee ? null : TStar.Web.Globals.Account.UserInfo.Dzbbh; Model.Jcgl.Jc_xs xs = BLL.Jcgl.Jc_xs.GetEntity(bmbh, dzbbh, xh, xm); if (string.IsNullOrEmpty(xs.Pkid)) { throw new Exception("该学生信息不存在。"); } if (BLL.Lcgl.Lc_nfzmd.Exist(xs.Pkid)) { throw new Exception("该名单已导入。"); } if (int.Parse(xs.Fzztdm) != (int)TStar.Web.Globals.SystemSetting.Fzzt.Jjfz) { throw new Exception("该学生不是积极分子。"); } string fzdxqdrq = drv[columns[2]].ToString().Trim(); if (fzdxqdrq.Length < 8) { throw new Exception(columns[2] + "不正确。"); } fzdxqdrq = string.Format("{0}-{1}-{2}", fzdxqdrq.Substring(0, 4), fzdxqdrq.Substring(4, 2), fzdxqdrq.Substring(6, 2)); DateTime dt; if (!DateTime.TryParse(fzdxqdrq, out dt)) { throw new Exception(columns[2] + "不正确。"); } string zsjg = drv[columns[3]].ToString().Trim(); string zsjgdm = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtDm_jgzt, null, "Mc", "Dm", zsjg, ""); if (zsjgdm == "") { throw new Exception(columns[3] + "不正确。"); } string dbjg = drv[columns[4]].ToString().Trim(); string dbjgdm = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtDm_jgzt, null, "Mc", "Dm", dbjg, ""); if (dbjgdm == "") { throw new Exception(columns[4] + "不正确。"); } string dbrq = drv[columns[5]].ToString().Trim(); string dbdd = drv[columns[6]].ToString().Trim(); string dbzcy = drv[columns[7]].ToString().Trim(); string dbyj = drv[columns[8]].ToString().Trim(); if (zsjgdm == "0") { dbjgdm = zsjgdm; dbrq = dbdd = dbzcy = dbyj = ""; } else { if (dbrq.Length < 8) { throw new Exception(columns[5] + "不正确。"); } dbrq = string.Format("{0}-{1}-{2}", dbrq.Substring(0, 4), dbrq.Substring(4, 2), dbrq.Substring(6, 2)); if (!DateTime.TryParse(dbrq, out dt)) { throw new Exception(columns[5] + "不正确。"); } if (dbrq.CompareTo(fzdxqdrq) <= 0) { throw new Exception("答辩日期应大于发展对象确定日期。"); } if (string.IsNullOrEmpty(dbdd)) { throw new Exception(columns[6] + "不能为空。"); } if (string.IsNullOrEmpty(dbzcy)) { throw new Exception(columns[7] + "不能为空。"); } if (string.IsNullOrEmpty(dbyj)) { throw new Exception(columns[8] + "不能为空。"); } else if (dbyj.Length > 200) { throw new Exception(columns[8] + "限填200个字。"); } } string zswtgyy = drv[columns[9]].ToString().Trim(); if (zsjgdm == "0") { if (string.IsNullOrEmpty(zswtgyy)) { throw new Exception(columns[9] + "不能为空。"); } else if (zswtgyy.Length > 200) { throw new Exception(columns[9] + "限填200个字。"); } } Model.Lcgl.Lc_nfzmd m = new Model.Lcgl.Lc_nfzmd(); m.Bmbh = bmbh; m.Dzbbh = xs.Dzbbh; m.Xsbh = xs.Pkid; m.Fzdxrq = fzdxqdrq; m.Zsjgdm = zsjgdm; m.Dbjgdm = dbjgdm; m.Dbrq = dbrq; m.Dbdd = dbdd; m.Dbzcy = dbzcy; m.Dbpjyj = dbyj; m.Zswtgyy = zswtgyy; m.Drsj = drsj; if (BLL.Lcgl.Lc_nfzmd.Save(m)) { cnt = 1; drv["Del"] = 1; } return(cnt); }
protected bool Save() { bool pwdOk = true; string errmsg = ""; string uid = this.tbxXh.Text.Trim().ToUpper(); string name = this.tbxXm.Text.Trim(); string pwd = this.tbxPwd.Text.Trim(); string pwd2 = this.tbxPwd2.Text.Trim(); string sfzh = this.tbxSfzh.Text.Trim().ToUpper(); string phone = this.tbxSjhm.Text.Trim(); string code = this.tbxYzm.Text.Trim().ToUpper(); if (String.IsNullOrEmpty(uid)) { errmsg += "请输入用户名 !<br/>"; } if (String.IsNullOrEmpty(name)) { errmsg += "请输入姓名 !<br/>"; } if (String.IsNullOrEmpty(sfzh)) { errmsg += "请输入身份证号 !<br/>"; } if (String.IsNullOrEmpty(pwd)) { pwdOk = false; errmsg += "请设置新的登录密码 !<br/>"; } else if (pwd.Length < 6) { errmsg += "密码长度至少 6 位 !<br/>"; } if (String.IsNullOrEmpty(pwd2)) { pwdOk = false; errmsg += "请再次确认密码 !<br/>"; } if (pwdOk && pwd != pwd2) { errmsg += "两次输入的密码不一致 !<br/>"; } if (String.IsNullOrEmpty(phone)) { errmsg += "请输入手机号码 !<br/>"; } if (String.IsNullOrEmpty(code)) { errmsg += "请输入验证码 !<br/>"; } else if (code != this.hfdCode.Text.ToUpper()) { errmsg += "输入的验证码不正确 !<br/>"; } if (errmsg.Length > 0) { Alert.Show(errmsg, MessageBoxIcon.Warning); return(false); } Model.Jcgl.Jc_xs u = BLL.Jcgl.Jc_xs.GetEntity(uid, name); if (string.IsNullOrEmpty(u.Pkid)) { Alert.Show("此学号与姓名的用户不存在,\n请与学院管理员联系 !", MessageBoxIcon.Error); return(false); } else if (u.Sfzh != sfzh) { Alert.Show("身份证号不匹配 !", MessageBoxIcon.Error); return(false); } else if (u.Sjhm.Substring(0, 11) != phone) { Alert.Show("手机号码不匹配 !", MessageBoxIcon.Error); return(false); } //TZM.AccountInfo ai = null; //try //{ // ai = BLL.Zykt.GetAccInfo(uid, 4); // if (ai == null) ShowErr("该统一帐户不存在 !"); //} //catch (Exception errykt) //{ // ShowErr("获取统一帐户信息失败 !"); // return; //} //if (ai.PerCode.ToUpper() != uid || ai.AccName != name) //{ // errmsg += "用户名与姓名不匹配 !<br/>"; //} //if (ai.CertCode.ToUpper() != sfzh) //{ // errmsg += "身份证号不匹配 !<br/>"; //} //if (errmsg.Length > 0) //{ // ShowWarn(errmsg); // return; //} //string[] bms = ai.FullPath.Split('|'); //string bm = bms.Length >= 3 ? bms[2] : ai.DepName; //try //{ // if (!BLL.Jcgl.Jd_Bm.Exists(bm)) // { // Model.Jcgl.Jd_Bm b = new Model.Jcgl.Jd_Bm(); // b.Pkid = "YKTBM"; // b.Dm = Guid.NewGuid().ToString().Replace("-", "").ToUpper(); // b.Mc = bm; // BLL.Jcgl.Jd_Bm.Insert(b); // bm = b.Pkid; // } //} //catch (Exception errbm) //{ // ShowErr("同步部门信息失败 !"); // return; //} try { BLL.Account.UpdatePwd(u.Pkid, pwd); return(true); } catch (Exception err) { Alert.Show(err.Message, "注册失败", MessageBoxIcon.Error); return(false); } }
protected void btnSave_Click(object sender, EventArgs e) { DateTime dt; string errMsg = ""; string oxh = this.lblXhOld.Text.Trim(); string oxm = this.lblXmOld.Text.Trim(); string osj = this.lblSjhmOld.Text.Trim(); Model.Jcgl.Jc_xs xs = TU.Common.ConvertHelper.ConvertToEntity <Model.Jcgl.Jc_xs>("SimpleForm1", "SimpleForm2", "SimpleForm3", "SimpleForm4"); xs.Pkid = Pkid; xs.Bmbh = TStar.Web.Globals.Account.DeptPkid; // 基本信息 if (String.IsNullOrEmpty(xs.Xh)) { errMsg += "请输入学号 !\n"; } else if (BLL.Jcgl.Jc_xs.IsRepeated(xs.Pkid, "Xh", xs.Xh)) { errMsg += "该学生已存在 !\n"; } if (String.IsNullOrEmpty(xs.Xm)) { errMsg += "请输入姓名 !\n"; } if (xs.Dzbbh == "__") { errMsg += "请选择党支部 !\n"; } if (xs.Zybh == "__") { errMsg += "请选择专业 !\n"; } if (xs.Bjbh == "__") { errMsg += "请选择班级 !\n"; } if (xs.Xbdm == "__") { errMsg += "请选择性别 !\n"; } if (String.IsNullOrEmpty(xs.Sfzh)) { errMsg += "请输入身份证号 !\n"; } else if (xs.Sfzh.Length != 18) { errMsg += "身份证号长度不正确 !\n"; } else if (BLL.Jcgl.Jc_xs.IsRepeated(xs.Pkid, "Sfzh", xs.Sfzh)) { errMsg += "身份证号已存在 !\n"; } else { int jcxb = int.Parse(xs.Sfzh[16].ToString()); if (xs.Xbdm == "1" && jcxb % 2 == 0 || xs.Xbdm == "2" && jcxb % 2 == 1) { errMsg += "身份证号的性别位不正确 !\n"; } xs.Csrq = string.Format("{0}.{1}.{2}", xs.Sfzh.Substring(6, 4), xs.Sfzh.Substring(10, 2), xs.Sfzh.Substring(12, 2)); if (!DateTime.TryParse(xs.Csrq, out dt)) { errMsg += "身份证号的出生日期位不正确 !\n"; } } if (String.IsNullOrEmpty(xs.Sjhm)) { errMsg += "请输入手机号码 !\n"; } if (String.IsNullOrEmpty(xs.Mz)) { errMsg += "请输入民族 !\n"; } if (String.IsNullOrEmpty(xs.Jg)) { errMsg += "请输入籍贯 !\n"; } if (String.IsNullOrEmpty(xs.Zw)) { errMsg += "请输入职务 !\n"; } if (String.IsNullOrEmpty(xs.Jtdz)) { errMsg += "请输入家庭地址 !\n"; } // 发展前信息 if (String.IsNullOrEmpty(xs.Sqrdrq)) { errMsg += "请输入申请入党日期 !\n"; } else if (!DateTime.TryParse(xs.Sqrdrq, out dt)) { errMsg += "申请入党日期不正确 !\n"; } if (String.IsNullOrEmpty(xs.Jjfzrq)) { errMsg += "请输入积极分子日期 !\n"; } else if (!DateTime.TryParse(xs.Jjfzrq, out dt)) { errMsg += "积极分子日期不正确 !\n"; } if (xs.Rdlxrbh1 == "__") { errMsg += "请选择入党联系人 !\n"; } // 发展后信息 if (!this.gplFzh.Hidden) { xs.Rdrq = this.tbxRdrq.Text.Trim(); xs.Zysbh = this.tbxZysbh.Text.Trim(); xs.Zzrq = this.tbxZzrq.Text.Trim(); if (String.IsNullOrEmpty(xs.Rdrq)) { errMsg += "请输入入党日期 !\n"; } else if (!DateTime.TryParse(xs.Rdrq, out dt)) { errMsg += "入党日期不正确 !\n"; } if (String.IsNullOrEmpty(xs.Zysbh)) { errMsg += "请输入志愿书编号 !\n"; } else if (BLL.Jcgl.Jc_xs.IsRepeated(xs.Pkid, "Zysbh", xs.Zysbh)) { errMsg += "志愿书编号已存在 !\n"; } if (String.IsNullOrEmpty(xs.Zzrq)) { if (((int)TStar.Web.Globals.SystemSetting.Fzzt.Zsdy).ToString() == xs.Fzztdm) { errMsg += "请输入转正日期 !\n"; } } else if (!DateTime.TryParse(xs.Zzrq, out dt)) { errMsg += this.tbxZzrq.Label.Replace(" ", "") + "不正确 !\n"; } } if (errMsg.Length > 0) { Alert.Show(errMsg, "保存提示", MessageBoxIcon.Warning); return; } try { if (BLL.Jcgl.Jc_xs.Update(xs, xs.Xh != oxh || xs.Xm != oxm || xs.Sjhm != osj)) { PageContext.RegisterStartupScript(Alert.GetShowInParentReference("保存成功 !", "操作完成", MessageBoxIcon.Information) + ActiveWindow.GetHidePostBackReference()); } else { Alert.Show("未成功保存,请与管理员联系 !", "保存失败", MessageBoxIcon.Warning); } } catch (Exception err) { Alert.Show(err.Message, "保存失败", MessageBoxIcon.Error); } }
/// <summary> /// 导入发展对象 /// </summary> protected int ImportFzmd(DataRowView drv, string drsj) { int cnt = 0; string[] columns = Columns; string xh = drv[columns[0]].ToString().Trim(); string xm = drv[columns[1]].ToString().Trim(); string bmbh = TStar.Web.Globals.Account.DeptPkid; string dzbbh = BLL.Globals.SystemSetting.IsCommittee ? null : TStar.Web.Globals.Account.UserInfo.Dzbbh; Model.Jcgl.Jc_xs xs = BLL.Jcgl.Jc_xs.GetEntity(bmbh, dzbbh, xh, xm); if (string.IsNullOrEmpty(xs.Pkid)) { throw new Exception("该学生信息不存在。"); } if (BLL.Lcgl.Lc_fzmd.Exist(xs.Pkid)) { throw new Exception("该名单已导入。"); } if (int.Parse(xs.Fzztdm) != (int)TStar.Web.Globals.SystemSetting.Fzzt.Nfzdx) { throw new Exception("该学生不是拟发展对象。"); } string bjjg = drv[columns[2]].ToString().Trim(); string bjjgdm = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtDm_jgzt, null, "Mc", "Dm", bjjg, ""); if (bjjgdm == "") { throw new Exception(columns[2] + "不正确。"); } DateTime dt; string zbdhrq = drv[columns[3]].ToString().Trim(); if (zbdhrq.Length != 8) { throw new Exception(columns[3] + "不正确。"); } zbdhrq = string.Format("{0}.{1}.{2}", zbdhrq.Substring(0, 4), zbdhrq.Substring(4, 2), zbdhrq.Substring(6, 2)); if (!DateTime.TryParse(zbdhrq, out dt)) { throw new Exception(columns[3] + "不正确。"); } string zysbh = drv[columns[4]].ToString().Trim(); if (string.IsNullOrEmpty(zysbh)) { throw new Exception(columns[4] + "不能为空。"); } string dzzsyqk = drv[columns[5]].ToString().Trim(); if (string.IsNullOrEmpty(zysbh)) { throw new Exception(columns[5] + "不能为空。"); } string dwspyj = drv[columns[6]].ToString().Trim(); if (string.IsNullOrEmpty(zysbh)) { throw new Exception(columns[6] + "不能为空。"); } string bz = ""; Model.Lcgl.Lc_fzmd m = new Model.Lcgl.Lc_fzmd(); m.Bmbh = bmbh; m.Dzbbh = xs.Dzbbh; m.Xsbh = xs.Pkid; m.Zysbh = zysbh; m.Bjjgdm = bjjgdm; m.Zbdhrq = zbdhrq; m.Dzzsyqk = dzzsyqk; m.Dwspyj = dwspyj; m.Bz = bz; m.Drsj = drsj; if (BLL.Lcgl.Lc_fzmd.Save(m)) { cnt = 1; drv["Del"] = 1; } return(cnt); }
/// <summary> /// 依据传入参数TableName导入数据 /// </summary> protected override int ImportData(DataRowView drv) { int cnt = 0; string[] columns = Columns; string xh = drv[columns[0]].ToString(); string xm = drv[columns[1]].ToString(); string bmbh = TStar.Web.Globals.Account.DeptPkid; string dzbbh = TStar.Web.Globals.Account.UserInfo.Dzbbh; Model.Jcgl.Jc_xs xs = BLL.Jcgl.Jc_xs.GetEntity(bmbh, dzbbh, xh, xm); if (string.IsNullOrEmpty(xs.Pkid)) { throw new Exception("该学生信息不存在。"); } string zbbh = Djzbmc.Substring(0, 32); string filter = string.Format("Zbbh='{0}'", zbbh); string djmc = drv[columns[4]].ToString(); string djbh = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtJd_xmdjLocal, filter, "Djmc", "Pkid", djmc, ""); if (djbh == "") { throw new Exception(columns[4] + "不正确。"); } string fzrbh = xs.Pkid; string fzztdm = xs.Fzztdm.ToString(); string xmmc = "第" + drv[columns[2]].ToString() + "期党校培训"; string xmrq = TU.Globals.Parse2DateTime(drv[columns[3]].ToString(), "2000-01-01").ToString("yyyy-MM-dd"); if (xmrq == "2000-01-01") { throw new Exception(columns[3] + "不正确。"); } if (BLL.Xmgl.Yj_xm.Exist(Pkid, new string[] { "Fzztdm", "Zbbh", "Fzrbh", "Xmmc" }, new string[] { fzztdm, zbbh, fzrbh, xmmc })) { throw new Exception("该党校培训成绩已导入。"); } Model.Xmgl.Yj_xm m = new Model.Xmgl.Yj_xm(); m.Xmmc = xmmc; m.Fzztdm = fzztdm; m.Bmbh = bmbh; m.Zbbh = zbbh; m.Djbh = djbh; m.Fzrbh = fzrbh; m.Xmrq = m.Jzrq = xmrq; m.Bcsj = m.Shsj = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"); m.Shrbh = TStar.Web.Globals.Account.Pkid; m.Ztdm = (int)TStar.Web.Globals.SystemSetting.Status.CommitteeImported; if (BLL.Xmgl.Yj_xm.Save(m)) { // 考核等级非不合格时写入jc_xs表的党校培训情况 string khzt = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtJd_xmdjLocal, "Pkid", "Djmc", djbh, "不合格"); if (khzt != "不合格") { string where = string.Format("Pkid='{0}'", fzrbh); string khztdm = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtDm_khzt, "Mc", "Dm", khzt, "1"); BLL.Jcgl.Jc_xs.UpdateFields <Model.Jcgl.Jc_xs>(new string[] { "Dxkhztdm", "Dxjyrq" }, new string[] { khztdm, xmrq }, where); } cnt = 1; drv["Del"] = 1; } return(cnt); }
/// <summary> /// 依据传入参数TableName导入数据 /// </summary> protected override int ImportData(DataRowView drv) { int cnt = 0, cjpm, zhpm, rs, bjgms; string[] columns = Columns, s; string xh = drv[columns[0]].ToString(); string xm = drv[columns[1]].ToString(); string bmbh = TStar.Web.Globals.Account.DeptPkid; string dzbbh = TStar.Web.Globals.Account.UserInfo.Dzbbh; Model.Jcgl.Jc_xs xs = BLL.Jcgl.Jc_xs.GetEntity(bmbh, dzbbh, xh, xm); if (string.IsNullOrEmpty(xs.Pkid)) { throw new Exception("该学生信息不存在。"); } string zbbh = Djzbmc.Substring(0, 32); string xxcjpm = drv[columns[2]].ToString(); if (!IsMatch(@"^\d+/\d+$", xxcjpm)) { throw new Exception(columns[2] + "不正确。"); } else { s = xxcjpm.Split('/'); cjpm = int.Parse(s[0]); rs = int.Parse(s[1]); } string zhkppm = drv[columns[3]].ToString(); if (!IsMatch(@"^\d+/\d+$", zhkppm)) { throw new Exception(columns[3] + "不正确。"); } else { s = zhkppm.Split('/'); zhpm = int.Parse(s[0]); int rs2 = int.Parse(s[1]); if (rs2 != rs) { throw new Exception(columns[2] + "与" + columns[3] + "的总人数不一致。"); } } string bjg = drv[columns[4]].ToString(); if (!IsMatch(@"^\d+$", bjg)) { throw new Exception(columns[4] + "不正确。"); } bjgms = int.Parse(bjg); string fzrbh = xs.Pkid; string fzztdm = xs.Fzztdm.ToString(); string xmmc = BLL.Globals.SystemSetting.Dqxqmc + "学习成绩"; string xmrq = BLL.Globals.SystemSetting.DxqJzsj.Substring(0, 10); string jzrq = BLL.Globals.SystemSetting.Dqxq; string bz = string.Format("学习成绩排名{0}、综合考评排名{1}、不及格门数{2}", xxcjpm, zhkppm, bjg); if (BLL.Xmgl.Yj_xm.Exist(Pkid, new string[] { "Fzztdm", "Zbbh", "Fzrbh", "Xmmc" }, new string[] { fzztdm, zbbh, fzrbh, xmmc })) { throw new Exception("该学习成绩已导入。"); } Model.Xmgl.Yj_xm m = new Model.Xmgl.Yj_xm(); m.Xmmc = xmmc; m.Fzztdm = fzztdm; m.Bmbh = bmbh; m.Zbbh = zbbh; m.Fzrbh = fzrbh; m.Xmrq = xmrq; m.Jzrq = jzrq; m.Bz = bz; m.Bcsj = m.Shsj = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"); m.Shrbh = TStar.Web.Globals.Account.Pkid; m.Ztdm = (int)TStar.Web.Globals.SystemSetting.Status.CommitteeImported; if (BLL.Xmgl.Yj_xm.Save(m)) { // 写入jc_xs表的学习成绩情况 string where = string.Format("Pkid='{0}'", fzrbh); BLL.Jcgl.Jc_xs.UpdateFields <Model.Jcgl.Jc_xs>(new string[] { "Xxcjpm", "Zhkppm", "Bjgms" }, new string[] { xxcjpm, zhkppm, bjg }, where); cnt = 1; drv["Del"] = 1; } return(cnt); }
/// <summary> /// 依据传入参数TableName导入数据 /// </summary> protected override int ImportData(DataRowView drv) { int cnt = 0; string[] columns = Columns; string xh = drv[columns[0]].ToString(); string xm = drv[columns[1]].ToString(); string bmbh = TStar.Web.Globals.Account.DeptPkid; string dzbbh = TStar.Web.Globals.Account.UserInfo.Dzbbh; Model.Jcgl.Jc_xs xs = BLL.Jcgl.Jc_xs.GetEntity(bmbh, dzbbh, xh, xm); if (string.IsNullOrEmpty(xs.Pkid)) { throw new Exception("该学生信息不存在。"); } string fzdxqdrq = drv[columns[2]].ToString(); fzdxqdrq = string.Format("{0}-{1}-{2}", fzdxqdrq.Substring(0, 4), fzdxqdrq.Substring(4, 2), fzdxqdrq.Substring(6, 2)); DateTime dt; if (!DateTime.TryParse(fzdxqdrq, out dt)) { throw new Exception(columns[2] + "不正确。"); } string zsjg = drv[columns[3]].ToString(); string zsjgdm = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtDm_jgzt, null, "Mc", "Dm", zsjg, ""); if (zsjgdm == "") { throw new Exception(columns[3] + "不正确。"); } string dbjg = drv[columns[4]].ToString(); string dbjgdm = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtDm_jgzt, null, "Mc", "Dm", dbjg, ""); if (dbjgdm == "") { throw new Exception(columns[4] + "不正确。"); } string dbrq = drv[columns[5]].ToString(); dbrq = string.Format("{0}-{1}-{2}", dbrq.Substring(0, 4), dbrq.Substring(4, 2), dbrq.Substring(6, 2)); if (!DateTime.TryParse(dbrq, out dt)) { throw new Exception(columns[5] + "不正确。"); } string dbdd = drv[columns[6]].ToString(); if (string.IsNullOrEmpty(dbdd)) { throw new Exception(columns[6] + "不能为空。"); } string dbzcy = drv[columns[7]].ToString(); if (string.IsNullOrEmpty(dbzcy)) { throw new Exception(columns[7] + "不能为空。"); } string dbyj = drv[columns[8]].ToString(); if (string.IsNullOrEmpty(dbyj)) { throw new Exception(columns[8] + "不能为空。"); } else if (dbyj.Length > 200) { throw new Exception(columns[8] + "限填200个字。"); } string zswtgyy = drv[columns[9]].ToString(); if (zsjgdm == "0") { if (string.IsNullOrEmpty(zswtgyy)) { throw new Exception(columns[9] + "不能为空。"); } else if (zswtgyy.Length > 200) { throw new Exception(columns[9] + "限填200个字。"); } } string fzrbh = xs.Pkid; string xmrq = drv[columns[3]].ToString(); if (BLL.Xmgl.Xm_ysdb.Exist(Pkid, new string[] { "Fzrbh", "Dbrq" }, new string[] { fzrbh, dbrq })) { throw new Exception("该预审答辩结果已导入。"); } Model.Xmgl.Xm_ysdb m = new Model.Xmgl.Xm_ysdb(); m.Fzrbh = fzrbh; m.Fzdxrq = fzdxqdrq; m.Zsjgdm = zsjgdm; m.Dbjgdm = dbjgdm; m.Dbrq = dbrq; m.Dbdd = dbdd; m.Dbzcy = dbzcy; m.Dbpjyj = dbyj; m.Zswtgyy = zswtgyy; if (BLL.Xmgl.Xm_ysdb.Save(m)) { cnt = 1; drv["Del"] = 1; } return(cnt); }