private void ClientGiftPurchase(int iGiftPrice) { ClientInfoBusiness ClientRemainPoints = new ClientInfoBusiness(); ClientInfoEntity ClientInfo = new ClientInfoEntity(); ClientInfo = ClientRemainPoints.GetClientInfoByID(long.Parse(Session["UsersID"].ToString())); if ((long)iGiftPrice - (long)ClientInfo.lclientPoints < 0) { GiftTradeBusiness GiftTrade = new GiftTradeBusiness(); GiftTrade.ClientGiftPurchase(long.Parse(Request.QueryString["GiftID"].ToString()), long.Parse(Session["UsersID"].ToString())); int iReturnValue = ClientRemainPoints.ClientGiftPurchaseByPoints(iGiftPrice, long.Parse(Session["UsersID"].ToString())); if (iReturnValue > 0) { Response.Write("<script>alert('感谢您的兑换!')</script>"); } else { Response.Write("<script>alert('程序出错,兑换失败!')</script>"); } } else { Response.Write("<script>alert('您的剩余积分不足!')</script>"); } }
protected void BTNPasswordReset_Click(object sender, EventArgs e) { ClientInfoBusiness ClientInfo = new ClientInfoBusiness(); CounsellorInfoBusiness CounsellorInfo = new CounsellorInfoBusiness(); long lClientID = ClientInfo.ClientPasswordResetJudgementByClientEmailAndPhoneNumber(TBUsersEmail.Text, long.Parse(TBUsersPhoneNumber.Text)); long lCounsellorID = CounsellorInfo.CounsellorPasswordResetJudgementByCounsellorEmailAndPhoneNumber(TBUsersEmail.Text, long.Parse(TBUsersPhoneNumber.Text)); if (lClientID > 0 || lCounsellorID > 0) { if (lClientID > 0) { int iClientReturnValue = ClientInfo.ClientPasswordReset(TBUsersNewPassword.Text, lClientID); if (iClientReturnValue > 0) { Response.Write("<script>alert('您的密码重置成功!')</script>"); } } else if (lCounsellorID > 0) { int iCounsellorReturnValue = CounsellorInfo.CounsellorPasswordReset(TBUsersNewPassword.Text, lCounsellorID); if (iCounsellorReturnValue > 0) { Response.Write("<script>alert('您的密码重置成功!')</script>"); } } } else { Response.Write("<script>alert('信息错误!')</script>"); } }
protected void BTNClientAccountDestory_Click(object sender, EventArgs e) { ClientInfoBusiness ClientAccountDestory = new ClientInfoBusiness(); int iResultJudgement = ClientAccountDestory.DeleteClientInfoByClientID(long.Parse(Session["ClientID"].ToString())); if (iResultJudgement > 0) { Response.Write("<script>alert('信息已成功注销,希望您的再次光临!')</script>"); } else { Response.Write("<script>alert('注销失败!请联系管理人员!')</script>"); } }
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>"); } } }
private void ClientInfoUpdate() { ClientInfoBusiness ClientInfoUpdate = new ClientInfoBusiness(); string sNewClientSex; if (RBMale.Checked == true) { sNewClientSex = "男"; } else { sNewClientSex = "女"; } IMGClientImageUpdate(); string sClientUpdateImagePath = "WebImages/ClientImages/" + this.sNewFullyClientImagePathAndName; int iResultJudgement = 0; if (this.sNewFullyClientImagePathAndName.Substring(this.sNewFullyClientImagePathAndName.Length - 1, 1) != "N") { //如果上传图片,则更新图片路径 iResultJudgement = ClientInfoUpdate.ClientInfoUpdate(TBClientPassword.Text.ToString(), TBClientName.Text.ToString(), sNewClientSex, int.Parse(DDLClientAge.SelectedValue), TBClientEmail.Text, long.Parse(TBClientPhoneNumber.Text), long.Parse(DDLClientDepositingMoney.SelectedValue) * 10000, sClientUpdateImagePath, TBClientAddress.Text.ToString(), long.Parse(Session["ClientID"].ToString())); if (iResultJudgement > 0) { Response.Write("<script>alert('信息已修改!')</script>"); } else { Response.Write("<script>alert('信息未修改!')</script>"); } } else { //如果未上传图片,则不更新图片路径 iResultJudgement = ClientInfoUpdate.ClientInfoUpdate(TBClientPassword.Text.ToString(), TBClientName.Text.ToString(), sNewClientSex, int.Parse(DDLClientAge.SelectedValue), TBClientEmail.Text, long.Parse(TBClientPhoneNumber.Text), long.Parse(DDLClientDepositingMoney.SelectedValue) * 10000, TBClientAddress.Text.ToString(), long.Parse(Session["ClientID"].ToString())); if (iResultJudgement > 0) { Response.Write("<script>alert('信息已修改!')</script>"); } else { Response.Write("<script>alert('信息未修改!')</script>"); } } }
private void ClientLoginJudgement() { /** * 功能:查询是否存在客户 */ ClientInfoBusiness ClientExistJudgement = new ClientInfoBusiness(); if ((int)ClientExistJudgement.ClientExistJudgementByClientID(long.Parse(TBUsersAccount.Text)) > 0) { if ((int)ClientExistJudgement.ClientExistJudgementByClientPassword(TBUsersPassword.Text) > 0) { Session["UsersID"] = TBUsersAccount.Text; Response.Redirect("~/03ClientPersonalCentre.aspx"); } else { Response.Write("<script>alert('客户密码有误!')</script>"); } } else { Response.Write("<script>alert('客户账号有误!')</script>"); } }
private void UsersInfoInsert() { long UserID = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss"));//用户ID的设置 string UserPassword = TBUserPassword.Text; if (RBClientSelected.Checked == true) { long lClientPhoneNumber = long.Parse(TBUserPhoneNumber.Text); ClientInfoBusiness ClientExistJudgement = new ClientInfoBusiness(); int iClientExitsJudgement = (int)ClientExistJudgement.ClientExistJudgementByClientPhoneNumber(lClientPhoneNumber); if (iClientExitsJudgement == 0) { ClientInfoEntity ClientInfo = new ClientInfoEntity(); //实例化Entity层客户的信息 ClientInfo.lclientID = long.Parse(UserID.ToString() + "99"); //客户ID详细设置 ClientInfo.sclientPassword = TBUserPassword.Text; ClientInfo.sclientName = TBUserName.Text; if (RBUserMale.Checked == true) { ClientInfo.sclientSex = "男"; } else if (RBUserFemale.Checked == true) { ClientInfo.sclientSex = "女"; } else { Response.Write("<script>alert('请务必选择性别!')</script>"); } ClientInfo.iclientAge = int.Parse(DDLUserAge.SelectedValue); ClientInfo.sclientEmail = TBUserEmail.Text; ClientInfo.lclientPhoneNumber = long.Parse(TBUserPhoneNumber.Text); ClientInfo.lclientDepositingMoney = long.Parse(DDLClientDepositingMoney.SelectedValue) * 10000; ClientInfo.lclientWallet = 0; ClientInfo.lclientTotalDepositedMoney = 0; IMGUserImageUpLoad(); ClientInfo.sclientImage = "WebImages/ClientImages/" + this.sFullyUsersUploadImagePathAndName; ClientInfo.sclientAddress = TBClientAddress.Text; ClientInfo.lclientPoints = 0; ClientInfo.iclientLevel = 1; ClientInfoBusiness ClientRegister = new ClientInfoBusiness(); int iResultJudgement = ClientRegister.ClientInfoRegister(ClientInfo); if (iResultJudgement > 0) { Session["UsersID"] = long.Parse(UserID.ToString() + "99"); Response.Redirect("~/03ClientPersonalCentre.aspx"); } else { Response.Write("<script>alert('抱歉,未成功注册!')</script>"); } } else { Response.Write("<script>alert('该手机号已注册!')</script>"); } } else if (RBCounsellorSelected.Checked == true) { CounsellorInfoBusiness CounsellorExistInfo = new CounsellorInfoBusiness(); BlackListInfoBusiness BlackListExistInfo = new BlackListInfoBusiness(); if ((int)CounsellorExistInfo.CounsellorExistJudgementByCounsellorPhoneNumber(long.Parse(TBUserPhoneNumber.Text)) != 0) { Response.Write("<script>alert('抱歉,该手机号已注册')</script>"); } else if ((int)BlackListExistInfo.BlackListExist(long.Parse(TBUserPhoneNumber.Text), TBUserEmail.Text) > 0) { Response.Write("<script>alert('由于您的违规行为,不可注册!')</script>"); } else { CounsellorInfoEntity CounsellorInfo = new CounsellorInfoEntity(); CounsellorInfo.lcounsellorID = long.Parse(UserID.ToString() + "67"); CounsellorInfo.scounsellorPassword = TBUserPassword.Text; CounsellorInfo.scounsellorName = TBUserName.Text; if (RBUserMale.Checked == true) { CounsellorInfo.scounsellorSex = "男"; } else { CounsellorInfo.scounsellorSex = "女"; } CounsellorInfo.icounsellorAge = int.Parse(DDLUserAge.SelectedValue); CounsellorInfo.scounsellorEmail = TBUserEmail.Text; CounsellorInfo.lcounsellorPhoneNumber = long.Parse(TBUserPhoneNumber.Text); IMGUserImageUpLoad(); CounsellorInfo.scounsellorImage = "WebImages/CounsellorImages/" + this.sFullyUsersUploadImagePathAndName; CounsellorInfo.scounsellorSelfIntroduction = TBCounsellorSelfIntroduction.Text; CounsellorInfo.lcounsellorWallet = 0; CounsellorInfo.icounsellorLevel = 0; CounsellorInfo.lcounsellorOfferMoney = 0; CounsellorInfo.sacounsellorAdvantageField = CounsellorAdvantageFieldsInfo(); CounsellorInfoBusiness CounsellorInfoRegister = new CounsellorInfoBusiness(); int iResultJudgement = CounsellorInfoRegister.CounsellorInfoRegister(CounsellorInfo); if (iResultJudgement > 0) { Session["UsersID"] = long.Parse(UserID.ToString() + "67"); Response.Redirect("~/03CounsellorPersonalCentre.aspx"); } 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>"); } } }
private void ClientInfoDisplayPage() { /** * 展示客户的一些信息 */ int iClientAge; int iClientDepositingMoney; long lClientID = long.Parse(Session["UsersID"].ToString()); //接收Login页面传来的Session ClientInfoBusiness ClientInfoBusiness = new ClientInfoBusiness(); //实体化BLL层中的ClientInfoBusiness类 ClientInfoEntity ClientInfoEntity = new ClientInfoEntity(); if (!IsPostBack) { ClientInfoEntity = ClientInfoBusiness.GetClientInfoByID(lClientID); if (ClientInfoEntity.sclientSex == "男") { LBLClientSexPolitely.Text = "先生"; } else { LBLClientSexPolitely.Text = "女士"; } LBLClientID.Text = ClientInfoEntity.lclientID.ToString(); TBClientPassword.Text = ClientInfoEntity.sclientPassword; LBLClientNameGreeting.Text = ClientInfoEntity.sclientName; TBClientName.Text = ClientInfoEntity.sclientName; if (ClientInfoEntity.sclientSex == "男") { RBMale.Checked = true; } else { RBFemale.Checked = true; } for (iClientAge = 18; iClientAge < 126; iClientAge++)//绑定18~120岁 { DDLClientAge.Items.Add(iClientAge.ToString()); } DDLClientAge.SelectedValue = ClientInfoEntity.iclientAge.ToString(); TBClientEmail.Text = ClientInfoEntity.sclientEmail; TBClientPhoneNumber.Text = ClientInfoEntity.lclientPhoneNumber.ToString(); for (iClientDepositingMoney = 0; iClientDepositingMoney < 101; iClientDepositingMoney += 5)//绑定1~x万元 { DDLClientDepositingMoney.Items.Add(iClientDepositingMoney.ToString()); } LBLClientWallet.Text = ClientInfoEntity.lclientWallet.ToString(); IMGClientImage.ImageUrl = ClientInfoEntity.sclientImage; TBClientAddress.Text = ClientInfoEntity.sclientAddress; LBLClientPoints.Text = ClientInfoEntity.lclientPoints.ToString(); LBLClientLevel.Text = ClientInfoEntity.iclientLevel.ToString(); for (int iWantedOfferMoney = 5; iWantedOfferMoney < 101; iWantedOfferMoney += 5) //绑定1~x万元 { //悬赏金额 DDLWantedOfferMoney.Items.Add(iWantedOfferMoney.ToString()); } } }