122 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			122 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C#
		
	
	
	
namespace BLL
 | 
						|
{
 | 
						|
    using Model;
 | 
						|
    using System.Collections.Generic;
 | 
						|
    using System.Linq;
 | 
						|
    using System.Web.UI.WebControls;
 | 
						|
 | 
						|
    public static class Base_DetectionRateService
 | 
						|
    {
 | 
						|
        /// <summary>
 | 
						|
        ///获取探伤比例信息
 | 
						|
        /// </summary>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static Model.Base_DetectionRate GetDetectionRateByDetectionRateId(string detectionRateId)
 | 
						|
        {
 | 
						|
            return Funs.DB.Base_DetectionRate.FirstOrDefault(e => e.DetectionRateId == detectionRateId);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 增加探伤比例信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="detectionRate"></param>
 | 
						|
        public static void AddDetectionRate(Model.Base_DetectionRate detectionRate)
 | 
						|
        {
 | 
						|
            Model.SGGLDB db = Funs.DB;
 | 
						|
            Model.Base_DetectionRate newDetectionRate = new Base_DetectionRate
 | 
						|
            {
 | 
						|
                DetectionRateId = detectionRate.DetectionRateId,
 | 
						|
                DetectionRateCode = detectionRate.DetectionRateCode,
 | 
						|
                DetectionRateValue = detectionRate.DetectionRateValue,
 | 
						|
                Remark = detectionRate.Remark,
 | 
						|
                DetectionRate = detectionRate.DetectionRate
 | 
						|
            };
 | 
						|
 | 
						|
            db.Base_DetectionRate.InsertOnSubmit(newDetectionRate);
 | 
						|
            db.SubmitChanges();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 修改探伤比例信息 
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="DetectionRate"></param>
 | 
						|
        public static void UpdateDetectionRate(Model.Base_DetectionRate detectionRate)
 | 
						|
        {
 | 
						|
            Model.SGGLDB db = Funs.DB;
 | 
						|
            Model.Base_DetectionRate newDetectionRate = db.Base_DetectionRate.FirstOrDefault(e => e.DetectionRateId == detectionRate.DetectionRateId);
 | 
						|
            if (newDetectionRate != null)
 | 
						|
            {
 | 
						|
                newDetectionRate.DetectionRateCode = detectionRate.DetectionRateCode;
 | 
						|
                newDetectionRate.DetectionRateValue = detectionRate.DetectionRateValue;
 | 
						|
                newDetectionRate.Remark = detectionRate.Remark;
 | 
						|
                newDetectionRate.DetectionRate = detectionRate.DetectionRate;
 | 
						|
                db.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据探伤比例Id删除一个探伤比例信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="detectionRateId"></param>
 | 
						|
        public static void DeleteDetectionRateByDetectionRateId(string detectionRateId)
 | 
						|
        {
 | 
						|
            Model.SGGLDB db = Funs.DB;
 | 
						|
            Model.Base_DetectionRate delDetectionRate = db.Base_DetectionRate.FirstOrDefault(e => e.DetectionRateId == detectionRateId);
 | 
						|
            if (delDetectionRate != null)
 | 
						|
            {
 | 
						|
                db.Base_DetectionRate.DeleteOnSubmit(delDetectionRate);
 | 
						|
                db.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 按类型获取探伤比例项
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="DetectionRateType"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static List<Model.Base_DetectionRate> GetDetectionRateList()
 | 
						|
        {
 | 
						|
            var list = (from x in Funs.DB.Base_DetectionRate
 | 
						|
                        orderby x.DetectionRateCode
 | 
						|
                        select x).ToList();
 | 
						|
 | 
						|
            return list;
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 获取探伤比例下拉框
 | 
						|
        /// </summary>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static ListItem[] GetNDTRateNameList()
 | 
						|
        {
 | 
						|
            var q = (from x in Funs.DB.Base_DetectionRate orderby x.DetectionRateCode select x).ToList();
 | 
						|
            ListItem[] list = new ListItem[q.Count()];
 | 
						|
            for (int i = 0; i < q.Count(); i++)
 | 
						|
            {
 | 
						|
                list[i] = new ListItem(q[i].DetectionRateCode + "-" + q[i].DetectionRate.ToString() + "%", q[i].DetectionRateId.ToString());
 | 
						|
            }
 | 
						|
            return list;
 | 
						|
        }
 | 
						|
 | 
						|
        #region 探伤比例下拉项
 | 
						|
        /// <summary>
 | 
						|
        /// 探伤比例下拉项
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="dropName">下拉框名称</param>
 | 
						|
        /// <param name="isShowPlease">是否显示请选择</param>
 | 
						|
        /// <param name="DetectionRateType">耗材类型</param>
 | 
						|
        public static void InitDetectionRateDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
 | 
						|
        {
 | 
						|
            dropName.DataValueField = "Value";
 | 
						|
            dropName.DataTextField = "Text";
 | 
						|
            dropName.DataSource = GetNDTRateNameList();
 | 
						|
            dropName.DataBind();
 | 
						|
            if (isShowPlease)
 | 
						|
            {
 | 
						|
                Funs.FineUIPleaseSelect(dropName);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
}
 |