protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!SessionBox.CheckUserSession()) { Response.Redirect("~/Login.aspx"); } else { SF_Role r = Rolebll.GetRoleModel(decimal.Parse(SessionBox.GetUserSession().CurrentRole[0].ToString().Split(',')[0])); rolelevel = (int)r.LevelID; roledeptid = SessionBox.GetUserSession().DeptNumber; if (rolelevel > 1) { Session["WhereRole"] = string.Format("MAINDEPTID='{0}' or (maindeptid='{1}' and levelid>={2})", SessionBox.GetUserSession().DeptNumber, "000000000", rolelevel.ToString()); Session["WhereUserGroup"] = "usergroupid not in(2,3,23)"; Session["maindeptid"] = SessionBox.GetUserSession().DeptNumber; Session["deptid"] = SessionBox.GetUserSession().DeptNumber.Remove(4); } InitData(); } } }
private void storeload() //执行查询 已改 { UserHandle.InitModule(this.PageTag); //初始化此模块的权限。 var data = from sw in dc.Getsanwei select sw; if (UserHandle.ValidationHandle(PermissionTag.SW_xxcl)) //三违处理权限 { data = data.Where(p => p.Dwid == SessionBox.GetUserSession().DeptNumber); } else if (UserHandle.ValidationHandle(PermissionTag.Browse)) //是否有浏览权限 { data = data.Where(p => p.Pcpersonid == SessionBox.GetUserSession().PersonNumber || p.Swpersonid == SessionBox.GetUserSession().PersonNumber); } if (!df_begin.IsNull) { data = data.Where(p => p.Pctime >= df_begin.SelectedDate); } if (!df_end.IsNull) { data = data.Where(p => p.Pctime <= df_end.SelectedDate); } if (cbb_part.SelectedIndex > -1) { data = data.Where(p => p.Kqid == cbb_part.SelectedItem.Value.Trim()); } if (cbb_lavel.SelectedIndex > -1) { data = data.Where(p => p.Levelid == decimal.Parse(cbb_lavel.SelectedItem.Value.Trim())); } Store1.DataSource = data; Store1.DataBind(); btn_detail.Disabled = true; Button1.Disabled = true; Button2.Disabled = true; }
protected void Page_Load(object sender, EventArgs e) { if (!SessionBox.CheckUserSession()) { Response.Redirect("~/Login.aspx"); } else { List <string> lstRole = new List <string>(); lstRole.Add("2"); lstRole.Add("46"); if (SessionBox.GetUserSession().CurrentRole[0].ToString().Split(',')[0] == "31") { } else if (lstRole.Contains(SessionBox.GetUserSession().CurrentRole[0].ToString().Split(',')[0])) { } else { adsPosition.Where = "Maindeptid == \"" + SessionBox.GetUserSession().DeptNumber + "\""; adsPFSWSet.Where = "Maindeptid == \"" + SessionBox.GetUserSession().DeptNumber + "\""; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Ext.IsAjaxRequest) { #region 初始化单位 MainDeptStore.DataSource = PublicCode.GetMaindept(""); MainDeptStore.DataBind(); if (SessionBox.GetUserSession().rolelevel.Contains("1") || SessionBox.GetUserSession().rolelevel.Contains("0")) { cbbKQ.Disabled = true; cbbPerson.Disabled = true; } else { cbbMianDept.SelectedItem.Value = SessionBox.GetUserSession().DeptNumber; cbbMianDept.Disabled = true; KQStore.DataSource = PublicCode.GetKQdept(SessionBox.GetUserSession().DeptNumber); KQStore.DataBind(); cbbPerson.Disabled = true; } #endregion } }
private void BaseStroeLoad() { var data = from m in dc.VMovefrequency where m.Maindept == SessionBox.GetUserSession().DeptNumber select new { FrequencyID = m.Frequencyid, DeptName = m.Deptname, PlaceName = m.Placename, PosName = m.Posname, Frequency = m.Frequency }; #region 直接linq查询-数据搜索速度慢,先改成上述视图 //var data = from m in dc.Movefrequency // from pos in dc.Position // from pl in dc.Place // from d in dc.Department // where m.Posid == pos.Posid && m.Placeid == pl.Placeid && m.Deptid == d.Deptnumber && m.Maindept==SessionBox.GetUserSession().DeptNumber // select new // { // FrequencyID = m.Frequencyid, // DeptName = d.Deptname, // PlaceName = pl.Placename, // PosName = pos.Posname, // Frequency = m.Frequency // }; #endregion Store1.DataSource = data; Store1.DataBind(); btn_update.Disabled = true; btn_delete.Disabled = true; RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel; sm.SelectedRows.Clear(); sm.UpdateSelection(); }
private void BindData()//基础信息绑定 { if (SessionBox.GetUserSession().rolelevel.Trim().IndexOf("1") > -1) { Store5.DataSource = PublicCode.GetMaindept(""); Store5.DataBind(); cbbDept.SelectedItem.Value = "241700000"; cbbDept.Disabled = false; } else { var dept = from d in db.Department where d.Deptnumber == SessionBox.GetUserSession().DeptNumber select new { d.Deptname, Deptid = d.Deptnumber }; Store5.DataSource = dept; Store5.DataBind(); cbbDept.SelectedItem.Value = SessionBox.GetUserSession().DeptNumber; cbbDept.Disabled = true; } }
protected void BindOrder() { string strWhere = ""; List <string> lstRole = new List <string>(); lstRole.Add("2"); lstRole.Add("46"); if (SessionBox.GetUserSession().CurrentRole[0].ToString().Split(',')[0] == "31") { } else if (lstRole.Contains(SessionBox.GetUserSession().CurrentRole[0].ToString().Split(',')[0])) { } else { strWhere += "Maindeptid == \"" + SessionBox.GetUserSession().DeptNumber + "\"";//&& Placestatus=1"; } if (ddlArea.SelectedValue != "-1") { strWhere += " && Pareasid=" + ddlArea.SelectedValue; } if (ddlLevel.SelectedValue != "-1") { strWhere += " && Plid=" + ddlLevel.SelectedValue; } if (txtPlace.Text != "") { strWhere += string.Format(" && Placename.Contains(\"{0}\")", txtPlace.Text.Trim()); } if (ddlStatus.SelectedValue != "-1") { strWhere += " && Placestatus=" + ddlStatus.SelectedValue; } adsPlace.Where = strWhere; adsPlaceAreas.Where = "Maindeptid == \"" + SessionBox.GetUserSession().DeptNumber + "\""; }
public void AddDept() { if (cbbDept.SelectedIndex == -1) { return; } if (SessionBox.GetUserSession().rolelevel.Contains("1") || SessionBox.GetUserSession().rolelevel.Contains("0")) { var dept = dc.Department.First(p => p.Deptnumber == cbbDept.SelectedItem.Value); if (dept.Visualfield == 3) { Ext.Msg.Alert("提示", "已添加的部门!").Show(); return; } dept.Visualfield = 3; dc.SubmitChanges(); Ext.Msg.Alert("提示", "保存成功!").Show(); Ext.DoScript("refreshTree(#{tpkind});"); } else { Ext.Msg.Alert("提示", "非局端用户,不能进行该项操作!").Show(); } }
protected void SearchBLDblClick(object sender, AjaxEventArgs e) { RowSelectionModel sm = gpSearchBL.SelectionModel.Primary as RowSelectionModel; if (sm.SelectedRows.Count > 0) { //修改多列显示 var yh = from hd in dc.Gethazardusing where hd.HNumber == sm.SelectedRow.RecordID && hd.Deptnumber == SessionBox.GetUserSession().DeptNumber select new { yhNumber = hd.HNumber, yhContent = hd.HBm, hd.Gzrwname, hd.Gxname }; yhStore.DataSource = yh; yhStore.DataBind(); cbbyh.SelectedItem.Value = sm.SelectedRow.RecordID; SearchBLWindow.Hide(); Ext.DoScript("#{cbbyh}.triggers[0].show();"); SelectLoad(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!SessionBox.CheckUserSession()) { Response.Redirect("~/Login.aspx"); } else { UserHandle.InitModule(this.PageTag); //初始化此模块的权限。 if (UserHandle.ValidationHandle(PermissionTag.Browse)) //是否有浏览权限 { txtSender.Text = "调度所"; GetPersonList(); } else { Session["ErrorNum"] = "0"; Response.Redirect("~/Error.aspx"); } } } }
//绑定待复查隐患 private void bindYH() { //绑定隐患录入信息 var query = from yh in dc.Nyhinput from yu in dc.Getyhandhazusing from d in dc.Department from pl in dc.Place from p in dc.Person where yh.Yhid == yu.Yhid && yh.Deptid == d.Deptnumber && yh.Placeid == pl.Placeid && yu.Deptnumber == SessionBox.GetUserSession().DeptNumber && yh.Status == "隐患已整改" && yh.Placeid == int.Parse(cbbplace.SelectedItem.Value.Trim()) && yh.Personid == p.Personnumber orderby yh.Intime descending select new { YHPutinID = yh.Yhputinid, DeptName = d.Deptname, PlaceName = pl.Placename, YHContent = yu.Yhcontent, Remarks = yh.Remarks, BanCi = yh.Banci, PCTime = yh.Pctime, YHType = yu.Typename, Status = yh.Status, YHLevel = yu.Levelname, INTime = yh.Intime, Name = p.Name }; Store6.DataSource = query; Store6.DataBind(); }
public void AddClick(string action) { if (cbbBc.SelectedIndex == -1 || cbbDept.SelectedIndex == -1 || cbbplace.SelectedIndex == -1 || cbbyh.SelectedIndex == -1 || dfPCtime.SelectedValue == null || cbbPerson.SelectedIndex == -1)//hdnPerson.Value.ToString().Trim()=="") { Ext.Msg.Alert("提示", "请填写完整信息!").Show(); return; } string[] pergroup = cbbPerson.SelectedItem.Value.Trim().Split(',');//hdnPerson.Value.ToString().Split(',');//排查人数组 if (action == "new") { //获取各班次截止时间 string time = "00:00:00"; switch (cbbBc.SelectedItem.Value.Trim()) { case "早班": time = PublicMethod.ReadXmlReturnNode("ZBSJ", this); break; case "中班": time = PublicMethod.ReadXmlReturnNode("ZHBSJ", this); break; case "夜班": time = PublicMethod.ReadXmlReturnNode("WBSJ", this); break; } //可录入时间为当班时间+4小时 DateTime btime = DateTime.Parse(System.DateTime.Today.ToString("yyyy-MM-dd") + " " + time).AddHours(-10); //起始时间 DateTime etime = DateTime.Parse(System.DateTime.Today.ToString("yyyy-MM-dd") + " " + time).AddHours(2); //截止时间 if (btime.Day < System.DateTime.Today.Day) { btime = btime.AddDays(1); } if (etime.Day > System.DateTime.Today.Day) { etime = etime.AddDays(-1); } if (etime > btime) { if (System.DateTime.Now < btime || System.DateTime.Now > etime) { Ext.Msg.Alert("提示", "不在当日" + cbbBc.SelectedItem.Value.Trim() + "隐患提交时间!").Show(); return; } } else { if (System.DateTime.Now < btime && System.DateTime.Now > etime) { Ext.Msg.Alert("提示", "不在当日" + cbbBc.SelectedItem.Value.Trim() + "隐患提交时间!").Show(); return; } } try { var yho = dc.Nyhinput.Where( p => p.Yhid == decimal.Parse(cbbyh.SelectedItem.Value.Trim()) && p.Deptid == cbbDept.SelectedItem.Value.Trim() && p.Placeid == int.Parse(cbbplace.SelectedItem.Value.Trim()) && new string[] { "新增", "提交审批", "隐患未整改", "逾期未整改" }.Contains(p.Status)); if (yho.Count() > 0) { AddYhMorePerson(yho.First().Yhputinid, pergroup); GhtnTech.SecurityFramework.BLL.LogManager.WriteLog(SessionBox.GetUserSession().PersonNumber, SessionBox.GetUserSession().LoginName, "", DateTime.Now, GhtnTech.SecurityFramework.BLL.ActiveType.录入隐患, yho.First().Yhputinid.ToString(), ""); Ext.Msg.Alert("提示", "执行隐患合并操作!并入隐患编号为:" + yho.First().Yhputinid).Show(); //+ ";合并明细:<br>"+).Show(); } else { //现场整改隐患处理:同班下同一人判断为重复录入,多人或其他人录入并入隐患 var yho_s = dc.Nyhinput.Where( p => p.Yhid == decimal.Parse(cbbyh.SelectedItem.Value.Trim()) && p.Deptid == cbbDept.SelectedItem.Value.Trim() && p.Placeid == int.Parse(cbbplace.SelectedItem.Value.Trim()) && p.Status == "现场整改" && p.Banci == cbbBc.SelectedItem.Value.Trim() && p.Pctime == Convert.ToDateTime(dfPCtime.Value)); if (yho_s.Count() > 0) { if (pergroup.Length == 1 && pergroup[0] == yho_s.First().Personid) { Ext.Msg.Alert("提示", "不能重复录入隐患信息!").Show(); return; } else { AddYhMorePerson(yho.First().Yhputinid, pergroup); GhtnTech.SecurityFramework.BLL.LogManager.WriteLog(SessionBox.GetUserSession().PersonNumber, SessionBox.GetUserSession().LoginName, "", DateTime.Now, GhtnTech.SecurityFramework.BLL.ActiveType.录入隐患, yho.First().Yhputinid.ToString(), ""); Ext.Msg.Alert("提示", "执行隐患合并操作!并入隐患编号为:" + yho.First().Yhputinid).Show();// + ";合并明细:<br>" + ).Show(); Ext.DoScript("#{YHputinStore}.reload();"); return; } } var lel = dc.Getyhandhazusing.Where(p => p.Yhid == decimal.Parse(cbbyh.SelectedItem.Value.Trim()) && p.Deptnumber == SessionBox.GetUserSession().DeptNumber); Nyhinput yh = new Nyhinput(); yh.Banci = cbbBc.SelectedItem.Value.Trim(); yh.Deptid = cbbDept.SelectedItem.Value.Trim(); yh.Inputpersonid = SessionBox.GetUserSession().PersonNumber; //cbbPerson.SelectedItem.Value.Trim(); DateTime dt = System.DateTime.Now; //当前时间 插入多人用 yh.Personid = pergroup[0]; //cbbPerson.SelectedItem.Value.Trim(); yh.Intime = dt; yh.Pctime = Convert.ToDateTime(dfPCtime.Value); yh.Placeid = int.Parse(cbbplace.SelectedItem.Value.Trim()); yh.Remarks = TextArea1.Text.Trim(); yh.Status = cbbStatus.SelectedItem.Value.Trim(); yh.Yhid = decimal.Parse(cbbyh.SelectedItem.Value.Trim()); yh.Maindeptid = SessionBox.GetUserSession().DeptNumber; yh.Jctype = cbbJctype.SelectedIndex; if (lel.Count() > 0) { yh.Levelid = lel.First().Levelid; } //修正状态为null的问题 if (string.IsNullOrEmpty(yh.Status)) { yh.Status = "现场整改"; } dc.Nyhinput.Insert(yh); dc.SubmitChanges(); //if (cbbStatus.SelectedItem.Value.Trim() == "现场整改") //{ // string url = string.Format("FinePersonSelect.aspx?Post={0}&Mod={1}&Win={2}", dc.Nyhinput.First(p => p.Intime == dt && p.Inputpersonid == SessionBox.GetUserSession().PersonNumber).Yhputinid, "yh", FineWin.ClientID); // Ext.DoScript("#{FineWin}.load('" + url + "');#{FineWin}.show();"); //} //else //{ decimal yhinputid = dc.Nyhinput.First(p => p.Intime == dt && p.Inputpersonid == SessionBox.GetUserSession().PersonNumber).Yhputinid; AddYhMorePerson(yhinputid, pergroup); GhtnTech.SecurityFramework.BLL.LogManager.WriteLog(SessionBox.GetUserSession().PersonNumber, SessionBox.GetUserSession().LoginName, "", DateTime.Now, GhtnTech.SecurityFramework.BLL.ActiveType.录入隐患, yhinputid.ToString(), ""); Ext.Msg.Alert("提示", "保存成功!").Show();//排查人员添加明细:<br>"+).Show(); //} } //Gridload(); Ext.DoScript("#{YHputinStore}.reload();"); //清空隐患信息 cbbyh.SelectedItem.Value = ""; TextArea2.Text = ""; } catch (Exception ex) { Ext.Msg.Alert("提示", string.Format("保存失败,请稍候重试!\n原因:{0}", ex.Message)).Show(); } } else { var yh = dc.Nyhinput.First(p => p.Yhputinid == decimal.Parse(Hidden1.Value.ToString().Trim())); try { yh.Banci = cbbBc.SelectedItem.Value.Trim(); yh.Deptid = cbbDept.SelectedItem.Value.Trim(); yh.Inputpersonid = SessionBox.GetUserSession().PersonNumber; // cbbPerson.SelectedItem.Value.Trim(); yh.Personid = pergroup[0]; //cbbPerson.SelectedItem.Value.Trim(); //yh.Intime = System.DateTime.Today; //yh.Pctime = Convert.ToDateTime(dfPCtime.Value); yh.Placeid = int.Parse(cbbplace.SelectedItem.Value.Trim()); yh.Remarks = TextArea1.Text.Trim(); yh.Status = cbbStatus.SelectedItem.Value.Trim(); yh.Yhid = decimal.Parse(cbbyh.SelectedItem.Value.Trim()); yh.Jctype = cbbJctype.SelectedIndex; //yh.Maindeptid = SessionBox.GetUserSession().DeptNumber; //dc.Yhinput.Insert(yh); dc.SubmitChanges(); AddYhMorePerson(decimal.Parse(Hidden1.Value.ToString().Trim()), pergroup); Ext.Msg.Alert("提示", "修改成功!").Show();//排查人员添加明细:<br>" + ).Show(); //Gridload(); Ext.DoScript("#{YHputinStore}.reload();"); //清空隐患信息 cbbyh.SelectedIndex = -1; TextArea2.Text = ""; } catch { Ext.Msg.Alert("提示", "保存失败,请稍候重试!").Show(); } } }
public void PYsearch(string py, string store) { if (py.Trim() == "") { return; } switch (store.Trim()) { case "deptStore": if (PublicCode.BugCreate(SessionBox.GetUserSession().DeptNumber)) { string areadept = dc.Person.First(p => p.Personnumber == SessionBox.GetUserSession().PersonNumber).Areadeptid; var dept = from d in dc.Department where d.Deptnumber.Substring(0, 4) == SessionBox.GetUserSession().DeptNumber.Substring(0, 4) && d.Deptnumber != areadept && d.Fatherid != areadept && (dc.F_PINYIN(d.Deptname).ToLower().Contains(py.ToLower()) || d.Deptname.Contains(py.Trim())) select new { deptID = d.Deptnumber, deptName = d.Deptname }; deptStore.DataSource = dept.Distinct(); deptStore.DataBind(); } else { var dept = from d in dc.Department where d.Deptnumber.Substring(0, 4) == SessionBox.GetUserSession().DeptNumber.Substring(0, 4) && (d.Deptnumber.Substring(7) == "00" || d.Deptlevel == "正科级") && d.Deptstatus == "1" && (dc.F_PINYIN(d.Deptname).ToLower().Contains(py.ToLower()) || d.Deptname.Contains(py.Trim())) select new { deptID = d.Deptnumber, deptName = d.Deptname }; deptStore.DataSource = dept.Distinct(); deptStore.DataBind(); } break; case "placeStore": if (PublicCode.BugCreate(SessionBox.GetUserSession().DeptNumber)) { decimal areaid = (from p in dc.Person from d in dc.Department from a in dc.Placeareas where p.Personnumber == SessionBox.GetUserSession().PersonNumber && p.Areadeptid == d.Deptnumber && d.Deptname.Replace(" ", "") == a.Pareasname select a).First().Pareasid; var place = from pl in dc.Place where pl.Maindeptid == SessionBox.GetUserSession().DeptNumber && pl.Pareasid != areaid && pl.Placestatus == 1 && (dc.F_PINYIN(pl.Placename).ToLower().Contains(py.ToLower()) || pl.Placename.Contains(py.Trim())) select new { placID = pl.Placeid, placName = pl.Placename }; placeStore.DataSource = place; placeStore.DataBind(); } else { var place = from pl in dc.Place where pl.Maindeptid == SessionBox.GetUserSession().DeptNumber&& pl.Placestatus == 1 && (dc.F_PINYIN(pl.Placename).ToLower().Contains(py.ToLower()) || pl.Placename.Contains(py.Trim())) select new { placID = pl.Placeid, placName = pl.Placename }; placeStore.DataSource = place; placeStore.DataBind(); } break; case "yhStore": //修改多列显示 var hazard = from yh in dc.Getyhandhazusing where yh.Deptnumber == SessionBox.GetUserSession().DeptNumber && (yh.Conpyfirst.ToLower().Contains(py.ToLower()) || yh.Yhcontent.Contains(py.Trim()) || yh.Yhnumber.ToLower().Contains(py.ToLower())) select new { yhNumber = yh.Yhid, yhContent = yh.Yhcontent, Gzrwname = yh.Levelname, Gxname = yh.Typename }; yhStore.DataSource = hazard; yhStore.DataBind(); break; case "PCpersonStore": if (cbbJctype.SelectedItem.Value == "2") { //局端排查人 var person = from p in dc.Person from d in dc.Department where p.Areadeptid == d.Deptnumber && p.Visualfield == 3 && p.Personstatus == 1 && (dc.F_PINYIN(p.Name).ToLower().Contains(py.ToLower()) || p.Name.Contains(py.Trim())) select new { p.Personnumber, p.Name, d.Deptname }; PCpersonStore.DataSource = person; PCpersonStore.DataBind(); } else { var person = from pl in dc.Vgetpl from p in dc.Person where pl.Moduletag == "HiddenDanage_HDprocess" && pl.Operatortag == "YH_fcfk" && pl.Unitid == SessionBox.GetUserSession().DeptNumber && (dc.F_PINYIN(pl.Name).ToLower().Contains(py.ToLower()) || pl.Name.Contains(py.Trim())) && pl.Personnumber == p.Personnumber && p.Personstatus == 1 select new { pl.Personnumber, pl.Name }; PCpersonStore.DataSource = person.Distinct(); PCpersonStore.DataBind(); } break; case "WorkTaskStore": var gzrw = dc.Worktasks.Where( p => p.Professionalid == decimal.Parse(cbbSbsdy.SelectedItem.Value) && dc.F_PINYIN(p.Worktask).ToLower().Contains(py.ToLower()) ); WorkTaskStore.DataSource = gzrw; WorkTaskStore.DataBind(); break; } }
private void storeload()//数据绑定 { //需要添加权限判断-判断是否为走动干部进入 var data = from m in dc.VMoveplan where m.Maindept == SessionBox.GetUserSession().DeptNumber select new { Name = m.Name, PlaceName = m.Placename, DeptName = m.Deptname, PosName = m.Posname, ID = m.Id, PersonID = m.Personid, StartTime = m.Starttime, EndTime = m.Endtime, MoveState = m.Movestate, m.Posid, m.Placeid }; if (df_begin.SelectedDate > df_end.SelectedDate) { Ext.Msg.Alert("提示", "日期选择有误!").Show(); return; } #region 直接linq查询-数据搜索速度慢,先改成上述视图 //var data = from m in dc.Moveplan // from p in dc.Person // from pl in dc.Place // from d in dc.Department // from pos in dc.Position // where m.Personid == p.Personnumber && m.Placeid == pl.Placeid && p.Deptid == d.Deptnumber && p.Posid == pos.Posid && m.Maindept == SessionBox.GetUserSession().DeptNumber // && m.Starttime.Value >= (df_begin.IsNull ? m.Starttime.Value : df_begin.SelectedDate.Date) && m.Endtime.Value <= (df_end.IsNull ? m.Endtime.Value : df_end.SelectedDate.Date) // //&& pos.Posid == (cbb_zhiwu.SelectedIndex == -1 ? pos.Posid : Convert.ToInt32(cbb_zhiwu.SelectedItem.Value)) // && p.Personnumber == (cbb_person.SelectedIndex == -1 ? p.Personnumber : cbb_person.SelectedItem.Value.Trim()) // //&& pl.Placeid == (cbb_place.SelectedIndex == -1 ? pl.Placeid : Decimal.Parse(cbb_place.SelectedItem.Value.Trim())) // select new // { // Name = p.Name, // PlaceName = pl.Placename, // DeptName = d.Deptname, // PosName = pos.Posname, // ID = m.Id, // PersonID = m.Personid, // StartTime = m.Starttime, // EndTime = m.Endtime, // MoveState = m.Movestate, // pos.Posid, // pl.Placeid // }; #endregion if (!df_begin.IsNull) { data = data.Where(p => p.StartTime >= df_begin.SelectedDate.Date); } if (!df_end.IsNull) { data = data.Where(p => p.EndTime <= df_end.SelectedDate.Date); } if (cbb_person.SelectedIndex > -1) { data = data.Where(p => p.PersonID == cbb_person.SelectedItem.Value.Trim()); } if (cbb_place.SelectedIndex > -1) { data = data.Where(p => p.Placeid == Decimal.Parse(cbb_place.SelectedItem.Value.Trim())); } if (cbb_zhiwu.SelectedIndex > -1) { data = data.Where(p => p.Posid == Decimal.Parse(cbb_zhiwu.SelectedItem.Value.Trim())); } MoveStore.DataSource = data; MoveStore.DataBind(); }
private void SearchLoad()//查询窗口初始化 { DBSCMDataContext dc = new DBSCMDataContext(); //初始化地点 var dep = from d in dc.Place where d.Maindeptid == SessionBox.GetUserSession().DeptNumber select new { PlaceName = d.Placename, PlaceID = d.Placeid }; Store4.DataSource = dep; Store4.DataBind(); //初始化人员职务 //需要添加权限判断-判断是否为走动干部进入 var pos = from p in dc.Position from per in dc.Person where p.Posid == per.Posid && p.Maindeptid == per.Maindeptid && per.Maindeptid == SessionBox.GetUserSession().DeptNumber select new { PosID = p.Posid, PosName = p.Posname }; PosStore.DataSource = pos; PosStore.DataBind(); }
public void YearDataLoad() { //获取当年全矿安全状况 int date = System.DateTime.Today.Year; string textYear = @"<br /><b>" + date + "年全矿安全动态:</b><br /><br />"; //var YHdata = from c in dc.Yhview // where c.Pctime.Value.Year == System.DateTime.Today.Year && c.Maindeptid == SessionBox.GetUserSession().DeptNumber // group c by c.Levelname into g // orderby g.Key // select new // { // YHLevel = g.Key, // YHnum = g.Count() // }; //var SWdata = from c in dc.Getsanwei // where c.Pctime.Value.Year == System.DateTime.Today.Year && c.Dwid == SessionBox.GetUserSession().DeptNumber // group c by c.Levelname into g // select new // { // SWLevel = g.Key, // SWnum = g.Count() // }; DateTime daybegin = new DateTime(System.DateTime.Today.Year, 1, 1); DateTime dayend = new DateTime(System.DateTime.Today.Year, 12, 31); var YHdata = GetSafeInfo.GetMainLeaderYH(daybegin, dayend, SessionBox.GetUserSession().DeptNumber).Tables[0]; //var SWdata = GetSafeInfo.GetMainLeaderSW(daybegin, dayend, SessionBox.GetUserSession().DeptNumber).Tables[0]; var SWdata = from s in dc.Getsanwei where s.Pctime >= daybegin && s.Pctime <= dayend && s.Dwid == SessionBox.GetUserSession().DeptNumber group s by s.Levelname into g select new { g.Key, swnum = g.Count() }; if (YHdata.Rows.Count <= 0 && SWdata.Count() <= 0) { textYear += " 本年度无安全动态!"; } else { if (YHdata.Rows.Count > 0) { textYear += "全矿隐患信息:<br />"; for (int i = 0; i < YHdata.Rows.Count; i++) { textYear += string.Format(" <span align=left> <font color={2}><b>{0}</b></font>级隐患:{1}条 <br /></span>", YHdata.Rows[i]["LEVELNAME"].ToString().Trim(), YHdata.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdata.Rows[i]["LEVELNAME"].ToString().Trim())); } } if (SWdata.Count() > 0) { textYear += "全矿三违信息:<br />"; foreach (var r in SWdata) { textYear += string.Format(" <span align=left><font color={5}><b>{0}</b></font>级别三违:" + SWstr + "条 </span><br />", r.Key, Server.UrlEncode(r.Key), daybegin, dayend, r.swnum, GetColor1(r.Key)); } } } this.YearPanel.Html = textYear; }
public void MonthDataLoad() { //获取当月全矿安全状况 DateTime start = new DateTime(System.DateTime.Today.Year, System.DateTime.Today.Month, 1); DateTime end = new DateTime(System.DateTime.Today.Year, System.DateTime.Today.Month, DateTime.DaysInMonth(System.DateTime.Today.Year, System.DateTime.Today.Month)); string textMonth = @"<br /><b>本月安全动态:</b><br /><br />"; //var YHdataMonth = from c in dc.Yhview // where (c.Pctime.Value >= start && c.Pctime.Value <= end) && c.Maindeptid == SessionBox.GetUserSession().DeptNumber // group c by c.Levelname into g // orderby g.Key // select new // { // YHLevel = g.Key, // YHnum = g.Count() // }; //var SWdataMonth = from c in dc.Getsanwei // where (c.Pctime.Value >= start && c.Pctime.Value <= end) && c.Dwid == SessionBox.GetUserSession().DeptNumber // group c by c.Levelname into g // select new // { // SWLevel = g.Key, // SWnum = g.Count() // }; var YHdataMonth = GetSafeInfo.GetMainLeaderYH(start, end, SessionBox.GetUserSession().DeptNumber).Tables[0]; //var SWdataMonth = GetSafeInfo.GetMainLeaderSW(start, end, SessionBox.GetUserSession().DeptNumber).Tables[0]; var SWdataMonth = from s in dc.Getsanwei where s.Pctime >= start && s.Pctime <= end && s.Dwid == SessionBox.GetUserSession().DeptNumber group s by s.Levelname into g select new { g.Key, swnum = g.Count() }; if (YHdataMonth.Rows.Count <= 0 && SWdataMonth.Count() <= 0) { textMonth += " 本月无安全动态!"; } else { if (YHdataMonth.Rows.Count > 0) { textMonth += "全矿隐患信息:<br />"; for (int i = 0; i < YHdataMonth.Rows.Count; i++) { textMonth += string.Format(" <span align=left><font color={5}><b>{0}</b></font>级隐患:" + YHstr + "条 </span><br />", YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).ToString("yyyy-MM-dd"), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"), YHdataMonth.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim())); } } if (SWdataMonth.Count() > 0) { textMonth += "全矿三违信息:<br />"; foreach (var r in SWdataMonth) { textMonth += string.Format(" <span align=left><font color={5}><b>{0}</b></font>级别三违:" + SWstr + "条 </span><br />", r.Key, Server.UrlEncode(r.Key), start, end, r.swnum, GetColor1(r.Key)); } //for (int i = 0; i < SWdataMonth.Rows.Count;i++) //{ // textMonth += string.Format(" <span align=left><font color={5}>{0}</font>级别三违:" + SWstr + "条 </span><br />", SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).ToString("yyyy-MM-dd"), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"), SWdataMonth.Rows[i]["SWNUM"].ToString().Trim(), GetColor1(SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim())); //} } } this.MonthPanel.Html = textMonth; }
public void storebind() { if (dfBegin.SelectedDate > dfEnd.SelectedDate) { Ext.Msg.Alert("提示", "请选择正确日期").Show(); return; } //var data = dc.GetAllSafetyCountByPAreas(dfBegin.SelectedDate, dfEnd.SelectedDate); if (SessionBox.GetUserSession().rolelevel.Contains("1") || SessionBox.GetUserSession().rolelevel.Contains("0")) { if (cbbUnit.SelectedIndex > -1 && cbbUnit.SelectedItem.Value != "-1") { var data = GetSafeInfo.GetAllSafetyCountByPAreas(dfBegin.SelectedDate, dfEnd.SelectedDate, cbbUnit.SelectedItem.Value); Store1.DataSource = data; Store1.DataBind(); } else { var data = GetSafeInfo.GetAllSafetyCountByPAreas(dfBegin.SelectedDate, dfEnd.SelectedDate, ""); Store1.DataSource = data; Store1.DataBind(); } } else { var data = GetSafeInfo.GetAllSafetyCountByPAreas(dfBegin.SelectedDate, dfEnd.SelectedDate, SessionBox.GetUserSession().DeptNumber); Store1.DataSource = data; Store1.DataBind(); } }
private void StoreLoad() { var datayh = from yh in dc.Swbase from d in dc.CsBaseinfoset where yh.Typeid == d.Infoid && yh.Nstatus == 2 select new { yh.Swid, yh.Swnumber, yh.Swcontent, yh.Levelid, yh.Typeid, Typename = d.Infoname, yh.Conpyfirst, yh.Intime, yh.Nstatus }; var data2 = from d in datayh join yq in dc.Swquote.Where(p => p.Deptnumber == SessionBox.GetUserSession().DeptNumber) on d.Swid equals yq.Swid into gg from g in gg.DefaultIfEmpty() select new { d.Swid, d.Swnumber, d.Swcontent, Levelid = (g == null ? d.Levelid : g.Levelid), d.Typeid, d.Typename, d.Conpyfirst, Intime = g.Quotetime, Nstatus = g == null ? 2 : g.Nstatus }; var data = from d in data2 from c in dc.CsBaseinfoset where d.Levelid == c.Infoid select new { d.Swid, d.Swnumber, d.Swcontent, d.Levelid, Levelname = c.Infoname, d.Typeid, d.Typename, d.Conpyfirst, d.Intime, d.Nstatus }; if (cbb_lavel.SelectedIndex > -1) { data = data.Where(p => p.Levelid == decimal.Parse(cbb_lavel.SelectedItem.Value)); } if (cbb_kind.SelectedIndex > -1) { data = data.Where(p => p.Typeid == decimal.Parse(cbb_kind.SelectedItem.Value)); } YHStore.DataSource = data; YHStore.DataBind(); }
public void Doquote() { RowSelectionModel sm = GridPanel3.SelectionModel.Primary as RowSelectionModel; if (sm.SelectedRows.Count > 0) { var yb = dc.Swquote.Where(p => p.Swid == decimal.Parse(sm.SelectedRow.RecordID) && p.Deptnumber == SessionBox.GetUserSession().DeptNumber); if (yb.Count() > 0) { yb.First().Nstatus = 1; dc.SubmitChanges(); } else { var yh = dc.Swbase.First(p => p.Swid == decimal.Parse(sm.SelectedRow.RecordID)); Swquote yq = new Swquote { Swid = decimal.Parse(sm.SelectedRow.RecordID), Levelid = yh.Levelid, Deptnumber = SessionBox.GetUserSession().DeptNumber, Nstatus = 1, Quotetime = System.DateTime.Today }; dc.Swquote.InsertOnSubmit(yq); dc.SubmitChanges(); } StoreLoad(); Ext.Msg.Alert("提示", "引用成功!").Show(); } }
private void storeload() { var data = from m in dc.VMoveplan from k in dc.Moveplan where m.Maindept == SessionBox.GetUserSession().DeptNumber&& m.Id == k.Id select new { m.Name, m.Placeid, m.Placename, m.Deptname, m.Posid, m.Posname, m.Id, m.Personid, m.Starttime, m.Endtime, m.Movestarttime, m.Movestate, Closeremarks = (k.Closeremarks == "录入隐患闭合" ? "" : k.Closeremarks) }; if (!df_begin.IsNull) { data = data.Where(p => p.Starttime >= df_begin.SelectedDate.Date); } if (!df_end.IsNull) { data = data.Where(p => p.Starttime <= df_end.SelectedDate.Date); } if (cbb_person.SelectedIndex > -1) { data = data.Where(p => p.Personid == cbb_person.SelectedItem.Value.Trim()); } if (cbb_place.SelectedIndex > -1) { data = data.Where(p => p.Placeid == Decimal.Parse(cbb_place.SelectedItem.Value.Trim())); } if (cbb_zhiwu.SelectedIndex > -1) { data = data.Where(p => p.Posid == Decimal.Parse(cbb_zhiwu.SelectedItem.Value.Trim())); } //var data = from a in dc.Moveplan // from b in dc.Person // from c in dc.Place // from d in dc.Department // from e in dc.Position // where a.Personid == b.Personnumber && a.Placeid == c.Placeid && b.Deptid == d.Deptnumber && b.Posid==e.Posid && // a.Maindept == SessionBox.GetUserSession().DeptNumber && a.Starttime >= start && a.Starttime <= end // select new // { // b.Name, // c.Placename, // d.Deptname, // e.Posname, // a.Id, // a.Personid, // a.Starttime, // a.Endtime, // a.Movestate // }; Store1.DataSource = data; Store1.DataBind(); btn_delete.Disabled = true; RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel; sm.SelectedRows.Clear(); sm.UpdateSelection(); }
private Coolite.Ext.Web.TreeNodeCollection LoadTree(Coolite.Ext.Web.TreeNodeCollection nodes) { if (nodes == null) { nodes = new Coolite.Ext.Web.TreeNodeCollection(); }//根节点为null时 tpPerson.Root.Clear(); Coolite.Ext.Web.TreeNode root = new Coolite.Ext.Web.TreeNode(); if (cbbJctype.SelectedItem.Value == "2") { var dept = dc.Department.First(p => p.Deptnumber == "000000000"); root = new Coolite.Ext.Web.TreeNode(dept.Deptnumber, dept.Deptname, Icon.UserHome); tpPerson.Root.Add(root); var per = (from d in dc.Department where //d.Deptnumber.Substring(0, 4) == "1303" //&& (d.Deptnumber.Substring(7) == "00" || d.Deptlevel == "正科级") //&& d.Visualfield == 3 select new { d.Deptnumber, d.Deptname }).OrderBy(p => p.Deptname); foreach (var r in per) { AsyncTreeNode asyncNode = new AsyncTreeNode(r.Deptnumber, r.Deptname); asyncNode.Icon = Icon.UserEarth; root.Nodes.Add(asyncNode); } //局端排查人 var person = from p in dc.Person from d in dc.Department where p.Areadeptid == d.Deptnumber && p.Visualfield == 100//返回空结构 select new { p.Personnumber, p.Name, d.Deptname }; SelectedStore.DataSource = person; SelectedStore.DataBind(); } else { var dept = dc.Department.First(p => p.Deptnumber == SessionBox.GetUserSession().DeptNumber); root = new Coolite.Ext.Web.TreeNode(dept.Deptnumber, dept.Deptname, Icon.UserHome); tpPerson.Root.Add(root); var per = (from v in dc.Vgetpl where v.Operatortag == "YH_fcfk" && v.Moduletag == "HiddenDanage_HDprocess" && v.Unitid == SessionBox.GetUserSession().DeptNumber select new { v.Deptnumber, v.Deptname }).Distinct().OrderBy(p => p.Deptname); foreach (var r in per) { AsyncTreeNode asyncNode = new AsyncTreeNode(r.Deptnumber, r.Deptname); asyncNode.Icon = Icon.UserEarth; root.Nodes.Add(asyncNode); } //排查人初始绑定 var person = (from pl in dc.Vgetpl where pl.Moduletag == "YSNewProcess_YHProcess" && pl.Operatortag == "YH_fcfk" && pl.Unitid == SessionBox.GetUserSession().DeptNumber && pl.Personnumber == SessionBox.GetUserSession().PersonNumber select new { pl.Personnumber, pl.Name, pl.Deptname }).Distinct(); if (person.Where(p => p.Personnumber == SessionBox.GetUserSession().PersonNumber).Count() > 0) { cbbPerson.SelectedItem.Value = SessionBox.GetUserSession().PersonNumber; var person1 = person.Where(p => p.Personnumber == SessionBox.GetUserSession().PersonNumber); SelectedStore.DataSource = person1; SelectedStore.DataBind(); } } return(nodes); }
protected void Page_Load(object sender, EventArgs e) { if (!Ext.IsAjaxRequest) { //改变走动状态 //AutoDoSth(); //待办事宜 string text = "<ul>"; string[] countYH = MainData.getYHDSP_kld(SessionBox.GetUserSession().PersonNumber, SessionBox.GetUserSession().DeptNumber); text += string.Format("<span><font color=#cc0000><b>待办事宜:</b></font></span>您有待审批隐患:<a href={1}>{0}条</a>", countYH[0], "YSNewProcess/YHProcess.aspx?YHIDgroup=" + (countYH[1].Length == 0 ? "-1" : countYH[1])); //待督促隐患 var sms = from s in dc.TblSmsendtask from p in dc.Person from yh in dc.Getyhinput where s.Destaddr == p.Tel && s.Msgid == yh.Yhputinid.ToString() && p.Personnumber == SessionBox.GetUserSession().PersonNumber&& yh.Status == "隐患未整改" group s by s.Msgid into g select new { YHPutinID = g.Key }; //group by 不要重复数据 string group = ""; foreach (var r in sms) { group += r.YHPutinID.ToString() + ","; } if (group.Length > 0) { group = group.Substring(0, group.Length - 1); } else { group = "-1"; } text += string.Format(" <span>您有待督促隐患:<a href={1}>{0}条</a></span>", sms.Count(), "YSNewProcess/YHProcess.aspx?YHIDgroup=" + group); text += "</ul>"; this.ScriptManager1.RegisterClientScriptBlock("part", string.Format("var part=\"{0}\";", text)); lab.Html = "={part}"; Ext.DoScript("Coolite.AjaxMethods.DayDataLoad();"); Ext.DoScript("Coolite.AjaxMethods.WeekDataLoad();"); Ext.DoScript("Coolite.AjaxMethods.MonthDataLoad();"); Ext.DoScript("Coolite.AjaxMethods.YearDataLoad();"); } }
private void pcPersonLoad() { var person = (from pl in dc.Vgetpl where pl.Moduletag == "YSNewProcess_YHProcess" && pl.Operatortag == "YH_fcfk" && pl.Unitid == SessionBox.GetUserSession().DeptNumber && pl.Personnumber == SessionBox.GetUserSession().PersonNumber select new { pl.Personnumber, pl.Name, pl.Deptname }).Distinct(); PCpersonStore.DataSource = person; PCpersonStore.DataBind(); cbbPerson.SelectedItem.Value = SessionBox.GetUserSession().PersonNumber; }
public void DayDataLoad() { //获取当天全矿安全状况 string textDay = @"<br /><b>今日安全动态:</b><br /><br />"; //var YHdataDay = from c in dc.Yhview // where c.Pctime == System.DateTime.Today && c.Maindeptid==SessionBox.GetUserSession().DeptNumber // group c by c.Levelname into g // orderby g.Key // select new // { // YHLevel = g.Key, // YHnum = g.Count() // }; //var SWdataDay = from c in dc.Getsanwei // where c.Pctime == System.DateTime.Today && c.Dwid == SessionBox.GetUserSession().DeptNumber // group c by c.Levelname into g // select new // { // SWLevel = g.Key, // SWnum = g.Count() // }; //几个视图未改成最新 var YHdataDay = GetSafeInfo.GetMainLeaderYH(System.DateTime.Today, System.DateTime.Today, SessionBox.GetUserSession().DeptNumber).Tables[0]; //var SWdataDay = GetSafeInfo.GetMainLeaderSW(System.DateTime.Today, System.DateTime.Today, SessionBox.GetUserSession().DeptNumber).Tables[0]; var SWdataDay = from s in dc.Getsanwei where s.Pctime == System.DateTime.Today && s.Dwid == SessionBox.GetUserSession().DeptNumber group s by s.Levelname into g select new { g.Key, swnum = g.Count() }; if (YHdataDay.Rows.Count <= 0 && SWdataDay.Count() <= 0) { textDay += " 今日无安全动态!"; } else { if (YHdataDay.Rows.Count > 0) { //textDay += "<font color=red>全矿隐患信息:</font><br />"; textDay += "全矿隐患信息:<br />"; for (int i = 0; i < YHdataDay.Rows.Count; i++) { textDay += string.Format(" <span align=left><font color={5}><b>{0}</b></font>级隐患:" + YHstr + "条</span> <br />", YHdataDay.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(YHdataDay.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.ToString("yyyy-MM-dd"), System.DateTime.Today.ToString("yyyy-MM-dd"), YHdataDay.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdataDay.Rows[i]["LEVELNAME"].ToString().Trim())); } } if (SWdataDay.Count() > 0) { textDay += "全矿三违信息:<br />"; foreach (var r in SWdataDay) { textDay += string.Format(" <span align=left><font color={5}><b>{0}</b></font>级别三违:" + SWstr + "条 </span><br />", r.Key, Server.UrlEncode(r.Key), System.DateTime.Today.ToString("yyyy-MM-dd"), System.DateTime.Today.ToString("yyyy-MM-dd"), r.swnum, GetColor1(r.Key)); } } } this.DayPanel.Html = textDay; }
public void SelectLoad() { var yh = dc.Getyhandhazusing.First(p => p.Yhid == decimal.Parse(cbbyh.SelectedItem.Value) && p.Deptnumber == SessionBox.GetUserSession().DeptNumber); string msg = "危 险 源:" + yh.HContent; msg += "\r\n辨识单元:" + yh.Typename; msg += "\r\n风险类型:" + yh.Fxlx; msg += "\r\n风险等级:" + yh.Fxlevel; msg += "\r\n事故类型:" + yh.Sglx; msg += "\r\n隐患级别:" + yh.Levelname; try { msg += "\r\n矿查积分:" + yh.Kcscore; } catch { msg += "\r\n矿查积分:无"; } TextArea2.Text = msg; }
protected void PersonRefresh(object sender, StoreRefreshDataEventArgs e) { //需要添加权限判断-判断是否为走动干部进入 //var q = dc.Person.Where(p => p.Posid == Convert.ToInt32(cbb_zhiwu.SelectedItem.Value) && p.Maindeptid == SessionBox.GetUserSession().DeptNumber); var q = from p in dc.Person where p.Posid == Convert.ToInt32(cbb_zhiwu.SelectedItem.Value) && p.Maindeptid == SessionBox.GetUserSession().DeptNumber orderby p.Name ascending select new { p.Personnumber, p.Name }; PersonStore.DataSource = q; PersonStore.DataBind(); cbb_person.Disabled = q.Count() > 0 ? false : true; }
private void Gridload() { //绑定隐患录入信息 var data = from yh in dc.Getyhinput from ny in dc.Nyhinput from m in dc.NyhinputMore where yh.Yhputinid == ny.Yhputinid && yh.Unitid == SessionBox.GetUserSession().DeptNumber //多人排查 如果为排查人也可看到 && yh.Yhputinid == m.Yhputinid && (ny.Inputpersonid == SessionBox.GetUserSession().PersonNumber || m.Personid == SessionBox.GetUserSession().PersonNumber) && yh.Intime >= System.DateTime.Today.AddDays(-7) //查询最近7天的信息 orderby yh.Intime descending select new { YHPutinID = yh.Yhputinid, DeptName = yh.Deptname, PlaceName = yh.Placename, YHContent = yh.Yhcontent, Remarks = yh.Remarks, BanCi = yh.Banci, Name = yh.Name, INTime = yh.Intime, PCTime = yh.Pctime, YHType = yh.Typename, Status = yh.Status }; if (data.Count() > 0) { YHputinStore.DataSource = data; YHputinStore.DataBind(); } }
protected void gvSWPointSet_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.NewValues["Deptnumber"] = SessionBox.GetUserSession().DeptNumber; e.NewValues["Usingtime"] = DateTime.Now; }
protected void RowClick(object sender, AjaxEventArgs e)//流程处理 { RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel; if (sm.SelectedRows.Count > 0) { var data = dc.Nyhinput.First(p => p.Yhputinid == decimal.Parse(sm.SelectedRow.RecordID.Trim())); if (data.Status != "新增") { cbbDept.SelectedItem.Value = ""; cbbplace.SelectedItem.Value = ""; cbbyh.SelectedItem.Value = ""; TextArea1.Text = ""; btnEdit.Disabled = true; btnDelete.Disabled = true; TextArea2.Text = ""; return; } cbbBc.SelectedItem.Value = data.Banci; //部门------------------------ cbbDept.Items.Clear(); var dept = from d in dc.Department where d.Deptnumber == data.Deptid select new { deptID = d.Deptnumber, deptName = d.Deptname }; deptStore.DataSource = dept; deptStore.DataBind(); cbbDept.SelectedItem.Value = data.Deptid; //cbbDept.SelectedItem.Text = dept.First().deptName; //------------------------ //cbbPerson.SelectedItem.Value = data.Personid; GetPersonName(int.Parse(sm.SelectedRow.RecordID.Trim())); dfPCtime.Value = data.Pctime.Value; cbbplace.Items.Clear(); //地点 var place = from pl in dc.Place where pl.Placeid == data.Placeid && pl.Placestatus == 1 select new { placID = pl.Placeid, placName = pl.Placename }; placeStore.DataSource = place; placeStore.DataBind(); cbbplace.SelectedItem.Value = data.Placeid.ToString(); //------------------------ try { TextArea1.Text = data.Remarks.Trim(); } catch { TextArea1.Text = ""; } cbbStatus.SelectedItem.Value = data.Status; cbbJctype.SelectedItem.Value = data.Jctype.ToString(); cbbyh.Items.Clear(); //修改多列显示 var yh = from hd in dc.Getyhandhazusing where hd.Yhid == data.Yhid && hd.Deptnumber == SessionBox.GetUserSession().DeptNumber select new { yhNumber = hd.Yhid, yhContent = hd.Yhcontent, Gzrwname = hd.Levelname, Gxname = hd.Typename }; //var yh = from ha in dc.Hazards // from ore in dc.HazardsOre // where ha.HNumber == ore.HNumber && ore.Deptnumber == SessionBox.GetUserSession().DeptNumber && ore.HBjw == "引用" //&& ore.YhSwBjw == "隐患" // && ha.HNumber==data.Yhnumber // select new // { // yhNumber = ha.HNumber, // yhContent = ore.HBm // }; yhStore.DataSource = yh; yhStore.DataBind(); cbbyh.SelectedItem.Value = data.Yhid.ToString(); Hidden1.Value = sm.SelectedRow.RecordID.Trim(); btnEdit.Disabled = false; btnDelete.Disabled = false; SelectLoad(); } }