public void GetAndBind() { List <Tunnel.Model.CheckList> clList = new List <Tunnel.Model.CheckList>(); if (workAndKID.Length > 0) { foreach (string item in workAndKID.Split('|')) { string workid = item.Split(',')[0].ToString(); //工作表ID string maxcent = item.Split(',')[1].ToString(); //最大分 string checkid = item.Split(',')[2].ToString(); //考核表ID tcc = tc.GetModel(Convert.ToInt32(checkid)); tww = tw.GetModel(Convert.ToInt32(workid)); if (tg.GetModelList("g_checkId=" + checkid + " and g_workId=" + workid + "").Count > 0) { tgg = tg.GetModelList("g_checkId=" + checkid + " and g_workId=" + workid + "")[0]; } Tunnel.Model.CheckList cl = new Tunnel.Model.CheckList(); cl.Income = tcc.c_income; cl.Score = Convert.ToInt32(tcc.c_score.ToString()); cl.Checkdate = tcc.c_date; cl.ItemsName = ti.GetModel(Convert.ToInt32(tcc.c_itemsId.ToString())).i_name; cl.UserName = tm.GetModel(Convert.ToInt64(tcc.c_userId.ToString())).m_name; cl.MaxCent = Convert.ToInt32(maxcent); cl.WorkName = tww.w_workName; cl.BumName = tww.w_bumName; cl.PFlist = "wid=" + workid + "&maxcent=" + maxcent + "&cid=" + checkid + ""; clList.Add(cl); } } GridView1.DataSource = clList; GridView1.DataBind(); }
/// <summary> /// 获得数据列表 /// </summary> public List <Tunnel.Model.Tunnel_check> DataTableToList(DataTable dt) { List <Tunnel.Model.Tunnel_check> modelList = new List <Tunnel.Model.Tunnel_check>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Tunnel.Model.Tunnel_check model; for (int n = 0; n < rowsCount; n++) { model = new Tunnel.Model.Tunnel_check(); if (dt.Rows[n]["c_id"].ToString() != "") { model.c_id = int.Parse(dt.Rows[n]["c_id"].ToString()); } if (dt.Rows[n]["c_userId"].ToString() != "") { model.c_userId = int.Parse(dt.Rows[n]["c_userId"].ToString()); } if (dt.Rows[n]["c_itemsId"].ToString() != "") { model.c_itemsId = int.Parse(dt.Rows[n]["c_itemsId"].ToString()); } if (dt.Rows[n]["c_score"].ToString() != "") { model.c_score = int.Parse(dt.Rows[n]["c_score"].ToString()); } if (dt.Rows[n]["c_income"].ToString() != "") { model.c_income = dt.Rows[n]["c_income"].ToString(); } model.c_date = dt.Rows[n]["c_date"].ToString(); modelList.Add(model); } } return(modelList); }
protected void btnSave_Click(object sender, EventArgs e) { try { int count = 0; Tunnel.BLL.Tunnel_check tc = new Tunnel.BLL.Tunnel_check(); Tunnel.Model.Tunnel_check tcc = new Tunnel.Model.Tunnel_check(); foreach (string item in HiddenField1.Value.Split(',')) { tcc.c_userId = Convert.ToInt32(item.Trim().ToString()); tcc.c_itemsId = Convert.ToInt32(DropDownList1.SelectedValue); tcc.c_date = DropDownList2.SelectedValue + DropDownList3.SelectedValue; tcc.c_income = "0"; tcc.c_score = 0; tc.Add(tcc); count++; } Tunnel.Common.Message.Show("成功增加" + count + "条记录"); } catch (Exception) { Tunnel.Common.Message.Show("请填写完整!", "ExamineAdd.aspx"); } }
public void ListBind() { nianyue = DropDownList1.SelectedValue; Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); Tunnel.Model.Tunnel_menber tmm = new Tunnel.Model.Tunnel_menber(); List <Tunnel.Model.Tunnel_menber> tmList = new List <Tunnel.Model.Tunnel_menber>(); Tunnel.BLL.Tunnel_work tw = new Tunnel.BLL.Tunnel_work(); Tunnel.Model.Tunnel_work tww = new Tunnel.Model.Tunnel_work(); List <Tunnel.Model.Tunnel_work> twList = new List <Tunnel.Model.Tunnel_work>(); Tunnel.BLL.Tunnel_grade tg = new Tunnel.BLL.Tunnel_grade(); Tunnel.Model.Tunnel_grade tgg = new Tunnel.Model.Tunnel_grade(); List <Tunnel.Model.Tunnel_grade> tgList = new List <Tunnel.Model.Tunnel_grade>(); Tunnel.BLL.Tunnel_items ti = new Tunnel.BLL.Tunnel_items(); Tunnel.Model.Tunnel_items tii = new Tunnel.Model.Tunnel_items(); List <Tunnel.Model.Tunnel_items> tiList = new List <Tunnel.Model.Tunnel_items>(); Tunnel.BLL.Tunnel_check tc = new Tunnel.BLL.Tunnel_check(); Tunnel.Model.Tunnel_check tcc = new Tunnel.Model.Tunnel_check(); List <Tunnel.Model.Tunnel_check> tcList = new List <Tunnel.Model.Tunnel_check>(); List <Tunnel.Model.Tunnel_ReadCheckList> trList = new List <Tunnel.Model.Tunnel_ReadCheckList>(); tcList = tc.GetModelList("c_date='" + nianyue + "'"); foreach (Tunnel.Model.Tunnel_check itemCheck in tcList) { Tunnel.Model.Tunnel_ReadCheckList tr = new Tunnel.Model.Tunnel_ReadCheckList(); List <Tunnel.Model.Tunnel_check> clist = new List <Tunnel.Model.Tunnel_check>(); tr.ItemsID = Convert.ToInt32(itemCheck.c_itemsId); tr.ItemsName = ti.GetModel(Convert.ToInt32(itemCheck.c_itemsId)).i_name; tr.UserId = Convert.ToInt32(itemCheck.c_userId); tr.UserName = tm.GetModel(Convert.ToInt64(itemCheck.c_userId.ToString())).m_name; tgList = tg.GetModelList("g_checkid=" + itemCheck.c_id + ""); tr.AqscCent = 0; tr.CbkzCent = 0; tr.ClglCent = 0; tr.DzbgzCent = 0; tr.GbgzCent = 0; tr.GczlCent = 0; tr.SbglCent = 0; tr.ScjhCent = 0; tr.WmsgCent = 0; tr.XcgzCent = 0; tr.XnzhCent = 0; tr.XxgzCent = 0; tr.ZhzlCent = 0; if (tgList.Count > 0) { foreach (Tunnel.Model.Tunnel_grade item in tgList) { if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "成本控制") { tr.CbkzCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "虚拟账户") { tr.XnzhCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "生产计划") { tr.ScjhCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "文明施工") { tr.WmsgCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "安全生产") { tr.AqscCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "工程质量") { tr.GczlCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "设备管理") { tr.SbglCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "材料管理") { tr.ClglCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "综合治理") { tr.ZhzlCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "贯标工作") { tr.GbgzCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "宣传工作") { tr.XcgzCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "党支部工作") { tr.DzbgzCent = Convert.ToSingle(item.g_cent.ToString()); } if (tw.GetModel(Convert.ToInt32(item.g_workId)).w_workName == "信息工作") { tr.XxgzCent = Convert.ToSingle(item.g_cent.ToString()); } } } tr.AllCent = tr.AqscCent + tr.CbkzCent + tr.ClglCent + tr.DzbgzCent + tr.GbgzCent + tr.GczlCent + tr.SbglCent + tr.ScjhCent + tr.WmsgCent + tr.XcgzCent + tr.XnzhCent + tr.XxgzCent + tr.ZhzlCent; trList.Add(tr); } GridView1.DataSource = trList; GridView1.DataBind(); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Tunnel.Model.Tunnel_check model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Tunnel.Model.Tunnel_check model) { return(dal.Add(model)); }