protected void DoSave(object sender, EventArgs e) { try { BOLUserBuys UserBuysBOL = new BOLUserBuys(1); UserBuys CurUserBuy = ((IBaseBOL <UserBuys>)UserBuysBOL).GetDetails((int)Code); BOLUserTransactions UserTransactionsBOL = new BOLUserTransactions(1); UserTransactions CurTransaction = ((IBaseBOL <UserTransactions>)UserTransactionsBOL).GetDetails(CurUserBuy.TransactionCode); string Authority = txtAuthority.Text; string BankName = txtBankName.Text; string BankState = txtBankState.Text; string Comment = txtComment.Text; string DigitalSignature = txtDigitalSignature.Text; string FishNo = txtFishNo.Text; string UserIP = txtUserIP.Text; int? NullVal = null; int?BankCode = cboBankCode.SelectedValue == "" ? NullVal : Convert.ToInt32(cboBankCode.SelectedValue); int?ChargeTypeCode = cboChargeTypeCode.SelectedValue == "" ? NullVal : Convert.ToInt32(cboChargeTypeCode.SelectedValue); int?HCTransStatusCode = cboHCTransStatusCode.SelectedValue == "" ? NullVal : Convert.ToInt32(cboHCTransStatusCode.SelectedValue); DateTime?ChargeDate = dteChargeDate.SelectedDateChristian; DateTime?PayDate = dtePayDate.SelectedDateChristian; UserTransactionsBOL.UpdateTrans(CurUserBuy.TransactionCode, Authority, BankName, BankState, Comment, DigitalSignature, FishNo, UserIP, BankCode, ChargeTypeCode, HCTransStatusCode, ChargeDate, PayDate); //Tools.CloseWin(Page, Master, BaseID, ViewState["InstanceName"].ToString()); } catch { } }
protected void btnPayCost_Click(object sender, ImageClickEventArgs e) { string Name = txtName.Text; string Email = txtEmail.Text; if (string.IsNullOrEmpty(Name)) { msg.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msg.Text = "لطفا نام را وارد کنید"; return; } if (string.IsNullOrEmpty(Email)) { msg.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msg.Text = "لطفا ایمیل را وارد کنید"; return; } string AfterBuyUrl = "http://www.parset.com/Domain/PayDomainStep2.aspx"; try { if (Session["DomainPrice"] == null) { return; } //lblDomainCost.Text = Tools.FormatCurrency2(Tools.ChangeEnc(100)); object strAddVal = Convert.ToInt32(Session["DomainPrice"]); if (strAddVal == null) { msg.Text = "مبلغ معتبر نيست"; msg.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; return; } int TotalCost; Int32.TryParse(strAddVal.ToString(), out TotalCost); if (TotalCost == 0) { msg.Text = "مبلغ معتبر نيست"; msg.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; return; } string UserIP = ""; //int BankCode = Convert.ToInt32(ddlBankCode.SelectedValue); int BankCode = 2; BOLUserTransactions UserTransactionsBOL = new BOLUserTransactions(1); int UserTransactionCode = UserTransactionsBOL.Insert(null, DateTime.Now, 1, 3, UserIP, TotalCost, 5, BankCode, Name, Email, ""); if (UserTransactionCode != -1) { if (BankCode == 1)//Saman { long OrderId = Convert.ToInt64(UserTransactionCode); Literal ltrMP = (Literal)this.Master.FindControl("ltrMP"); ltrMP.Text = @"<form id=""formsaman"" method=post action=""https://acquirer.sb24.com/CardServices/controller""> <input type=""hidden"" name=""MID"" id=""MID"" value=""" + ConfigurationManager.AppSettings["SamanMerchantID"] + @""" /> <input type=""hidden"" name=""ResNum"" id=""ResNum"" value=""" + OrderId + @""" /> <input type=""hidden"" name=""Amount"" id=""Amount"" value=""" + TotalCost + @""" /> <input type=""hidden"" name=""RedirectURL"" id=""RedirectURL"" value=""" + AfterBuyUrl + @""" /> </form> <script type=""text/javascript"">document.getElementById(""formsaman"").submit();</script>" ; return; } #region Parsian else if (BankCode == 2) // Parsian Bank { long Authority = 0; byte Status = 1; Parset.com.pecco24.www.EShopService ParsianService = new Parset.com.pecco24.www.EShopService(); ParsianService.PinPaymentRequest(ConfigurationManager.AppSettings["ParsianPin"], TotalCost, UserTransactionCode, AfterBuyUrl, ref Authority, ref Status); if (Status == 0) { BOLUserBuys UserBuysBOL = new BOLUserBuys(1); int UpdateResult = UserBuysBOL.UpdateAuthority(UserTransactionCode, Authority.ToString()); if (UpdateResult == 0) { Response.Redirect("https://www.pecco24.com/pecpaymentgateway/?au=" + Authority); return; } else { msg.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msg.Text = "خطا ذخیره داده های تراکنش بانک پارسیان" + " کد خطا: " + Status; return; } } else { msg.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msg.Text = "خطا در برقراری ارتباط با بانک پارسیان" + " کد خطا: " + Status; return; } } #endregion } else { msg.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msg.Text = "خطا در ثبت تراکنش"; return; } } catch (Exception err) { msg.Text = "خطا در برقراری ارتباط با سرور بانک " + err.Message; msg.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; return; } }
protected void Page_Load(object sender, EventArgs e) { Code = Convert.ToInt32(Request["Code"]); //BOLClass = new BOLUserBuys(1); //MasterFieldName = "TransactionCode"; //Label MasterPageTitle = (Label)Master.FindControl("lblTitle"); //MasterPageTitle.Text = BOLClass.PageLable; //if (MasterCode == null) // throw new Exception("No MasterCode Exception"); //if ((Code == null) && (!NewMode)) return; //if (!Page.IsPostBack) //{ // ViewState["InstanceName"] = Request["InstanceName"]; Tools.SetClientScript(this, "ActiveTab1", "BrowseObj1.ShowDetail('UserBuyProducts', '" + Code + "',true,'BrowseObj1')"); if (!Page.IsPostBack) { cboHCTransStatusCode.DataSource = new BOLHardCode().GetHCDataTable("HCUserTransStatuses"); cboChargeTypeCode.DataSource = new BOLHardCode().GetHCDataTable("HCChargeTypes"); cboHCTransStatusCode.DataSource = new BOLHardCode().GetHCDataTable("HCUserTransStatuses"); cboBankCode.DataSource = new BOLHardCode().GetHCDataTable("HCBanks"); //LoadData((int)Code); BOLUserBuys UserBuysBOL = new BOLUserBuys(1); UserBuys CurUserBuy = ((IBaseBOL <UserBuys>)UserBuysBOL).GetDetails((int)Code); BOLUserTransactions UserTransactionsBOL = new BOLUserTransactions(1); UserTransactions CurTransaction = ((IBaseBOL <UserTransactions>)UserTransactionsBOL).GetDetails(CurUserBuy.TransactionCode); if (CurTransaction != null) { txtAuthority.Text = CurTransaction.Authority; txtBankName.Text = CurTransaction.BankName; txtBankState.Text = CurTransaction.BankState; txtComment.Text = CurTransaction.Comment; txtDigitalSignature.Text = CurTransaction.DigitalSignature; txtFishNo.Text = CurTransaction.FishNo; txtUserIP.Text = CurTransaction.UserIP; if (CurTransaction.BankCode != null) { cboBankCode.SelectedValue = CurTransaction.BankCode.ToString(); } if (CurTransaction.HCPayMethodCode != null) { cboChargeTypeCode.SelectedValue = CurTransaction.HCPayMethodCode.ToString(); } cboHCTransStatusCode.SelectedValue = CurTransaction.HCTransStatusCode.ToString(); if (CurTransaction.ChargeDate != null) { dteChargeDate.SelectedDateChristian = CurTransaction.ChargeDate; } if (CurTransaction.PayDate != null) { dtePayDate.SelectedDateChristian = CurTransaction.PayDate; } BOLUserBuyProducts UserBuyProductsBOL = new BOLUserBuyProducts((int)Code); DataTable dtBuyProducts = ((IBaseBOL <UserBuyProducts>)UserBuyProductsBOL).GetDataSource(new SearchFilterCollection(), "Code", 100, 1); int TotalAmount = 0; for (int i = 0; i < dtBuyProducts.Rows.Count; i++) { int Amount = Convert.ToInt32(dtBuyProducts.Rows[i]["Amount"]); int Quantity = Convert.ToInt32(dtBuyProducts.Rows[i]["Quantity"]); TotalAmount += (Amount * Quantity); } lblTotalAmount.Text = Tools.FormatCurrency(TotalAmount.ToString()); } if (CurTransaction.UserCode != null) { pnlGuestUser.Visible = false; } else { txtFirstName.Text = CurUserBuy.FirstName; txtLastName.Text = CurUserBuy.LastName; txtEmail.Text = CurUserBuy.Email; txtPhone.Text = CurUserBuy.Phone; } } }