private void GetOtherOrg(ref int deptCount, ref int staffCount, ref string msg) { deptCount = 0; staffCount = 0; msg = ""; if (string.IsNullOrEmpty(hidCondition.Value)) { return; } string[] deviceIds = hidCondition.Value.Split(','); HR_CHECKWORKDEVICE con = new HR_CHECKWORKDEVICE(); con.In(HR_CHECKWORKDEVICE.Attribute.DeviceID, deviceIds); List <HR_CHECKWORKDEVICE> devList = BLLTable <HR_CHECKWORKDEVICE> .Factory(conn).Select(new HR_CHECKWORKDEVICE(), con); if (devList.Count < 1) { return; } List <DeviceOrg> orgList = new List <DeviceOrg>(); msg += "<div class='maskmsgtool' style='width:500px; height:20px;'><a onclick=\"$('.main').unmask();\">关闭</a></div>"; msg += "<div class='msgtblist' style='width:500px;'>"; msg += "<table style='width:100%;'>"; msg += " <thead>"; msg += " <tr>"; msg += " <td colspan='4' style='width:500px;'>详细信息</td>"; msg += " </tr>"; msg += " <tr>"; msg += " <td style='width:60px;'>设备ID</td>"; msg += " <td style='width:180px;'>设备名</td>"; msg += " <td style='width:160px;'>部门表(新增/总数)</td>"; msg += " <td style='width:160px;'>员工表(新增/总数)</td>"; msg += " </tr>"; msg += " </thead>"; msg += " <tbody>"; foreach (HR_CHECKWORKDEVICE dev in devList) { msg += " <tr>"; msg += " <td class='first''>" + dev.DeviceID + "</td>"; msg += " <td>" + dev.DeviceName + "</td>"; DeviceOrg devOrg = null; GetOtherOrg(dev, ref devOrg); orgList.Add(devOrg); msg += " <td>" + devOrg.deptMsg + "</td>"; msg += " <td>" + devOrg.staffMsg + "</td>"; msg += " </tr>"; } msg += " </tbody>"; RemoveRepeatAndInsertAioByName(orgList, ref deptCount, ref staffCount); msg += " <tbody>"; msg += " <tr style='background:#eee;'>"; msg += " <td colspan='2' style='text-align:right;'>根据部门/员工名称去重后获取记录数:</td>"; msg += " <td>" + staffCount + "</td>"; msg += " <td>" + deptCount + "</td>"; msg += " </tr>"; msg += " </tbody>"; msg += "</table>"; msg += "</div>"; }
protected void Page_Load(object sender, EventArgs e) { //在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录 if (Request["DelDeviceID"] != null) { int re = BLLTable <HR_CHECKWORKDEVICE> .Factory(conn).Delete(HR_CHECKWORKDEVICE.Attribute.DeviceID, Request["DelDeviceID"]); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在列表顶部点击删除按钮,通过AJAX执行这里的后台代码,删除多条记录 if (Request["DelKeyIDS"] != null) { HR_CHECKWORKDEVICE cond = new HR_CHECKWORKDEVICE(); cond.In(HR_CHECKWORKDEVICE.Attribute.DeviceID, Request["DelKeyIDS"]); int re = BLLTable <HR_CHECKWORKDEVICE> .Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在用户详细信息查看编辑页面,点保存时,通过AJAX执行这里的后台代码,实现部门字段的更新 if (Request["saveInfo"] != null) { HR_CHECKWORKDEVICE val = new HR_CHECKWORKDEVICE(); val.DeviceID = 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_CHECKWORKDEVICE> .Factory(conn).Update(val, HR_CHECKWORKDEVICE.Attribute.DeviceID); Response.Write("修改用户信息成功"); } Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //���б�����ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��һ����¼ if (Request["DelDeviceID"] != null) { int re = BLLTable<HR_CHECKWORKDEVICE>.Factory(conn).Delete(HR_CHECKWORKDEVICE.Attribute.DeviceID, Request["DelDeviceID"]); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���б�������ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��������¼ if (Request["DelKeyIDS"] != null) { HR_CHECKWORKDEVICE cond = new HR_CHECKWORKDEVICE(); cond.In(HR_CHECKWORKDEVICE.Attribute.DeviceID, Request["DelKeyIDS"]); int re = BLLTable<HR_CHECKWORKDEVICE>.Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���û���ϸ��Ϣ�鿴�༭ҳ�棬�㱣��ʱ��ͨ��AJAXִ������ĺ�̨���룬ʵ�ֲ����ֶεĸ��� if (Request["saveInfo"] != null) { HR_CHECKWORKDEVICE val = new HR_CHECKWORKDEVICE(); val.DeviceID = 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_CHECKWORKDEVICE>.Factory(conn).Update(val, HR_CHECKWORKDEVICE.Attribute.DeviceID); Response.Write("���û���Ϣ�ɹ�"); } Response.End(); }
private void GetOtherOrg(ref int deptCount, ref int staffCount, ref string msg) { deptCount = 0; staffCount = 0; msg = ""; if (string.IsNullOrEmpty(hidCondition.Value)) return; string[] deviceIds = hidCondition.Value.Split(','); HR_CHECKWORKDEVICE con = new HR_CHECKWORKDEVICE(); con.In(HR_CHECKWORKDEVICE.Attribute.DeviceID, deviceIds); List<HR_CHECKWORKDEVICE> devList = BLLTable<HR_CHECKWORKDEVICE>.Factory(conn).Select(new HR_CHECKWORKDEVICE(), con); if (devList.Count < 1) return; List<DeviceOrg> orgList = new List<DeviceOrg>(); msg += "<div class='maskmsgtool' style='width:500px; height:20px;'><a onclick=\"$('.main').unmask();\">�ر�</a></div>"; msg += "<div class='msgtblist' style='width:500px;'>"; msg += "<table style='width:100%;'>"; msg += " <thead>"; msg += " <tr>"; msg += " <td colspan='4' style='width:500px;'>��ϸ��Ϣ</td>"; msg += " </tr>"; msg += " <tr>"; msg += " <td style='width:60px;'>�豸ID</td>"; msg += " <td style='width:180px;'>�豸��</td>"; msg += " <td style='width:160px;'>���ű�(����/����)</td>"; msg += " <td style='width:160px;'>Ա����(����/����)</td>"; msg += " </tr>"; msg += " </thead>"; msg += " <tbody>"; foreach (HR_CHECKWORKDEVICE dev in devList) { msg += " <tr>"; msg += " <td class='first''>" + dev.DeviceID + "</td>"; msg += " <td>" + dev.DeviceName + "</td>"; DeviceOrg devOrg = null; GetOtherOrg(dev, ref devOrg); orgList.Add(devOrg); msg += " <td>" + devOrg.deptMsg + "</td>"; msg += " <td>" + devOrg.staffMsg + "</td>"; msg += " </tr>"; } msg += " </tbody>"; RemoveRepeatAndInsertAioByName(orgList, ref deptCount, ref staffCount); msg += " <tbody>"; msg += " <tr style='background:#eee;'>"; msg += " <td colspan='2' style='text-align:right;'>���ݲ���/Ա������ȥ�غ��ȡ��¼����</td>"; msg += " <td>" + staffCount + "</td>"; msg += " <td>" + deptCount + "</td>"; msg += " </tr>"; msg += " </tbody>"; msg += "</table>"; msg += "</div>"; }