247 lines
12 KiB
C#
247 lines
12 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
public class SESRelatedDataService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取SES相关数据
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public static Model.FC_SESRelatedData GetSESRelatedDataById(string id)
|
|
{
|
|
int Id = Convert.ToInt32(id);
|
|
return Funs.DB.FC_SESRelatedData.FirstOrDefault(e => e.ID == Id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取SES视图数据
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public static Model.View_FC_SESRelatedData GetSESRelatedDataViewById(string id)
|
|
{
|
|
return Funs.DB.View_FC_SESRelatedData.FirstOrDefault(e => e.ID == Convert.ToInt32(id));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据FO_No获取SES视图数据
|
|
/// </summary>
|
|
/// <param name="foNo"></param>
|
|
/// <returns></returns>
|
|
public static Model.View_FC_SESRelatedData GetSESRelatedDataViewByFO(string foNo)
|
|
{
|
|
return Funs.DB.View_FC_SESRelatedData.FirstOrDefault(e => e.FO_NO == foNo);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取最大的ID
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static int GetMaxId()
|
|
{
|
|
return (from x in Funs.DB.FC_SESRelatedData select x.ID).FirstOrDefault();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加
|
|
/// </summary>
|
|
/// <param name="SESRelatedData"></param>
|
|
public static void AddSESRelatedData(Model.FC_SESRelatedData SESRelatedData)
|
|
{
|
|
Model.FC_SESRelatedData newSESRelatedData = new Model.FC_SESRelatedData();
|
|
newSESRelatedData.ID = SESRelatedData.ID;
|
|
newSESRelatedData.FO_NO = SESRelatedData.FO_NO;
|
|
newSESRelatedData.Contract_Title = SESRelatedData.Contract_Title;
|
|
newSESRelatedData.Contractor = SESRelatedData.Contractor;
|
|
newSESRelatedData.Pricing_Scheme = SESRelatedData.Pricing_Scheme;
|
|
newSESRelatedData.Item = SESRelatedData.Item;
|
|
newSESRelatedData.Material_Group = SESRelatedData.Material_Group;
|
|
newSESRelatedData.Purchase_Group = SESRelatedData.Purchase_Group;
|
|
newSESRelatedData.Cost_Element = SESRelatedData.Cost_Element;
|
|
newSESRelatedData.Vendor_NO = SESRelatedData.Vendor_NO;
|
|
newSESRelatedData.Currency = SESRelatedData.Currency;
|
|
newSESRelatedData.Original_WC = SESRelatedData.Original_WC;
|
|
newSESRelatedData.Type = SESRelatedData.Type;
|
|
newSESRelatedData.Contract_Admin = SESRelatedData.Contract_Admin;
|
|
newSESRelatedData.Cost_Checker = SESRelatedData.Cost_Checker;
|
|
newSESRelatedData.Buyer = SESRelatedData.Buyer;
|
|
newSESRelatedData.BuyerId = SESRelatedData.BuyerId;
|
|
newSESRelatedData.Main_Coordinator = SESRelatedData.Main_Coordinator;
|
|
newSESRelatedData.User_Representative = SESRelatedData.User_Representative;
|
|
newSESRelatedData.Applicant = SESRelatedData.Applicant;
|
|
newSESRelatedData.Validate_Date = SESRelatedData.Validate_Date;
|
|
newSESRelatedData.Expire_Date = SESRelatedData.Expire_Date;
|
|
newSESRelatedData.FC_Status = SESRelatedData.FC_Status;
|
|
newSESRelatedData.Contract_Person = SESRelatedData.Contract_Person;
|
|
newSESRelatedData.Contract_Tel = SESRelatedData.Contract_Tel;
|
|
newSESRelatedData.Total_Budget = SESRelatedData.Total_Budget;
|
|
newSESRelatedData.Proportion_of_FC_Definition = SESRelatedData.Proportion_of_FC_Definition;
|
|
newSESRelatedData.Actual_Budget = SESRelatedData.Actual_Budget;
|
|
newSESRelatedData.DateIn = SESRelatedData.DateIn;
|
|
newSESRelatedData.Remark = SESRelatedData.Remark;
|
|
newSESRelatedData.Remark1 = SESRelatedData.Remark1;
|
|
newSESRelatedData.OldSAPData = SESRelatedData.OldSAPData;
|
|
newSESRelatedData.ConstRecords = SESRelatedData.ConstRecords;
|
|
newSESRelatedData.DisciplineId = SESRelatedData.DisciplineId;
|
|
newSESRelatedData.FOTypeId = SESRelatedData.FOTypeId;
|
|
newSESRelatedData.ConnectedTransaction = SESRelatedData.ConnectedTransaction;
|
|
newSESRelatedData.Contract_Title_CN = SESRelatedData.Contract_Title_CN;
|
|
|
|
newSESRelatedData.Allocation = SESRelatedData.Allocation;
|
|
|
|
newSESRelatedData.Email = SESRelatedData.Email;
|
|
newSESRelatedData.MainHead = SESRelatedData.MainHead;
|
|
newSESRelatedData.MainHeadContact = SESRelatedData.MainHeadContact;
|
|
newSESRelatedData.SafetyOfficer = SESRelatedData.SafetyOfficer;
|
|
newSESRelatedData.SafetyOfficerContact = SESRelatedData.SafetyOfficerContact;
|
|
newSESRelatedData.ProjectManager = SESRelatedData.ProjectManager;
|
|
newSESRelatedData.ProjectManagerContact = SESRelatedData.ProjectManagerContact;
|
|
|
|
newSESRelatedData.ExceedLimit = SESRelatedData.ExceedLimit;
|
|
newSESRelatedData.CreateDate = SESRelatedData.CreateDate;
|
|
newSESRelatedData.CreatePerson = SESRelatedData.CreatePerson;
|
|
newSESRelatedData.InitialBudget = SESRelatedData.InitialBudget;
|
|
newSESRelatedData.IfExtend = SESRelatedData.IfExtend;
|
|
newSESRelatedData.PreviousFO = SESRelatedData.PreviousFO;
|
|
newSESRelatedData.InitialAllocation = SESRelatedData.InitialAllocation;
|
|
|
|
Funs.DB.FC_SESRelatedData.InsertOnSubmit(newSESRelatedData);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="SESRelatedData"></param>
|
|
public static void UpdateSESRelatedData(Model.FC_SESRelatedData SESRelatedData)
|
|
{
|
|
Model.FC_SESRelatedData newSESRelatedData = Funs.DB.FC_SESRelatedData.FirstOrDefault(e => e.ID == SESRelatedData.ID);
|
|
if (newSESRelatedData != null)
|
|
{
|
|
newSESRelatedData.FO_NO = SESRelatedData.FO_NO;
|
|
newSESRelatedData.Contract_Title = SESRelatedData.Contract_Title;
|
|
newSESRelatedData.Contractor = SESRelatedData.Contractor;
|
|
newSESRelatedData.Pricing_Scheme = SESRelatedData.Pricing_Scheme;
|
|
newSESRelatedData.Item = SESRelatedData.Item;
|
|
newSESRelatedData.Material_Group = SESRelatedData.Material_Group;
|
|
newSESRelatedData.Purchase_Group = SESRelatedData.Purchase_Group;
|
|
newSESRelatedData.Cost_Element = SESRelatedData.Cost_Element;
|
|
newSESRelatedData.Vendor_NO = SESRelatedData.Vendor_NO;
|
|
newSESRelatedData.Currency = SESRelatedData.Currency;
|
|
newSESRelatedData.Original_WC = SESRelatedData.Original_WC;
|
|
newSESRelatedData.Type = SESRelatedData.Type;
|
|
newSESRelatedData.Contract_Admin = SESRelatedData.Contract_Admin;
|
|
newSESRelatedData.Cost_Checker = SESRelatedData.Cost_Checker;
|
|
newSESRelatedData.Buyer = SESRelatedData.Buyer;
|
|
newSESRelatedData.BuyerId = SESRelatedData.BuyerId;
|
|
newSESRelatedData.Main_Coordinator = SESRelatedData.Main_Coordinator;
|
|
newSESRelatedData.User_Representative = SESRelatedData.User_Representative;
|
|
newSESRelatedData.Applicant = SESRelatedData.Applicant;
|
|
newSESRelatedData.Validate_Date = SESRelatedData.Validate_Date;
|
|
newSESRelatedData.Expire_Date = SESRelatedData.Expire_Date;
|
|
newSESRelatedData.FC_Status = SESRelatedData.FC_Status;
|
|
newSESRelatedData.Contract_Person = SESRelatedData.Contract_Person;
|
|
newSESRelatedData.Contract_Tel = SESRelatedData.Contract_Tel;
|
|
newSESRelatedData.Total_Budget = SESRelatedData.Total_Budget;
|
|
newSESRelatedData.Proportion_of_FC_Definition = SESRelatedData.Proportion_of_FC_Definition;
|
|
newSESRelatedData.Actual_Budget = SESRelatedData.Actual_Budget;
|
|
newSESRelatedData.DateIn = SESRelatedData.DateIn;
|
|
newSESRelatedData.Remark = SESRelatedData.Remark;
|
|
newSESRelatedData.Remark1 = SESRelatedData.Remark1;
|
|
newSESRelatedData.OldSAPData = SESRelatedData.OldSAPData;
|
|
newSESRelatedData.ConstRecords = SESRelatedData.ConstRecords;
|
|
newSESRelatedData.DisciplineId = SESRelatedData.DisciplineId;
|
|
newSESRelatedData.FOTypeId = SESRelatedData.FOTypeId;
|
|
newSESRelatedData.ConnectedTransaction = SESRelatedData.ConnectedTransaction;
|
|
newSESRelatedData.Contract_Title_CN = SESRelatedData.Contract_Title_CN;
|
|
|
|
newSESRelatedData.Allocation = SESRelatedData.Allocation;
|
|
newSESRelatedData.Email = SESRelatedData.Email;
|
|
newSESRelatedData.MainHead = SESRelatedData.MainHead;
|
|
newSESRelatedData.MainHeadContact = SESRelatedData.MainHeadContact;
|
|
newSESRelatedData.SafetyOfficer = SESRelatedData.SafetyOfficer;
|
|
newSESRelatedData.SafetyOfficerContact = SESRelatedData.SafetyOfficerContact;
|
|
newSESRelatedData.ProjectManager = SESRelatedData.ProjectManager;
|
|
newSESRelatedData.ProjectManagerContact = SESRelatedData.ProjectManagerContact;
|
|
|
|
newSESRelatedData.ExceedLimit = SESRelatedData.ExceedLimit;
|
|
newSESRelatedData.ModifyDate = SESRelatedData.ModifyDate;
|
|
newSESRelatedData.ModifyPerson = SESRelatedData.ModifyPerson;
|
|
newSESRelatedData.InitialBudget = SESRelatedData.InitialBudget;
|
|
newSESRelatedData.IfExtend = SESRelatedData.IfExtend;
|
|
newSESRelatedData.PreviousFO = SESRelatedData.PreviousFO;
|
|
newSESRelatedData.InitialAllocation = SESRelatedData.InitialAllocation;
|
|
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
public static void DeleteSESRelatedDataById(string id)
|
|
{
|
|
Model.FC_SESRelatedData data = Funs.DB.FC_SESRelatedData.FirstOrDefault(e => e.ID == Convert.ToInt32(id));
|
|
if (data != null)
|
|
{
|
|
Funs.DB.FC_SESRelatedData.DeleteOnSubmit(data);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断FONO是否存在
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <param name="FO_NO"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExistFO_NO(string id, string FO_NO)
|
|
{
|
|
bool isExist = false;
|
|
var fono = Funs.DB.FC_SESRelatedData.FirstOrDefault(x => x.FO_NO == FO_NO && x.ID != Convert.ToInt32(id));
|
|
if (fono != null)
|
|
{
|
|
isExist = true;
|
|
}
|
|
return isExist;
|
|
}
|
|
|
|
public static Model.FC_SESRelatedData GetSESRelatedDataByFoNo(string fono)
|
|
{
|
|
return Funs.DB.FC_SESRelatedData.FirstOrDefault(e => e.FO_NO == fono);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取合同列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.FC_SESRelatedData> GetSESRelatedDataList()
|
|
{
|
|
return (from x in Funs.DB.FC_SESRelatedData orderby x.FO_NO select x).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据承包商ID获取未关闭的FO
|
|
/// </summary>
|
|
/// <param name="dropName"></param>
|
|
/// <param name="ContractorId"></param>
|
|
/// <param name="isShowPlease"></param>
|
|
public static void InitFONoDropDownList(FineUIPro.DropDownList dropName, string ContractorId, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "FO_NO";
|
|
dropName.DataTextField = "FO_NO";
|
|
dropName.DataSource = (from x in Funs.DB.FC_SESRelatedData where x.Contractor == ContractorId && x.FC_Status != "Closed" orderby x.FO_NO select x.FO_NO).Distinct();
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
}
|
|
}
|