/// <summary> /// 修改学历学位信息 /// </summary> /// <param name="obj"></param> /// <returns></returns> public bool EditEdu(object obj) { A01BLL _aBll = new A01BLL(); SM_CodeItemsBLL item = new SM_CodeItemsBLL(); FormCollection param = (FormCollection)obj; A04 a = new A04(); a.PersonID = _aBll.GetByRowID(param["EduRowID"]).PersonID; if (!string.IsNullOrEmpty(param["A0405"])) { a.A0405 = item.GetCodeItemByCodeID("JDXL").Where(o => o.CodeItemName == param["A0405"]).FirstOrDefault().CodeItemID; } if (!string.IsNullOrEmpty(param["C0401"])) { a.C0401 = item.GetCodeItemByCodeID("KF").Where(o => o.CodeItemName == param["C0401"]).FirstOrDefault().CodeItemID; } a.DispOrder = GetA04Info().Count() + 1; a.IsLastRow = 1; if (!string.IsNullOrEmpty(param["A0415"])) { a.A0415 = Convert.ToDateTime(param["A0415"]); } if (!string.IsNullOrEmpty(param["A0430"])) { a.A0430 = Convert.ToDateTime(param["A0430"]); } a.A0435 = param["A0435"]; a.A0410 = param["A0410"]; string RowID = param["EduRowID"]; return(base.Modify(a, o => o.RowID == RowID, "A0405", "C0401", "A0415", "A0430", "A0435", "A0410") > 0); }
/// <summary> /// 获取View_A02信息,已经打卡的人员信息 /// </summary> /// <returns></returns> public List <View_A02> GetView() { SM_CodeItemsBLL codeItem = new SM_CodeItemsBLL(); List <View_A02> returnList = new List <View_A02>(); List <View_A02> list = base.DBSession.IView_A02DAL.Select(o => o.A0101 != "") .OrderByDescending(k => k.A0201) .ThenBy(n => n.PersonID).ToList(); return(list); }
/// <summary> /// 添加学历学位信息 /// </summary> /// <param name="obj"></param> /// <returns></returns> public bool AddEdu(object obj) { A01BLL _aBll = new A01BLL(); SM_CodeItemsBLL item = new SM_CodeItemsBLL(); FormCollection param = (FormCollection)obj; A04 a = new A04(); a.PersonID = _aBll.GetByRowID(param["EduRowID"]).PersonID; a.RowID = HCQ2_Common.RowIDHelp.GetNewRowID(); if (!string.IsNullOrEmpty(param["A0405"])) { a.A0405 = item.GetCodeItemByCodeID("JDXL").Where(o => o.CodeItemName == param["A0405"]).FirstOrDefault().CodeItemID; } if (!string.IsNullOrEmpty(param["C0401"])) { a.C0401 = item.GetCodeItemByCodeID("KF").Where(o => o.CodeItemName == param["C0401"]).FirstOrDefault().CodeItemID; } a.IsLastRow = 1; if (!string.IsNullOrEmpty(param["A0415"]) && param["A0415"] != "学历学位") { a.A0415 = Convert.ToDateTime(param["A0415"]); } if (!string.IsNullOrEmpty(param["A0430"]) && param["A0430"] != "A0430") { a.A0430 = Convert.ToDateTime(param["A0430"]); } a.A0435 = param["A0435"]; a.A0410 = param["A0410"]; bool isAccess = false; if (!string.IsNullOrEmpty(param["EduIsEdit"])) { //编辑 string EduRowID = param["EduIsEdit"]; isAccess = base.Modify(a, o => o.RowID == EduRowID, "A0405", "C0401", "A0415", "A0430", "A0435", "A0410") > 0; } else { var data = GetA04Info(); if (data.Count() > 0) { a.DispOrder = data.Max(o => o.DispOrder) + 1; } else { a.DispOrder = 1; } //添加 isAccess = base.Add(a) > 0; } return(isAccess); }
/// <summary> /// 替换数据源里面的字典值 /// </summary> /// <param name="list"></param> /// <returns></returns> public List <View_A02> GetViewReplace(List <View_A02> list) { SM_CodeItemsBLL codeItem = new SM_CodeItemsBLL(); List <View_A02> returnList = new List <View_A02>(); for (int i = 0; i < list.Count; i++) { View_A02 view = list[i]; if (!string.IsNullOrEmpty(view.E0386)) { view.E0386 = codeItem.GetCodeItemDetail("JA", view.E0386).CodeItemName; } returnList.Add(view); } return(returnList); }
/// <summary> /// 没有打卡的人员 /// </summary> /// <returns></returns> private object NoCard(string unit_code, string check_time) { SM_CodeItemsBLL code = new SM_CodeItemsBLL(); //项目SQL语句 StringBuilder sbUnit = new StringBuilder(); switch (unit_code.Length) { case 3: sbUnit.AppendFormat(" and a.B0001='{0}' ", unit_code); break; case 6: sbUnit.AppendFormat(" and a.B000201='{0}' ", unit_code); break; case 9: sbUnit.AppendFormat(" and a.B000202='{0}' ", unit_code); break; default: break; } StringBuilder sbSql = new StringBuilder(); //已经打卡的人员 sbSql = new StringBuilder(); string[] time = check_time.Split('-'); sbSql.AppendFormat(" select * from View_A02 a left join A01 b on a.PersonID=b.PersonID "); sbSql.AppendFormat(" WHERE YEAR(A0201)={0} and MONTH(A0201)={1} and DAY(A0201)={2} ", time[0], time[1], time[2]); sbSql.AppendFormat(sbUnit.ToString()); DataTable dtOk = HCQ2_Common.SQL.SqlHelper.ExecuteDataTable(sbSql.ToString()); //已打卡人员集合 List <Dictionary <string, object> > listOk = new List <Dictionary <string, object> >(); Dictionary <string, object> dicOk = new Dictionary <string, object>(); //接收已经打卡人员的person_id string person_id = string.Empty; for (int i = 0; i < dtOk.Rows.Count; i++) { dicOk = new Dictionary <string, object>(); dicOk.Add("personName", dtOk.Rows[i]["A0101"]); dicOk.Add("personSex", dtOk.Rows[i]["A0107"]); dicOk.Add("personPhone", dtOk.Rows[i]["C0104"]); if (dtOk.Rows[i]["E0386"] != null) { dicOk.Add("personWorkType", code.GetCodeItemByCodeID("JA"). Where(o => o.CodeItemID == dtOk.Rows[i]["E0386"].ToString()). FirstOrDefault().CodeItemName); } else { dicOk.Add("personWorkType", ""); } dicOk.Add("personHomeTown", dtOk.Rows[i]["A0114"]); listOk.Add(dicOk); if (string.IsNullOrEmpty(person_id)) { person_id = "'" + dtOk.Rows[i]["PersonID"].ToString() + "'"; } else { person_id += ",'" + dtOk.Rows[i]["PersonID"].ToString() + "'"; } } //没有打卡的人员 sbSql = new StringBuilder(); sbSql.AppendFormat("select * from A01 a where 1=1 "); if (!string.IsNullOrEmpty(person_id)) { sbSql.AppendFormat(" and PersonID not in ({0}) ", person_id); } sbSql.AppendFormat(sbUnit.ToString()); DataTable dtNot = HCQ2_Common.SQL.SqlHelper.ExecuteDataTable(sbSql.ToString()); List <Dictionary <string, object> > listFin = new List <Dictionary <string, object> >(); Dictionary <string, object> dicFin = new Dictionary <string, object>(); for (int i = 0; i < dtNot.Rows.Count; i++) { dicFin = new Dictionary <string, object>(); dicFin.Add("personName", dtNot.Rows[i]["A0101"]); dicFin.Add("personSex", dtNot.Rows[i]["A0107"]); dicFin.Add("personPhone", dtNot.Rows[i]["C0104"]); if (!string.IsNullOrEmpty(dtNot.Rows[i]["E0386"].ToString())) { dicFin.Add("personWorkType", code.GetCodeItemByCodeID("JA"). Where(o => o.CodeItemID == dtNot.Rows[i]["E0386"].ToString()). FirstOrDefault().CodeItemName); } else { dicFin.Add("personWorkType", ""); } dicFin.Add("personHomeTown", dtNot.Rows[i]["A0114"]); listFin.Add(dicFin); } List <Dictionary <string, object> > list = new List <Dictionary <string, object> >(); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("ok", listOk); dic.Add("fin", listFin); list.Add(dic); return(list); }