179 lines
7.5 KiB
C#
179 lines
7.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
public class QuantityDesctiptionService
|
|
{
|
|
public static Model.Base_QuantityDesctiption GetQuantityDesctiptionById(string keyId)
|
|
{
|
|
return Funs.DB.Base_QuantityDesctiption.FirstOrDefault(e => e.KeyId == keyId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加
|
|
/// </summary>
|
|
/// <param name="des"></param>
|
|
public static void AddQuantityDesctiption(Model.Base_QuantityDesctiption des)
|
|
{
|
|
Model.Base_QuantityDesctiption newDes = new Model.Base_QuantityDesctiption();
|
|
newDes.KeyId = des.KeyId;
|
|
newDes.DepartId = des.DepartId;
|
|
newDes.DisciplinesWBSId = des.DisciplinesWBSId;
|
|
newDes.QuantityDesctiption = des.QuantityDesctiption;
|
|
newDes.PlanMHRsUnit = des.PlanMHRsUnit;
|
|
Funs.DB.Base_QuantityDesctiption.InsertOnSubmit(newDes);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="des"></param>
|
|
public static void UpdateQuantityDesctiption(Model.Base_QuantityDesctiption des)
|
|
{
|
|
Model.Base_QuantityDesctiption newDes = Funs.DB.Base_QuantityDesctiption.FirstOrDefault(e => e.KeyId == des.KeyId);
|
|
if (newDes != null)
|
|
{
|
|
newDes.DepartId = des.DepartId;
|
|
newDes.DisciplinesWBSId = des.DisciplinesWBSId;
|
|
newDes.QuantityDesctiption = des.QuantityDesctiption;
|
|
newDes.PlanMHRsUnit = des.PlanMHRsUnit;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="keyId"></param>
|
|
public static void DeleteQuantityDesctiptionById(string keyId)
|
|
{
|
|
Model.Base_QuantityDesctiption newDes = Funs.DB.Base_QuantityDesctiption.FirstOrDefault(e => e.KeyId == keyId);
|
|
if (newDes != null)
|
|
{
|
|
Funs.DB.Base_QuantityDesctiption.DeleteOnSubmit(newDes);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 验证是否存在
|
|
/// </summary>
|
|
/// <param name="departId"></param>
|
|
/// <param name="DisciplinesWBSId"></param>
|
|
/// <param name="quantityDesctiption"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExitQuantityDesctiption(string departId, string DisciplinesWBSId, string quantityDesctiption, string id)
|
|
{
|
|
var q = Funs.DB.Base_QuantityDesctiption.FirstOrDefault(x => x.DepartId == departId && x.DisciplinesWBSId == DisciplinesWBSId && x.QuantityDesctiption == quantityDesctiption && x.KeyId != id);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
#region Identifier下拉值加载
|
|
public static void InitIdentifierDropDownList(FineUIPro.DropDownList dropName,string type, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "DisciplinesWBSCode";
|
|
dropName.DataTextField = "DisciplinesWBSCode";
|
|
dropName.DataSource = GetDisciplinesWBSCodeList(type);
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName,"-请选择-");
|
|
}
|
|
}
|
|
|
|
public static List<string> GetDisciplinesWBSCodeList(string type)
|
|
{
|
|
return (from x in Funs.DB.Base_QuantityDesctiption
|
|
join y in Funs.DB.Base_DisciplinesWBS on x.DisciplinesWBSId equals y.DisciplinesWBSId
|
|
where x.DepartId == type
|
|
orderby y.DisciplinesWBSCode
|
|
select y.DisciplinesWBSCode).Distinct().ToList();
|
|
}
|
|
#endregion
|
|
|
|
#region Descipline下拉值加载
|
|
public static void InitDesciplineDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease,string type, string disciplinesWBSCode)
|
|
{
|
|
dropName.DataValueField = "DisciplinesWBSName";
|
|
dropName.DataTextField = "DisciplinesWBSName";
|
|
dropName.DataSource = GetDesciplineList(type,disciplinesWBSCode);
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName, "-请选择-");
|
|
}
|
|
}
|
|
|
|
public static List<string> GetDesciplineList(string type,string disciplinesWBSCode)
|
|
{
|
|
return (from x in Funs.DB.Base_QuantityDesctiption
|
|
join y in Funs.DB.Base_DisciplinesWBS on x.DisciplinesWBSId equals y.DisciplinesWBSId
|
|
where y.DisciplinesWBSCode == disciplinesWBSCode && x.DepartId == type
|
|
orderby y.DisciplinesWBSName
|
|
select y.DisciplinesWBSName).Distinct().ToList();
|
|
}
|
|
#endregion
|
|
|
|
#region Quantity Desctiption 下拉值加载
|
|
public static void InitQuantityDesctiptionDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease,string type, string disciplinesWBSCode, string disciplinesWBSName)
|
|
{
|
|
dropName.DataValueField = "QuantityDesctiption";
|
|
dropName.DataTextField = "QuantityDesctiption";
|
|
dropName.DataSource = GetQuantityDesctiptionList(type,disciplinesWBSCode, disciplinesWBSName);
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName, "-请选择-");
|
|
}
|
|
}
|
|
|
|
public static List<string> GetQuantityDesctiptionList(string type, string disciplinesWBSCode, string disciplinesWBSName)
|
|
{
|
|
return (from x in Funs.DB.Base_QuantityDesctiption
|
|
join y in Funs.DB.Base_DisciplinesWBS on x.DisciplinesWBSId equals y.DisciplinesWBSId
|
|
where x.DepartId == type && y.DisciplinesWBSCode == disciplinesWBSCode && y.DisciplinesWBSName == disciplinesWBSName
|
|
orderby x.QuantityDesctiption
|
|
select x.QuantityDesctiption).Distinct().ToList();
|
|
}
|
|
#endregion
|
|
|
|
#region PlanMHRsUnit 下拉值加载
|
|
public static void InitPlanMHRsUnitDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease,string type, string disciplinesWBSCode, string disciplinesWBSName, string quantityDesctiption)
|
|
{
|
|
dropName.DataValueField = "PlanMHRsUnit";
|
|
dropName.DataTextField = "PlanMHRsUnit";
|
|
dropName.DataSource = GetPlanMHRsUnitList(type,disciplinesWBSCode, disciplinesWBSName, quantityDesctiption);
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName, "-请选择-");
|
|
}
|
|
}
|
|
|
|
public static List<string> GetPlanMHRsUnitList(string type, string disciplinesWBSCode, string disciplinesWBSName, string quantityDesctiption)
|
|
{
|
|
return (from x in Funs.DB.Base_QuantityDesctiption
|
|
join y in Funs.DB.Base_DisciplinesWBS on x.DisciplinesWBSId equals y.DisciplinesWBSId
|
|
where x.DepartId == type && y.DisciplinesWBSCode == disciplinesWBSCode && y.DisciplinesWBSName == disciplinesWBSName
|
|
&& x.QuantityDesctiption == quantityDesctiption
|
|
orderby x.PlanMHRsUnit
|
|
select x.PlanMHRsUnit.ToString()).Distinct().ToList();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|