示例#1
0
    protected void ddlPOCode_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddlPOCode.SelectedValue.Trim() != "-1")
            {
                //
                // Load Pending PO's
                //
                hdnPOId.Value = ddlPOCode.SelectedValue.Trim();
                ObjGRNPO.POId = Int32.Parse(ddlPOCode.SelectedValue.Trim());
                //hdnPOId.Value = ObjGRNPO.POId.ToString();

                DataSet dsPOItems = ObjGRNPO.GetAllPartialyReceivedPOItemsByPOID();
                if (dsPOItems == null || dsPOItems.Tables.Count == 0)
                {
                    ddlPOCode.Items.Add(new ListItem("--No Records--", "-1"));
                }
                else
                {
                    Master.BindDropdown("ItemDescription", "ItemId", dsPOItems, ddlItemCode);
                    ddlItemCode.Items.Add(new ListItem("--Please Select--", "-1"));
                    ddlItemCode.SelectedValue = "-1";
                    txtPOAmmount.Text         = Decimal.Round(ObjGRNPO.POAmount, 2).ToString();
                    txtSupplierName.Text      = ObjGRNPO.SupplierName;
                }
            }
            else
            {
                this.ClearItemDetails();
            }
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void ddlPOCode_SelectedIndexChanged(object sender, EventArgs e)");
            if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty)
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false);
            }
            else
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false);
            }
        }
    }
示例#2
0
    protected void ddlItemCode_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddlItemCode.SelectedValue.Trim() != "-1" && ddlItemCode.SelectedValue.Trim() != "")
            {
                if (rblGRNType.SelectedItem.Value.Trim() == "1")//PO
                {
                    Item tmpItem = new Item();
                    tmpItem.ItemId = Int32.Parse(ddlItemCode.SelectedValue.Trim());
                    tmpItem.GetItemByID();
                    txtItemName.Text = tmpItem.ItemDescription.Trim();

                    DataSet dsItems = ObjGRNPO.GetAllPartialyReceivedPOItemsByPOID();
                    if (dsItems != null && dsItems.Tables[0].Rows.Count > 0)
                    {
                        DataView dvItems = dsItems.Tables[0].DefaultView;

                        dvItems.Sort = "ItemId";
                        DataRowView[] dr = dvItems.FindRows(tmpItem.ItemId.ToString());
                        if (dr.Length > 0)
                        {
                            hdnItemId.Value       = dr[0]["ItemId"].ToString();
                            txtItemName.Text      = dr[0]["ItemDescription"].ToString();
                            txtMaxRecievable.Text = dr[0]["TotalRemaining"].ToString();
                            hdnItemValue.Value    = dr[0]["POItemCost"].ToString();
                            txtCost.Text          = Decimal.Round(Convert.ToDecimal(dr[0]["POItemCost"].ToString()), 2).ToString();
                        }
                    }
                }
                else if (rblGRNType.SelectedItem.Value.Trim() == "2")//Invoice
                {
                    DataSet ds = new DataSet();
                    ds = new InvoiceDAO().GetInvoiceDetailsByInvoiceIDForReturns(ObjGRN.GRNInvoice);

                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        DataView dvItems = ds.Tables[0].DefaultView;
                        dvItems.Sort = "Id";
                        DataRowView[] dr = dvItems.FindRows(ddlItemCode.SelectedValue.Trim());
                        if (dr.Length > 0)
                        {
                            hdnItemId.Value       = dr[0]["Id"].ToString();
                            txtItemName.Text      = dr[0]["ItemDescription"].ToString();
                            txtMaxRecievable.Text = dr[0]["ReturnQty"].ToString();//IssuedQTY - 30-09-2012 changed from ReturnQty to IssuedQTY
                            hdnItemValue.Value    = dr[0]["Price"].ToString();
                            txtCost.Text          = Math.Round(Convert.ToDecimal(dr[0]["Price"].ToString()), 2).ToString();
                        }
                    }
                }
            }
            else
            {
                ClearItemDetails();
            }
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void ddlItemCode_SelectedIndexChanged(object sender, EventArgs e)");
            if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty)
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false);
            }
            else
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false);
            }
        }
    }