コード例 #1
0
ファイル: Purchase.aspx.cs プロジェクト: UrviGandhi/IGRSS
    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);
        }
    }
コード例 #2
0
ファイル: Purchase.aspx.cs プロジェクト: UrviGandhi/IGRSS
    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);
    }
コード例 #3
0
ファイル: Purchase.aspx.cs プロジェクト: UrviGandhi/IGRSS
    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;
    }
コード例 #4
0
ファイル: Purchase.aspx.cs プロジェクト: UrviGandhi/IGRSS
    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;
    }
コード例 #5
0
ファイル: Purchase.aspx.cs プロジェクト: UrviGandhi/IGRSS
 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();
     }
 }