コード例 #1
0
ファイル: ContraEntry.aspx.cs プロジェクト: BTSSGIT/GEB-2019
        protected void btnAddRow_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = new DataTable();
                if (ViewState["data"] != null)
                {
                    GvContraEntry.DataSource = (DataTable)ViewState["data"];
                    GvContraEntry.DataBind();
                    int cnt = GvContraEntry.Rows.Count;
                    cnt++;

                    dt = (DataTable)ViewState["data"];
                    dt.Rows.Add(cnt.ToString());

                    GvContraEntry.DataSource = dt;
                    GvContraEntry.DataBind();
                }
                else
                {
                    int cnt = GvContraEntry.Rows.Count;
                    cnt++;
                    dt.Columns.Add("NO");
                    for (int i = 0; i < cnt; i++)
                    {
                        dt.Rows.Add(i.ToString());
                    }
                    GvContraEntry.DataSource = dt;
                    GvContraEntry.DataBind();
                }

                BindAccountGroup();

                ViewState["data"] = dt;

                if (ViewState["grid"] != null)
                {
                    dtGridData = (DataTable)ViewState["grid"];

                    for (int i = 0; i < dtGridData.Rows.Count; i++)
                    {
                        ((DropDownList)(GvContraEntry.Rows[i].Cells[0].FindControl("ddlAccountName"))).SelectedValue = dtGridData.Rows[i][0].ToString();
                        ((TextBox)(GvContraEntry.Rows[i].Cells[2].FindControl("txtDebitAmount"))).Text  = dtGridData.Rows[i][1].ToString();
                        ((TextBox)(GvContraEntry.Rows[i].Cells[3].FindControl("txtCreditAmount"))).Text = dtGridData.Rows[i][2].ToString();
                    }
                }
                setControlScript();
                enableDisableText();
                getDebitCreditSum();
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
コード例 #2
0
ファイル: ContraEntry.aspx.cs プロジェクト: BTSSGIT/GEB-2019
        public void getNewRows()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Number");
            for (int i = 1; i <= 10; i++)
            {
                dt.Rows.Add(i.ToString());
            }
            GvContraEntry.DataSource = dt;
            GvContraEntry.DataBind();
        }
コード例 #3
0
ファイル: ContraEntry.aspx.cs プロジェクト: BTSSGIT/GEB-2019
        public void clear()
        {
            objControl.ClearForm(Master.FindControl("ContentPlaceHolder1"));
            ViewState["Mode"]        = "Save";
            ViewState["VoucherNo"]   = "";
            ViewState["VoucherCode"] = "";
            ViewState["VoucherRow"]  = "0";
            GetMaxDate();

            GvContraEntry.DataSource = null;
            getNewRows();
            GvContraEntry.DataBind();

            BindAccountGroup();
            setControlScript();
            getDebitCreditSum();
        }
