Esempio n. 1
0
    protected void LinkApprovePurchase_Click(object sender, EventArgs e)
    {
        Session["Click"] = false;
        MvPurchase.SetActiveView(MvPurchase.Views[0]);

        FvPurchase.ChangeMode(FormViewMode.ReadOnly);
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            switch (Request.Params["Mode"])

            {
            case "DataEntry":
                MvPurchase.SetActiveView(MvPurchase.Views[0]);
                FvPurchase.ChangeMode(FormViewMode.Insert);
                break;

            case "Verify":
                MvPurchase.SetActiveView(MvPurchase.Views[1]);
                break;
            }
            Session["Mode"] = Request.Params["Mode"];
        }
        if (FvPurchase.CurrentMode == FormViewMode.Insert)
        {
            XmlDataSource1.Data = (string)ConfigAdapter.GetConfigByModule("PUR", "PackType");
            XmlDataSource1.DataBind();
        }
        if (FvPurchase.CurrentMode == FormViewMode.Edit)
        {
            XmlDataSource1.Data = (string)ConfigAdapter.GetConfigByModule("PUR", "PackType");
            XmlDataSource1.DataBind();
        }
    }
Esempio n. 3
0
    protected void LinkverifyPurchaseRequest_Click(object sender, EventArgs e)
    {
        Session["Click"] = true;
        MvPurchase.SetActiveView(MvPurchase.Views[1]);

        FvPurchase.ChangeMode(FormViewMode.Edit);
    }
Esempio n. 4
0
    protected void txtPriceIns_DataBinding(object sender, EventArgs e)
    {
        TextBox txt = (TextBox)FvPurchase.FindControl("txtPriceIns");

        if (txt.Text != "")
        {
            string s = txt.Text;
            int    i = s.IndexOf('.');
            s.Remove(i + 2);
        }
    }
Esempio n. 5
0
    protected void btnApproveItm_Click(object sender, EventArgs e)
    {
        string userName = Thread.CurrentPrincipal.Identity.Name;

        DateTime PurchaseDate = Convert.ToDateTime(((TextBox)FvPurchase.FindControl("txtPurchaseDateItm")).Text);
        Purchase objPurchase  = new Purchase();

        Guid PurchaseID = (Guid)GvPurchase.SelectedValue;

        objPurchase.ApprovePurchaseOrder(PurchaseID, PurchaseDate, userName, DateTime.Now);
    }
Esempio n. 6
0
    protected void btnUpdatePurchaseDetails_Click(object sender, EventArgs e)
    {
        string Mode       = "Ins";
        Guid   PurchaseID = Guid.Empty;

        if (null == ViewState["PurchaseRegDetails"])
        {
            ViewState["PurchaseRegDetails"] = new Purchase().SelectPurchaseRegDetailsByID(Guid.Empty);

            PurchaseID = Guid.Empty;
        }
        if (FvPurchase.CurrentMode == FormViewMode.Edit)
        {
            PurchaseID = (Guid)FvPurchase.DataKey["PurchaseID"];
            Mode       = "Upd";
        }

        GridView  GvPurchageDetails    = ((GridView)FvPurchase.FindControl("GvPurchageDetails" + Mode));
        DataTable dtPurchaseRegDetails = (DataTable)ViewState["PurchaseRegDetails"];

        DropDownList ddlItemID   = ((DropDownList)FvPurchase.FindControl("ddlItemID" + Mode));
        DropDownList ddlPackType = ((DropDownList)FvPurchase.FindControl("ddlPackType" + Mode));
        TextBox      txtQuantity = ((TextBox)FvPurchase.FindControl("txtQuantity" + Mode));
        TextBox      txtPrice    = ((TextBox)FvPurchase.FindControl("txtPrice" + Mode));

        //TextBox txtValue = ((TextBox) FvPurchase.FindControl("txtValue" + Mode));

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

        if (null != dr)
        {
            dr["ItemID"]   = ddlItemID.SelectedValue;
            dr["PackType"] = ddlPackType.SelectedValue;
            dr["Quantity"] = txtQuantity.Text;
            dr["Price"]    = txtPrice.Text;
            dr["Value"]    = ((decimal)dr["Price"]) * ((decimal)dr["Quantity"]);

            ddlItemID.SelectedIndex   = -1;
            ddlPackType.SelectedIndex = -1;
            txtQuantity.Text          = "";
            txtPrice.Text             = "";
        }
        ((Button)FvPurchase.FindControl("btnAddPurchaseDetails" + Mode)).Visible    = true;
        ((Button)FvPurchase.FindControl("btnUpdatePurchaseDetails" + Mode)).Visible = false;
        GvPurchageDetails.DataSource = (DataTable)ViewState["PurchaseRegDetails"];
        GvPurchageDetails.DataBind();
        GvPurchageDetails.SelectedIndex = -1;
    }
