protected void btnFind_Click(object sender, EventArgs e) { try { condObj = new HR_STAFF(); condObj.PID = decimal.Parse(pid); if (txtSNAME.Value != "") condObj.Like(HR_STAFF.Attribute.SNAME, Convert.ToDecimal(txtSNAME.Value)); if (txtRNAME.Value != "") condObj.Like(HR_STAFF.Attribute.RNAME, Convert.ToDecimal(txtRNAME.Value)); if(txtSTAFF_NO.Value !="" ) condObj.Like(HR_STAFF.Attribute.STAFF_NO, Convert.ToString(txtSTAFF_NO.Value)); if(txtNAME.Value !="" ) condObj.Like(HR_STAFF.Attribute.STAFF_NAME, Convert.ToString(txtNAME.Value)); if(txtDEPT_ID.Value !="" ) condObj.Like(HR_STAFF.Attribute.DEPT_ID, Convert.ToString(txtDEPT_ID.Value)); if(txtGENDER.Value !="" ) condObj.GENDER = Convert.ToString(txtGENDER.Value); if(txtSTATION_CODE.Value !="" ) condObj.Like(HR_STAFF.Attribute.STATION_CODE, Convert.ToString(txtSTATION_CODE.Value)); if(txtMOBILE.Value !="" ) condObj.Like(HR_STAFF.Attribute.MOBILE, Convert.ToString(txtMOBILE.Value)); if(txtOFFICE_TEL.Value !="" ) condObj.Like(HR_STAFF.Attribute.OFFICE_TEL, Convert.ToString(txtOFFICE_TEL.Value)); if(txtON_POS_FLAG.Value !="" ) condObj.Like(HR_STAFF.Attribute.ON_POS_FLAG, Convert.ToString(txtON_POS_FLAG.Value)); if(txtTITLE_CODE.Value !="" ) condObj.Like(HR_STAFF.Attribute.TITLE_CODE, Convert.ToString(txtTITLE_CODE.Value)); if(txtEMAIL.Value !="" ) condObj.Like(HR_STAFF.Attribute.EMAIL, Convert.ToString(txtEMAIL.Value)); listObj = BLLTable<HR_STAFF>.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; }
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) { string wran = ""; litWarn.Visible = false; //值班类型设置 string wdTypeHtml = tbyWorkDayType.InnerHtml; string[] wdTypeStrs = wdTypeHtml.ToLower().Contains("<tr>") ? wdTypeHtml.ToLower().Substring(wdTypeHtml.ToLower().IndexOf("<tr>")).Split(new string[] { "<tr>" }, StringSplitOptions.RemoveEmptyEntries) : new string[0]; Dictionary <DateTime, int> dicWdType = new Dictionary <DateTime, int>(); foreach (string wdTStr in wdTypeStrs) { string[] tds = wdTStr.ToLower().Substring(wdTStr.ToLower().IndexOf("<td>")).Split(new string[] { "<td>" }, StringSplitOptions.RemoveEmptyEntries); if (tds.Length < 3) { continue; } DateTime sd = DateTime.MinValue; DateTime ed = DateTime.MinValue; int ty = -1; if (!DateTime.TryParse(tds[0].Remove(tds[0].IndexOf('<'), tds[0].Length - tds[0].IndexOf('<')), out sd) || !DateTime.TryParse(tds[1].Remove(tds[1].IndexOf('<'), tds[1].Length - tds[1].IndexOf('<')), out ed) || !int.TryParse(tds[2].Remove(tds[2].IndexOf('<'), tds[2].Length - tds[2].IndexOf('<')), out ty)) { continue; } sd = sd.Date; ed = ed.Date; while (sd <= ed) { if (!dicWdType.ContainsKey(sd)) { dicWdType.Add(sd, ty); } else { dicWdType[sd] = ty; } sd = sd.AddDays(1); } } //休息日设置 string[] weekStr = txtXiuXi.Value.Split(new char[] { ',', ',', ' ', ' ' }, StringSplitOptions.RemoveEmptyEntries); //是否 周一到周7之间 bool isAllRight = true; int[] week = new int[weekStr.Length]; for (int i = 0; i < weekStr.Length; i++) { if (!int.TryParse(weekStr[i].Replace(" ", ""), out week[i])) { isAllRight = false; } else if (week[i] < 1 || week[i] > 7) { isAllRight = false; } } HR_Scheduling_IniProject proj = new HR_Scheduling_IniProject(); proj.WorkDayType = wdTypeHtml; proj.XiuXi = txtXiuXi.Value; proj.ProjectName = txtProjectName.Value; if (chkFuGai.Checked) { proj.FuGaiOrZengBu = 1; } else { proj.FuGaiOrZengBu = 2; } if (isAllRight) { string delschWhere = " 1=1 "; HR_STAFF stfVal = new HR_STAFF(); stfVal.STAFF_ID = 0; HR_STAFF stfCon = new HR_STAFF(); if (!string.IsNullOrEmpty(hidstaffid.Value.Trim())) { stfCon.STAFF_ID = decimal.Parse(hidstaffid.Value); delschWhere += " and HR_STAFF.STAFF_ID = " + stfCon.STAFF_ID; proj.StaffID = stfCon.STAFF_ID.ToString(); } else if (!string.IsNullOrEmpty(hiddeptid.Value.Trim())) { stfCon.Like(HR_STAFF.Attribute.DEPT_ID, hiddeptid.Value); delschWhere += " and HR_STAFF.DEPT_ID like '" + hiddeptid.Value + "%'"; proj.DeptID = stfCon.DEPT_ID; } else if (!string.IsNullOrEmpty(hidorgid.Value.Trim())) { stfCon.Like(HR_STAFF.Attribute.ORG_ID, hidorgid.Value); delschWhere += " and HR_STAFF.ORG_ID like '" + hidorgid.Value + "%'"; proj.OrgID = stfCon.ORG_ID; } else { stfCon.STAFF_ID = userBase.StaffID; delschWhere += " and HR_STAFF.STAFF_ID = " + userBase.StaffID; proj.StaffID = stfCon.STAFF_ID.ToString(); } List <HR_STAFF> stffs = BLLTable <HR_STAFF> .Factory(conn).Select(stfVal, stfCon); //外部传入选中的班次id string[] schidstr = hidSelBanciId.Value.TrimEnd(',').Split(','); proj.SelBanciId = hidSelBanciId.Value; List <int> schids = new List <int>(); for (int i = 0; i < schidstr.Length; i++) { int sid = -1; if (int.TryParse(schidstr[i], out sid)) { schids.Add(sid); } } int stfCount = 0; int stfSch = 0; //开始时间 DateTime sDate = DateTime.Parse(txtStartTime.Value); proj.StartTime = sDate; //结束时间 DateTime eDate = DateTime.Parse(txtEndTime.Value); proj.EndTime = eDate; DateTime dt = sDate; //找出班次 List <HR_Scheduling> schList = new List <HR_Scheduling>(); foreach (HR_STAFF stf in stffs) { stfCount++; dt = sDate; while (dt.Date <= eDate.Date) { foreach (int schid in schids) { HR_Scheduling sch = new HR_Scheduling(); sch._SchYear = dt.Date.Year; sch._SchMonth = Convert.ToInt16(dt.Date.Month); sch._SchDay = Convert.ToInt16(dt.Date.Day); sch._STAFF_ID = Convert.ToInt32(stf.STAFF_ID); sch._SchType = week.Contains(CheckInOutHelper.IndexOfWeekByEnWeek(dt)) ? 3 : 1; if (dicWdType.ContainsKey(dt.Date)) { sch._SchType = dicWdType[dt.Date]; } sch._SchClassid = schid; schList.Add(sch); } dt = dt.AddDays(1); stfSch++; } } int buildCount = 0; int delsCount = 0; if (chkFuGai.Checked) { //HR_Scheduling delCon = new HR_Scheduling(); //delCon.Top(1000); //string wher = " CAST(CAST({0} AS char(4)) + '-' + CAST({1} AS char(2)) + '-' + CAST({2} AS char(2)) as datetime) >= '{3}-{4}-{5}' and CAST(CAST({6} AS char(4)) + '-' + CAST({7} AS char(2)) + '-' + CAST({8} AS char(2)) as datetime) <= '{9}-{10}-{11}' "; //delCon.Where(wher, HR_Scheduling.Attribute.SchYear, HR_Scheduling.Attribute.SchMonth, HR_Scheduling.Attribute.SchDay, // sDate.Year, sDate.Month, sDate.Day, // HR_Scheduling.Attribute.SchYear, HR_Scheduling.Attribute.SchMonth, HR_Scheduling.Attribute.SchDay, // eDate.Year, eDate.Month, eDate.Day); //Relation rt = new Relation(HR_STAFF.Attribute.STAFF_ID, HR_Scheduling.Attribute.STAFF_ID); //rt.AddCondition(stfCon); //while (BLLTable<HR_Scheduling>.Factory(conn).Delete(delCon, rt) > 0) //{ // continue; //} string wher = " delete top(1000) " + " from HR_Scheduling " + " where CAST(CAST({0} AS char(4)) + '-' + CAST({1} AS char(2)) + '-' + CAST({2} AS char(2)) as datetime) >= '{3}-{4}-{5}' and CAST(CAST({6} AS char(4)) + '-' + CAST({7} AS char(2)) + '-' + CAST({8} AS char(2)) as datetime) <= '{9}-{10}-{11}' " + " and HR_Scheduling.staff_id in (select hr_staff.staff_id from hr_staff where " + delschWhere + ")"; wher = string.Format(wher, HR_Scheduling.Attribute.SchYear, HR_Scheduling.Attribute.SchMonth, HR_Scheduling.Attribute.SchDay, sDate.Year, sDate.Month, sDate.Day, HR_Scheduling.Attribute.SchYear, HR_Scheduling.Attribute.SchMonth, HR_Scheduling.Attribute.SchDay, eDate.Year, eDate.Month, eDate.Day); int delCount = BLLTable.ExecSQL(new HR_Scheduling(), wher, CommandType.Text); while (delCount > 0) { delsCount += delCount; delCount = BLLTable.ExecSQL(new HR_Scheduling(), wher, CommandType.Text); continue; } DataTable dataTable = BLLTable <HR_Scheduling> .qDataTable("select * from " + HR_Scheduling.Attribute.SchDay.TableName + " where 1=2"); List <DataRow> dataList = new List <DataRow>(); foreach (HR_Scheduling sch in schList) { DataRow dr = dataTable.NewRow(); foreach (DataColumn dc in dataTable.Columns) { dr[dc] = sch.GetValue(new AttributeItem(HR_Scheduling.Attribute.STAFF_ID.TableName, dc.ColumnName)); } dataList.Add(dr); } try { //将电量数据批量插入数据库 SqlBulkCopy sbc = new SqlBulkCopy(MyConfigurationSettings.GetValue("conn")); sbc.BatchSize = 1000; sbc.BulkCopyTimeout = (((dataList.Count) / 1000) + 1) * 3; sbc.DestinationTableName = HR_Scheduling.Attribute.STAFF_ID.TableName; sbc.WriteToServer(dataList.ToArray()); buildCount += dataList.Count; } catch { } } else { foreach (HR_Scheduling sch in schList) { if (!BLLTable <HR_Scheduling> .Exists(sch)) { buildCount += BLLTable <HR_Scheduling> .Factory(conn).Insert(sch, HR_Scheduling.Attribute.ID); } } } int ret2 = BLLTable <HR_Scheduling_IniProject> .Factory(conn).Insert(proj, HR_Scheduling_IniProject.Attribute.ID); litScript.Text = "<script>alert('生成成功!" + (chkFuGai.Checked ? "覆盖" : "增补") + "生成" + buildCount + "条记录!删除" + delsCount + "条记录,保存" + ret2 + "个配置方案" + "');$('.main').unmask();</script>"; } else { wran = "休息日输入有误!请参考提示输入。"; } if (!string.IsNullOrEmpty(wran)) { litWarn.Text = wran; litWarn.Visible = true; litScript.Text = "<script>alert('" + wran + "');$('.main').unmask();</script>"; } }
protected void btnOK_Click(object sender, EventArgs e) { string wran = ""; litWarn.Visible = false; //值班类型设置 string wdTypeHtml = tbyWorkDayType.InnerHtml; string[] wdTypeStrs = wdTypeHtml.ToLower().Contains("<tr>") ? wdTypeHtml.ToLower().Substring(wdTypeHtml.ToLower().IndexOf("<tr>")).Split(new string[] { "<tr>" }, StringSplitOptions.RemoveEmptyEntries) : new string[0]; Dictionary<DateTime, int> dicWdType = new Dictionary<DateTime, int>(); foreach (string wdTStr in wdTypeStrs) { string[] tds = wdTStr.ToLower().Substring(wdTStr.ToLower().IndexOf("<td>")).Split(new string[] { "<td>" }, StringSplitOptions.RemoveEmptyEntries); if (tds.Length < 3) continue; DateTime sd = DateTime.MinValue; DateTime ed = DateTime.MinValue; int ty = -1; if (!DateTime.TryParse(tds[0].Remove(tds[0].IndexOf('<'), tds[0].Length - tds[0].IndexOf('<')), out sd) || !DateTime.TryParse(tds[1].Remove(tds[1].IndexOf('<'), tds[1].Length - tds[1].IndexOf('<')), out ed) || !int.TryParse(tds[2].Remove(tds[2].IndexOf('<'), tds[2].Length - tds[2].IndexOf('<')), out ty)) continue; sd = sd.Date; ed = ed.Date; while (sd <= ed) { if (!dicWdType.ContainsKey(sd)) dicWdType.Add(sd, ty); else dicWdType[sd] = ty; sd = sd.AddDays(1); } } //休息日设置 string[] weekStr = txtXiuXi.Value.Split(new char[] { ',', ',', ' ', ' ' }, StringSplitOptions.RemoveEmptyEntries); //是否 周一到周7之间 bool isAllRight = true; int[] week = new int[weekStr.Length]; for (int i = 0; i < weekStr.Length; i++) { if (!int.TryParse(weekStr[i].Replace(" ", ""), out week[i])) isAllRight = false; else if (week[i] < 1 || week[i] > 7) isAllRight = false; } HR_Scheduling_IniProject proj = new HR_Scheduling_IniProject(); proj.WorkDayType = wdTypeHtml; proj.XiuXi = txtXiuXi.Value; proj.ProjectName = txtProjectName.Value; if (chkFuGai.Checked) proj.FuGaiOrZengBu = 1; else proj.FuGaiOrZengBu = 2; if (isAllRight) { string delschWhere = " 1=1 "; HR_STAFF stfVal = new HR_STAFF(); stfVal.STAFF_ID = 0; HR_STAFF stfCon = new HR_STAFF(); if (!string.IsNullOrEmpty(hidstaffid.Value.Trim())) { stfCon.STAFF_ID = decimal.Parse(hidstaffid.Value); delschWhere += " and HR_STAFF.STAFF_ID = " + stfCon.STAFF_ID; proj.StaffID = stfCon.STAFF_ID.ToString(); } else if (!string.IsNullOrEmpty(hiddeptid.Value.Trim())) { stfCon.Like(HR_STAFF.Attribute.DEPT_ID, hiddeptid.Value); delschWhere += " and HR_STAFF.DEPT_ID like '" + hiddeptid.Value + "%'"; proj.DeptID = stfCon.DEPT_ID; } else if (!string.IsNullOrEmpty(hidorgid.Value.Trim())) { stfCon.Like(HR_STAFF.Attribute.ORG_ID, hidorgid.Value); delschWhere += " and HR_STAFF.ORG_ID like '" + hidorgid.Value + "%'"; proj.OrgID = stfCon.ORG_ID; } else { stfCon.STAFF_ID = userBase.StaffID; delschWhere += " and HR_STAFF.STAFF_ID = " + userBase.StaffID; proj.StaffID = stfCon.STAFF_ID.ToString(); } List<HR_STAFF> stffs = BLLTable<HR_STAFF>.Factory(conn).Select(stfVal, stfCon); //外部传入选中的班次id string[] schidstr = hidSelBanciId.Value.TrimEnd(',').Split(','); proj.SelBanciId = hidSelBanciId.Value; List<int> schids = new List<int>(); for (int i = 0; i < schidstr.Length; i++) { int sid = -1; if (int.TryParse(schidstr[i], out sid)) schids.Add(sid); } int stfCount = 0; int stfSch = 0; //开始时间 DateTime sDate = DateTime.Parse(txtStartTime.Value); proj.StartTime = sDate; //结束时间 DateTime eDate = DateTime.Parse(txtEndTime.Value); proj.EndTime = eDate; DateTime dt = sDate; //找出班次 List<HR_Scheduling> schList = new List<HR_Scheduling>(); foreach (HR_STAFF stf in stffs) { stfCount++; dt = sDate; while (dt.Date <= eDate.Date) { foreach (int schid in schids) { HR_Scheduling sch = new HR_Scheduling(); sch._SchYear = dt.Date.Year; sch._SchMonth = Convert.ToInt16(dt.Date.Month); sch._SchDay = Convert.ToInt16(dt.Date.Day); sch._STAFF_ID = Convert.ToInt32(stf.STAFF_ID); sch._SchType = week.Contains(CheckInOutHelper.IndexOfWeekByEnWeek(dt)) ? 3 : 1; if (dicWdType.ContainsKey(dt.Date)) sch._SchType = dicWdType[dt.Date]; sch._SchClassid = schid; schList.Add(sch); } dt = dt.AddDays(1); stfSch++; } } int buildCount = 0; int delsCount = 0; if (chkFuGai.Checked) { //HR_Scheduling delCon = new HR_Scheduling(); //delCon.Top(1000); //string wher = " CAST(CAST({0} AS char(4)) + '-' + CAST({1} AS char(2)) + '-' + CAST({2} AS char(2)) as datetime) >= '{3}-{4}-{5}' and CAST(CAST({6} AS char(4)) + '-' + CAST({7} AS char(2)) + '-' + CAST({8} AS char(2)) as datetime) <= '{9}-{10}-{11}' "; //delCon.Where(wher, HR_Scheduling.Attribute.SchYear, HR_Scheduling.Attribute.SchMonth, HR_Scheduling.Attribute.SchDay, // sDate.Year, sDate.Month, sDate.Day, // HR_Scheduling.Attribute.SchYear, HR_Scheduling.Attribute.SchMonth, HR_Scheduling.Attribute.SchDay, // eDate.Year, eDate.Month, eDate.Day); //Relation rt = new Relation(HR_STAFF.Attribute.STAFF_ID, HR_Scheduling.Attribute.STAFF_ID); //rt.AddCondition(stfCon); //while (BLLTable<HR_Scheduling>.Factory(conn).Delete(delCon, rt) > 0) //{ // continue; //} string wher = " delete top(1000) " + " from HR_Scheduling " + " where CAST(CAST({0} AS char(4)) + '-' + CAST({1} AS char(2)) + '-' + CAST({2} AS char(2)) as datetime) >= '{3}-{4}-{5}' and CAST(CAST({6} AS char(4)) + '-' + CAST({7} AS char(2)) + '-' + CAST({8} AS char(2)) as datetime) <= '{9}-{10}-{11}' " + " and HR_Scheduling.staff_id in (select hr_staff.staff_id from hr_staff where " + delschWhere + ")"; wher = string.Format(wher, HR_Scheduling.Attribute.SchYear, HR_Scheduling.Attribute.SchMonth, HR_Scheduling.Attribute.SchDay, sDate.Year, sDate.Month, sDate.Day, HR_Scheduling.Attribute.SchYear, HR_Scheduling.Attribute.SchMonth, HR_Scheduling.Attribute.SchDay, eDate.Year, eDate.Month, eDate.Day); int delCount = BLLTable.ExecSQL(new HR_Scheduling(), wher, CommandType.Text); while (delCount > 0) { delsCount += delCount; delCount = BLLTable.ExecSQL(new HR_Scheduling(), wher, CommandType.Text); continue; } DataTable dataTable = BLLTable<HR_Scheduling>.qDataTable("select * from " + HR_Scheduling.Attribute.SchDay.TableName + " where 1=2"); List<DataRow> dataList = new List<DataRow>(); foreach (HR_Scheduling sch in schList) { DataRow dr = dataTable.NewRow(); foreach (DataColumn dc in dataTable.Columns) { dr[dc] = sch.GetValue(new AttributeItem(HR_Scheduling.Attribute.STAFF_ID.TableName, dc.ColumnName)); } dataList.Add(dr); } try { //将电量数据批量插入数据库 SqlBulkCopy sbc = new SqlBulkCopy(MyConfigurationSettings.GetValue("conn")); sbc.BatchSize = 1000; sbc.BulkCopyTimeout = (((dataList.Count) / 1000) + 1) * 3; sbc.DestinationTableName = HR_Scheduling.Attribute.STAFF_ID.TableName; sbc.WriteToServer(dataList.ToArray()); buildCount += dataList.Count; } catch { } } else { foreach (HR_Scheduling sch in schList) { if (!BLLTable<HR_Scheduling>.Exists(sch)) buildCount += BLLTable<HR_Scheduling>.Factory(conn).Insert(sch, HR_Scheduling.Attribute.ID); } } int ret2 = BLLTable<HR_Scheduling_IniProject>.Factory(conn).Insert(proj, HR_Scheduling_IniProject.Attribute.ID); litScript.Text = "<script>alert('生成成功!" + (chkFuGai.Checked ? "覆盖" : "增补") + "生成" + buildCount + "条记录!删除" + delsCount + "条记录,保存" + ret2 + "个配置方案" + "');$('.main').unmask();</script>"; } else { wran = "休息日输入有误!请参考提示输入。"; } if (!string.IsNullOrEmpty(wran)) { litWarn.Text = wran; litWarn.Visible = true; litScript.Text = "<script>alert('" + wran + "');$('.main').unmask();</script>"; } }
protected void btnFind_Click(object sender, EventArgs e) { condObj = new HR_STAFF(); if (txtSTAFF_NO.Value != "") { condObj.Like(HR_STAFF.Attribute.STAFF_NO, Convert.ToString(txtSTAFF_NO.Value)); } if (txtNAME.Value != "") { condObj.Like(HR_STAFF.Attribute.STAFF_NAME, Convert.ToString(txtNAME.Value)); } if (txtDEPT_ID.Value != "") { condObj.Like(HR_STAFF.Attribute.DEPT_ID, Convert.ToString(txtDEPT_ID.Value)); } if (txtGENDER.Value != "") { condObj.GENDER = Convert.ToString(txtGENDER.Value); } if (txtPOS_NAME.Value != "") { condObj.Like(HR_STAFF.Attribute.POS_NAME, Convert.ToString(txtPOS_NAME.Value)); } if (txtSTATION_CODE.Value != "") { condObj.Like(HR_STAFF.Attribute.STATION_CODE, Convert.ToString(txtSTATION_CODE.Value)); } if (txtWORK_TYPE_CODE.Value != "") { condObj.WORK_TYPE_CODE = Convert.ToString(txtWORK_TYPE_CODE.Value); } if (txtTECH_LEVEL_CODE.Value != "") { condObj.Like(HR_STAFF.Attribute.TECH_LEVEL_CODE, Convert.ToString(txtTECH_LEVEL_CODE.Value)); } if (txtMOBILE.Value != "") { condObj.Like(HR_STAFF.Attribute.MOBILE, Convert.ToString(txtMOBILE.Value)); } if (txtOFFICE_TEL.Value != "") { condObj.Like(HR_STAFF.Attribute.OFFICE_TEL, Convert.ToString(txtOFFICE_TEL.Value)); } if (txtCERT_FLAG.Value != "") { condObj.Like(HR_STAFF.Attribute.CERT_FLAG, Convert.ToString(txtCERT_FLAG.Value)); } if (txtON_POS_FLAG.Value != "") { condObj.Like(HR_STAFF.Attribute.ON_POS_FLAG, Convert.ToString(txtON_POS_FLAG.Value)); } if (txtJOIN_DATE.Value != "") { condObj.Like(HR_STAFF.Attribute.JOIN_DATE, Convert.ToString(txtJOIN_DATE.Value)); } if (txtTITLE_CODE.Value != "") { condObj.Like(HR_STAFF.Attribute.TITLE_CODE, Convert.ToString(txtTITLE_CODE.Value)); } if (txtSTATUS_CODE.Value != "") { condObj.Like(HR_STAFF.Attribute.STATUS_CODE, Convert.ToString(txtSTATUS_CODE.Value)); } if (txtDEGREE_CODE.Value != "") { condObj.Like(HR_STAFF.Attribute.DEGREE_CODE, Convert.ToString(txtDEGREE_CODE.Value)); } if (txtMAJOR.Value != "") { condObj.Like(HR_STAFF.Attribute.MAJOR, Convert.ToString(txtMAJOR.Value)); } hidCondition.Value = condObj.ToJson(20); BindList(condObj, 1); }
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 btnFind_Click(object sender, EventArgs e) { try { condObj = new HR_STAFF(); condObj.PID = decimal.Parse(pid); if (txtSNAME.Value != "") { condObj.Like(HR_STAFF.Attribute.SNAME, Convert.ToDecimal(txtSNAME.Value)); } if (txtRNAME.Value != "") { condObj.Like(HR_STAFF.Attribute.RNAME, Convert.ToDecimal(txtRNAME.Value)); } if (txtSTAFF_NO.Value != "") { condObj.Like(HR_STAFF.Attribute.STAFF_NO, Convert.ToString(txtSTAFF_NO.Value)); } if (txtNAME.Value != "") { condObj.Like(HR_STAFF.Attribute.STAFF_NAME, Convert.ToString(txtNAME.Value)); } if (txtDEPT_ID.Value != "") { condObj.Like(HR_STAFF.Attribute.DEPT_ID, Convert.ToString(txtDEPT_ID.Value)); } if (txtGENDER.Value != "") { condObj.GENDER = Convert.ToString(txtGENDER.Value); } if (txtSTATION_CODE.Value != "") { condObj.Like(HR_STAFF.Attribute.STATION_CODE, Convert.ToString(txtSTATION_CODE.Value)); } if (txtMOBILE.Value != "") { condObj.Like(HR_STAFF.Attribute.MOBILE, Convert.ToString(txtMOBILE.Value)); } if (txtOFFICE_TEL.Value != "") { condObj.Like(HR_STAFF.Attribute.OFFICE_TEL, Convert.ToString(txtOFFICE_TEL.Value)); } if (txtON_POS_FLAG.Value != "") { condObj.Like(HR_STAFF.Attribute.ON_POS_FLAG, Convert.ToString(txtON_POS_FLAG.Value)); } if (txtTITLE_CODE.Value != "") { condObj.Like(HR_STAFF.Attribute.TITLE_CODE, Convert.ToString(txtTITLE_CODE.Value)); } if (txtEMAIL.Value != "") { condObj.Like(HR_STAFF.Attribute.EMAIL, Convert.ToString(txtEMAIL.Value)); } listObj = BLLTable <HR_STAFF> .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 btnFind_Click(object sender, EventArgs e) { condObj = new HR_STAFF(); if(txtSTAFF_NO.Value !="" ) condObj.Like(HR_STAFF.Attribute.STAFF_NO, Convert.ToString(txtSTAFF_NO.Value)); if(txtNAME.Value !="" ) condObj.Like(HR_STAFF.Attribute.STAFF_NAME, Convert.ToString(txtNAME.Value)); if(txtDEPT_ID.Value !="" ) condObj.Like(HR_STAFF.Attribute.DEPT_ID, Convert.ToString(txtDEPT_ID.Value)); if(txtGENDER.Value !="" ) condObj.GENDER = Convert.ToString(txtGENDER.Value); if(txtPOS_NAME.Value !="" ) condObj.Like(HR_STAFF.Attribute.POS_NAME, Convert.ToString(txtPOS_NAME.Value)); if(txtSTATION_CODE.Value !="" ) condObj.Like(HR_STAFF.Attribute.STATION_CODE, Convert.ToString(txtSTATION_CODE.Value)); if(txtWORK_TYPE_CODE.Value !="" ) condObj.WORK_TYPE_CODE = Convert.ToString(txtWORK_TYPE_CODE.Value); if(txtTECH_LEVEL_CODE.Value !="" ) condObj.Like(HR_STAFF.Attribute.TECH_LEVEL_CODE, Convert.ToString(txtTECH_LEVEL_CODE.Value)); if(txtMOBILE.Value !="" ) condObj.Like(HR_STAFF.Attribute.MOBILE, Convert.ToString(txtMOBILE.Value)); if(txtOFFICE_TEL.Value !="" ) condObj.Like(HR_STAFF.Attribute.OFFICE_TEL, Convert.ToString(txtOFFICE_TEL.Value)); if(txtCERT_FLAG.Value !="" ) condObj.Like(HR_STAFF.Attribute.CERT_FLAG, Convert.ToString(txtCERT_FLAG.Value)); if(txtON_POS_FLAG.Value !="" ) condObj.Like(HR_STAFF.Attribute.ON_POS_FLAG, Convert.ToString(txtON_POS_FLAG.Value)); if(txtJOIN_DATE.Value !="" ) condObj.Like(HR_STAFF.Attribute.JOIN_DATE, Convert.ToString(txtJOIN_DATE.Value)); if(txtTITLE_CODE.Value !="" ) condObj.Like(HR_STAFF.Attribute.TITLE_CODE, Convert.ToString(txtTITLE_CODE.Value)); if(txtSTATUS_CODE.Value !="" ) condObj.Like(HR_STAFF.Attribute.STATUS_CODE, Convert.ToString(txtSTATUS_CODE.Value)); if(txtDEGREE_CODE.Value !="" ) condObj.Like(HR_STAFF.Attribute.DEGREE_CODE, Convert.ToString(txtDEGREE_CODE.Value)); if(txtMAJOR.Value !="" ) condObj.Like(HR_STAFF.Attribute.MAJOR, Convert.ToString(txtMAJOR.Value)); hidCondition.Value = condObj.ToJson(20); BindList(condObj, 1); }
protected void btnFind_Click(object sender, EventArgs e) { try { condObj = new HR_STAFF(); condObj.PID = decimal.Parse(pid); if (condObj.af_PageByAttributeItem == null)//如果不存在用户定义的分页排序属性,则用主键属性排序 { condObj.af_PageBy(HR_STAFF.Attribute.STAFF_ID, Order.Desc); } if (txtSNAME.Value != "") { condObj.Like(HR_STAFF.Attribute.SNAME, Convert.ToDecimal(txtSNAME.Value)); } if (txtRNAME.Value != "") { condObj.Like(HR_STAFF.Attribute.RNAME, Convert.ToDecimal(txtRNAME.Value)); } if (txtSTAFF_NO.Value != "") { condObj.Like(HR_STAFF.Attribute.STAFF_NO, Convert.ToString(txtSTAFF_NO.Value)); } if (txtNAME.Value != "") { condObj.Like(HR_STAFF.Attribute.STAFF_NAME, Convert.ToString(txtNAME.Value)); } if (txtGENDER.Value != "") { condObj.GENDER = Convert.ToString(txtGENDER.Value); } if (txtSTATION_CODE.Value != "") { condObj.Like(HR_STAFF.Attribute.STATION_CODE, Convert.ToString(txtSTATION_CODE.Value)); } if (txtMOBILE.Value != "") { condObj.Like(HR_STAFF.Attribute.MOBILE, Convert.ToString(txtMOBILE.Value)); } if (txtTITLE_CODE.Value != "") { condObj.Like(HR_STAFF.Attribute.TITLE_CODE, Convert.ToString(txtTITLE_CODE.Value)); } if (txtEMAIL.Value != "") { condObj.Like(HR_STAFF.Attribute.EMAIL, Convert.ToString(txtEMAIL.Value)); } listObj = BLLTable <HR_STAFF> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repList.DataSource = listObj; repList.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } aspPager.RecordCount = recount; }