Ejemplo n.º 1
0
    protected void AddStampDetails_Click(object sender, EventArgs e)
    {
        string Mode = "Ins";
        Guid RefundApplicationId = Guid.Empty;

        if (null == ViewState["StampDetails"])
        {
            ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId(Guid.Empty);
            RefundApplicationId = Guid.Empty;
        }
        if (fvRefundApplication.CurrentMode == FormViewMode.Edit)
        {
            RefundApplicationId = (Guid) fvRefundApplication.DataKey["RefundApplicationId"];
            Mode = "Upd";
        }

        GridView gvStampDetails = ((GridView) fvRefundApplication.FindControl("gvRefundStampDetails" + Mode));
        DataTable dtStampDetails = (DataTable) ViewState["StampDetails"];

        DropDownList ddlRevenueStamp = ((DropDownList) fvRefundApplication.FindControl("ddlRevenueStampId" + Mode));
        TextBox txtRefundQty = ((TextBox) fvRefundApplication.FindControl("txtReturnedQuantity" + Mode));
        TextBox txtSerialNo = ((TextBox) fvRefundApplication.FindControl("txtStampSlNo" + Mode));

        object[] keys = {RefundApplicationId,
        new Guid(ddlRevenueStamp.SelectedValue)};

        DataRow dr = dtStampDetails.Rows.Find(keys);

        if (null == dr)
        {
            dr = dtStampDetails.NewRow();
            dr["RevenueStampId"] = new Guid(ddlRevenueStamp.SelectedValue);
            dr["StampName"] = ddlRevenueStamp.SelectedItem.Text;
            dr["ReturnedQty"] = txtRefundQty.Text;
            dr["StampNumber"] = txtSerialNo.Text;
            dr["RefundApplicationId"] = RefundApplicationId;
            dtStampDetails.Rows.Add(dr);
            ddlRevenueStamp.SelectedIndex = -1;
            txtRefundQty.Text = "";
            txtSerialNo.Text = "";
        }

        ((Button) fvRefundApplication.FindControl("btnAddStamp" + Mode)).Visible = true;
        ((Button) fvRefundApplication.FindControl("btnUpdateStamp" + Mode)).Visible = false;

        ViewState["StampDetails"] = dtStampDetails;
        gvStampDetails.DataSource = (DataTable) ViewState["StampDetails"];
        gvStampDetails.DataBind();
    }
Ejemplo n.º 2
0
 protected void btnApprove_Click(object sender, EventArgs e)
 {
     //RefundApplication RfApplication = new RefundApplication();
     //RfApplication.InsertNewRefundOrders(
     string userName = Thread.CurrentPrincipal.Identity.Name;
     string RefundOrderID=((TextBox)FVRefundApplication.FindControl("txtRefundOrderId")).Text;
     DateTime RefundDate = Convert.ToDateTime(((TextBox) FVRefundApplication.FindControl("txtRefundDate")).Text);
     RefundApplication RfApplication = new RefundApplication();
      Guid RefundApplicationId=(Guid)FVRefundApplication.SelectedValue;
      DataTable dtTotAmount = RfApplication.GetAllRefundApplicationsById(RefundApplicationId);
      string TotAmount = Convert.ToString(dtTotAmount.Rows[0]["TotalValueOfStamps"]);
      decimal cTotAmount = Convert.ToDecimal(TotAmount);
      decimal PenalityAmount = (cTotAmount)*Convert.ToDecimal(0.10);
      decimal RefundAmount = (cTotAmount)*Convert.ToDecimal(0.90);
      RfApplication.UpdateRefundOrderDetails(RefundApplicationId, PenalityAmount, RefundAmount, RefundOrderID, RefundDate, userName, DateTime.Now);
 }
Ejemplo n.º 3
0
    protected void FVRefundApplication_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        InitActsApplicable();
        InitStampDetails();
        //Adding The DataTable dt to the eventArgs of FVRefundApplication

        e.NewValues.Add("StampDetails", dt);

        dt.Rows.Add(dlRevenueStampId.SelectedValue, dlRevenueStampId.SelectedItem.Text, TxtReturnedQty.Text, txtStampsNumbers.Text);
        dt.AcceptChanges();
        gvRefundStampDetails.DataSource = dt;
        gvRefundStampDetails.DataBind();
        Session["StampDetails"] = dt;
        txtStampsNumbers.Text = "";
        TxtReturnedQty.Text = "";

        //******
        gvRefundStampDetails.DataSource = dt;
        gvRefundStampDetails.DataBind();

        RefundApplication RfApplication = new RefundApplication();
        Guid RefundApplicationId = (Guid) FVRefundApplication.SelectedValue;

        DataTable dtStampDetails = RfApplication.SelectRefundStampDetailsByRefundId(RefundApplicationId);
        gvRefundStampDetails.DataSource = dtStampDetails;
        gvRefundStampDetails.DataBind();
    }