コード例 #4
0
ファイル: ContraEntry.aspx.cs プロジェクト: BTSSGIT/GEB-2019
        protected void gvJournalEntry_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                JournalVoucherMBL objJournalVoucherMBL = new JournalVoucherMBL();
                JournalVoucherMBO objJournalVoucherMBO = new JournalVoucherMBO();
                ViewState["VoucherCode"] = e.CommandArgument.ToString();

                if (e.CommandName.ToString() == "Edit1")
                {
                    GvContraEntry.SelectedIndex = -1;
                    ApplicationResult objResultSelect = new ApplicationResult();
                    objResultSelect = objJournalVoucherMBL.JournalVoucherM_Select(ViewState["VoucherCode"].ToString(), Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
                    if (objResultSelect != null)
                    {
                        DataTable dtSelect = new DataTable();
                        dtSelect = objResultSelect.resultDT;
                        if (dtSelect.Rows.Count > 0)
                        {
                            ViewState["VoucherRow"] = dtSelect.Rows.Count;
                            DataTable dt = new DataTable();

                            dt.Columns.Add("Number");
                            for (int i = 1; i <= Convert.ToInt32(ViewState["VoucherRow"]); i++)
                            {
                                dt.Rows.Add(i.ToString());
                            }
                            GvContraEntry.DataSource = dt;
                            GvContraEntry.DataBind();

                            BindAccountGroup();

                            for (int i = 0; i < dtSelect.Rows.Count; i++)
                            {
                                ((DropDownList)GvContraEntry.Rows[i].Cells[0].FindControl("ddlAccountName")).SelectedValue = dtSelect.Rows[i]["LedgerID"].ToString();

                                if (dtSelect.Rows[i]["TransactionType"].ToString() == "Debit")
                                {
                                    ((TextBox)GvContraEntry.Rows[i].Cells[2].FindControl("txtDebitAmount")).Text = dtSelect.Rows[i]["Amount"].ToString();
                                }
                                else
                                {
                                    ((TextBox)GvContraEntry.Rows[i].Cells[3].FindControl("txtCreditAmount")).Text = dtSelect.Rows[i]["Amount"].ToString();
                                }
                                GvContraEntry.Rows[i].Cells[4].Text = dtSelect.Rows[i][0].ToString();

                                txtNarration.Text = dtSelect.Rows[i]["Description"].ToString();
                                if (Convert.ToInt32(dtSelect.Rows[i]["ChequeNumber"]) != 0)
                                {
                                    txtChequeNo.Text = dtSelect.Rows[i]["ChequeNumber"].ToString();
                                }
                                txtVoucherCode.Text = ViewState["VoucherCode"].ToString();
                                txtDate.Text        = dtSelect.Rows[i]["VoucherDate"].ToString();
                            }
                            PanelVisibility(2);
                            setControlScript();
                            enableDisableText();
                            getDebitCreditSum();
                            ViewState["Mode"] = "Edit";
                        }
                    }
                }
                else if (e.CommandName.ToString() == "Delete1")
                {
                    ApplicationResult objResultDelete = new ApplicationResult();
                    objResultDelete = objJournalVoucherMBL.JournalVoucherM_Delete(e.CommandArgument.ToString(), "Contra");
                    if (objResultDelete.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        BindGrid();
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Deleted Successfully.');</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
コード例 #5
0
ファイル: ContraEntry.aspx.cs プロジェクト: BTSSGIT/GEB-2019
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Session[ApplicationSession.HASACCESSACCOUNTUSERID]) > 0)
            {
                if (!IsPostBack)
                {
                    if (Request.QueryString["mode"] == "TU")
                    {
                        lblDuration.Text = Session[ApplicationSession.TRUSTNAME].ToString() + ". Account Duration : " + Session[ApplicationSession.ACCOUNTFROMDATE].ToString() + " To " + Session[ApplicationSession.ACCOUNTTODATE].ToString();
                    }
                    else
                    {
                        if (Convert.ToInt32(Session[ApplicationSession.SCHOOLID]) == 0)
                        {
                            lblDuration.Text = Session[ApplicationSession.TRUSTNAME].ToString() + ". Account Duration : " + Session[ApplicationSession.ACCOUNTFROMDATE].ToString() + " To " + Session[ApplicationSession.ACCOUNTTODATE].ToString();
                        }
                        else
                        {
                            lblDuration.Text = Session[ApplicationSession.SCHOOLNAME].ToString() + ". Account Duration : " + Session[ApplicationSession.ACCOUNTFROMDATE].ToString() + " To " + Session[ApplicationSession.ACCOUNTTODATE].ToString();
                        }
                    }

                    GetMaxDate();
                    txtVoucherCode.Attributes.Add("readonly", "readonly");
                    txtDate.Attributes.Add("readonly", "readonly");

                    DataTable dt = new DataTable();
                    dt.Rows.Clear();
                    dt.Columns.Add("NO");
                    for (var i = 1; i <= 10; i++)
                    {
                        dt.Rows.Add(this.ToString());
                    }
                    GvContraEntry.DataSource = dt;
                    GvContraEntry.DataBind();

                    BindGrid();
                    BindAccountGroup();
                    PanelVisibility(1);
                }

                if (ViewState["grid"] != null)
                {
                    dtGridData = (DataTable)ViewState["grid"];
                    dtGridData.Rows.Clear();

                    for (int i = 0; i < GvContraEntry.Rows.Count; i++)
                    {
                        DataRow dr = dtGridData.NewRow();

                        dr[0] = ((DropDownList)(GvContraEntry.Rows[i].Cells[0].FindControl("ddlAccountName"))).SelectedItem.Value;
                        dr[1] = ((TextBox)(GvContraEntry.Rows[i].Cells[2].FindControl("txtDebitAmount"))).Text;
                        dr[2] = ((TextBox)(GvContraEntry.Rows[i].Cells[3].FindControl("txtCreditAmount"))).Text;

                        dtGridData.Rows.Add(dr);
                    }
                    ViewState["grid"] = dtGridData;
                }
                else
                {
                    dtGridData.Rows.Clear();
                    dtGridData.Columns.Add("AccountID");
                    dtGridData.Columns.Add("DebitAmount");
                    dtGridData.Columns.Add("CreditAmount");

                    ViewState["grid"] = dtGridData;
                }
                setControlScript();
            }
            else
            {
                if (Convert.ToInt32(Session[ApplicationSession.SCHOOLID]) == 0)
                {
                    Response.Redirect("../Accounting/AccountLogin.aspx?mode=TU", false);
                }
                else
                {
                    Response.Redirect("../Accounting/AccountLogin.aspx", false);
                }
            }
        }