/// <summary> /// 得到一个对象实体 /// </summary> public Tunnel.Model.Tunnel_items GetModel(int i_id) { SqlParameter[] parameters = { new SqlParameter("@i_id", SqlDbType.Int, 4) }; parameters[0].Value = i_id; Tunnel.Model.Tunnel_items model = new Tunnel.Model.Tunnel_items(); DataSet ds = DbHelperSQL.RunProcedure("UP_Tunnel_items_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["i_id"].ToString() != "") { model.i_id = int.Parse(ds.Tables[0].Rows[0]["i_id"].ToString()); } model.i_name = ds.Tables[0].Rows[0]["i_name"].ToString(); model.year = ds.Tables[0].Rows[0]["year"].ToString(); model.moon = ds.Tables[0].Rows[0]["moon"].ToString(); return(model); } else { return(null); } }
public void ListBind2() { 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> ilist = new List <Tunnel.Model.Tunnel_items>(); DropDownList1.Items.Clear(); ilist = ti.GetModelList(" year='" + DropDownList2.SelectedValue + "' and moon='" + DropDownList3.SelectedValue + "'"); foreach (Tunnel.Model.Tunnel_items item in ilist) { DropDownList1.Items.Add(new ListItem(item.i_name, item.i_id.ToString())); } DropDownList1.Items.Insert(0, new ListItem("请选择", "0")); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Tunnel.Model.Tunnel_items model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@i_id", SqlDbType.Int, 4), new SqlParameter("@i_name", SqlDbType.VarChar, 50), new SqlParameter("@year", SqlDbType.VarChar, 50), new SqlParameter("@moon", SqlDbType.VarChar, 50) }; parameters[0].Value = model.i_id; parameters[1].Value = model.i_name; parameters[2].Value = model.year; parameters[3].Value = model.moon; DbHelperSQL.RunProcedure("UP_Tunnel_items_Update", parameters, out rowsAffected); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Tunnel.Model.Tunnel_items model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@i_id", SqlDbType.Int, 4), new SqlParameter("@i_name", SqlDbType.VarChar, 50), new SqlParameter("@year", SqlDbType.VarChar, 50), new SqlParameter("@moon", SqlDbType.VarChar, 50) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.i_name; parameters[2].Value = model.year; parameters[3].Value = model.moon; DbHelperSQL.RunProcedure("UP_Tunnel_items_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }
/// <summary> /// 获得数据列表 /// </summary> public List <Tunnel.Model.Tunnel_items> DataTableToList(DataTable dt) { List <Tunnel.Model.Tunnel_items> modelList = new List <Tunnel.Model.Tunnel_items>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Tunnel.Model.Tunnel_items model; for (int n = 0; n < rowsCount; n++) { model = new Tunnel.Model.Tunnel_items(); if (dt.Rows[n]["i_id"].ToString() != "") { model.i_id = int.Parse(dt.Rows[n]["i_id"].ToString()); } model.i_name = dt.Rows[n]["i_name"].ToString(); model.year = dt.Rows[n]["year"].ToString(); model.moon = dt.Rows[n]["moon"].ToString(); modelList.Add(model); } } return(modelList); }
public List <Tunnel.Model.Tunnel_items> GetList(PageBase pb, ref int count) { DataTable dt = dal.GetList(pb, ref count).Tables[0]; List <Tunnel.Model.Tunnel_items> modelList = new List <Tunnel.Model.Tunnel_items>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0 && pb.DoCount == 0) { Tunnel.Model.Tunnel_items model; for (int n = 0; n < rowsCount; n++) { model = new Tunnel.Model.Tunnel_items(); if (dt.Rows[n]["i_id"].ToString() != "") { model.i_id = int.Parse(dt.Rows[n]["i_id"].ToString()); } model.i_name = dt.Rows[n]["i_name"].ToString(); model.year = dt.Rows[n]["year"].ToString(); model.moon = dt.Rows[n]["moon"].ToString(); modelList.Add(model); } } return(modelList); }
protected void btnSave_Click(object sender, EventArgs e) { Tunnel.BLL.Tunnel_items ti = new Tunnel.BLL.Tunnel_items(); Tunnel.Model.Tunnel_items tii = new Tunnel.Model.Tunnel_items(); tii.i_name = txtItems.Text.Trim(); tii.year = TextBox1.Text; tii.moon = TextBox2.Text; if (ti.GetModelList("1=1 and i_name = '" + tii.i_name + "' and year = '" + tii.year + "' and moon = '" + tii.moon + "'").Count == 0) { if (ti.Add(tii) > 0) { Tunnel.Common.Message.Show("添加工程项目成功!"); } else { Tunnel.Common.Message.Show("添加工程项目失败!"); } } else { Tunnel.Common.Message.Show("本月存在该项目!"); } }
public void ListBind() { DropDownList1.Items.Clear(); DropDownList2.Items.Clear(); DropDownList3.Items.Clear(); 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> ilist = new List <Tunnel.Model.Tunnel_items>(); for (int i = 2009; i < 2019; i++) { DropDownList2.Items.Add(new ListItem(i.ToString(), i.ToString())); } for (int i = 1; i < 13; i++) { if (i.ToString().Length == 2) { DropDownList3.Items.Add(new ListItem(i.ToString(), i.ToString())); } else { DropDownList3.Items.Add(new ListItem("0" + i.ToString(), "0" + i.ToString())); } } DateTime dt = DateTime.Now.AddMonths(-1); DropDownList2.Items.FindByValue(dt.Year.ToString()).Selected = true; DropDownList3.Items.FindByValue(dt.Month.ToString().Length > 1 ? dt.Month.ToString() : "0" + dt.Month.ToString()).Selected = true; ilist = ti.GetModelList(" year='" + DropDownList2.SelectedValue + "' and moon='" + DropDownList3.SelectedValue + "'"); foreach (Tunnel.Model.Tunnel_items item in ilist) { DropDownList1.Items.Add(new ListItem(item.i_name, item.i_id.ToString())); } DropDownList1.Items.Insert(0, new ListItem("请选择", "0")); }
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_items model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Tunnel.Model.Tunnel_items model) { return(dal.Add(model)); }