Beispiel #1
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj      = new UnitHolderRegistration();
        UnitTransfer           transferObj = new UnitTransfer();

        regObj.FundCode   = tfereeFundCodeTextBox.Text.Trim();
        regObj.BranchCode = tfereeBranhCodeTextBox.Text.Trim();
        regObj.RegNumber  = tferorRegNoTextBox.Text.Trim();

        transferObj.TransferNo       = Convert.ToInt32(transferNoTextBox.Text.Trim());
        transferObj.TransferDate     = transferDateTextBox.Text.Trim().ToString();
        transferObj.TransferorRegNo  = tferorRegNoTextBox.Text.Trim().ToString();
        transferObj.TferorBranchCode = tferorBranchCodeTextBox.Text.Trim().ToString();
        transferObj.TransfereeRegNo  = tfereeRegNoTextBox.Text.Trim().ToString();
        transferObj.TfereeBranchCode = tfereeBranhCodeTextBox.Text.Trim().ToString();

        try
        {
            if (unitTransferBLObj.IsTransferLock(regObj))
            {
                transferNoTextBox.Focus();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + "Transfer Opearation is Locked " + "');", true);
            }
            else if (unitTransferBLObj.IsDuplicateTransfer(regObj, transferObj))
            {
                transferNoTextBox.Focus();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Transfer Number " + "');", true);
            }
            else
            {
                DataTable dtGrid = opendMFDAO.getTableDataGridCDS();
                DataRow   drGrid;
                foreach (DataGridItem gridRow in leftDataGrid.Items)
                {
                    CheckBox leftCheckBox = (CheckBox)gridRow.FindControl("leftCheckBox");
                    if (leftCheckBox.Checked)
                    {
                        TextBox SL_TR_NOTxt        = (TextBox)gridRow.FindControl("SL_TR_NoTextBox");
                        TextBox SURRENDER_UNITSTxt = (TextBox)gridRow.FindControl("Sale_UnitsTextBox");
                        TextBox EXIST_UNITSTxt     = (TextBox)gridRow.FindControl("Exist_UnitsTextBox");
                        drGrid                    = dtGrid.NewRow();
                        drGrid["SL_TR_NO"]        = SL_TR_NOTxt.Text.Trim().ToString();
                        drGrid["SURRENDER_UNITS"] = SURRENDER_UNITSTxt.Text.Trim().ToString();
                        drGrid["EXIST_UNITS"]     = EXIST_UNITSTxt.Text.Trim().ToString();
                        dtGrid.Rows.Add(drGrid);
                    }
                }

                unitTransferBLObj.saveTransferCDS(dtGrid, regObj, transferObj, userObj); //save Transfer Data
                ClearText();
                leftDataGrid.DataSource = opendMFDAO.getTableDataGridCDS();              // hide remaining Data
                leftDataGrid.DataBind();
                tferorRegNoTextBox.Focus();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save SuccessFully');", true);
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.Message.Replace("'", "").ToString() + "');", true);
        }
    }
