Exemple #1
0
        private void CreateAdditionalPurchaseOrderType()
        {
            string     message            = string.Empty;
            List <int> OrderIds           = new List <int>();
            bool       accountDebitStatus = false;

            onlinemforderVo.SchemePlanCode = Int32.Parse(ddlScheme.SelectedValue.ToString());
            if (!string.IsNullOrEmpty(txtAmt.Text.ToString()))
            {
                onlinemforderVo.Amount = double.Parse(txtAmt.Text.ToString());
            }
            else
            {
                onlinemforderVo.Amount = 0.0;
            }
            onlinemforderVo.FolioNumber     = ddlFolio.SelectedValue;
            onlinemforderVo.DividendType    = ddlDivType.SelectedValue;
            onlinemforderVo.TransactionType = "ABY";
            float    amt;
            float    minAmt;
            float    multiAmt;
            DateTime Dt;

            if (string.IsNullOrEmpty(txtAmt.Text))
            {
                amt = 0;
            }
            else
            {
                amt = float.Parse(txtAmt.Text);
            }
            if (string.IsNullOrEmpty(lblMintxt.Text) && string.IsNullOrEmpty(lblMulti.Text) && string.IsNullOrEmpty(lbltime.Text))
            {
                minAmt = 0; multiAmt = 0; Dt = DateTime.MinValue;
            }
            else
            {
                minAmt   = float.Parse(lblMintxt.Text);
                multiAmt = float.Parse(lblMulti.Text);
                Dt       = DateTime.Parse(lbltime.Text);
            }
            int retVal = commonLookupBo.IsRuleCorrect(amt, minAmt, amt, multiAmt, Dt);

            if (retVal != 0)
            {
                if (retVal == -1)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('You should enter the amount in multiples of Subsequent amount');", true); return;
                }
                if (retVal == -2)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('You have entered amount less than Minimum Initial amount allowed');", true); return;
                }
            }
            decimal availableBalance = onlineMforderBo.GetUserRMSAccountBalance(customerVo.AccountId);

            if (availableBalance >= Convert.ToDecimal(onlinemforderVo.Amount))
            {
                //onlineMforderBo.CreateCustomerOnlineMFOrderDetails(onlinemforderVo, userVo.UserId, customerVo.CustomerId);
                //OrderIds =
                //OrderId = int.Parse(OrderIds[0].ToString());
                OrderId = 0;
                if (OrderId != 0 && !string.IsNullOrEmpty(customerVo.AccountId))
                {
                    accountDebitStatus = onlineMforderBo.DebitRMSUserAccountBalance(customerVo.AccountId, -onlinemforderVo.Amount, OrderId, out debitstatus);
                    ShowAvailableLimits();
                }
            }
            char msgType;

            message = CreateUserMessage(OrderId, accountDebitStatus, retVal == 1 ? true : false, out msgType);
            ShowMessage(message, msgType);
            PurchaseOrderControlsEnable(false);
        }
