コード例 #1
0
ファイル: TicketService.cs プロジェクト: paddy235/BSFramework
        //perqfr 第二许可人对不上  jz 没有 地点没有
        public TicketEntity GetDetail(string ticketid, string ticketStr)
        {
            var       db = new TicketContext();
            DataTable dt;

            switch (ticketStr)
            {
            case "红雁池":
                dt = db.HyGetDetail(ticketid);
                break;

            default:
                dt = db.GetDetail(ticketid);
                break;
            }
            if (dt == null || dt.Rows.Count == 0)
            {
                return(null);
            }
            var result = new TicketEntity()
            {
                TicketId       = dt.Rows[0].Field <string>("gzpid"),
                TicketCode     = dt.Rows[0].Field <string>("gzpbh"),
                Unit           = dt.Rows[0].Field <string>("jz"),
                Category       = dt.Rows[0].Field <string>("category"),
                DutyPerson     = dt.Rows[0].Field <string>("pergzfzr"),
                DutyPerson2    = dt.Rows[0].Field <string>("pergzfzrx"),
                StartTime      = dt.Rows[0].Field <DateTime?>("xkgzdate"),
                Content        = dt.Rows[0].Field <string>("gznr"),
                ApprovePerson  = dt.Rows[0].Field <string>("perxkgzxkr"),
                ApprovePerson2 = dt.Rows[0].Field <string>("perqfr"),
                EndTime        = dt.Rows[0].Field <DateTime?>("pzjsdate"),
                TicketStatus   = dt.Rows[0].Field <string>("gzpstatus"),
                EndTime2       = dt.Rows[0].Field <DateTime?>("yqdate"),
                DeptName       = dt.Rows[0].Field <string>("bz"),
                WorkMate       = dt.Rows[0].Field <string>("cy"),
                Place          = dt.Rows[0].Field <string>("gzdd"),
                OtherTickets   = new Dictionary <string, int>()
            };

            switch (ticketStr)
            {
            case "红雁池":
                var OtherTickets = db.HYgetNum(ticketid);
                result.OtherTickets.Add("一级动火证", OtherTickets.FirstOrDefault(x => x.Key == "一级动火工作票").Value);
                result.OtherTickets.Add("二级动火证", OtherTickets.FirstOrDefault(x => x.Key == "二级动火工作票").Value);
                result.OtherTickets.Add("风险作业审批单", OtherTickets.FirstOrDefault(x => x.Key == "").Value);
                result.OtherTickets.Add("热控保护措施票", OtherTickets.FirstOrDefault(x => x.Key == "热控保护措施票").Value);
                result.OtherTickets.Add("继电保护措施票", OtherTickets.FirstOrDefault(x => x.Key == "继电保护措施票").Value);
                result.OtherTickets.Add("作业安全措施票", OtherTickets.FirstOrDefault(x => x.Key == "作业安全措施票").Value);
                break;

            default:
                result.OtherTickets.Add("一级动火证", db.GetNum1(result.TicketCode));
                result.OtherTickets.Add("二级动火证", db.GetNum2(result.TicketCode));
                result.OtherTickets.Add("风险作业审批单", db.GetNum3(result.TicketCode));
                result.OtherTickets.Add("热控保护措施票", db.GetNum4(result.TicketCode));
                result.OtherTickets.Add("继电保护措施票", db.GetNum5(result.TicketCode));
                result.OtherTickets.Add("作业安全措施票", db.GetNum6(result.TicketCode));
                break;
            }



            return(result);
        }