Ejemplo n.º 4
0
    protected void StampDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Guid RefundApplicationId = Guid.Empty;
        if (null == ViewState["StampDetails"])
        {
            ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId(Guid.Empty);
            RefundApplicationId = Guid.Empty;
        }
        if (fvRefundApplication.CurrentMode == FormViewMode.Edit)
        {
            RefundApplicationId = (Guid) fvRefundApplication.DataKey["RefundApplicationId"];
        }

        GridView gvStampDetails = (GridView) sender;
        DataTable dtStampDetails = (DataTable) ViewState["StampDetails"];

        //object[] keys = {RefundApplicationId,
        //                e.Keys["RevenueStampId"]};
        //DataRow dr = dtStampDetails.Rows.Find(keys);

        //if (null != dr)
        //{
        //    dtStampDetails.Rows.Remove(dr);
        //}

        int i = e.RowIndex;
        dtStampDetails.Rows[i].Delete();
        dtStampDetails.AcceptChanges();

        ViewState["StampDetails"] = dtStampDetails;
        gvStampDetails.DataSource = ViewState["StampDetails"];
        gvStampDetails.DataBind();
    }
Ejemplo n.º 5
0
    protected void StampDetailsGrid_SelectedIndexChanged(object sender, EventArgs e)
    {
        string Mode = "Ins";
        Guid RefundApplicationId = Guid.Empty;
        if (null == ViewState["StampDetails"])
        {
            ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId(Guid.Empty);
            RefundApplicationId = Guid.Empty;
        }
        if (fvRefundApplication.CurrentMode == FormViewMode.Edit)
        {
            RefundApplicationId = (Guid) fvRefundApplication.DataKey["RefundApplicationId"];
            Mode = "Upd";
        }

        GridView gvStampDetails = (GridView) sender;
        DataTable dtStampDetails = (DataTable) ViewState["StampDetails"];

        DropDownList ddlRevenueStamp = ((DropDownList) fvRefundApplication.FindControl("ddlRevenueStampId" + Mode));
        TextBox txtRefundQty = ((TextBox) fvRefundApplication.FindControl("txtReturnedQuantity" + Mode));
        TextBox txtSerialNo = ((TextBox) fvRefundApplication.FindControl("txtStampSlNo" + Mode));

        object[] keys = new object[gvStampDetails.SelectedDataKey.Values.Count];
        for (int i = 0; i < keys.Length; i++)
        {
            keys[i] = gvStampDetails.SelectedDataKey.Values[i];
        }
        DataRow dr = dtStampDetails.Rows.Find(keys);

        if (null != dr)
        {
            ddlRevenueStamp.SelectedValue = Convert.ToString(dr["RevenueStampId"]);
            txtRefundQty.Text = Convert.ToString(dr["ReturnedQty"]);
            txtSerialNo.Text = Convert.ToString(dr["StampNumber"]);
        }

        ((Button) fvRefundApplication.FindControl("btnAddStamp" + Mode)).Visible = false;
        ((Button) fvRefundApplication.FindControl("btnUpdateStamp" + Mode)).Visible = true;
    }
Ejemplo n.º 6
0
 protected void OdsRefundDetails_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     RefundApplication app = new RefundApplication();
     DataTable dt = app.SelectRefundStampDetailsByRefundId((Guid) e.OutputParameters["RefundApplicationId"]);
     e.OutputParameters.Add("StampDetails", dt);
 }
Ejemplo n.º 7
0
    protected void FvRefundReadOnly_DataBound(object sender, EventArgs e)
    {
        RefundApplication app = new RefundApplication();
        Guid RefundApplicationId = (Guid) FvRefundReadOnly.DataKey["RefundApplicationId"];
        DataTable ItmActsApplicable = app.SelectActDetailsByRefundApplicationId(RefundApplicationId);
        ViewState["dtActsApplicable"] = ItmActsApplicable;

        CheckBoxList lstActs = (CheckBoxList) FvRefundReadOnly.FindControl("chkLstBxReadOnly");
        foreach (DataRow act in ItmActsApplicable.Rows)
        {
            ListItem item = new ListItem();
            item.Text = Convert.ToString(act["NameOfAct"]);
            item.Selected = Convert.ToBoolean(act["Checked"]);
            item.Value = ((Guid) act["ActId"]).ToString();
            lstActs.Items.Add(item);
        }
    }
