//public static Guid InsertOtherAccountNumber(Guid userGuid)
        //{
        //	Business.AccountInformation accountInfoController = new Business.AccountInformation();
        //	Common.AccountInformation accountInfo = new Common.AccountInformation();
        //	accountInfo.Owner = "0";
        //	accountInfo.Bank = 0;
        //	accountInfo.Branch = "0";
        //	accountInfo.AccountNo = "0";
        //	//accountInfo.Type = (int)Business.TypeAccountInformation.Other;
        //	accountInfo.IsActive = true;
        //	accountInfo.UserGuid = userGuid;
        //	return accountInfoController.Insert(accountInfo);
        //}

        //public static DataTable GetTypeAccount(Guid userGuid, int type)
        //{
        //	Business.AccountInformation accountInfoController = new Business.AccountInformation();
        //	return accountInfoController.GetTypeAccount(userGuid, type);
        //}

        public static Common.AccountInformation LoadAccountInformation(Guid accountNumberGuid)
        {
            Business.AccountInformation accountInfoController = new Business.AccountInformation();
            Common.AccountInformation   accountInfo           = new Common.AccountInformation();
            accountInfoController.Load(accountNumberGuid, accountInfo);
            return(accountInfo);
        }
        protected void btnPayment_Click(object sender, EventArgs e)
        {
            Common.Fish fish   = new Common.Fish();
            string      result = string.Empty;

            try
            {
                Common.AccountInformation accountInfo = Facade.AccountInformation.LoadAccountInformation(Helper.GetGuid(hdnAccountGuid.Value));

                Common.User parent = Facade.User.LoadUser(Facade.User.GetGuidOfParent(Guid.Empty, DomainName));

                switch (accountInfo.Bank)
                {
                case (int)Banks.Mellat:
                    BehPardakhtMellat behPardakht = new BehPardakhtMellat();

                    if (Helper.CheckDataConditions(accountInfo.TerminalID).IsEmpty ||
                        Helper.CheckDataConditions(accountInfo.UserName).IsEmpty ||
                        Helper.CheckDataConditions(accountInfo.Password).IsEmpty)
                    {
                        throw new Exception(Language.GetString("OnlineGatewayInfoIncorrect"));
                    }

                    behPardakht.TerminalID  = Helper.GetLong(accountInfo.TerminalID);
                    behPardakht.UserName    = accountInfo.UserName;
                    behPardakht.Password    = accountInfo.Password;
                    behPardakht.Amount      = Helper.GetLong(txtPanelPrice.Text);
                    behPardakht.CallBackUrl = string.Format("{0}/{1}/{2}/{3}/", "http://" + Helper.GetLocalDomain(Request.Url.Authority), "SalePackage", PackageId, (int)Business.Banks.Mellat);
                    string refID = behPardakht.Request(ref result);

                    if (Helper.CheckDataConditions(refID).IsEmpty)
                    {
                        throw new Exception(Language.GetString("DontAccessToOnlineGateway"));
                    }

                    #region InsertFish
                    fish.ReferenceID            = refID;
                    fish.CreateDate             = DateTime.Now;
                    fish.PaymentDate            = DateTime.Now;
                    fish.SmsCount               = 0;
                    fish.Amount                 = Helper.GetDecimal(txtPanelPrice.Text);
                    fish.OrderID                = behPardakht.OrderID.ToString();
                    fish.Type                   = (int)Business.TypeFish.OnLine;
                    fish.Status                 = (int)Business.FishStatus.Checking;
                    fish.AccountInformationGuid = accountInfo.AccountInfoGuid;
                    fish.UserGuid               = UserGuid;
                    Facade.Fish.InsertOnlinePayment(fish);
                    #endregion

                    Page.ClientScript.RegisterClientScriptBlock(typeof(string), "behpardakht", string.Format("<script language=javascript type='text/javascript'>$(function(){{{0}}});</script>", behPardakht.GotoGateway(refID)));
                    break;
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Beispiel #3
0
 public bool UpdateAccount(Common.AccountInformation accountInfo)
 {
     return(base.ExecuteSPCommand("UpdateAccount", "@Guid", accountInfo.AccountInfoGuid,
                                  "@Owner", accountInfo.Owner,
                                  "@Branch", accountInfo.Branch,
                                  "@AccountNo", accountInfo.AccountNo,
                                  "@TerminalID", accountInfo.TerminalID,
                                  "@UserName", accountInfo.UserName,
                                  "@Password", accountInfo.Password,
                                  "@PinCode", accountInfo.PinCode,
                                  "@Bank", accountInfo.Bank,
                                  "@CardNo", accountInfo.CardNo,
                                  "@IsActive", accountInfo.IsActive,
                                  "@OnlineGatewayIsActive", accountInfo.OnlineGatewayIsActive));
 }
        private void InitializePage()
        {
            btnSave.Attributes["onclick"]  = "return saveAccount();";
            drpBank.Attributes["onchange"] = "showOnlineGatewayInfo();";
            btnSave.Text = Language.GetString("Register");

            foreach (Banks bankes in System.Enum.GetValues(typeof(Banks)))
            {
                drpBank.Items.Add(new ListItem(Language.GetString(bankes.ToString()), ((int)bankes).ToString()));
            }
            drpBank.Items.Insert(0, new ListItem(string.Empty, string.Empty));

            if (ActionType.ToLower() == "edit")
            {
                Common.AccountInformation accountNumber = new Common.AccountInformation();
                accountNumber         = Facade.AccountInformation.LoadAccountInformation(AccountInfoGuid);
                txtOwner.Text         = accountNumber.Owner;
                drpBank.SelectedValue = accountNumber.Bank.ToString();
                switch (accountNumber.Bank)
                {
                case (int)Banks.Mellat:
                    txtTerminalID.Text = accountNumber.TerminalID;
                    txtUserName.Text   = accountNumber.UserName;
                    txtPassword.Text   = accountNumber.Password;
                    break;

                case (int)Banks.Parsian:
                    txtPinCode.Text = accountNumber.PinCode;
                    break;
                }

                txtBranch.Text      = accountNumber.Branch;
                txtAccountNo.Text   = accountNumber.AccountNo;
                txtCardNo.Text      = accountNumber.CardNo;
                chbIsActive.Checked = accountNumber.IsActive;
                chbOnlineGatewayIsActive.Checked = accountNumber.OnlineGatewayIsActive;
                ClientSideScript = "showOnlineGatewayInfo();";
            }
        }
        protected void btnPayment_Click(object sender, EventArgs e)
        {
            Common.Fish fish   = new Common.Fish();
            string      result = string.Empty;

            try
            {
                if (Helper.GetDecimal(txtPrice.Text) == 0)
                {
                    if (!Facade.PrivateNumber.UpdateExpireDate(PrivateNumberGuid, DateTime.Now.AddYears(1)))
                    {
                        throw new Exception(Language.GetString("ErrorRecord"));
                    }

                    Response.Redirect(string.Format("/PageLoader.aspx?c={0}", Helper.Encrypt((int)UserControls.UI_PrivateNumbers_UserPrivateNumber, Session)));
                }

                Common.AccountInformation accountInfo = Facade.AccountInformation.LoadAccountInformation(Helper.GetGuid(hdnAccountGuid.Value));

                Common.User parent = Facade.User.LoadUser(ParentGuid);

                switch (accountInfo.Bank)
                {
                case (int)Banks.Mellat:
                    BehPardakhtMellat behPardakht = new BehPardakhtMellat();

                    if (Helper.CheckDataConditions(accountInfo.TerminalID).IsEmpty ||
                        Helper.CheckDataConditions(accountInfo.UserName).IsEmpty ||
                        Helper.CheckDataConditions(accountInfo.Password).IsEmpty)
                    {
                        throw new Exception(Language.GetString("OnlineGatewayInfoIncorrect"));
                    }

                    behPardakht.TerminalID  = Helper.GetLong(accountInfo.TerminalID);
                    behPardakht.UserName    = accountInfo.UserName;
                    behPardakht.Password    = accountInfo.Password;
                    behPardakht.Amount      = Helper.GetLong(txtPrice.Text);
                    behPardakht.CallBackUrl = string.Format("{0}/{1}/{2}", "http://" + Helper.GetLocalDomain(Request.Url.Authority), "ExtendedNumber", (int)Banks.Mellat);
                    string refID = behPardakht.Request(ref result);

                    if (Helper.CheckDataConditions(refID).IsEmpty)
                    {
                        throw new Exception(Language.GetString("DontAccessToOnlineGateway"));
                    }

                    #region InsertFish
                    fish.ReferenceID            = refID;
                    fish.CreateDate             = DateTime.Now;
                    fish.PaymentDate            = DateTime.Now;
                    fish.SmsCount               = 0;
                    fish.Amount                 = Helper.GetDecimal(txtPrice.Text);
                    fish.OrderID                = behPardakht.OrderID.ToString();
                    fish.Type                   = (int)TypeFish.OnLine;
                    fish.Status                 = (int)FishStatus.Checking;
                    fish.ReferenceGuid          = PrivateNumberGuid;
                    fish.AccountInformationGuid = accountInfo.AccountInfoGuid;
                    fish.UserGuid               = UserGuid;
                    Facade.Fish.InsertOnlinePayment(fish);
                    #endregion

                    Page.ClientScript.RegisterClientScriptBlock(typeof(string), "behpardakht", string.Format("<script language=javascript type='text/javascript'>$(function(){{{0}}});</script>", behPardakht.GotoGateway(refID)));
                    break;
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Common.AccountInformation accountNumber = new Common.AccountInformation();
            try
            {
                accountNumber.Owner                 = txtOwner.Text.Trim();
                accountNumber.Branch                = txtBranch.Text.Trim();
                accountNumber.AccountNo             = txtAccountNo.Text.Trim();
                accountNumber.CreateDate            = DateTime.Now;
                accountNumber.Bank                  = Helper.GetInt(drpBank.SelectedValue);
                accountNumber.CardNo                = txtCardNo.Text.Trim();
                accountNumber.IsActive              = chbIsActive.Checked;
                accountNumber.OnlineGatewayIsActive = chbOnlineGatewayIsActive.Checked;
                accountNumber.UserGuid              = UserGuid;

                switch (ActionType.ToLower())
                {
                case "edit":
                    accountNumber.AccountInfoGuid = AccountInfoGuid;
                    switch (Helper.GetInt(drpBank.SelectedValue))
                    {
                    case (int)Banks.Mellat:
                        accountNumber.TerminalID = txtTerminalID.Text.Trim();
                        accountNumber.UserName   = txtUserName.Text.Trim();
                        accountNumber.Password   = txtPassword.Text.Trim();
                        break;

                    case (int)Banks.Parsian:
                        accountNumber.PinCode = txtPinCode.Text;
                        break;

                    default:
                        accountNumber.TerminalID = accountNumber.UserName = accountNumber.Password = string.Empty;
                        break;
                    }

                    if (accountNumber.HasError)
                    {
                        throw new Exception(accountNumber.ErrorMessage);
                    }

                    if (!Facade.AccountInformation.UpdateAccount(accountNumber))
                    {
                        throw new Exception(Language.GetString("ErrorRecord"));
                    }

                    break;

                case "insert":
                    switch (Helper.GetInt(drpBank.SelectedValue))
                    {
                    case (int)Banks.Mellat:
                        accountNumber.TerminalID = txtTerminalID.Text.Trim();
                        accountNumber.UserName   = txtUserName.Text.Trim();
                        accountNumber.Password   = txtPassword.Text.Trim();
                        break;

                    case (int)Banks.Parsian:
                        accountNumber.PinCode = txtPinCode.Text;
                        break;
                    }

                    if (accountNumber.HasError)
                    {
                        throw new Exception(accountNumber.ErrorMessage);
                    }

                    if (!Facade.AccountInformation.Insert(accountNumber))
                    {
                        throw new Exception(Language.GetString("ErrorRecord"));
                    }

                    break;
                }
                Response.Redirect(string.Format("/PageLoader.aspx?c={0}", Helper.Encrypt((int)Arad.SMS.Gateway.Business.UserControls.UI_AccountInformations_AccountInformation, Session)));
            }
            catch (Exception ex)
            {
                ShowMessageBox(Language.GetString(ex.Message), string.Empty, "danger");
            }
        }
 public static bool UpdateAccount(Common.AccountInformation accountInfo)
 {
     Business.AccountInformation accountInfoController = new Business.AccountInformation();
     return(accountInfoController.UpdateAccount(accountInfo));
 }
 public static bool Insert(Common.AccountInformation accountNumber)
 {
     Business.AccountInformation accountInfoController = new Business.AccountInformation();
     return(accountInfoController.Insert(accountNumber) != Guid.Empty ? true : false);
 }
Beispiel #9
0
        protected void btnSaveOnlinePayment_Click(object sender, EventArgs e)
        {
            Common.AccountInformation accountInfo = new Common.AccountInformation();
            Common.Fish fish   = new Common.Fish();
            string      result = string.Empty;

            try
            {
                if (rdbMellat.Checked)
                {
                    if (Helper.GetGuid(rdbMellat.Value) == Guid.Empty)
                    {
                        throw new Exception(Language.GetString("AccountInvalid"));
                    }
                    accountInfo = Facade.AccountInformation.LoadAccountInformation(Helper.GetGuid(rdbMellat.Value));
                }
                else if (rdbParsian.Checked)
                {
                    if (Helper.GetGuid(rdbParsian.Value) == Guid.Empty)
                    {
                        throw new Exception(Language.GetString("AccountInvalid"));
                    }
                    accountInfo = Facade.AccountInformation.LoadAccountInformation(Helper.GetGuid(rdbParsian.Value));
                }

                Common.User parent = Facade.User.LoadUser(ParentGuid);
                if (!parent.IsMainAdmin && parent.Credit < Helper.GetLong(txtOnlineSmsCount.Text))
                {
                    throw new Exception(Language.GetString("SystemUnableAssignCredit"));
                }

                switch (accountInfo.Bank)
                {
                case (int)Banks.Mellat:
                    BehPardakhtMellat behPardakht = new BehPardakhtMellat();

                    if (Helper.CheckDataConditions(accountInfo.TerminalID).IsEmpty ||
                        Helper.CheckDataConditions(accountInfo.UserName).IsEmpty ||
                        Helper.CheckDataConditions(accountInfo.Password).IsEmpty)
                    {
                        throw new Exception(Language.GetString("OnlineGatewayInfoIncorrect"));
                    }

                    behPardakht.TerminalID  = Helper.GetLong(accountInfo.TerminalID);
                    behPardakht.UserName    = accountInfo.UserName;
                    behPardakht.Password    = accountInfo.Password;
                    behPardakht.Amount      = Helper.GetLong(txtOnlineAmount.Text);
                    behPardakht.CallBackUrl = string.Format("{0}/{1}/{2}", "http://" + Helper.GetLocalDomain(Request.Url.Authority), "PaymentReport", (int)Arad.SMS.Gateway.Business.Banks.Mellat);
                    string refID = behPardakht.Request(ref result);

                    if (Helper.CheckDataConditions(refID).IsEmpty)
                    {
                        throw new Exception(Language.GetString("DontAccessToOnlineGateway"));
                    }

                    #region InsertFish
                    fish.ReferenceID            = refID;
                    fish.CreateDate             = DateTime.Now;
                    fish.PaymentDate            = DateTime.Now;
                    fish.SmsCount               = Helper.GetLong(txtOnlineSmsCount.Text);
                    fish.Amount                 = Helper.GetDecimal(txtOnlineAmount.Text);
                    fish.OrderID                = behPardakht.OrderID.ToString();
                    fish.Type                   = (int)Arad.SMS.Gateway.Business.TypeFish.OnLine;
                    fish.Status                 = (int)Arad.SMS.Gateway.Business.FishStatus.Checking;
                    fish.AccountInformationGuid = accountInfo.AccountInfoGuid;
                    fish.UserGuid               = UserGuid;
                    Facade.Fish.InsertOnlinePayment(fish);
                    #endregion

                    ClientSideScript = behPardakht.GotoGateway(refID);
                    break;

                case (int)Banks.Parsian:
                    ParsianPaymentGateway parsian = new ParsianPaymentGateway();

                    if (Helper.CheckDataConditions(accountInfo.PinCode).IsEmpty)
                    {
                        throw new Exception(Language.GetString("OnlineGatewayInfoIncorrect"));
                    }

                    parsian.Pin         = accountInfo.PinCode;
                    parsian.Amount      = Helper.GetInt(txtOnlineAmount.Text);
                    parsian.CallBackUrl = string.Format("{0}/{1}/{2}", "http://" + Helper.GetLocalDomain(Request.Url.Authority), "PaymentReport", (int)Arad.SMS.Gateway.Business.Banks.Parsian);
                    string authority = parsian.Request();

                    if (Helper.CheckDataConditions(authority).IsEmpty)
                    {
                        throw new Exception(Language.GetString("DontAccessToOnlineGateway"));
                    }

                    #region InsertFish
                    fish.ReferenceID            = authority;
                    fish.CreateDate             = DateTime.Now;
                    fish.PaymentDate            = DateTime.Now;
                    fish.SmsCount               = Helper.GetLong(txtOnlineSmsCount.Text);
                    fish.Amount                 = Helper.GetDecimal(txtOnlineAmount.Text);
                    fish.OrderID                = parsian.OrderID.ToString();
                    fish.Type                   = (int)TypeFish.OnLine;
                    fish.Status                 = (int)FishStatus.Checking;
                    fish.AccountInformationGuid = accountInfo.AccountInfoGuid;
                    fish.UserGuid               = UserGuid;
                    Facade.Fish.InsertOnlinePayment(fish);
                    #endregion

                    var redirectUrl = string.Format(parsian.PostUrl, authority);
                    //Response.Redirect(redirectUrl, true);

                    Response.Write("<script language='javascript'>self.parent.location='" + redirectUrl + "';</script>");


                    break;
                }
            }
            catch (Exception ex)
            {
                ClientSideScript = string.Format("saveResult('online','error','{0}')", ex.Message);
            }
        }