protected void OkButton_Click(object sender, EventArgs e)
    {
        BaseClass bcContent           = new BaseClass();
        UnitUser  userObj             = new UnitUser();
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        userObj.UserID = (string)Session["UserID"].ToString();
        //userObj.UserPassword = (string)Session["UserPassword"].ToString();
        regObj.FundCode   = fundNameDropDownList.SelectedValue.ToString();
        regObj.BranchCode = branchNameDropDownList.SelectedValue.ToString();
        bool userLevelPermission = false;

        if (userObj.UserID.ToUpper().ToString() == "ADMIN")
        {
            userLevelPermission = true;
        }
        else
        {
            if (userBLObj.GetUserBranchPermission(regObj, userObj) && userBLObj.GetUserFundPermission(regObj, userObj))
            {
                userLevelPermission = true;
            }
            else
            {
                userLevelPermission = false;
            }
        }

        if (userLevelPermission)
        {
            bcContent.LoginID       = (string)Session["UserID"];
            bcContent.LoginUserName = (string)Session["UserName"];
            bcContent.LoginTime     = DateTime.Now;
            bcContent.Roles         = (string)Session["UseRole"];
            bcContent.BranchCode    = branchNameDropDownList.SelectedValue.ToString();
            bcContent.FundCode      = fundNameDropDownList.SelectedValue.ToString();
            bcContent.CDS           = opendMFDAO.getCDSStatus(fundNameDropDownList.SelectedValue.ToString());
            bcContent.AppId         = 1;
            bcContent.DbServerType  = "C";
            long loginSessionID = logDAO.Login(bcContent);
            bcContent.SessionID  = loginSessionID;
            Session["BCContent"] = bcContent;
            Response.Redirect("UnitHome.aspx");
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('You Have No Permission to Enter This Branch or Fund');", true);
        }
    }
Beispiel #2
0
    protected void PrintSaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        long      money_Receipt_ID     = 0;
        Hashtable htInsertMoneyReceipt = new Hashtable();

        try
        {
            regObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
            regObj.BranchCode = branchCodeDDL.SelectedValue.ToString();
            regObj.RegNumber  = regNoTextBox.Text.Trim();
            CDSStatus         = opendMFDAO.getCDSStatus(fundCodeDDL.SelectedValue.ToString());
            decimal TotalUnitsBalance = 0;
            if (CDSStatus == "Y")
            {
                TotalUnitsBalance = opendMFDAO.getTotalSaleUnitBalanceCDS(regObj);
            }
            else
            {
                TotalUnitsBalance = opendMFDAO.getTotalSaleUnitBalance(regObj);
            }
            decimal unitQty = Convert.ToDecimal(QtyTextBox.Text.Trim());
            if (unitQty > TotalUnitsBalance)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Save Failed: Insufficient Units');", true);
            }
            else if (unitSaleBLObj.CheckDuplicateMoneyReceiptNo(regObj, "REP", Convert.ToInt64(ReceiptNoTextBox.Text.Trim())))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Receipt Number " + "');", true);
            }
            else
            {
                money_Receipt_ID = commonGatewayObj.GetMaxNo("MONEY_RECEIPT", "ID") + 1;
                commonGatewayObj.BeginTransaction();
                htInsertMoneyReceipt.Add("ID", money_Receipt_ID);
                htInsertMoneyReceipt.Add("RECEIPT_NO", ReceiptNoTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("RECEIPT_TYPE", "REP");
                htInsertMoneyReceipt.Add("RECEIPT_DATE", ReceiptDateTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("REG_BK", fundCodeDDL.SelectedValue.ToString());
                htInsertMoneyReceipt.Add("REG_BR", branchCodeDDL.SelectedValue.ToString());
                htInsertMoneyReceipt.Add("REG_NO", regNoTextBox.Text.Trim());

                if (holderBOTextBox.Text.Trim() != "")
                {
                    htInsertMoneyReceipt.Add("BO", holderBOTextBox.Text.Trim());
                }
                htInsertMoneyReceipt.Add("HNAME", NameTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("ADDRESS", addressTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("UNIT_QTY", QtyTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("RATE", RateTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("SL_TR_RN_NO", SaleTRRNNoTextBox.Text.Trim().ToUpper());
                if (EFTRadioButton.Checked)
                {
                    htInsertMoneyReceipt.Add("REP_PAY_TYPE", "EFT");
                }
                else
                {
                    htInsertMoneyReceipt.Add("REP_PAY_TYPE", "CHQ");
                }
                htInsertMoneyReceipt.Add("REP_PAY_DATE", PayDateTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("RECEIPT_ENTRY_BY", userObj.UserID.ToString());
                htInsertMoneyReceipt.Add("RECEIPT_ENTRY_DATE", DateTime.Today.ToString("dd-MMM-yyyy"));

                commonGatewayObj.Insert(htInsertMoneyReceipt, "MONEY_RECEIPT");
                commonGatewayObj.CommitTransaction();
                ClearText();
                Session["MONEY_RECEIPT_ID"]   = money_Receipt_ID.ToString();
                Session["MONEY_RECEIPT_TYPE"] = "REP";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "window.open('ReportViewer/UnitReportMoneyReceiptReportViewer.aspx');", true);
            }
        }

        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            Session["MONEY_RECEIPT_ID"]   = null;
            Session["MONEY_RECEIPT_TYPE"] = null;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save and print Failed');", true);
        }
    }