Ejemplo n.º 8
0
    protected void fvRefundApplication_ModeChanging(object sender, FormViewModeEventArgs e)
    {
        switch (e.NewMode)
        {
            case FormViewMode.Edit:
                FormView Form = (FormView) sender;
                ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId((Guid) Form.DataKey["RefundApplicationId"]);

                GridView StampDetailsGrid = (GridView) Form.FindControl("gvRefundStampDetailsUpd");
                if (null != StampDetailsGrid)
                {
                    StampDetailsGrid.DataSource = (DataTable) ViewState["StampDetails"];
                    StampDetailsGrid.DataBind();
                }

                DropDownList dlOfficeName = (DropDownList) fvRefundApplication.FindControl("dlOfficeName");
                Profile.Permissions.FillOffices(dlOfficeName, "REF", "Insert");

                break;
            case FormViewMode.Insert:
                break;
            case FormViewMode.ReadOnly:
                break;
            default:
                break;
        }
    }
Ejemplo n.º 9
0
    protected void fvRefundApplication_ModeChanged(object sender, EventArgs e)
    {
        FormView Form = (FormView) sender;
        switch (((FormView) sender).CurrentMode)
        {
            case FormViewMode.Edit:
                ViewState["StampDetails"] = new RefundApplication().SelectRefundStampDetailsByRefundId((Guid) Form.DataKey["RefundApplicationId"]);

                GridView StampDetailsGrid = (GridView) Form.FindControl("gvRefundStampDetailsUpd");
                if (null != StampDetailsGrid)
                {
                    StampDetailsGrid.DataSource = (DataTable) ViewState["StampDetails"];
                    StampDetailsGrid.DataBind();
                }
                break;
            case FormViewMode.Insert:
                break;
            case FormViewMode.ReadOnly:
                break;
            default:
                break;
        }
    }
Ejemplo n.º 10
0
    protected void fvRefundApplication_DataBound(object sender, EventArgs e)
    {
        if (fvRefundApplication.CurrentMode == FormViewMode.Edit)
        {
            RefundApplication app = new RefundApplication();

            Guid RefundApplicationId = (Guid) fvRefundApplication.DataKey["RefundApplicationId"];
            ViewState["StampDetails"] = app.SelectRefundStampDetailsByRefundId(RefundApplicationId);

            GridView grd = (GridView) fvRefundApplication.FindControl("gvRefundStampDetailsUpd");
            grd.DataSource = (DataTable) ViewState["StampDetails"];
            grd.SelectedIndex = -1;
            grd.DataBind();

            DataTable ActsApplicable = app.SelectActDetailsByRefundApplicationId(RefundApplicationId);

            //ViewState["dtActsApplicable"] = ActsApplicable;

            CheckBoxList lstActs = (CheckBoxList) fvRefundApplication.FindControl("chkLstBxUpd");
            foreach (DataRow act in ActsApplicable.Rows)
            {
                ListItem item = new ListItem();
                item.Text = Convert.ToString(act["NameOfAct"]);
                item.Selected = Convert.ToBoolean(act["Checked"]);
                item.Value = ((Guid) act["ActId"]).ToString();
                lstActs.Items.Add(item);
            }
        }
        if (fvRefundApplication.CurrentMode == FormViewMode.ReadOnly)
        {
            RefundApplication app = new RefundApplication();
            Guid RefundApplicationId = (Guid) fvRefundApplication.DataKey["RefundApplicationId"];
            DataTable ItmActsApplicable = app.SelectActDetailsByRefundApplicationId(RefundApplicationId);
            ViewState["dtActsApplicable"] = ItmActsApplicable;

            CheckBoxList lstActs = (CheckBoxList) fvRefundApplication.FindControl("chkLstBxItm");
            foreach (DataRow act in ItmActsApplicable.Rows)
            {
                ListItem item = new ListItem();
                item.Text = Convert.ToString(act["NameOfAct"]);
                item.Selected = Convert.ToBoolean(act["Checked"]);
                item.Value = ((Guid) act["ActId"]).ToString();
                lstActs.Items.Add(item);
            }
        }
    }
Ejemplo n.º 11
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     OdsRefundDetails.SelectParameters["RefundApplicationId"].DefaultValue = GvRefundAlerts.SelectedDataKey.Value.ToString();
     RefundApplication Rf = new RefundApplication();
     DataTable dtGridUpd = new DataTable();
     Guid RefundApplicationId = (Guid) GvRefundAlerts.SelectedValue;
     dtGridUpd = Rf.SelectRefundStampDetailsByRefundId(RefundApplicationId);
     GridView Gv = ((GridView) fvRefundApplication.FindControl("gvRefundStampDetailsIns"));
     Gv.DataSource = dtGridUpd;
     Gv.DataBind();
 }