Esempio n. 1
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);
        }
        private void CreateRedemptionOrderType()
        {
            List <int> OrderIds = new List <int>();
            DateTime   dtCutOfffTime;

            onlinemforderVo.SchemePlanCode = Int32.Parse(ddlScheme.SelectedValue.ToString());
            bool isCutOffTimeOver = false;

            onlinemforderVo.FolioNumber     = ddlFolio.SelectedValue;
            onlinemforderVo.DividendType    = ddlDivType.SelectedValue;
            onlinemforderVo.TransactionType = "SEL";
            dtCutOfffTime = DateTime.Parse(lbltime.Text);

            if (DateTime.Now.TimeOfDay > dtCutOfffTime.TimeOfDay && dtCutOfffTime.TimeOfDay < System.TimeSpan.Parse("23:59:59"))
            {
                isCutOffTimeOver = true;
            }

            if (ddlRedeem.SelectedValue == "1")
            {
                if (!string.IsNullOrEmpty(txtRedeemTypeValue.Text))
                {
                    onlinemforderVo.Redeemunits = double.Parse(txtRedeemTypeValue.Text);
                }
                else
                {
                    onlinemforderVo.Redeemunits = 0;
                }

                float RedeemUnits    = float.Parse(string.IsNullOrEmpty(txtRedeemTypeValue.Text) ? "0" : txtRedeemTypeValue.Text);
                float AvailableUnits = float.Parse(string.IsNullOrEmpty(lblUnitsheldDisplay.Text) ? "0" : lblUnitsheldDisplay.Text);
                if ((ddlRedeem.SelectedValue == "1" && (RedeemUnits > AvailableUnits)))
                {
                    retVal = 1;
                }
            }
            else if (ddlRedeem.SelectedValue == "2")
            {
                if (!string.IsNullOrEmpty(txtRedeemTypeValue.Text))
                {
                    onlinemforderVo.Amount = double.Parse(txtRedeemTypeValue.Text);
                }
                else
                {
                    onlinemforderVo.Amount = 0;
                }
                float RedeemAmt    = float.Parse(string.IsNullOrEmpty(txtRedeemTypeValue.Text) ? "0" : txtRedeemTypeValue.Text);
                float AvailableAmt = float.Parse(string.IsNullOrEmpty(lblCurrentValueDisplay.Text) ? "0" : lblCurrentValueDisplay.Text);

                if ((ddlRedeem.SelectedValue == "2" && (RedeemAmt > AvailableAmt)))
                {
                    retVal = -1;
                }
            }
            else if (ddlRedeem.SelectedValue == "3")
            {
                if (!string.IsNullOrEmpty(txtRedeemTypeValue.Text))
                {
                    onlinemforderVo.Redeemunits = double.Parse(txtRedeemTypeValue.Text);
                }
                else
                {
                    onlinemforderVo.Redeemunits = 0;
                }
                onlinemforderVo.IsAllUnits = true;
                //onlinemforderVo.Redeemunits = float.Parse(txtRedeemTypeValue.Text);
            }

            if (retVal != 0)
            {
                if (retVal == -1)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Please enter a valid amount');", true); return;
                }
                else if (retVal == 1)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Please enter a valid Units');", true); return;
                }
            }

            string message = string.Empty;
            char   msgType = 'F';

            if (exchangeType == "Online")
            {
                onlinemforderVo.OrderType = 1;
                OrderIds = onlineMforderBo.CreateCustomerOnlineMFOrderDetails(onlinemforderVo, (BackOfficeUserId != 0) ? BackOfficeUserId : userVo.UserId, customerVo.CustomerId);
                OrderId  = int.Parse(OrderIds[0].ToString());
                message  = CreateUserMessage(OrderId, isCutOffTimeOver, out msgType);
            }
            else if (exchangeType == "Demat")
            {
                onlinemforderVo.OrderType = 0;
                DematAccountVo dematevo = new DematAccountVo();
                BoDematAccount bo       = new BoDematAccount();
                dematevo = bo.GetCustomerActiveDematAccount(customerVo.CustomerId);
                onlinemforderVo.BSESchemeCode = ViewState["BseCode"].ToString();
                OnlineMFOrderBo OnlineMFOrderBo = new OnlineMFOrderBo();
                message = OnlineMFOrderBo.BSEorderEntryParam(userVo.UserId, customerVo.CustCode, onlinemforderVo, customerVo.CustomerId, dematevo.DepositoryName, out msgType);
            }

            PurchaseOrderControlsEnable(false);
            ShowMessage(message, msgType);
        }
Esempio n. 3
0
        private void CreateNFOOrderType()
        {
            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.DividendType    = ddlDivType.SelectedValue;
            onlinemforderVo.TransactionType = "BUY";
            if (ddlFolio.SelectedValue.ToString() != "1")
            {
                onlinemforderVo.AccountId   = Convert.ToInt32(ddlFolio.SelectedValue.ToString());
                onlinemforderVo.FolioNumber = ddlFolio.SelectedValue.ToString();
            }
            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);
                OrderId  = int.Parse(OrderIds[0].ToString());

                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);
            PurchaseOrderControlsEnable(false);
            ShowMessage(message, msgType);
        }