Beispiel #2
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        UnitRepurchase unitRepObj = new UnitRepurchase();

        regObj.FundCode   = FundCodeTextBox.Text.Trim();
        regObj.BranchCode = BranchCodeTextBox.Text.Trim();
        regObj.RegNumber  = RegNoTextBox.Text.Trim();

        unitRepObj.RepurchaseNo   = Convert.ToInt32(RepNoTextBox.Text.Trim().ToString());
        unitRepObj.RepurchaseRate = decimal.Parse(RepRateTextBox.Text.Trim().ToString());
        unitRepObj.RepurchaseDate = RepDateTextBox.Text.Trim().ToString();
        if (EFTRadioButton.Checked)
        {
            unitRepObj.PayType = "EFT";
        }
        else
        {
            unitRepObj.PayType = "CHQ";
        }

        try
        {
            if (opendMFDAO.IsValidRegistration(regObj))
            {
                if (unitRepBLObj.IsRepurchaseLock(regObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + " Repurchase Operation is locked " + "');", true);
                }

                else if (unitRepBLObj.IsDuplicateRepurchase(regObj, unitRepObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Repurchase Number " + "');", true);
                }
                else if (Convert.ToInt64(TotalUnitRepurchaseTextBox.Text.ToString()) <= 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed: Surrender Value con not be equal or less than Zero');", true);
                }
                else if (!unitRepBLObj.IsValidBEFTN(regObj, unitRepObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + "Either No Router Number  or Account Number>13 digits " + "');", true);
                }
                else if (unitRepBLObj.IsIDAccount(regObj, unitRepObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + "ID Account is not allow to BEFTN " + "');", true);
                }
                else
                {
                    DataTable dtGrid = opendMFDAO.getTableDataGridCDS();
                    DataRow   drGrid;
                    foreach (DataGridItem gridRow in leftDataGrid.Items)
                    {
                        CheckBox leftCheckBox = (CheckBox)gridRow.FindControl("leftCheckBox");
                        if (leftCheckBox.Checked)
                        {
                            TextBox SL_TR_NOTxt        = (TextBox)gridRow.FindControl("SL_TR_NoTextBox");
                            TextBox SURRENDER_UNITSTxt = (TextBox)gridRow.FindControl("Sale_UnitsTextBox");
                            TextBox EXIST_UNITSTxt     = (TextBox)gridRow.FindControl("Exist_UnitsTextBox");
                            drGrid                    = dtGrid.NewRow();
                            drGrid["SL_TR_NO"]        = SL_TR_NOTxt.Text.Trim().ToString();
                            drGrid["SURRENDER_UNITS"] = SURRENDER_UNITSTxt.Text.Trim().ToString();
                            drGrid["EXIST_UNITS"]     = EXIST_UNITSTxt.Text.Trim().ToString();
                            dtGrid.Rows.Add(drGrid);
                        }
                    }

                    unitRepBLObj.saveRepurchaseCDS(dtGrid, regObj, unitRepObj, userObj);//save Repurchase Data
                    ClearText();

                    leftDataGrid.DataSource = opendMFDAO.getTableDataGridCDS();// hide remaining Data
                    leftDataGrid.DataBind();
                    TotalUnitHoldingTextBox.Text = "";
                    EFTRadioButton.Checked       = true;
                    CHQRadioButton.Checked       = false;

                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save SuccessFully');", true);
                }
            }
            else
            {
                ClearText();
                leftDataGrid.DataSource = opendMFDAO.getTableDataGridCDS();// hide remaining Data
                leftDataGrid.DataBind();
                TotalUnitHoldingTextBox.Text = "";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number');", true);
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.Message.Replace("'", "").ToString() + "');", true);
        }
    }
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        UnitRepurchase unitRepObj = new UnitRepurchase();

        regObj.FundCode   = FundCodeTextBox.Text.Trim();
        regObj.BranchCode = BranchCodeTextBox.Text.Trim();
        regObj.RegNumber  = RegNoTextBox.Text.Trim();

        unitRepObj.RepurchaseNo   = Convert.ToInt32(moneyReceipDropDownList.SelectedItem.Text.ToString());
        unitRepObj.RepurchaseRate = decimal.Parse(RepRateTextBox.Text.Trim().ToString());
        unitRepObj.RepurchaseDate = RepDateTextBox.Text.Trim().ToString();
        unitRepObj.PayType        = payTypeLabel.Text.ToUpper();

        try
        {
            if (opendMFDAO.IsValidRegistration(regObj))
            {
                if (unitRepBLObj.IsRepurchaseLock(regObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + " Repurchase Operation is locked " + "');", true);
                }

                else if (unitRepBLObj.IsDuplicateRepurchase(regObj, unitRepObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Repurchase Number " + "');", true);
                }
                else if (Convert.ToInt64(TotalUnitRepurchaseTextBox.Text.ToString()) <= 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed: Surrender Value con not be equal or less than Zero');", true);
                }
                else if (!unitRepBLObj.IsValidBEFTN(regObj, unitRepObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + "Either No Router Number  or Account Number>13 digits " + "');", true);
                }
                else if (unitRepBLObj.IsIDAccount(regObj, unitRepObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + "ID Account is not allow to BEFTN " + "');", true);
                }
                else
                {
                    long      totalSurrenderUnits = 0;
                    DataTable dtGrid = opendMFDAO.getTableDataGridCDS();
                    DataRow   drGrid;
                    foreach (DataGridItem gridRow in leftDataGrid.Items)
                    {
                        CheckBox leftCheckBox = (CheckBox)gridRow.FindControl("leftCheckBox");
                        if (leftCheckBox.Checked)
                        {
                            TextBox SL_TR_NOTxt        = (TextBox)gridRow.FindControl("SL_TR_NoTextBox");
                            TextBox SURRENDER_UNITSTxt = (TextBox)gridRow.FindControl("Sale_UnitsTextBox");
                            TextBox EXIST_UNITSTxt     = (TextBox)gridRow.FindControl("Exist_UnitsTextBox");
                            drGrid                    = dtGrid.NewRow();
                            drGrid["SL_TR_NO"]        = SL_TR_NOTxt.Text.Trim().ToString();
                            drGrid["SURRENDER_UNITS"] = SURRENDER_UNITSTxt.Text.Trim().ToString();
                            drGrid["EXIST_UNITS"]     = EXIST_UNITSTxt.Text.Trim().ToString();
                            dtGrid.Rows.Add(drGrid);
                            totalSurrenderUnits = totalSurrenderUnits + Convert.ToInt64(SURRENDER_UNITSTxt.Text.ToString());
                        }
                    }
                    if (dtGrid.Rows.Count > 0)
                    {
                        if (totalSurrenderUnits == Convert.ToInt64(TotalUnitRepurchaseTextBox.Text) && totalSurrenderUnits == Convert.ToInt64(QtyTextBox.Text))
                        {
                            commonGatewayObj.ExecuteNonQuery("UPDATE MONEY_RECEIPT SET SL_REP_TR_RN_NO=" + unitRepObj.RepurchaseNo + "  WHERE ID=" + Convert.ToUInt64(moneyReceipDropDownList.SelectedValue.ToString()));
                            unitRepBLObj.saveRepurchaseCDS(dtGrid, regObj, unitRepObj, userObj);//save Repurchase Data
                            ClearText();

                            moneyReceipDropDownList.DataSource     = unitSaleBLObj.dtMoneyRecieptforDDL(" AND REG_BK = '" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR = '" + regObj.BranchCode.ToString().ToUpper() + "'AND RECEIPT_TYPE = 'REP' AND SL_REP_TR_RN_NO IS NULL  ORDER BY RECEIPT_NO DESC ");
                            moneyReceipDropDownList.DataTextField  = "RECEIPT_NO";
                            moneyReceipDropDownList.DataValueField = "ID";
                            moneyReceipDropDownList.DataBind();

                            leftDataGrid.DataSource = opendMFDAO.getTableDataGridCDS();// hide remaining Data
                            leftDataGrid.DataBind();
                            TotalUnitHoldingTextBox.Text = "";

                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save SuccessFully');", true);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed : Total Selected Units and Add Total Units is not equal');", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to No Sale Selected');", true);
                    }
                }
            }
            else
            {
                ClearText();
                leftDataGrid.DataSource = opendMFDAO.getTableDataGridCDS();// hide remaining Data
                leftDataGrid.DataBind();
                TotalUnitHoldingTextBox.Text = "";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number');", true);
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.Message.Replace("'", "").ToString() + "');", true);
        }
    }