84 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Linq;
 | 
						|
using System.Text;
 | 
						|
 | 
						|
namespace BLL
 | 
						|
{
 | 
						|
    /// <summary>
 | 
						|
    /// 钢结构完成情况
 | 
						|
    /// </summary>
 | 
						|
    public class SteelStructureCompletionService
 | 
						|
    {
 | 
						|
        public static Model.SGGLDB db = Funs.DB;
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据主键获取钢结构完成情况
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="steelStructureCompletionId"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static Model.JDGL_SteelStructureCompletion GetSteelStructureCompletionById(string steelStructureCompletionId)
 | 
						|
        {
 | 
						|
            return Funs.DB.JDGL_SteelStructureCompletion.FirstOrDefault(e => e.SteelStructureCompletionId == steelStructureCompletionId);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 添加钢结构完成情况
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="steelStructureCompletion"></param>
 | 
						|
        public static void AddSteelStructureCompletion(Model.JDGL_SteelStructureCompletion steelStructureCompletion)
 | 
						|
        {
 | 
						|
            Model.SGGLDB db = Funs.DB;
 | 
						|
            Model.JDGL_SteelStructureCompletion newSteelStructureCompletion = new Model.JDGL_SteelStructureCompletion
 | 
						|
            {
 | 
						|
                SteelStructureCompletionId = steelStructureCompletion.SteelStructureCompletionId,
 | 
						|
                ProjectId = steelStructureCompletion.ProjectId,
 | 
						|
                UnitId = steelStructureCompletion.UnitId,
 | 
						|
                TotalNum = steelStructureCompletion.TotalNum,
 | 
						|
                ArrivalNum = steelStructureCompletion.ArrivalNum,
 | 
						|
                ThisNum = steelStructureCompletion.ThisNum,
 | 
						|
                CompileMan = steelStructureCompletion.CompileMan,
 | 
						|
                CompileDate = steelStructureCompletion.CompileDate,
 | 
						|
                StartDate = steelStructureCompletion.StartDate,
 | 
						|
                EndDate = steelStructureCompletion.EndDate
 | 
						|
            };
 | 
						|
            db.JDGL_SteelStructureCompletion.InsertOnSubmit(newSteelStructureCompletion);
 | 
						|
            db.SubmitChanges();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 修改钢结构完成情况
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="steelStructureCompletion"></param>
 | 
						|
        public static void UpdateSteelStructureCompletion(Model.JDGL_SteelStructureCompletion steelStructureCompletion)
 | 
						|
        {
 | 
						|
            Model.SGGLDB db = Funs.DB;
 | 
						|
            Model.JDGL_SteelStructureCompletion newSteelStructureCompletion = db.JDGL_SteelStructureCompletion.FirstOrDefault(e => e.SteelStructureCompletionId == steelStructureCompletion.SteelStructureCompletionId);
 | 
						|
            if (newSteelStructureCompletion != null)
 | 
						|
            {
 | 
						|
                newSteelStructureCompletion.TotalNum = steelStructureCompletion.TotalNum;
 | 
						|
                newSteelStructureCompletion.ArrivalNum = steelStructureCompletion.ArrivalNum;
 | 
						|
                newSteelStructureCompletion.ThisNum = steelStructureCompletion.ThisNum;
 | 
						|
                newSteelStructureCompletion.CompileMan = steelStructureCompletion.CompileMan;
 | 
						|
                newSteelStructureCompletion.CompileDate = steelStructureCompletion.CompileDate;
 | 
						|
                db.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据主键删除钢结构完成情况
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="steelStructureCompletionId"></param>
 | 
						|
        public static void DeleteSteelStructureCompletionById(string steelStructureCompletionId)
 | 
						|
        {
 | 
						|
            Model.SGGLDB db = Funs.DB;
 | 
						|
            var steelStructureCompletion = (from x in db.JDGL_SteelStructureCompletion where x.SteelStructureCompletionId == steelStructureCompletionId select x).FirstOrDefault();
 | 
						|
            if (steelStructureCompletion != null)
 | 
						|
            {
 | 
						|
                db.JDGL_SteelStructureCompletion.DeleteOnSubmit(steelStructureCompletion);
 | 
						|
                db.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |