initproject
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
namespace BLL
|
||||
{
|
||||
using Model;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public static class Base_ProjectTypeService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据项目类型ID获取项目类型
|
||||
/// </summary>
|
||||
/// <param name="projectTypeId">项目类型ID</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_ProjectType GetProjectTypeByProjectTypeId(string projectTypeId)
|
||||
{
|
||||
return Funs.DB.Base_ProjectType.FirstOrDefault(e => e.ProjectTypeId == projectTypeId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加项目类型信息
|
||||
/// </summary>
|
||||
/// <param name="Components"></param>
|
||||
public static void AddProjectType(Model.Base_ProjectType projectType)
|
||||
{
|
||||
Model.HJGLDB db = Funs.DB;
|
||||
Model.Base_ProjectType newProjectType = new Base_ProjectType
|
||||
{
|
||||
ProjectTypeId = projectType.ProjectTypeId,
|
||||
ProjectTypeName = projectType.ProjectTypeName,
|
||||
Remark = projectType.Remark,
|
||||
};
|
||||
|
||||
db.Base_ProjectType.InsertOnSubmit(newProjectType);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改项目类型信息
|
||||
/// </summary>
|
||||
/// <param name="Components"></param>
|
||||
public static void UpdateProjectType(Model.Base_ProjectType projectType)
|
||||
{
|
||||
Model.HJGLDB db = Funs.DB;
|
||||
Model.Base_ProjectType newProjectType = db.Base_ProjectType.FirstOrDefault(e => e.ProjectTypeId == projectType.ProjectTypeId);
|
||||
if (newProjectType != null)
|
||||
{
|
||||
newProjectType.ProjectTypeName = projectType.ProjectTypeName;
|
||||
newProjectType.Remark = projectType.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目类型Id删除一个项目类型信息
|
||||
/// </summary>
|
||||
/// <param name="ComponentsId"></param>
|
||||
public static void DeleteProjectTypeById(string projectTypeId)
|
||||
{
|
||||
Model.HJGLDB db = Funs.DB;
|
||||
Model.Base_ProjectType del = db.Base_ProjectType.FirstOrDefault(e => e.ProjectTypeId == projectTypeId);
|
||||
if (del != null)
|
||||
{
|
||||
db.Base_ProjectType.DeleteOnSubmit(del);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按项目类型项
|
||||
/// </summary>
|
||||
/// <param name="ComponentsType"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_ProjectType> GetProjectTypeList()
|
||||
{
|
||||
var list = (from x in Funs.DB.Base_ProjectType
|
||||
orderby x.ProjectTypeName
|
||||
select x).ToList();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#region 项目类型下拉项
|
||||
/// <summary>
|
||||
/// 项目类型下拉项
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名称</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitProjectTypeDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease,string itemText)
|
||||
{
|
||||
dropName.DataValueField = "ProjectTypeId";
|
||||
dropName.DataTextField = "ProjectTypeName";
|
||||
dropName.DataSource = GetProjectTypeList();
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName,itemText);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user