155 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			155 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
using Model;
 | 
						|
using System;
 | 
						|
using System.Collections;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Globalization;
 | 
						|
using System.Linq;
 | 
						|
using System.Text;
 | 
						|
using System.Threading.Tasks;
 | 
						|
using System.Web.UI.WebControls;
 | 
						|
 | 
						|
namespace BLL
 | 
						|
{
 | 
						|
    public class CheckFineService
 | 
						|
    {
 | 
						|
        public static Model.SGGLDB db = Funs.DB;
 | 
						|
        /// <summary>
 | 
						|
        /// 根据质量检查与控制Id删除一个质量检查与控制信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="CheckControlId"></param>
 | 
						|
        public static void DeleteCheckList(string id)
 | 
						|
        {
 | 
						|
            Model.SGGLDB db = Funs.DB;
 | 
						|
            Model.Check_CheckFine CheckFine = db.Check_CheckFine.First(e => e.CheckFineId == id);
 | 
						|
            db.Check_CheckFine.DeleteOnSubmit(CheckFine);
 | 
						|
            db.SubmitChanges();
 | 
						|
        }
 | 
						|
        
 | 
						|
        /// <summary>
 | 
						|
        /// 添加质量检查与控制
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="CheckControl"></param>
 | 
						|
        public static void AddCheckFine(Model.Check_CheckFine CheckControl)
 | 
						|
        {
 | 
						|
            Model.SGGLDB db = Funs.DB;
 | 
						|
            Model.Check_CheckFine newCheckControl = new Model.Check_CheckFine();
 | 
						|
            newCheckControl.CheckFineId = CheckControl.CheckFineId;
 | 
						|
            newCheckControl.CheckControlCode = CheckControl.CheckControlCode;
 | 
						|
            newCheckControl.ProposeUnitId = CheckControl.ProposeUnitId;
 | 
						|
            newCheckControl.DocCode = CheckControl.DocCode;
 | 
						|
            newCheckControl.ProjectId = CheckControl.ProjectId;
 | 
						|
            newCheckControl.UnitWorkId = CheckControl.UnitWorkId;
 | 
						|
            newCheckControl.UnitId = CheckControl.UnitId;
 | 
						|
            newCheckControl.CheckDate = CheckControl.CheckDate;
 | 
						|
            newCheckControl.CheckMan = CheckControl.CheckMan;
 | 
						|
            newCheckControl.Fee = CheckControl.Fee;
 | 
						|
            newCheckControl.QuestionDef = CheckControl.QuestionDef;
 | 
						|
            newCheckControl.LimitDate = CheckControl.LimitDate;
 | 
						|
            newCheckControl.RectifyOpinion = CheckControl.RectifyOpinion;
 | 
						|
            newCheckControl.AttachUrl = CheckControl.AttachUrl;
 | 
						|
            newCheckControl.HandleWay = CheckControl.HandleWay;
 | 
						|
            newCheckControl.State = CheckControl.State;
 | 
						|
            newCheckControl.SaveHandleMan = CheckControl.SaveHandleMan;
 | 
						|
 | 
						|
            db.Check_CheckFine.InsertOnSubmit(newCheckControl);
 | 
						|
            db.SubmitChanges();
 | 
						|
        }
 | 
						|
    
 | 
						|
        /// <summary>
 | 
						|
        /// 根据质量检查与控制Id获取一个质量检查与控制信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="CheckControlDetailId"></param>
 | 
						|
        public static Model.Check_CheckFine CheckFine(string id)
 | 
						|
        {
 | 
						|
            return Funs.DB.Check_CheckFine.FirstOrDefault(e => e.CheckFineId == id);
 | 
						|
        }
 | 
						|
         /// <summary>
 | 
						|
        /// 修改质量检查与控制
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="CheckControl"></param>
 | 
						|
        public static void UpdateCheckControl(Model.Check_CheckFine CheckControl)
 | 
						|
        {
 | 
						|
            Model.SGGLDB db = Funs.DB;
 | 
						|
            Model.Check_CheckFine newCheckControl = db.Check_CheckFine.First(e => e.CheckFineId == CheckControl.CheckFineId);
 | 
						|
            newCheckControl.DocCode = CheckControl.DocCode;
 | 
						|
            newCheckControl.ProposeUnitId = CheckControl.ProposeUnitId;
 | 
						|
            newCheckControl.UnitWorkId = CheckControl.UnitWorkId;
 | 
						|
            newCheckControl.UnitId = CheckControl.UnitId;
 | 
						|
            newCheckControl.CheckDate = CheckControl.CheckDate;
 | 
						|
            newCheckControl.CheckControlCode = CheckControl.CheckControlCode;
 | 
						|
 | 
						|
            newCheckControl.Fee = CheckControl.Fee;
 | 
						|
            
 | 
						|
            newCheckControl.QuestionDef = CheckControl.QuestionDef;
 | 
						|
            newCheckControl.LimitDate = CheckControl.LimitDate;
 | 
						|
            newCheckControl.RectifyOpinion = CheckControl.RectifyOpinion;
 | 
						|
            newCheckControl.AttachUrl = CheckControl.AttachUrl;
 | 
						|
            newCheckControl.HandleWay = CheckControl.HandleWay;
 | 
						|
            
 | 
						|
            newCheckControl.State = CheckControl.State;
 | 
						|
            newCheckControl.SaveHandleMan = CheckControl.SaveHandleMan;
 | 
						|
 | 
						|
            db.SubmitChanges();
 | 
						|
        }
 | 
						|
         
 | 
						|
        
 | 
						|
         public static int GetListCount(string projectId)
 | 
						|
        {
 | 
						|
            using (var db = new Model.SGGLDB(Funs.ConnString))
 | 
						|
            {
 | 
						|
                IQueryable<Model.Check_CheckFine> q = db.Check_CheckFine;
 | 
						|
                if (!string.IsNullOrEmpty(projectId))
 | 
						|
                {
 | 
						|
                    q = q.Where(e => e.ProjectId == projectId);
 | 
						|
                }
 | 
						|
 | 
						|
                return q.Count();
 | 
						|
            }
 | 
						|
 | 
						|
        }
 | 
						|
 | 
						|
        public static void Init(FineUIPro.DropDownList dropName, string state, bool isShowPlease)
 | 
						|
        {
 | 
						|
            dropName.DataValueField = "Value";
 | 
						|
            dropName.DataTextField = "Text";
 | 
						|
            dropName.DataSource = GetDHandleTypeByState(state);
 | 
						|
            dropName.DataBind();
 | 
						|
            if (isShowPlease)
 | 
						|
            {
 | 
						|
                Funs.FineUIPleaseSelect(dropName);
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据状态选择下一步办理类型
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="state"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static ListItem[] GetDHandleTypeByState(string state)
 | 
						|
        {
 | 
						|
            if (state == Const.CheckFine_Compile || state == Const.CheckFine_ReCompile)  //无是否同意
 | 
						|
            {
 | 
						|
                ListItem[] lis = new ListItem[1];
 | 
						|
                lis[0] = new ListItem("现场质量经理审核", Const.CheckFine_Audit1);
 | 
						|
                return lis;
 | 
						|
            }
 | 
						|
            else if (state == Const.CheckFine_Audit1)//有是否同意
 | 
						|
            {
 | 
						|
                ListItem[] lis = new ListItem[2];
 | 
						|
                lis[0] = new ListItem("现场经理/施工经理审批", Const.CheckFine_Audit2);//是 加载
 | 
						|
                lis[1] = new ListItem("重新编制", Const.CheckFine_ReCompile);//否加载
 | 
						|
                return lis;
 | 
						|
            }
 | 
						|
            else if (state == Const.CheckFine_Audit2)//无是否同意
 | 
						|
            {
 | 
						|
                ListItem[] lis = new ListItem[2];
 | 
						|
                lis[0] = new ListItem("审批完成", Const.CheckFine_Complete);
 | 
						|
                lis[1] = new ListItem("重新编制", Const.CheckFine_ReCompile);
 | 
						|
                return lis;
 | 
						|
            }
 | 
						|
            else
 | 
						|
                return null;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |