protected void BTNEstablishContract_Click(object sender, EventArgs e) { long lClientID = long.Parse(Session["UsersID"].ToString()); ClientInfoBusiness GetClientWallet = new ClientInfoBusiness(); ClientInfoEntity ClientWallet = new ClientInfoEntity(); ClientWallet = GetClientWallet.GetClientInfoByID(lClientID); long lCounsellorID = long.Parse(Request.QueryString["CounsellorID"].ToString()); CounsellorInfoBusiness CounsellorInfoBusiness = new CounsellorInfoBusiness();//实体化BLL层中的CounsellorInfoBusiness类 CounsellorInfoEntity CounsellorInfoEntity = new CounsellorInfoEntity(); CounsellorInfoEntity = CounsellorInfoBusiness.GetCounsellorInfoByID(lCounsellorID); ContractInfoBusiness ContractEstablish = new ContractInfoBusiness(); int iCounsellorContractExistDetect = int.Parse(ContractEstablish.CounsellorContractExistDetect(lClientID).ToString()); if (iCounsellorContractExistDetect > 0) { Response.Write("<script>alert('您已经与该律师签约!')</script>"); } else { if (ClientWallet.lclientWallet >= CounsellorInfoEntity.lcounsellorOfferMoney) { int iContractJudegementValue = ContractEstablish.ContractEstablish(lCounsellorID, lClientID); int iClientJudegementValue = GetClientWallet.ClientWalletMoneyUpdate(CounsellorInfoEntity.lcounsellorOfferMoney, lClientID); int iCounsellorJudegementValue = CounsellorInfoBusiness.CounsellorWalletMoneyUpdate(lCounsellorID, CounsellorInfoEntity.lcounsellorOfferMoney); if (iContractJudegementValue > 0 && iClientJudegementValue > 0 && iCounsellorJudegementValue > 0) { Response.Write("<script>alert('您已经成功签约!')</script>"); } else { Response.Write("<script>alert('签约失败!')</script>"); } } else { Response.Write("<script>alert('您的余额不足以签约!')</script>"); } } }
protected void DLWantedAnswerInfo_ItemCommand(object source, DataListCommandEventArgs e) { Button BTNSelectAsAnswer = (Button)e.Item.FindControl("BTNSelectAsAnswer"); Label LBLAnswerID = (Label)e.Item.FindControl("LBLAnswerID"); WantedInfoBusiness SetTargetAsAnswer = new WantedInfoBusiness(); int iReturnedValue = 0; if (e.CommandName == "BTNSelectAsAnswer") { //当客户登录时,若没有选定的答案,则点击后可设置最佳答案 iReturnedValue = SetTargetAsAnswer.SetAsAnswer(long.Parse(LBLAnswerID.Text)); if (iReturnedValue > 0) { long lWantedID = long.Parse(Request.QueryString["WantedID"].ToString()); CounsellorInfoBusiness CounsellorInfo = new CounsellorInfoBusiness(); ClientInfoBusiness ClientInfo = new ClientInfoBusiness(); long lCounsellorID = CounsellorInfo.GetCounsellorIDByAnswerID(long.Parse(LBLAnswerID.Text)); long lClientID = ClientInfo.GetClientIDByWantedID(lWantedID); WantedInfoBusiness WantedQuestionDetailsInfoSearch = new WantedInfoBusiness(); WantedQuestionDetailsInfoEntity WantedQuestionInfo = new WantedQuestionDetailsInfoEntity(); WantedQuestionInfo = WantedQuestionDetailsInfoSearch.WantedQuestionDetailsInfoByID(lWantedID); long lBountyMoney = WantedQuestionInfo.lwantedBounty; LBLWantedField.Text = lBountyMoney.ToString(); ClientInfo.ClientWantedBountyMoney(lBountyMoney, lClientID); CounsellorInfo.CounsellorWalletMoneyUpdate(lCounsellorID, lBountyMoney); Response.Write("<script>alert('成功设置为答案!')</script>"); } else { Response.Write("<script>alert('设置为答案失败!')</script>"); } } /** * 任何身份都可以点赞,包括游客 */ else if (e.CommandName == "BTNRespondLikedCount") { //点了点赞后,让点赞数+1 iReturnedValue = SetTargetAsAnswer.RespondLiked(long.Parse(LBLAnswerID.Text)); if (iReturnedValue > 0) { Response.Write("<script>alert('您赞了此答案!')</script>"); } else { Response.Write("<script>alert('点赞失败!!')</script>"); } } else if (e.CommandName == "BTNRespondDislikedCount") { //点了点踩后,让点踩数+1 iReturnedValue = SetTargetAsAnswer.RespondDisliked(long.Parse(LBLAnswerID.Text)); if (iReturnedValue > 0) { Response.Write("<script>alert('您踩了此答案!')</script>"); } else { Response.Write("<script>alert('点踩失败!')</script>"); } } }