protected void btnFind_Click(object sender, EventArgs e) { int uid = -1; condObj = new HR_CK_USERINFO(); if (txtUSERID.Value != "" && int.TryParse(txtUSERID.Value, out uid)) { condObj.USERID = Convert.ToInt32(txtUSERID.Value); } if (txtSTAFF_ID.Value != "" && int.TryParse(txtSTAFF_ID.Value, out uid)) { condObj.STAFF_ID = Convert.ToInt32(txtSTAFF_ID.Value); } if (txtBADGENUMBER.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.BADGENUMBER, txtBADGENUMBER.Value); } if (txtSSN.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.SSN, txtSSN.Value); } if (txtNAME.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.NAME, txtNAME.Value); } hidCondition.Value = condObj.ToJson(20); BindList(condObj, 1); }
protected void Page_Load(object sender, EventArgs e) { string doType = Request["dotype"]; string userid = Server.UrlDecode(Request["userid"]); if (string.IsNullOrEmpty(doType) || string.IsNullOrEmpty(userid)) { Response.Write("user id is null"); Response.End(); return; } if (doType == "doUpdateCKUSERINFOStff") { try { string stfid = Server.UrlDecode(Request["stfid"]); HR_CK_USERINFO user = new HR_CK_USERINFO(); user._USERID = Convert.ToInt32(userid); if (!string.IsNullOrEmpty(stfid) && stfid != "-") { HR_CK_USERINFO userCon = new HR_CK_USERINFO(); userCon.STAFF_ID = Convert.ToInt32(stfid); if (BLLTable<HR_CK_USERINFO>.Exists(userCon)) { Response.Write("该员工已有对应关系!"); } else { user.STAFF_ID = Convert.ToInt32(stfid); if (BLLTable<HR_CK_USERINFO>.Factory(conn).Update(user, HR_CK_USERINFO.Attribute.USERID) > 0) Response.Write("操作成功"); else Response.Write("操作失败"); } } else { user.STAFF_ID = 0; if (BLLTable<HR_CK_USERINFO>.Factory(conn).Update(user, HR_CK_USERINFO.Attribute.USERID) > 0) Response.Write("操作成功"); else Response.Write("操作失败"); } } catch (Exception ex) { Response.Write("操作失败!\r\n原因如下:\r\n----------\r\n" + ex.Message); Response.End(); } Response.End(); } else { Response.Write("不支持的操作!"); Response.End(); return; } Response.End(); }
protected void aspPager_PageChanged(object sender, EventArgs e) { if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson<HR_CK_USERINFO>(hidCondition.Value); } BindList(condObj, aspPager.CurrentPageIndex); }
protected void aspPager_PageChanged(object sender, EventArgs e) { if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson <HR_CK_USERINFO>(hidCondition.Value); } BindList(condObj, aspPager.CurrentPageIndex); }
protected void btnSetPageSize_Click(object sender, EventArgs e) { aspPager.PageSize = int.Parse(txtPageSize.Value); if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson<HR_CK_USERINFO>(hidCondition.Value); } BindList(condObj, aspPager.CurrentPageIndex); }
protected void btnSetPageSize_Click(object sender, EventArgs e) { aspPager.PageSize = int.Parse(txtPageSize.Value); if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson <HR_CK_USERINFO>(hidCondition.Value); } BindList(condObj, aspPager.CurrentPageIndex); }
protected void Page_Load(object sender, EventArgs e) { //在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录 if (Request["DelUSERID"] != null) { int re = BLLTable <HR_CK_USERINFO> .Factory(conn).Delete(HR_CK_USERINFO.Attribute.USERID, Request["DelUSERID"]); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在列表顶部点击删除按钮,通过AJAX执行这里的后台代码,删除多条记录 if (Request["DelKeyIDS"] != null) { HR_CK_USERINFO cond = new HR_CK_USERINFO(); cond.In(HR_CK_USERINFO.Attribute.USERID, Request["DelKeyIDS"]); int re = BLLTable <HR_CK_USERINFO> .Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在用户详细信息查看编辑页面,点保存时,通过AJAX执行这里的后台代码,实现部门字段的更新 if (Request["saveInfo"] != null) { HR_CK_USERINFO val = new HR_CK_USERINFO(); val.USERID = int.Parse(Request["FieldKeyID"]); List <AttributeItem> lstCol = val.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { val.SetValue(lstCol[i].FieldName, Request["txt" + lstCol[i].FieldName]); } } BLLTable <HR_CK_USERINFO> .Factory(conn).Update(val, HR_CK_USERINFO.Attribute.USERID); Response.Write("修改用户信息成功"); } Response.End(); }
protected void Page_Load(object sender, EventArgs e) { #region//默认隐藏的列 //hideTableColumnList = new List<AttributeItem>(); //hideTableColumnList.Add(HR_CK_USERINFO.Attribute.EXP1); //hideTableColumnList.Add(HR_CK_USERINFO.Attribute.EXP2); //hideTableColumnList.Add(HR_CK_USERINFO.Attribute.EXP3); //valObj.LoadAllAttributes(true);//暂时加此代码,以后框架更新将不需要 //valObj.Remove(hideTableColumnList); //hideFindColumnList = new List<AttributeItem>(); //hideFindColumnList.Add(HR_CK_USERINFO.Attribute.EXP1); //hideFindColumnList.Add(HR_CK_USERINFO.Attribute.EXP2); //hideFindColumnList.Add(HR_CK_USERINFO.Attribute.EXP3); #endregion condObj.OrderBy(HR_CK_USERINFO.Attribute.USERID, Order.Desc); if (!IsPostBack) { btnFind.Text = LanguageService.GetLanguageString("btnFind", "查询"); aspPager.PageSize = 10; aspPager.CurrentPageIndex = 1; if (!string.IsNullOrEmpty(Request["ids"])) { HR_CK_USERINFO roleOld = new HR_CK_USERINFO(); roleOld.Where(HR_CK_USERINFO.Attribute.USERID, Request["ids"].ToString()); listObj = BLLTable <HR_CK_USERINFO> .Factory(conn).Select(valObj, roleOld); for (int i = 0; i < listObj.Count; i++) { if (i > 0) { hidOld.Value += ","; hidInitIDS.Value += ","; } hidOld.Value += "{ID:'" + listObj[i].USERID + "',Name:'" + listObj[i].USERID + "'}";//这里的Name用于显示在列表中,请自行重定义。 hidInitIDS.Value += listObj[i].USERID; } } try { listObj = BLLTable <HR_CK_USERINFO> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repList.DataSource = listObj; repList.DataBind(); aspPager.RecordCount = recount; } catch (Exception ex) { litWarn.Text = ex.Message; } } }
protected void Page_Load(object sender, EventArgs e) { //���б�����ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��һ����¼ if (Request["DelUSERID"] != null) { int re = BLLTable<HR_CK_USERINFO>.Factory(conn).Delete(HR_CK_USERINFO.Attribute.USERID, Request["DelUSERID"]); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���б�������ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��������¼ if (Request["DelKeyIDS"] != null) { HR_CK_USERINFO cond = new HR_CK_USERINFO(); cond.In(HR_CK_USERINFO.Attribute.USERID, Request["DelKeyIDS"]); int re = BLLTable<HR_CK_USERINFO>.Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���û���ϸ��Ϣ�鿴�༭ҳ�棬�㱣��ʱ��ͨ��AJAXִ������ĺ�̨���룬ʵ�ֲ����ֶεĸ��� if (Request["saveInfo"] != null) { HR_CK_USERINFO val = new HR_CK_USERINFO(); val.USERID = int.Parse(Request["FieldKeyID"]); List<AttributeItem> lstCol = val.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { val.SetValue(lstCol[i].FieldName,Request["txt" + lstCol[i].FieldName]); } } BLLTable<HR_CK_USERINFO>.Factory(conn).Update(val, HR_CK_USERINFO.Attribute.USERID); Response.Write("���û���Ϣ�ɹ�"); } Response.End(); }
protected void btnFind_Click(object sender, EventArgs e) { int uid = -1; condObj = new HR_CK_USERINFO(); if (txtUSERID.Value != "" && int.TryParse(txtUSERID.Value, out uid)) condObj.USERID = Convert.ToInt32(txtUSERID.Value); if (txtSTAFF_ID.Value != "" && int.TryParse(txtSTAFF_ID.Value, out uid)) condObj.STAFF_ID = Convert.ToInt32(txtSTAFF_ID.Value); if (txtBADGENUMBER.Value != "") condObj.Like(HR_CK_USERINFO.Attribute.BADGENUMBER, txtBADGENUMBER.Value); if (txtSSN.Value != "") condObj.Like(HR_CK_USERINFO.Attribute.SSN, txtSSN.Value); if (txtNAME.Value != "") condObj.Like(HR_CK_USERINFO.Attribute.NAME, txtNAME.Value); hidCondition.Value = condObj.ToJson(20); BindList(condObj, 1); }
protected void aspPager_PageChanged(object sender, EventArgs e) { try { if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson <HR_CK_USERINFO>(hidCondition.Value); } listObj = BLLTable <HR_CK_USERINFO> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, aspPager.CurrentPageIndex, ref recount); repCus.DataSource = listObj; repCus.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } }
protected void aspPager_PageChanged(object sender, EventArgs e) { try { recount = aspPager.RecordCount; if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson<HR_CK_USERINFO>(hidCondition.Value); } List<HR_CK_USERINFO> listVal = BLLTable<HR_CK_USERINFO>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, aspPager.CurrentPageIndex, ref recount); repList.DataSource = listVal; repList.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } }
private void BindList(HR_CK_USERINFO condObj, int curPage) { if (condObj.af_PageByAttributeItem == null)//如果不存在用户定义的分页排序属性,则用主键属性排序 { condObj.af_PageBy(HR_CK_USERINFO.Attribute.USERID, Order.Asc); } #region//数据权限条件 #endregion //condObj.PID = decimal.Parse(pid); HR_STAFF otherVal = new HR_STAFF(); otherVal.STAFF_NAME = ""; Relation r2 = new Relation(HR_STAFF.Attribute.STAFF_ID, HR_CK_USERINFO.Attribute.STAFF_ID, RelationType.RightJoin); if (!string.IsNullOrEmpty(txtSTAFF_NAME.Value) || !string.IsNullOrEmpty(txtSTAFF_NO.Value)) { HR_STAFF otherCon = new HR_STAFF(); if (!string.IsNullOrEmpty(txtSTAFF_NAME.Value)) { otherCon.Like(HR_STAFF.Attribute.STAFF_NAME, txtSTAFF_NAME.Value); } if (!string.IsNullOrEmpty(txtSTAFF_NO.Value)) { otherCon.Like(HR_STAFF.Attribute.STAFF_NO, txtSTAFF_NO.Value); } listObj = BLLTable <HR_CK_USERINFO> .Factory(conn).SelectByPage(valObj, new List <Relation>(new Relation[] { r2 }), new List <ITableImplement>(new ITableImplement[] { otherVal }), new List <ITableImplement>(new ITableImplement[] { condObj, otherCon }), aspPager.PageSize, curPage, ref recount); } else { listObj = BLLTable <HR_CK_USERINFO> .Factory(conn).SelectByPage(valObj, r2, otherVal, condObj, aspPager.PageSize, curPage, ref recount); } repList.DataSource = listObj; repList.DataBind(); aspPager.RecordCount = recount; }
protected void btnOK_Click(object sender, EventArgs e) { try { HR_CK_USERINFO valObj = new HR_CK_USERINFO(); if (txtUSERID.Value != "") { valObj.USERID = Convert.ToInt32(txtUSERID.Value); } if (wucSelStaff1.Staff_ID > 0) { valObj.STAFF_ID = Convert.ToDecimal(wucSelStaff1.Staff_ID); } if (txtBADGENUMBER.Value != "") { valObj.BADGENUMBER = Convert.ToString(txtBADGENUMBER.Value); } if (txtSSN.Value != "") { valObj.SSN = Convert.ToString(txtSSN.Value); } if (txtNAME.Value != "") { valObj.NAME = Convert.ToString(txtNAME.Value); } if (txtGENDER.Value != "") { valObj.GENDER = Convert.ToString(txtGENDER.Value); } if (txtTITLE.Value != "") { valObj.TITLE = Convert.ToString(txtTITLE.Value); } if (txtPAGER.Value != "") { valObj.PAGER = Convert.ToString(txtPAGER.Value); } if (txtBIRTHDAY.Value != "") { valObj.BIRTHDAY = Convert.ToDateTime(txtBIRTHDAY.Value); } if (txtHIREDDAY.Value != "") { valObj.HIREDDAY = Convert.ToDateTime(txtHIREDDAY.Value); } if (txtSTREET.Value != "") { valObj.STREET = Convert.ToString(txtSTREET.Value); } if (txtCITY.Value != "") { valObj.CITY = Convert.ToString(txtCITY.Value); } if (txtSTATE.Value != "") { valObj.STATE = Convert.ToString(txtSTATE.Value); } if (txtZIP.Value != "") { valObj.ZIP = Convert.ToString(txtZIP.Value); } if (txtOPHONE.Value != "") { valObj.OPHONE = Convert.ToString(txtOPHONE.Value); } if (txtFPHONE.Value != "") { valObj.FPHONE = Convert.ToString(txtFPHONE.Value); } if (txtVERIFICATIONMETHOD.Value != "") { valObj.VERIFICATIONMETHOD = Convert.ToInt16(txtVERIFICATIONMETHOD.Value); } if (txtDEFAULTDEPTID.Value != "") { valObj.DEFAULTDEPTID = Convert.ToInt16(txtDEFAULTDEPTID.Value); } if (txtSECURITYFLAGS.Value != "") { valObj.SECURITYFLAGS = Convert.ToInt16(txtSECURITYFLAGS.Value); } if (txtATT.Value != "") { valObj.ATT = Convert.ToInt16(txtATT.Value); } if (txtINLATE.Value != "") { valObj.INLATE = Convert.ToInt16(txtINLATE.Value); } if (txtOUTEARLY.Value != "") { valObj.OUTEARLY = Convert.ToInt16(txtOUTEARLY.Value); } if (txtOVERTIME.Value != "") { valObj.OVERTIME = Convert.ToInt16(txtOVERTIME.Value); } if (txtSEP.Value != "") { valObj.SEP = Convert.ToInt16(txtSEP.Value); } if (txtHOLIDAY.Value != "") { valObj.HOLIDAY = Convert.ToInt16(txtHOLIDAY.Value); } if (txtMINZU.Value != "") { valObj.MINZU = Convert.ToString(txtMINZU.Value); } if (txtPASSWORD.Value != "") { valObj.PASSWORD = Convert.ToString(txtPASSWORD.Value); } if (txtLUNCHDURATION.Value != "") { valObj.LUNCHDURATION = Convert.ToInt16(txtLUNCHDURATION.Value); } if (txtMVerifyPass.Value != "") { valObj.MVerifyPass = Convert.ToString(txtMVerifyPass.Value); } if (keyid != "") { valObj.USERID = Convert.ToInt32(keyid); count = BLLTable <HR_CK_USERINFO> .Factory(conn).Update(valObj, HR_CK_USERINFO.Attribute.USERID); } else { count = BLLTable <HR_CK_USERINFO> .Factory(conn).Insert(valObj, HR_CK_USERINFO.Attribute.USERID); keyid = valObj.USERID.ToString(); } if (count > 0) { StringBuilder sbData = new StringBuilder("({valObj:''"); List <AttributeItem> lstCol = valObj.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { object val = valObj.GetValue(lstCol[i]); if (val != null) { sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'"); } } sbData.Append("})"); Button btn = (Button)sender; if (btn.ID == "btnOK") { if (ViewState["hadSave"] == null) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = '" + sbData.ToString() + "';}else{window.returnValue = '" + sbData.ToString() + "';}window.close();", true); } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = 're';}else{window.returnValue = 're';}window.close();", true); } } else { txtUSERID.Value = ""; wucSelStaff1.Staff_ID = 0; txtBADGENUMBER.Value = ""; txtSSN.Value = ""; txtNAME.Value = ""; txtGENDER.Value = ""; txtTITLE.Value = ""; txtPAGER.Value = ""; txtBIRTHDAY.Value = ""; txtHIREDDAY.Value = ""; txtSTREET.Value = ""; txtCITY.Value = ""; txtSTATE.Value = ""; txtZIP.Value = ""; txtOPHONE.Value = ""; txtFPHONE.Value = ""; txtVERIFICATIONMETHOD.Value = ""; txtDEFAULTDEPTID.Value = ""; txtSECURITYFLAGS.Value = ""; txtATT.Value = ""; txtINLATE.Value = ""; txtOUTEARLY.Value = ""; txtOVERTIME.Value = ""; txtSEP.Value = ""; txtHOLIDAY.Value = ""; txtMINZU.Value = ""; txtPASSWORD.Value = ""; txtLUNCHDURATION.Value = ""; txtMVerifyPass.Value = ""; txtPHOTO.Value = ""; } } } catch (Exception ex) { litWarn.Text = ex.Message; } }
private void UpdateStff(OleDbConnection conn2, string fangan) { if (conn2 == null) { return; } Dictionary <string, string> userFields = GetFieldsByFangAn(fangan, "USERINFO"); if (!userFields.ContainsKey("*USERINFO")) { Response.Write("同步方案不完整,请修改方案!"); Response.End(); return; } string sql = "select "; foreach (string field in userFields.Keys) { if (field.Contains("*")) { continue; } sql += " " + userFields[field] + ","; } sql = sql.TrimEnd(','); sql += " from " + userFields["*USERINFO"]; OleDbCommand com = new OleDbCommand(sql, conn2); OleDbDataReader dr = com.ExecuteReader(); HR_CK_USERINFO hruser = new HR_CK_USERINFO(); List <HR_CK_USERINFO> hrusers = new List <HR_CK_USERINFO>(); Dictionary <string, HR_CK_USERINFO> userDic = new Dictionary <string, HR_CK_USERINFO>(); List <HR_CK_USERINFO> chongfuUser = new List <HR_CK_USERINFO>(); while (dr.Read()) { try { hruser = new HR_CK_USERINFO(); foreach (AttributeItem ai in hruser.af_AttributeItemList) { if (userFields.ContainsKey("USERINFO_" + ai.FieldName)) { object val = dr[userFields["USERINFO_" + ai.FieldName]]; if (val != null && !string.IsNullOrEmpty(val.ToString())) { hruser.SetValue(ai, val.ToString().Replace("?粀", "").Replace("\0", "").Replace("?", "").Replace("粀", "")); } } } hruser.Remove(new AttributeItem[] { HR_CK_USERINFO.Attribute.STAFF_ID }); if (!userDic.ContainsKey(hruser.NAME)) { userDic.Add(hruser.NAME, hruser); } else { chongfuUser.Add(hruser); } hrusers.Add(hruser); } catch { } } foreach (HR_CK_USERINFO user in chongfuUser) { if (userDic.ContainsKey(user.NAME)) { userDic.Remove(hruser.NAME); } } HR_STAFF stfVal = new HR_STAFF(); stfVal.STAFF_NAME = ""; stfVal.STAFF_ID = 0; HR_STAFF stfCon = new HR_STAFF(); List <HR_STAFF> stfList = BLLTable <HR_STAFF> .Factory(conn).Select(stfVal, stfCon); Dictionary <string, HR_STAFF> stfDic = new Dictionary <string, HR_STAFF>(); List <HR_STAFF> chongfuStf = new List <HR_STAFF>(); foreach (HR_STAFF stf in stfList) { if (!stfDic.ContainsKey(stf.STAFF_NAME)) { stfDic.Add(stf.STAFF_NAME, stf); } else { chongfuStf.Add(stf); } } foreach (HR_STAFF stf in chongfuStf) { if (stfDic.ContainsKey(stf.STAFF_NAME)) { stfDic.Remove(stf.STAFF_NAME); } } foreach (string name in userDic.Keys) { if (stfDic.ContainsKey(name)) { HR_CK_USERINFO stfidcon = new HR_CK_USERINFO();//wcp考虑优化新能 stfidcon.STAFF_ID = stfDic[name].STAFF_ID; if (!BLLTable <HR_CK_USERINFO> .Exists(stfidcon)) { userDic[name].STAFF_ID = stfDic[name].STAFF_ID; } } } int countok = 0; int countfi = 0; int counter = 0; foreach (HR_CK_USERINFO user in hrusers) { try { int count = 0; count = BLLTable <HR_CK_USERINFO> .SaveOrUpdate(user, HR_CK_USERINFO.Attribute.USERID); if (count > 0) { countok++; } else { countfi++; } } catch { counter++; } } Response.Write("同步员工信息数:" + hrusers.Count + "条" + "\n成功:" + countok + "条\n失败:" + countfi + "条\n出错:" + counter + "条"); }
protected void btnFind_Click(object sender, EventArgs e) { condObj = new HR_CK_USERINFO(); if(txtUSERID.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.USERID, Convert.ToInt32(txtUSERID.Value)); if(txtSTAFF_ID.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.STAFF_ID, Convert.ToDecimal(txtSTAFF_ID.Value)); if(txtBADGENUMBER.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.BADGENUMBER, Convert.ToString(txtBADGENUMBER.Value)); if(txtSSN.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.SSN, Convert.ToString(txtSSN.Value)); if(txtNAME.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.NAME, Convert.ToString(txtNAME.Value)); if(txtGENDER.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.GENDER, Convert.ToString(txtGENDER.Value)); if(txtTITLE.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.TITLE, Convert.ToString(txtTITLE.Value)); if(txtPAGER.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.PAGER, Convert.ToString(txtPAGER.Value)); if(txtBIRTHDAY.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.BIRTHDAY, Convert.ToDateTime(txtBIRTHDAY.Value)); if(txtHIREDDAY.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.HIREDDAY, Convert.ToDateTime(txtHIREDDAY.Value)); if(txtSTREET.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.STREET, Convert.ToString(txtSTREET.Value)); if(txtCITY.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.CITY, Convert.ToString(txtCITY.Value)); if(txtSTATE.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.STATE, Convert.ToString(txtSTATE.Value)); if(txtZIP.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.ZIP, Convert.ToString(txtZIP.Value)); if(txtOPHONE.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.OPHONE, Convert.ToString(txtOPHONE.Value)); if(txtFPHONE.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.FPHONE, Convert.ToString(txtFPHONE.Value)); if(txtVERIFICATIONMETHOD.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.VERIFICATIONMETHOD, Convert.ToInt16(txtVERIFICATIONMETHOD.Value)); if(txtDEFAULTDEPTID.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.DEFAULTDEPTID, Convert.ToInt16(txtDEFAULTDEPTID.Value)); if(txtSECURITYFLAGS.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.SECURITYFLAGS, Convert.ToInt16(txtSECURITYFLAGS.Value)); if(txtATT.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.ATT, Convert.ToInt16(txtATT.Value)); if(txtINLATE.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.INLATE, Convert.ToInt16(txtINLATE.Value)); if(txtOUTEARLY.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.OUTEARLY, Convert.ToInt16(txtOUTEARLY.Value)); if(txtOVERTIME.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.OVERTIME, Convert.ToInt16(txtOVERTIME.Value)); if(txtSEP.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.SEP, Convert.ToInt16(txtSEP.Value)); if(txtHOLIDAY.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.HOLIDAY, Convert.ToInt16(txtHOLIDAY.Value)); if(txtMINZU.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.MINZU, Convert.ToString(txtMINZU.Value)); if(txtPASSWORD.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.PASSWORD, Convert.ToString(txtPASSWORD.Value)); if(txtLUNCHDURATION.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.LUNCHDURATION, Convert.ToInt16(txtLUNCHDURATION.Value)); if(txtMVerifyPass.Value !="" ) condObj.Like_OR(HR_CK_USERINFO.Attribute.MVerifyPass, Convert.ToString(txtMVerifyPass.Value)); try { hidCondition.Value = condObj.ToJson(20); listObj = BLLTable<HR_CK_USERINFO>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repList.DataSource = listObj; repList.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "±à¼"; Page.Title = title; if (!string.IsNullOrEmpty(Request["USERID"])) { keyid = Request["USERID"]; } if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Request["KeyID"]; } if (!IsPostBack) { txtBIRTHDAY.Value = (DateTime.Now).ToString("yyyy-MM-dd"); txtHIREDDAY.Value = (DateTime.Now).ToString("yyyy-MM-dd"); this.txtUSERID.Disabled = true; this.txtUSERID.Attributes["class"] = "dis"; try { if (keyid != "") { valObj = BLLTable <HR_CK_USERINFO> .Factory(conn).GetRowData(HR_CK_USERINFO.Attribute.USERID, keyid); if (valObj == null) { return; } txtUSERID.Value = Convert.ToString(valObj.USERID);//Convert.ToInt32 wucSelStaff1.Staff_ID = Convert.ToDecimal(valObj.STAFF_ID); wucSelStaff1.Staff_NAME = Convert.ToString(valObj.NAME); //txtSTAFF_ID.Value = Convert.ToString(valObj.STAFF_ID);//Convert.ToDecimal txtBADGENUMBER.Value = Convert.ToString(valObj.BADGENUMBER); //Convert.ToString txtSSN.Value = Convert.ToString(valObj.SSN); //Convert.ToString txtNAME.Value = Convert.ToString(valObj.NAME); //Convert.ToString txtGENDER.Value = Convert.ToString(valObj.GENDER); //Convert.ToString txtTITLE.Value = Convert.ToString(valObj.TITLE); //Convert.ToString txtPAGER.Value = Convert.ToString(valObj.PAGER); //Convert.ToString txtBIRTHDAY.Value = (valObj.BIRTHDAY == DateTime.MinValue) ? "" : valObj.BIRTHDAY.ToString("yyyy-MM-dd"); txtHIREDDAY.Value = (valObj.HIREDDAY == DateTime.MinValue) ? "" : valObj.HIREDDAY.ToString("yyyy-MM-dd"); txtSTREET.Value = Convert.ToString(valObj.STREET); //Convert.ToString txtCITY.Value = Convert.ToString(valObj.CITY); //Convert.ToString txtSTATE.Value = Convert.ToString(valObj.STATE); //Convert.ToString txtZIP.Value = Convert.ToString(valObj.ZIP); //Convert.ToString txtOPHONE.Value = Convert.ToString(valObj.OPHONE); //Convert.ToString txtFPHONE.Value = Convert.ToString(valObj.FPHONE); //Convert.ToString txtVERIFICATIONMETHOD.Value = Convert.ToString(valObj.VERIFICATIONMETHOD); //Convert.ToInt16 txtDEFAULTDEPTID.Value = Convert.ToString(valObj.DEFAULTDEPTID); //Convert.ToInt16 txtSECURITYFLAGS.Value = Convert.ToString(valObj.SECURITYFLAGS); //Convert.ToInt16 txtATT.Value = Convert.ToString(valObj.ATT); //Convert.ToInt16 txtINLATE.Value = Convert.ToString(valObj.INLATE); //Convert.ToInt16 txtOUTEARLY.Value = Convert.ToString(valObj.OUTEARLY); //Convert.ToInt16 txtOVERTIME.Value = Convert.ToString(valObj.OVERTIME); //Convert.ToInt16 txtSEP.Value = Convert.ToString(valObj.SEP); //Convert.ToInt16 txtHOLIDAY.Value = Convert.ToString(valObj.HOLIDAY); //Convert.ToInt16 txtMINZU.Value = Convert.ToString(valObj.MINZU); //Convert.ToString txtPASSWORD.Value = Convert.ToString(valObj.PASSWORD); //Convert.ToString txtLUNCHDURATION.Value = Convert.ToString(valObj.LUNCHDURATION); //Convert.ToInt16 txtMVerifyPass.Value = Convert.ToString(valObj.MVerifyPass); //Convert.ToString txtPHOTO.Value = Convert.ToString(valObj.PHOTO); //Convert.ToBase64CharArray } } catch (Exception ex) { litWarn.Text = ex.Message; } } }
protected void Page_Load(object sender, EventArgs e) { #region//Ĭ�����ص��� //hideTableColumnList = new List<AttributeItem>(); //hideTableColumnList.Add(HR_CK_USERINFO.Attribute.EXP1); //hideTableColumnList.Add(HR_CK_USERINFO.Attribute.EXP2); //hideTableColumnList.Add(HR_CK_USERINFO.Attribute.EXP3); //valObj.LoadAllAttributes(true);//��ʱ�Ӵ˴��룬�Ժ��ܸ��½�����Ҫ //valObj.Remove(hideTableColumnList); //hideFindColumnList = new List<AttributeItem>(); //hideFindColumnList.Add(HR_CK_USERINFO.Attribute.EXP1); //hideFindColumnList.Add(HR_CK_USERINFO.Attribute.EXP2); //hideFindColumnList.Add(HR_CK_USERINFO.Attribute.EXP3); #endregion condObj.OrderBy(HR_CK_USERINFO.Attribute.USERID, Order.Desc); if (!IsPostBack) { btnFind.Text = LanguageService.GetLanguageString("btnFind", "��ѯ"); aspPager.PageSize = 10; aspPager.CurrentPageIndex = 1; if (!string.IsNullOrEmpty(Request["ids"])) { HR_CK_USERINFO roleOld = new HR_CK_USERINFO(); roleOld.Where(HR_CK_USERINFO.Attribute.USERID, Request["ids"].ToString()); listObj = BLLTable<HR_CK_USERINFO>.Factory(conn).Select(valObj, roleOld); for (int i = 0; i < listObj.Count; i++) { if (i > 0) { hidOld.Value += ","; hidInitIDS.Value += ","; } hidOld.Value += "{ID:'" + listObj[i].USERID + "',Name:'" + listObj[i].USERID + "'}";//�����Name������ʾ���б��У��������ض��塣 hidInitIDS.Value += listObj[i].USERID; } } try { listObj = BLLTable<HR_CK_USERINFO>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repList.DataSource = listObj; repList.DataBind(); aspPager.RecordCount = recount; } catch (Exception ex) { litWarn.Text = ex.Message; } } }
private DataTable CreatDefaultFangAnTable(string fangan) { DataTable tab = new DataTable(fangan); tab.Columns.Add("*USERINFO"); tab.Columns.Add("*CHECKINOUT"); HR_CK_USERINFO hruser = new HR_CK_USERINFO(); foreach (AttributeItem ai in hruser.af_AttributeItemList) { if (ai.FieldName == "ID" || ai.FieldName == "PHOTO") continue; tab.Columns.Add("USERINFO_" + ai.FieldName); } HR_CHECKINOUT hrcheck = new HR_CHECKINOUT(); foreach (AttributeItem ai in hrcheck.af_AttributeItemList) { if (ai.FieldName == "ID" || ai.FieldName == "PHOTO") continue; tab.Columns.Add("CHECKINOUT_" + ai.FieldName); } DataRow dr = tab.NewRow(); dr["*USERINFO"] = "USERINFO"; dr["*CHECKINOUT"] = "CHECKINOUT"; foreach (AttributeItem ai in hruser.af_AttributeItemList) { if (ai.FieldName == "ID" || ai.FieldName == "PHOTO") continue; if (ai.FieldName == "STAFF_ID") dr["USERINFO_" + ai.FieldName] = "USERID"; else dr["USERINFO_" + ai.FieldName] = ai.FieldName; } foreach (AttributeItem ai in hrcheck.af_AttributeItemList) { if (ai.FieldName == "ID" || ai.FieldName == "PHOTO") continue; if (ai.FieldName == "STAFF_ID") dr["CHECKINOUT_" + ai.FieldName] = "USERID"; else dr["CHECKINOUT_" + ai.FieldName] = ai.FieldName; } tab.Rows.Add(dr); return tab; }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "�༭"; Page.Title = title; if (!string.IsNullOrEmpty(Request["USERID"])) { keyid = Request["USERID"]; } if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Request["KeyID"]; } if (!IsPostBack) { txtBIRTHDAY.Value = (DateTime.Now).ToString("yyyy-MM-dd"); txtHIREDDAY.Value = (DateTime.Now).ToString("yyyy-MM-dd"); this.txtUSERID.Disabled = true; this.txtUSERID.Attributes["class"] = "dis"; try { if (keyid != "") { valObj = BLLTable<HR_CK_USERINFO>.Factory(conn).GetRowData(HR_CK_USERINFO.Attribute.USERID, keyid); if(valObj==null) return ; txtUSERID.Value = Convert.ToString(valObj.USERID);//Convert.ToInt32 wucSelStaff1.Staff_ID = Convert.ToDecimal(valObj.STAFF_ID); wucSelStaff1.Staff_NAME = Convert.ToString(valObj.NAME); //txtSTAFF_ID.Value = Convert.ToString(valObj.STAFF_ID);//Convert.ToDecimal txtBADGENUMBER.Value = Convert.ToString(valObj.BADGENUMBER);//Convert.ToString txtSSN.Value = Convert.ToString(valObj.SSN);//Convert.ToString txtNAME.Value = Convert.ToString(valObj.NAME);//Convert.ToString txtGENDER.Value = Convert.ToString(valObj.GENDER);//Convert.ToString txtTITLE.Value = Convert.ToString(valObj.TITLE);//Convert.ToString txtPAGER.Value = Convert.ToString(valObj.PAGER);//Convert.ToString txtBIRTHDAY.Value = (valObj.BIRTHDAY == DateTime.MinValue) ? "" : valObj.BIRTHDAY.ToString("yyyy-MM-dd"); txtHIREDDAY.Value = (valObj.HIREDDAY == DateTime.MinValue) ? "" : valObj.HIREDDAY.ToString("yyyy-MM-dd"); txtSTREET.Value = Convert.ToString(valObj.STREET);//Convert.ToString txtCITY.Value = Convert.ToString(valObj.CITY);//Convert.ToString txtSTATE.Value = Convert.ToString(valObj.STATE);//Convert.ToString txtZIP.Value = Convert.ToString(valObj.ZIP);//Convert.ToString txtOPHONE.Value = Convert.ToString(valObj.OPHONE);//Convert.ToString txtFPHONE.Value = Convert.ToString(valObj.FPHONE);//Convert.ToString txtVERIFICATIONMETHOD.Value = Convert.ToString(valObj.VERIFICATIONMETHOD);//Convert.ToInt16 txtDEFAULTDEPTID.Value = Convert.ToString(valObj.DEFAULTDEPTID);//Convert.ToInt16 txtSECURITYFLAGS.Value = Convert.ToString(valObj.SECURITYFLAGS);//Convert.ToInt16 txtATT.Value = Convert.ToString(valObj.ATT);//Convert.ToInt16 txtINLATE.Value = Convert.ToString(valObj.INLATE);//Convert.ToInt16 txtOUTEARLY.Value = Convert.ToString(valObj.OUTEARLY);//Convert.ToInt16 txtOVERTIME.Value = Convert.ToString(valObj.OVERTIME);//Convert.ToInt16 txtSEP.Value = Convert.ToString(valObj.SEP);//Convert.ToInt16 txtHOLIDAY.Value = Convert.ToString(valObj.HOLIDAY);//Convert.ToInt16 txtMINZU.Value = Convert.ToString(valObj.MINZU);//Convert.ToString txtPASSWORD.Value = Convert.ToString(valObj.PASSWORD);//Convert.ToString txtLUNCHDURATION.Value = Convert.ToString(valObj.LUNCHDURATION);//Convert.ToInt16 txtMVerifyPass.Value = Convert.ToString(valObj.MVerifyPass);//Convert.ToString txtPHOTO.Value = Convert.ToString(valObj.PHOTO);//Convert.ToBase64CharArray } } catch (Exception ex) { litWarn.Text = ex.Message; } } }
protected void btnOK_Click(object sender, EventArgs e) { try { HR_CK_USERINFO valObj = new HR_CK_USERINFO(); if(txtUSERID.Value !="" ) valObj.USERID = Convert.ToInt32(txtUSERID.Value); if (wucSelStaff1.Staff_ID > 0) valObj.STAFF_ID = Convert.ToDecimal(wucSelStaff1.Staff_ID); if(txtBADGENUMBER.Value !="" ) valObj.BADGENUMBER = Convert.ToString(txtBADGENUMBER.Value); if(txtSSN.Value !="" ) valObj.SSN = Convert.ToString(txtSSN.Value); if(txtNAME.Value !="" ) valObj.NAME = Convert.ToString(txtNAME.Value); if(txtGENDER.Value !="" ) valObj.GENDER = Convert.ToString(txtGENDER.Value); if(txtTITLE.Value !="" ) valObj.TITLE = Convert.ToString(txtTITLE.Value); if(txtPAGER.Value !="" ) valObj.PAGER = Convert.ToString(txtPAGER.Value); if(txtBIRTHDAY.Value !="" ) valObj.BIRTHDAY = Convert.ToDateTime(txtBIRTHDAY.Value); if(txtHIREDDAY.Value !="" ) valObj.HIREDDAY = Convert.ToDateTime(txtHIREDDAY.Value); if(txtSTREET.Value !="" ) valObj.STREET = Convert.ToString(txtSTREET.Value); if(txtCITY.Value !="" ) valObj.CITY = Convert.ToString(txtCITY.Value); if(txtSTATE.Value !="" ) valObj.STATE = Convert.ToString(txtSTATE.Value); if(txtZIP.Value !="" ) valObj.ZIP = Convert.ToString(txtZIP.Value); if(txtOPHONE.Value !="" ) valObj.OPHONE = Convert.ToString(txtOPHONE.Value); if(txtFPHONE.Value !="" ) valObj.FPHONE = Convert.ToString(txtFPHONE.Value); if(txtVERIFICATIONMETHOD.Value !="" ) valObj.VERIFICATIONMETHOD = Convert.ToInt16(txtVERIFICATIONMETHOD.Value); if(txtDEFAULTDEPTID.Value !="" ) valObj.DEFAULTDEPTID = Convert.ToInt16(txtDEFAULTDEPTID.Value); if(txtSECURITYFLAGS.Value !="" ) valObj.SECURITYFLAGS = Convert.ToInt16(txtSECURITYFLAGS.Value); if(txtATT.Value !="" ) valObj.ATT = Convert.ToInt16(txtATT.Value); if(txtINLATE.Value !="" ) valObj.INLATE = Convert.ToInt16(txtINLATE.Value); if(txtOUTEARLY.Value !="" ) valObj.OUTEARLY = Convert.ToInt16(txtOUTEARLY.Value); if(txtOVERTIME.Value !="" ) valObj.OVERTIME = Convert.ToInt16(txtOVERTIME.Value); if(txtSEP.Value !="" ) valObj.SEP = Convert.ToInt16(txtSEP.Value); if(txtHOLIDAY.Value !="" ) valObj.HOLIDAY = Convert.ToInt16(txtHOLIDAY.Value); if(txtMINZU.Value !="" ) valObj.MINZU = Convert.ToString(txtMINZU.Value); if(txtPASSWORD.Value !="" ) valObj.PASSWORD = Convert.ToString(txtPASSWORD.Value); if(txtLUNCHDURATION.Value !="" ) valObj.LUNCHDURATION = Convert.ToInt16(txtLUNCHDURATION.Value); if(txtMVerifyPass.Value !="" ) valObj.MVerifyPass = Convert.ToString(txtMVerifyPass.Value); if (keyid != "") { valObj.USERID = Convert.ToInt32(keyid); count = BLLTable<HR_CK_USERINFO>.Factory(conn).Update(valObj, HR_CK_USERINFO.Attribute.USERID); } else { count = BLLTable<HR_CK_USERINFO>.Factory(conn).Insert(valObj, HR_CK_USERINFO.Attribute.USERID); keyid = valObj.USERID.ToString(); } if (count > 0) { StringBuilder sbData = new StringBuilder("({valObj:''"); List<AttributeItem> lstCol = valObj.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { object val = valObj.GetValue(lstCol[i]); if (val != null) { sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'"); } } sbData.Append("})"); Button btn = (Button)sender; if (btn.ID == "btnOK") { if (ViewState["hadSave"] == null) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = '" + sbData.ToString() + "';}else{window.returnValue = '" + sbData.ToString() + "';}window.close();", true); } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "if (window.opener){window.opener.returnValue = 're';}else{window.returnValue = 're';}window.close();", true); } } else { txtUSERID.Value =""; wucSelStaff1.Staff_ID = 0; txtBADGENUMBER.Value =""; txtSSN.Value =""; txtNAME.Value =""; txtGENDER.Value =""; txtTITLE.Value =""; txtPAGER.Value =""; txtBIRTHDAY.Value =""; txtHIREDDAY.Value =""; txtSTREET.Value =""; txtCITY.Value =""; txtSTATE.Value =""; txtZIP.Value =""; txtOPHONE.Value =""; txtFPHONE.Value =""; txtVERIFICATIONMETHOD.Value =""; txtDEFAULTDEPTID.Value =""; txtSECURITYFLAGS.Value =""; txtATT.Value =""; txtINLATE.Value =""; txtOUTEARLY.Value =""; txtOVERTIME.Value =""; txtSEP.Value =""; txtHOLIDAY.Value =""; txtMINZU.Value =""; txtPASSWORD.Value =""; txtLUNCHDURATION.Value =""; txtMVerifyPass.Value =""; txtPHOTO.Value =""; } } } catch (Exception ex) { litWarn.Text = ex.Message; } }
private void UpdateStff(OleDbConnection conn2, string fangan) { if (conn2 == null) return; Dictionary<string, string> userFields = GetFieldsByFangAn(fangan, "USERINFO"); if (!userFields.ContainsKey("*USERINFO")) { Response.Write("同步方案不完整,请修改方案!"); Response.End(); return; } string sql = "select "; foreach (string field in userFields.Keys) { if (field.Contains("*")) continue; sql += " " + userFields[field] + ","; } sql = sql.TrimEnd(','); sql += " from " + userFields["*USERINFO"]; OleDbCommand com = new OleDbCommand(sql, conn2); OleDbDataReader dr = com.ExecuteReader(); HR_CK_USERINFO hruser = new HR_CK_USERINFO(); List<HR_CK_USERINFO> hrusers = new List<HR_CK_USERINFO>(); Dictionary<string, HR_CK_USERINFO> userDic = new Dictionary<string, HR_CK_USERINFO>(); List<HR_CK_USERINFO> chongfuUser = new List<HR_CK_USERINFO>(); while (dr.Read()) { try { hruser = new HR_CK_USERINFO(); foreach (AttributeItem ai in hruser.af_AttributeItemList) { if (userFields.ContainsKey("USERINFO_" + ai.FieldName)) { object val = dr[userFields["USERINFO_" + ai.FieldName]]; if (val != null && !string.IsNullOrEmpty(val.ToString())) hruser.SetValue(ai, val.ToString().Replace("?粀", "").Replace("\0", "").Replace("?", "").Replace("粀", "")); } } hruser.Remove(new AttributeItem[] { HR_CK_USERINFO.Attribute.STAFF_ID }); if (!userDic.ContainsKey(hruser.NAME)) userDic.Add(hruser.NAME, hruser); else chongfuUser.Add(hruser); hrusers.Add(hruser); } catch { } } foreach (HR_CK_USERINFO user in chongfuUser) { if (userDic.ContainsKey(user.NAME)) userDic.Remove(hruser.NAME); } HR_STAFF stfVal = new HR_STAFF(); stfVal.STAFF_NAME = ""; stfVal.STAFF_ID = 0; HR_STAFF stfCon = new HR_STAFF(); List<HR_STAFF> stfList = BLLTable<HR_STAFF>.Factory(conn).Select(stfVal, stfCon); Dictionary<string, HR_STAFF> stfDic = new Dictionary<string, HR_STAFF>(); List<HR_STAFF> chongfuStf = new List<HR_STAFF>(); foreach (HR_STAFF stf in stfList) { if (!stfDic.ContainsKey(stf.STAFF_NAME)) stfDic.Add(stf.STAFF_NAME, stf); else chongfuStf.Add(stf); } foreach (HR_STAFF stf in chongfuStf) { if (stfDic.ContainsKey(stf.STAFF_NAME)) stfDic.Remove(stf.STAFF_NAME); } foreach (string name in userDic.Keys) { if (stfDic.ContainsKey(name)) { HR_CK_USERINFO stfidcon = new HR_CK_USERINFO();//wcp考虑优化新能 stfidcon.STAFF_ID = stfDic[name].STAFF_ID; if (!BLLTable<HR_CK_USERINFO>.Exists(stfidcon)) userDic[name].STAFF_ID = stfDic[name].STAFF_ID; } } int countok = 0; int countfi = 0; int counter = 0; foreach (HR_CK_USERINFO user in hrusers) { try { int count = 0; count = BLLTable<HR_CK_USERINFO>.SaveOrUpdate(user, HR_CK_USERINFO.Attribute.USERID); if (count > 0) countok++; else countfi++; } catch { counter++; } } Response.Write("同步员工信息数:" + hrusers.Count + "条" + "\n成功:" + countok + "条\n失败:" + countfi + "条\n出错:" + counter + "条"); }
protected void btnFind_Click(object sender, EventArgs e) { try { condObj = new HR_CK_USERINFO(); if (txtUSERID.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.USERID, Convert.ToInt32(txtUSERID.Value)); } if (txtSTAFF_ID.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.STAFF_ID, Convert.ToDecimal(txtSTAFF_ID.Value)); } if (txtBADGENUMBER.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.BADGENUMBER, Convert.ToString(txtBADGENUMBER.Value)); } if (txtSSN.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.SSN, Convert.ToString(txtSSN.Value)); } if (txtNAME.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.NAME, Convert.ToString(txtNAME.Value)); } if (txtGENDER.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.GENDER, Convert.ToString(txtGENDER.Value)); } if (txtTITLE.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.TITLE, Convert.ToString(txtTITLE.Value)); } if (txtPAGER.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.PAGER, Convert.ToString(txtPAGER.Value)); } if (txtBIRTHDAY.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.BIRTHDAY, Convert.ToDateTime(txtBIRTHDAY.Value)); } if (txtHIREDDAY.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.HIREDDAY, Convert.ToDateTime(txtHIREDDAY.Value)); } if (txtSTREET.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.STREET, Convert.ToString(txtSTREET.Value)); } if (txtCITY.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.CITY, Convert.ToString(txtCITY.Value)); } if (txtSTATE.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.STATE, Convert.ToString(txtSTATE.Value)); } if (txtZIP.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.ZIP, Convert.ToString(txtZIP.Value)); } if (txtOPHONE.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.OPHONE, Convert.ToString(txtOPHONE.Value)); } if (txtFPHONE.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.FPHONE, Convert.ToString(txtFPHONE.Value)); } if (txtVERIFICATIONMETHOD.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.VERIFICATIONMETHOD, Convert.ToInt16(txtVERIFICATIONMETHOD.Value)); } if (txtDEFAULTDEPTID.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.DEFAULTDEPTID, Convert.ToInt16(txtDEFAULTDEPTID.Value)); } if (txtSECURITYFLAGS.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.SECURITYFLAGS, Convert.ToInt16(txtSECURITYFLAGS.Value)); } if (txtATT.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.ATT, Convert.ToInt16(txtATT.Value)); } if (txtINLATE.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.INLATE, Convert.ToInt16(txtINLATE.Value)); } if (txtOUTEARLY.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.OUTEARLY, Convert.ToInt16(txtOUTEARLY.Value)); } if (txtOVERTIME.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.OVERTIME, Convert.ToInt16(txtOVERTIME.Value)); } if (txtSEP.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.SEP, Convert.ToInt16(txtSEP.Value)); } if (txtHOLIDAY.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.HOLIDAY, Convert.ToInt16(txtHOLIDAY.Value)); } if (txtMINZU.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.MINZU, Convert.ToString(txtMINZU.Value)); } if (txtPASSWORD.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.PASSWORD, Convert.ToString(txtPASSWORD.Value)); } if (txtLUNCHDURATION.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.LUNCHDURATION, Convert.ToInt16(txtLUNCHDURATION.Value)); } if (txtMVerifyPass.Value != "") { condObj.Like(HR_CK_USERINFO.Attribute.MVerifyPass, Convert.ToString(txtMVerifyPass.Value)); } listObj = BLLTable <HR_CK_USERINFO> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repCus.DataSource = listObj; repCus.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } aspPager.RecordCount = recount; }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "详细"; Page.Title = title; if (!IsPostBack) { try { if (!string.IsNullOrEmpty(Request["USERID"])) { valObj = BLLTable <HR_CK_USERINFO> .Factory(conn).GetRowData(HR_CK_USERINFO.Attribute.USERID, Request["USERID"]); if (valObj == null) { return; } txtUSERID.Text = Convert.ToString(valObj.USERID);//Convert.ToInt32 txtSTAFF_ID.Text = Convert.ToString(valObj.STAFF_ID);//Convert.ToDecimal txtBADGENUMBER.Text = Convert.ToString(valObj.BADGENUMBER);//Convert.ToString txtSSN.Text = Convert.ToString(valObj.SSN);//Convert.ToString txtNAME.Text = Convert.ToString(valObj.NAME);//Convert.ToString txtGENDER.Text = Convert.ToString(valObj.GENDER);//Convert.ToString txtTITLE.Text = Convert.ToString(valObj.TITLE);//Convert.ToString txtPAGER.Text = Convert.ToString(valObj.PAGER);//Convert.ToString txtBIRTHDAY.Text = (valObj.BIRTHDAY == DateTime.MinValue) ? "" : valObj.BIRTHDAY.ToString("yyyy-MM-dd HH:mm"); txtHIREDDAY.Text = (valObj.HIREDDAY == DateTime.MinValue) ? "" : valObj.HIREDDAY.ToString("yyyy-MM-dd HH:mm"); txtSTREET.Text = Convert.ToString(valObj.STREET);//Convert.ToString txtCITY.Text = Convert.ToString(valObj.CITY);//Convert.ToString txtSTATE.Text = Convert.ToString(valObj.STATE);//Convert.ToString txtZIP.Text = Convert.ToString(valObj.ZIP);//Convert.ToString txtOPHONE.Text = Convert.ToString(valObj.OPHONE);//Convert.ToString txtFPHONE.Text = Convert.ToString(valObj.FPHONE);//Convert.ToString txtVERIFICATIONMETHOD.Text = Convert.ToString(valObj.VERIFICATIONMETHOD);//Convert.ToInt16 txtDEFAULTDEPTID.Text = Convert.ToString(valObj.DEFAULTDEPTID);//Convert.ToInt16 txtSECURITYFLAGS.Text = Convert.ToString(valObj.SECURITYFLAGS);//Convert.ToInt16 txtATT.Text = Convert.ToString(valObj.ATT);//Convert.ToInt16 txtINLATE.Text = Convert.ToString(valObj.INLATE);//Convert.ToInt16 txtOUTEARLY.Text = Convert.ToString(valObj.OUTEARLY);//Convert.ToInt16 txtOVERTIME.Text = Convert.ToString(valObj.OVERTIME);//Convert.ToInt16 txtSEP.Text = Convert.ToString(valObj.SEP);//Convert.ToInt16 txtHOLIDAY.Text = Convert.ToString(valObj.HOLIDAY);//Convert.ToInt16 txtMINZU.Text = Convert.ToString(valObj.MINZU);//Convert.ToString txtPASSWORD.Text = Convert.ToString(valObj.PASSWORD);//Convert.ToString txtLUNCHDURATION.Text = Convert.ToString(valObj.LUNCHDURATION);//Convert.ToInt16 txtMVerifyPass.Text = Convert.ToString(valObj.MVerifyPass);//Convert.ToString txtPHOTO.Text = Convert.ToString(valObj.PHOTO);//Convert.ToBase64CharArray } } catch (Exception ex) { litWarn.Text = ex.Message; } if (Request["ajax"] != null) { Response.Clear(); Response.Buffer = true; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");//设置输出流为简体中文 //Response.ContentType = "html/text"; this.EnableViewState = false; System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true); System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); divC.RenderControl(oHtmlTextWriter); Response.Write(oStringWriter.ToString()); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { string doType = Request["dotype"]; string userid = Server.UrlDecode(Request["userid"]); if (string.IsNullOrEmpty(doType) || string.IsNullOrEmpty(userid)) { Response.Write("user id is null"); Response.End(); return; } if (doType == "doUpdateCKUSERINFOStff") { try { string stfid = Server.UrlDecode(Request["stfid"]); HR_CK_USERINFO user = new HR_CK_USERINFO(); user._USERID = Convert.ToInt32(userid); if (!string.IsNullOrEmpty(stfid) && stfid != "-") { HR_CK_USERINFO userCon = new HR_CK_USERINFO(); userCon.STAFF_ID = Convert.ToInt32(stfid); if (BLLTable <HR_CK_USERINFO> .Exists(userCon)) { Response.Write("该员工已有对应关系!"); } else { user.STAFF_ID = Convert.ToInt32(stfid); if (BLLTable <HR_CK_USERINFO> .Factory(conn).Update(user, HR_CK_USERINFO.Attribute.USERID) > 0) { Response.Write("操作成功"); } else { Response.Write("操作失败"); } } } else { user.STAFF_ID = 0; if (BLLTable <HR_CK_USERINFO> .Factory(conn).Update(user, HR_CK_USERINFO.Attribute.USERID) > 0) { Response.Write("操作成功"); } else { Response.Write("操作失败"); } } } catch (Exception ex) { Response.Write("操作失败!\r\n原因如下:\r\n----------\r\n" + ex.Message); Response.End(); } Response.End(); } else { Response.Write("不支持的操作!"); Response.End(); return; } Response.End(); }
private DataTable CreatDefaultFangAnTable(string fangan) { DataTable tab = new DataTable(fangan); tab.Columns.Add("*USERINFO"); tab.Columns.Add("*CHECKINOUT"); HR_CK_USERINFO hruser = new HR_CK_USERINFO(); foreach (AttributeItem ai in hruser.af_AttributeItemList) { if (ai.FieldName == "ID" || ai.FieldName == "PHOTO") { continue; } tab.Columns.Add("USERINFO_" + ai.FieldName); } HR_CHECKINOUT hrcheck = new HR_CHECKINOUT(); foreach (AttributeItem ai in hrcheck.af_AttributeItemList) { if (ai.FieldName == "ID" || ai.FieldName == "PHOTO") { continue; } tab.Columns.Add("CHECKINOUT_" + ai.FieldName); } DataRow dr = tab.NewRow(); dr["*USERINFO"] = "USERINFO"; dr["*CHECKINOUT"] = "CHECKINOUT"; foreach (AttributeItem ai in hruser.af_AttributeItemList) { if (ai.FieldName == "ID" || ai.FieldName == "PHOTO") { continue; } if (ai.FieldName == "STAFF_ID") { dr["USERINFO_" + ai.FieldName] = "USERID"; } else { dr["USERINFO_" + ai.FieldName] = ai.FieldName; } } foreach (AttributeItem ai in hrcheck.af_AttributeItemList) { if (ai.FieldName == "ID" || ai.FieldName == "PHOTO") { continue; } if (ai.FieldName == "STAFF_ID") { dr["CHECKINOUT_" + ai.FieldName] = "USERID"; } else { dr["CHECKINOUT_" + ai.FieldName] = ai.FieldName; } } tab.Rows.Add(dr); return(tab); }
private void BindList(HR_CK_USERINFO condObj, int curPage) { if (condObj.af_PageByAttributeItem == null)//����������û�����ķ�ҳ�������ԣ����������������� condObj.af_PageBy(HR_CK_USERINFO.Attribute.USERID, Order.Asc); #region//����Ȩ������ #endregion //condObj.PID = decimal.Parse(pid); HR_STAFF otherVal = new HR_STAFF(); otherVal.STAFF_NAME = ""; Relation r2 = new Relation(HR_STAFF.Attribute.STAFF_ID, HR_CK_USERINFO.Attribute.STAFF_ID, RelationType.RightJoin); if (!string.IsNullOrEmpty(txtSTAFF_NAME.Value) || !string.IsNullOrEmpty(txtSTAFF_NO.Value)) { HR_STAFF otherCon = new HR_STAFF(); if (!string.IsNullOrEmpty(txtSTAFF_NAME.Value)) otherCon.Like(HR_STAFF.Attribute.STAFF_NAME, txtSTAFF_NAME.Value); if (!string.IsNullOrEmpty(txtSTAFF_NO.Value)) otherCon.Like(HR_STAFF.Attribute.STAFF_NO, txtSTAFF_NO.Value); listObj = BLLTable<HR_CK_USERINFO>.Factory(conn).SelectByPage(valObj, new List<Relation>(new Relation[] { r2 }), new List<ITableImplement>(new ITableImplement[] { otherVal }), new List<ITableImplement>(new ITableImplement[] { condObj, otherCon }), aspPager.PageSize, curPage, ref recount); } else listObj = BLLTable<HR_CK_USERINFO>.Factory(conn).SelectByPage(valObj, r2, otherVal, condObj, aspPager.PageSize, curPage, ref recount); repList.DataSource = listObj; repList.DataBind(); aspPager.RecordCount = recount; }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "��ϸ"; Page.Title = title; if (!IsPostBack) { try { if (!string.IsNullOrEmpty(Request["USERID"])) { valObj = BLLTable<HR_CK_USERINFO>.Factory(conn).GetRowData(HR_CK_USERINFO.Attribute.USERID, Request["USERID"]); if(valObj==null) return ; txtUSERID.Text = Convert.ToString(valObj.USERID);//Convert.ToInt32 txtSTAFF_ID.Text = Convert.ToString(valObj.STAFF_ID);//Convert.ToDecimal txtBADGENUMBER.Text = Convert.ToString(valObj.BADGENUMBER);//Convert.ToString txtSSN.Text = Convert.ToString(valObj.SSN);//Convert.ToString txtNAME.Text = Convert.ToString(valObj.NAME);//Convert.ToString txtGENDER.Text = Convert.ToString(valObj.GENDER);//Convert.ToString txtTITLE.Text = Convert.ToString(valObj.TITLE);//Convert.ToString txtPAGER.Text = Convert.ToString(valObj.PAGER);//Convert.ToString txtBIRTHDAY.Text = (valObj.BIRTHDAY == DateTime.MinValue) ? "" : valObj.BIRTHDAY.ToString("yyyy-MM-dd HH:mm"); txtHIREDDAY.Text = (valObj.HIREDDAY == DateTime.MinValue) ? "" : valObj.HIREDDAY.ToString("yyyy-MM-dd HH:mm"); txtSTREET.Text = Convert.ToString(valObj.STREET);//Convert.ToString txtCITY.Text = Convert.ToString(valObj.CITY);//Convert.ToString txtSTATE.Text = Convert.ToString(valObj.STATE);//Convert.ToString txtZIP.Text = Convert.ToString(valObj.ZIP);//Convert.ToString txtOPHONE.Text = Convert.ToString(valObj.OPHONE);//Convert.ToString txtFPHONE.Text = Convert.ToString(valObj.FPHONE);//Convert.ToString txtVERIFICATIONMETHOD.Text = Convert.ToString(valObj.VERIFICATIONMETHOD);//Convert.ToInt16 txtDEFAULTDEPTID.Text = Convert.ToString(valObj.DEFAULTDEPTID);//Convert.ToInt16 txtSECURITYFLAGS.Text = Convert.ToString(valObj.SECURITYFLAGS);//Convert.ToInt16 txtATT.Text = Convert.ToString(valObj.ATT);//Convert.ToInt16 txtINLATE.Text = Convert.ToString(valObj.INLATE);//Convert.ToInt16 txtOUTEARLY.Text = Convert.ToString(valObj.OUTEARLY);//Convert.ToInt16 txtOVERTIME.Text = Convert.ToString(valObj.OVERTIME);//Convert.ToInt16 txtSEP.Text = Convert.ToString(valObj.SEP);//Convert.ToInt16 txtHOLIDAY.Text = Convert.ToString(valObj.HOLIDAY);//Convert.ToInt16 txtMINZU.Text = Convert.ToString(valObj.MINZU);//Convert.ToString txtPASSWORD.Text = Convert.ToString(valObj.PASSWORD);//Convert.ToString txtLUNCHDURATION.Text = Convert.ToString(valObj.LUNCHDURATION);//Convert.ToInt16 txtMVerifyPass.Text = Convert.ToString(valObj.MVerifyPass);//Convert.ToString txtPHOTO.Text = Convert.ToString(valObj.PHOTO);//Convert.ToBase64CharArray } } catch (Exception ex) { litWarn.Text = ex.Message; } if (Request["ajax"] != null) { Response.Clear(); Response.Buffer = true; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");//���������Ϊ�������� //Response.ContentType = "html/text"; this.EnableViewState = false; System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true); System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); divC.RenderControl(oHtmlTextWriter); Response.Write(oStringWriter.ToString()); Response.End(); } } }