using System; using System.Linq; namespace FineUIPro.Web.Controls { public partial class QRCodePrint : PageBase { /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.getQRUrl(); } } private void getQRUrl() { if (!string.IsNullOrEmpty(Request.Params["PersonId"])) { ////人员 var getp = BLL.Person_PersonsService.GetPerson_PersonsByProjectPersonId(Request.Params["PersonId"]); if (getp != null && !string.IsNullOrEmpty(getp.QRCodeAttachUrl)) { this.imgPhoto.Src = "../" + getp.QRCodeAttachUrl; var siteperson = BLL.SitePerson_PersonService.GetSitePersonByProjectIdPersonId(this.CurrUser.LoginProjectId, getp.PersonId); if (siteperson != null) { this.lbWedCode.Text = "人员卡号:" + siteperson.CardNo; } this.lbWedName.Text = "人员姓名:" + getp.PersonName; Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(getp.UnitId); string unitName = string.Empty; if (unit != null) { unitName = unit.UnitName; } this.lbUnitName.Text = "人员单位:" + unitName; } } else if (!string.IsNullOrEmpty(Request.Params["TrainingPlanId"])) { ///培训计划 var trainingPlan = BLL.Funs.DB.Training_Plan.FirstOrDefault(x => x.PlanId == Request.Params["TrainingPlanId"]); if (trainingPlan != null && !string.IsNullOrEmpty(trainingPlan.QRCodeUrl)) { this.imgPhoto.Src = "../" + trainingPlan.QRCodeUrl; string code = string.Empty; if (!string.IsNullOrEmpty(trainingPlan.PlanCode)) { code = trainingPlan.PlanCode; } else { code = BLL.CodeRecordsService.ReturnCodeByDataId(trainingPlan.PlanId); } this.lbWedCode.Text = "编号:" + code; this.lbWedName.Text = "名称:" + trainingPlan.PlanName; this.lbUnitName.Text = "培训时间:" + string.Format("{0:yyyy-MM-dd}", trainingPlan.TrainStartDate) + ";培训地点:" + trainingPlan.TeachAddress; } } else if (!string.IsNullOrEmpty(Request.Params["TestPlanId"])) { ///培训计划 var testPlan = BLL.Funs.DB.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == Request.Params["TestPlanId"]); if (testPlan != null && !string.IsNullOrEmpty(testPlan.QRCodeUrl)) { this.imgPhoto.Src = "../" + testPlan.QRCodeUrl; string code = string.Empty; if (!string.IsNullOrEmpty(testPlan.PlanCode)) { code = testPlan.PlanCode; } else { code = BLL.CodeRecordsService.ReturnCodeByDataId(testPlan.PlanId); } this.lbWedCode.Text = "编号:" + code; this.lbWedName.Text = "名称:" + testPlan.PlanName; this.lbUnitName.Text = "考试扫码时间:" + string.Format("{0:yyyy-MM-dd}", testPlan.TestStartTime) + ";考试地点:" + testPlan.TestPalce; } } else if (!string.IsNullOrEmpty(Request.Params["ServerTestPlanId"])) { ///知识竞赛 var testPlan = BLL.ServerTestPlanService.GetTestPlanById(Request.Params["ServerTestPlanId"]); if (testPlan != null && !string.IsNullOrEmpty(testPlan.QRCodeUrl)) { this.imgPhoto.Src = "../" + testPlan.QRCodeUrl; this.lbWedCode.Text = "编号:" + testPlan.PlanCode; this.lbWedName.Text = "名称:" + testPlan.PlanName; this.lbUnitName.Text = "扫码考试时间:" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", testPlan.TestStartTime) + ";至:" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", testPlan.TestEndTime); } } } } }