Exemple #2
0
        private void CreatePurchaseOrderType()
        {
            List <int> OrderIds           = new List <int>();
            bool       accountDebitStatus = false;

            onlinemforderVo.SchemePlanCode = int.Parse(Session["MFSchemePlan"].ToString());
            if (!string.IsNullOrEmpty(txtAmt.Text.ToString()))
            {
                onlinemforderVo.Amount = double.Parse(txtAmt.Text.ToString());
            }
            else
            {
                onlinemforderVo.Amount = 0.0;
            }

            onlinemforderVo.DividendType = ddlDivType.SelectedValue;
            if (ddlFolio.SelectedValue != "New" && ddlFolio.SelectedValue != "0")
            {
                onlinemforderVo.TransactionType = "ABY";
                onlinemforderVo.FolioNumber     = ddlFolio.SelectedValue;
            }
            else
            {
                onlinemforderVo.TransactionType = "BUY";
            }
            float    amt;
            float    minAmt;
            float    multiAmt;
            DateTime Dt;

            if (string.IsNullOrEmpty(txtAmt.Text))
            {
                amt = 0;
            }
            else
            {
                amt = float.Parse(txtAmt.Text);
            }
            if (string.IsNullOrEmpty(lblMintxt.Text) && string.IsNullOrEmpty(lblMulti.Text) && string.IsNullOrEmpty(lbltime.Text))
            {
                minAmt = 0; multiAmt = 0; Dt = DateTime.MinValue;
            }
            else
            {
                minAmt   = float.Parse(lblMintxt.Text);
                multiAmt = float.Parse(lblMulti.Text);
                Dt       = DateTime.Parse(lbltime.Text);
            }
            int retVal = commonLookupBo.IsRuleCorrect(amt, minAmt, amt, multiAmt, Dt);

            if (retVal != 0)
            {
                if (retVal == -2)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('You have entered amount less than Minimum Initial amount allowed');", true); return;
                }
                if (retVal == -1)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('You should enter the amount in multiples of Subsequent amount ');", true); return;
                }
            }
            decimal availableBalance = onlineMforderBo.GetUserRMSAccountBalance(customerVo.AccountId);
            //string message = string.Empty;

            //if (availableBalance >= Convert.ToDecimal(onlinemforderVo.Amount))
            //{
            //    OrderIds = onlineMforderBo.CreateCustomerOnlineMFOrderDetails(onlinemforderVo, userVo.UserId, customerVo.CustomerId, exchangeType);
            //    OrderId = int.Parse(OrderIds[0].ToString());

            //    if (OrderId != 0 && !string.IsNullOrEmpty(customerVo.AccountId))
            //    {
            //        accountDebitStatus = onlineMforderBo.DebitRMSUserAccountBalance(customerVo.AccountId, -onlinemforderVo.Amount, OrderId);
            //        ShowAvailableLimits();
            //    }

            //}
            //onlinemforderVo.BSESchemeCode = lblDemate.Text;
            string message = string.Empty;
            char   msgType = 'F';

            if (exchangeType == "Online")
            {
                onlinemforderVo.OrderType = 1;
                if (availableBalance >= Convert.ToDecimal(onlinemforderVo.Amount))
                {
                    OrderIds = onlineMforderBo.CreateCustomerOnlineMFOrderDetails(onlinemforderVo, (BackOfficeUserId != 0) ? BackOfficeUserId:userVo.UserId, customerVo.CustomerId);
                    OrderId  = int.Parse(OrderIds[0].ToString());

                    if (OrderId != 0 && !string.IsNullOrEmpty(customerVo.AccountId))
                    {
                        accountDebitStatus = onlineMforderBo.DebitRMSUserAccountBalance(customerVo.AccountId, -onlinemforderVo.Amount, OrderId, out debitstatus);
                        ShowAvailableLimits();
                    }
                }

                message = CreateUserMessage(OrderId, accountDebitStatus, retVal == 1 ? true : false, out msgType);
            }
            else if (exchangeType == "Demat")
            {
                onlinemforderVo.OrderType = 0;
                DematAccountVo dematevo = new DematAccountVo();
                BoDematAccount bo       = new BoDematAccount();
                dematevo = bo.GetCustomerActiveDematAccount(customerVo.CustomerId);
                onlinemforderVo.BSESchemeCode = lblDemate.Text;
                if (availableBalance >= Convert.ToDecimal(onlinemforderVo.Amount))
                {
                    OnlineMFOrderBo OnlineMFOrderBo = new OnlineMFOrderBo();
                    message = OnlineMFOrderBo.BSEorderEntryParam(userVo.UserId, customerVo.CustCode, onlinemforderVo, customerVo.CustomerId, dematevo.DepositoryName, out msgType);
                }
                else
                {
                    message = "Order cannot be processed. Insufficient balance";
                }
            }
            PurchaseOrderControlsEnable(false);
            ShowMessage(message, msgType);
        }