public string GetTechnologyName(int id) { BLL.Technology bllTechnology = new BLL.Technology(); Model.Technology model = bllTechnology.GetModel(id); return(bllTechnology.GetModel(model.ParentId).NameInfo + ":" + model.NameInfo); }
/// <summary> /// 修改工艺 /// </summary> public static bool ChangeTechnology(Model.Technology tech) { bool f = DAL.DA_Technology.ChangeTechnology(tech); listTechnology = GetTechnologyList(); return(f); }
/// <summary> /// 绑定供应商详细信息 /// </summary> /// <param name="id"></param> void BindDetail(int id) { model = bll.GetModel(id); txtPrice.Text = ((decimal)model.Price).ToString("0.00"); //txtTemPrice.Text = ((decimal)model.Price).ToString("0.00"); txtRemark.Text = model.Remark; txtSortNum.Text = model.SortNum.ToString(); txtTitle.Text = model.NameInfo; ckState.Checked = model.StateInfo == 1 ? true : false; ddlTechnology.SelectedValue = model.ParentId.ToString(); }
/// <summary> /// 添加工艺信息 /// </summary> public static bool AddTechnology(Model.Technology tech) { string sql = "insert into ROSO_Technology(TechnologyID,TechnologyValue) values(@TechnologyID,@TechnologyValue)"; SqlParameter[] p = { new SqlParameter("@TechnologyID", tech.TechnologyID), new SqlParameter("@TechnologyValue", tech.TechnologyValue) }; int i = SQLHelper.ExecuteNonQuery(sql, CommandType.Text, p); return(i > 0); }
/// <summary> /// 修改工艺信息 /// </summary> public static bool ChangeTechnology(Model.Technology tech) { string sql = "update ROSO_Technology set TechnologyValue=@TechnologyValue where TechnologyID=@TechnologyID"; SqlParameter[] p = { new SqlParameter("@TechnologyID", tech.TechnologyID), new SqlParameter("@TechnologyValue", tech.TechnologyValue) }; int i = SQLHelper.ExecuteNonQuery(sql, CommandType.Text, p); return(i > 0); }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, EventArgs e) { bool isEdit = false; if (int.TryParse(Request.Params["id"], out id)) { model = bll.GetModel(id); isEdit = true; } else { model.NumId = bll.SetNumID(); model.AddTime = DateTime.Now; } model.NameInfo = txtTitle.Text; model.ParentId = int.Parse(ddlTechnology.SelectedValue); model.Price = decimal.Parse(txtPrice.Text); model.Remark = txtRemark.Text; model.SortNum = int.Parse(txtSortNum.Text); model.StateInfo = ckState.Checked ? 1 : 0; //model.TemPrice = decimal.Parse(txtTemPrice.Text); if (isEdit) { if (bll.Update(model)) { JsMessage("工艺信息修改成功", 2000, "true", "index.aspx" + Request.Url.Query); } else { JsMessage("工艺信息修改失败,请稍候重试", 2000, "false"); } } else { if (bll.Add(model) > 0) { JsMessage("工艺信息录入成功", 2000, "true", "index.aspx"); } else { JsMessage("工艺信息录入失败,请稍候重试", 2000, "false"); } } }
/// <summary> /// 获取所有工艺列表 /// </summary> public static List <Model.Technology> GetTechnologyList() { string sql = "select * from ROSO_Technology order by TechnologyID"; List <Model.Technology> list = new List <Model.Technology>(); using (SqlDataReader dr = SQLHelper.ExecuteReader(sql, CommandType.Text, null)) { while (dr.Read()) { Model.Technology tech = new Model.Technology(); tech.ID = Convert.ToInt32(dr["ID"]); tech.TechnologyID = Convert.ToInt32(dr["TechnologyID"]); tech.TechnologyValue = Convert.ToString(dr["TechnologyValue"]); list.Add(tech); } } return(list); }
/// <summary> /// 分页获取数据列表 /// </summary> //public DataSet GetList(int PageSize,int PageIndex,string strWhere) //{ //return dal.GetList(PageSize,PageIndex,strWhere); //} #endregion BasicMethod #region ExtensionMethod /// <summary> /// 获取类别编号 /// </summary> /// <param name="id"></param> /// <returns></returns> public string SetNumID() { StringBuilder strNumId = new StringBuilder("OA"); strNumId.Append(DateTime.Now.ToString("yyMMdd")); Model.Technology model = GetModel(GetMaxId()); if (model != null) { strNumId.Append((int.Parse(model.NumId.Substring(model.NumId.Length - 3)) + 1).ToString().PadLeft(3, '0')); } else { strNumId.Append("001"); } return(strNumId.ToString()); }
/// <summary> /// 绑定所属工艺 /// </summary> /// <param name="pid"></param> /// <returns></returns> public string GetParentName(int pid) { if (string.Equals(pid, 0)) { return("顶级工艺"); } else { Model.Technology model = bll.GetModel(pid); if (model != null) { return(model.NameInfo); } else { return("未找到所属工艺"); } } }
/// <summary> /// 根据ID获取工艺对象 /// </summary> public static Model.Technology GetTechnology(Int32 technologyID) { string sql = "select * from ROSO_Technology where TechnologyID=@TechnologyID"; SqlParameter[] p = { new SqlParameter("@TechnologyID", technologyID) }; Model.Technology tech = new Model.Technology(); using (SqlDataReader dr = SQLHelper.ExecuteReader(sql, CommandType.Text, p)) { if (dr.Read()) { tech.ID = Convert.ToInt32(dr["ID"]); tech.TechnologyID = Convert.ToInt32(dr["TechnologyID"]); tech.TechnologyValue = Convert.ToString(dr["TechnologyValue"]); } } return(tech); }
/// <summary> /// 根据ID获取工艺名称,从静态列表中获取,效率高 /// </summary> /// <param name="technologyID"></param> /// <returns></returns> public static string GetTechnologyValue(Int32 technologyID) { Model.Technology tech = listTechnology.Find(p => p.TechnologyID.Equals(technologyID)); return(tech.TechnologyValue); }