Esempio n. 7
0
    protected void GvPurchageDetails_SelectedIndexChanged(object sender, EventArgs e)
    {
        string Mode       = "Ins";
        Guid   PurchaseID = Guid.Empty;

        if (null == ViewState["PurchaseRegDetails"])
        {
            ViewState["PurchaseRegDetails"] = new Purchase().SelectPurchaseRegDetailsByID(Guid.Empty);
            PurchaseID = Guid.Empty;
        }
        if (FvPurchase.CurrentMode == FormViewMode.Edit)
        {
            PurchaseID = (Guid)FvPurchase.DataKey["PurchaseID"];
            Mode       = "Upd";
        }

        GridView     GvPurchageDetails    = ((GridView)FvPurchase.FindControl("GvPurchageDetails" + Mode));
        DataTable    dtPurchaseRegDetails = (DataTable)ViewState["PurchaseRegDetails"];
        DropDownList ddlItemID            = ((DropDownList)FvPurchase.FindControl("ddlItemID" + Mode));
        DropDownList ddlPackType          = ((DropDownList)FvPurchase.FindControl("ddlPackType" + Mode));
        TextBox      txtQuantity          = ((TextBox)FvPurchase.FindControl("txtQuantity" + Mode));
        TextBox      txtPrice             = ((TextBox)FvPurchase.FindControl("txtPrice" + Mode));

        //TextBox txtValue = ((TextBox) FvPurchase.FindControl("txtValue" + Mode));

        object[] keys = { GvPurchageDetails.SelectedDataKey.Value };
        //for (int i = 0; i < keys.Length; i++)
        //{
        //    keys[i] = GvPurchageDetails.SelectedDataKey.Values["DetailID"];

        //}
        DataRow dr = dtPurchaseRegDetails.Rows.Find(keys);

        if (null != dr)
        {
            ddlItemID.SelectedValue = Convert.ToString(dr["ItemID"]);

            ddlPackType.SelectedValue = Convert.ToString(dr["PackType"]);

            txtQuantity.Text = Convert.ToString(dr["Quantity"]);
            txtPrice.Text    = Convert.ToString(dr["Price"]);
            string s = txtPrice.Text;
            int    i = s.IndexOf('.');
            if (i > 0)
            {
                txtPrice.Text = s.Remove(i + 3);
            }
        }

        ((Button)FvPurchase.FindControl("btnAddPurchaseDetails" + Mode)).Visible    = false;
        ((Button)FvPurchase.FindControl("btnUpdatePurchaseDetails" + Mode)).Visible = true;
    }
Esempio n. 8
0
 protected void FvPurchase_DataBound(object sender, EventArgs e)
 {
     if (FvPurchase.CurrentMode == FormViewMode.Edit)
     {
         Purchase objpurchase = new Purchase();
         //Guid PurchaseID = (Guid) FvPurchase.DataKey["PurchaseID"];
         Guid PurchaseID = (Guid)GvPurchase.SelectedDataKey.Value;
         ViewState["PurchaseRegDetails"] = objpurchase.SelectPurchaseRegDetailsByID(PurchaseID);
         GridView grd = (GridView)FvPurchase.FindControl("GvPurchageDetailsUpd");
         grd.DataSource    = (DataTable)ViewState["PurchaseRegDetails"];
         grd.SelectedIndex = -1;
         grd.DataBind();
     }
     if (FvPurchase.CurrentMode == FormViewMode.ReadOnly)
     {
         Purchase objpurchase = new Purchase();
         Guid     PurchaseID  = (Guid)FvPurchase.DataKey["PurchaseID"];
         ViewState["PurchaseRegDetails"] = objpurchase.SelectPurchaseRegDetailsByID(PurchaseID);
         GridView grd = (GridView)FvPurchase.FindControl("GvPurchageDetailsItm");
         grd.DataSource    = (DataTable)ViewState["PurchaseRegDetails"];
         grd.SelectedIndex = -1;
         grd.DataBind();
     }
 }
Esempio n. 9
0
    protected void LinkRequest_Click(object sender, EventArgs e)
    {
        MvPurchase.SetActiveView(MvPurchase.Views[0]);

        FvPurchase.ChangeMode(FormViewMode.Insert);
    }
Esempio n. 10
0
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        MvPurchase.SetActiveView(MvPurchase.Views[1]);

        FvPurchase.ChangeMode(FormViewMode.ReadOnly);
    }
Esempio n. 11
0
 protected void GvPurchase_SelectedIndexChanged(object sender, EventArgs e)
 {
     MvPurchase.SetActiveView(MvPurchase.Views[0]);
     FvPurchase.ChangeMode(FormViewMode.Edit);
 }