protected void gvdetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Cheque_CashDetails cheDelete = new Cheque_CashDetails();

        cheDelete.CQ_ID         = Convert.ToInt32(((Label)gvdetails.Rows[e.RowIndex].FindControl("lblid2")).Text);
        cheDelete.EmpID         = txtEMcode.Text = ((Label)gvdetails.Rows[e.RowIndex].FindControl("lblempcode")).Text;
        cheDelete.ChequeNo      = ((Label)gvdetails.Rows[e.RowIndex].FindControl("lblchequeno")).Text;
        cheDelete.Deposite_Type = ((Label)gvdetails.Rows[e.RowIndex].FindControl("lblDepositeType")).Text;
        cheDelete.ChequeDate    = Convert.ToString(((Label)gvdetails.Rows[e.RowIndex].FindControl("lblcheque")).Text);
        cheDelete.ReciptNo      = Convert.ToInt32(((Label)gvdetails.Rows[e.RowIndex].FindControl("lblreceipt")).Text);
        cheDelete.CustId        = ((Label)gvdetails.Rows[e.RowIndex].FindControl("lblcustomer")).Text;
        cheDelete.Amount        = Convert.ToDecimal(((Label)gvdetails.Rows[e.RowIndex].FindControl("lblamount")).Text);
        cheDelete.Payee_Bank    = ((Label)gvdetails.Rows[e.RowIndex].FindControl("lblbank")).Text;
        cheDelete.Description   = ((Label)gvdetails.Rows[e.RowIndex].FindControl("lblremark")).Text;
        cheDelete.CreatedBy     = ((Label)gvdetails.Rows[e.RowIndex].FindControl("lblCreated")).Text;

        //cheDelete. = ((Label)gvdetails.Rows[e.RowIndex].FindControl("lblBankId")).Text;
        // lblCustName.Text = ((Label)gvdetails.Rows[e.NewEditIndex].FindControl("lblcustname")).Text;
        // lblshow.Text = ((Label)gvdetails.Rows[e.NewEditIndex].FindControl("lblempname")).Text;
        cheDelete.IsDelete = Convert.ToBoolean(true);

        cheDelete.Update();
        message("Record Deleted successfully");
        BindDataGet();
    }
Exemplo n.º 2
0
    protected void btn_Save_Click(object sender, EventArgs e)

    {
        if (Session["UserName"] != null)
        {
            Cheque_CashDetails che = new Cheque_CashDetails();
            if (lblID.Text == "")
            {
                lblID.Text = "0";
            }
            che.CQ_ID = Convert.ToInt32(lblID.Text);

            che.EmpID    = txtEMcode.Text.Trim();
            che.ChequeNo = txtCheck.Text.Trim();
            //string txtChequeDate= Convert.ToDateTime(txtChequeDate.Text.Split('/')[1] + "/" + txtChequeDate.Text.Split('/')[0] + "/" + txtChequeDate.Text.Split('/')[2]);
            if (txtChequeDate.Text == "")
            {
                ChequeDate1 = "";
            }
            else
            {
                ChequeDate1 = txtChequeDate.Text.Split('/')[1] + "/" + txtChequeDate.Text.Split('/')[0] + "/" + txtChequeDate.Text.Split('/')[2];
            }
            che.ChequeDate = ChequeDate1;


            che.CustId     = txtcustomerid.Text.Trim();
            che.ReciptNo   = Convert.ToInt32(txtReciptNo.Text.Trim());
            che.Payee_Bank = txtBankName.Text.Trim();
            //che.Deposited_By = txtDeposit.Text.Trim();

            che.Amount        = Convert.ToDecimal(txtAmount.Text.Trim());
            che.CreatedBy     = Session["UserName"].ToString();
            che.Description   = txtRemark.Text.Trim();
            che.FinancialYear = Convert.ToInt32(strFY);
            if (Cheque.Items[0].Selected)
            {
                pnlCust.Visible = true;

                che.Deposite_Type = Cheque.SelectedValue;
            }
            else
            {
                pnlCust.Visible = true;

                che.Deposite_Type = Cheque.SelectedValue;
            }
            if (lblID.Text == "0")
            {
                che.Save(1, out IDNo);
            }
            else
            {
                che.Update();
            }

            lblId3.Text = Convert.ToString("CQ ID :" + (IDNo));
            message("Record Saved Successfully");
            if (lblID.Text == "0")
            {
                lblId3.Visible = true;
            }
            else
            {
                lblId3.Visible = false;
            }
            pnlCust.Visible    = true;
            lblempname.Text    = "";
            txtEMcode.Text     = "";
            txtCheck.Text      = "";
            txtChequeDate.Text = "";
            txtcustomerid.Text = "";
            txtReciptNo.Text   = "";
            //txtDeposit.Text = "";
            txtAmount.Text   = "";
            txtBankName.Text = "";
            lblshow.Text     = "";
            lblCustName.Text = "";
            //lblbank.Text = "";
            txtRemark.Text = "";
        }
        else
        {
            Response.Redirect("LoginUserDetails.aspx");
        }
    }