public void GetApplicantInfotabs(HttpContext context) { int ApplicantInfoID = 0; int OrderApplyID = 0; if (!string.IsNullOrEmpty(context.Request.QueryString["ApplicantInfoID"])) { ApplicantInfoID = Convert.ToInt32(context.Request.QueryString["ApplicantInfoID"]); } if (!string.IsNullOrEmpty(context.Request.QueryString["OrderApplyID"])) { OrderApplyID = Convert.ToInt32(context.Request.QueryString["OrderApplyID"]); } ApplicantInfoBackups ort = new ApplicantInfoBackups(); ApplicantInfoBLL applicantInfobll = new ApplicantInfoBLL(); ort = applicantInfobll.GetOrderModel(OrderApplyID); var b = SerializerHelper.SerializeObject(new { data = ort }); context.Response.Write(b); }
/// <summary> /// 得到一个对象实体 /// </summary> public ApplicantInfoBackups GetOrderModel(int OrderApplyID) { StringBuilder strSql = new StringBuilder(); strSql.Append(@"select top 1 aio.ApplicantInfoID, aio.OrderApplyID, aio.CName, aio.EName, aio.CardType, aio.CardCode, aio.Sex, aio.BirthDay, aio.Mobile, aio.Email, aio.CardPeriod, aio.CreatUserID, aio.RecordUpdateUserID, aio.RecordUpdateTime, aio.RecordIsDelete, aio.RecordCreateTime, ct.Name as CardTypeName,ISNULL(u.UserName,'') as CreatUserName from ApplicantInfo aio LEFT JOIN dbo.CardType ct ON ct.Value = aio.CardType LEFT JOIN [BWJSDB].[dbo].[Users] u ON u.UserID=aio.CreatUserID AND u.RecordIsDelete=0 "); strSql.Append(" where OrderApplyID=@OrderApplyID"); SqlParameter[] parameters = { new SqlParameter("@OrderApplyID", SqlDbType.Int, 4) }; parameters[0].Value = OrderApplyID; ApplicantInfoBackups model = new ApplicantInfoBackups(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ApplicantInfoID"].ToString() != "") { model.ApplicantInfoID = int.Parse(ds.Tables[0].Rows[0]["ApplicantInfoID"].ToString()); } if (ds.Tables[0].Rows[0]["OrderApplyID"].ToString() != "") { model.OrderApplyID = int.Parse(ds.Tables[0].Rows[0]["OrderApplyID"].ToString()); } model.CName = ds.Tables[0].Rows[0]["CName"].ToString(); model.EName = ds.Tables[0].Rows[0]["EName"].ToString(); if (ds.Tables[0].Rows[0]["CardType"].ToString() != "") { model.CardType = int.Parse(ds.Tables[0].Rows[0]["CardType"].ToString()); } model.CardCode = ds.Tables[0].Rows[0]["CardCode"].ToString(); if (ds.Tables[0].Rows[0]["Sex"].ToString() != "") { model.Sex = int.Parse(ds.Tables[0].Rows[0]["Sex"].ToString()); } model.BirthDay = ds.Tables[0].Rows[0]["BirthDay"].ToString(); model.Mobile = ds.Tables[0].Rows[0]["Mobile"].ToString(); model.Email = ds.Tables[0].Rows[0]["Email"].ToString(); model.CardPeriod = ds.Tables[0].Rows[0]["CardPeriod"].ToString(); if (ds.Tables[0].Rows[0]["CreatUserID"].ToString() != "") { model.CreatUserID = int.Parse(ds.Tables[0].Rows[0]["CreatUserID"].ToString()); } if (ds.Tables[0].Rows[0]["RecordUpdateUserID"].ToString() != "") { model.RecordUpdateUserID = int.Parse(ds.Tables[0].Rows[0]["RecordUpdateUserID"].ToString()); } if (ds.Tables[0].Rows[0]["RecordUpdateTime"].ToString() != "") { model.RecordUpdateTime = DateTime.Parse(ds.Tables[0].Rows[0]["RecordUpdateTime"].ToString()); } if (ds.Tables[0].Rows[0]["RecordIsDelete"].ToString() != "") { if ((ds.Tables[0].Rows[0]["RecordIsDelete"].ToString() == "1") || (ds.Tables[0].Rows[0]["RecordIsDelete"].ToString().ToLower() == "true")) { model.RecordIsDelete = true; } else { model.RecordIsDelete = false; } } if (ds.Tables[0].Rows[0]["RecordCreateTime"].ToString() != "") { model.RecordCreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["RecordCreateTime"].ToString()); } if (ds.Tables[0].Rows[0]["CardTypeName"].ToString() != "") { model.CardTypeName = ds.Tables[0].Rows[0]["CardTypeName"].ToString(); } if (ds.Tables[0].Rows[0]["CreatUserName"].ToString() != "") { model.CreatUserName = ds.Tables[0].Rows[0]["CreatUserName"].ToString(); } return(model); } else { return(null); } }