private static int Update(Model.Lcgl.Lc_nfzmd xm) { //xm.Ztdm = (int)TStar.Web.Globals.SystemSetting.Status.Submitted; int r = Update <Model.Lcgl.Lc_nfzmd>(xm); // 写日志 return(r); }
private static int Insert(Model.Lcgl.Lc_nfzmd xm) { xm.Xq = BLL.Globals.SystemSetting.Dqxq; xm.Ztdm = (int)TStar.Web.Globals.SystemSetting.Status.Draft; int r = Insert <Model.Lcgl.Lc_nfzmd>(xm); // 写日志 return(r); }
/// <summary> /// 保存名单 /// </summary> public static bool Save(Model.Lcgl.Lc_nfzmd xm) { int r = 0; if (String.IsNullOrEmpty(xm.Pkid)) // 新增 { r = Insert(xm); } else // 保存 { r = Update(xm); } return(r > 0); }
/// <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); }