protected void Grid1_RowCommand(object sender, Obout.Grid.GridRowEventArgs e)
        {
            iPartRequestClient objService = new iPartRequestClient();
            CustomProfile      profile    = CustomProfile.GetProfile();

            try
            {
                Obout.Grid.GridDataControlFieldCell cell = e.Row.Cells[6] as Obout.Grid.GridDataControlFieldCell;
                DropDownList ddl = cell.FindControl("ddlUOM") as DropDownList;

                ddl.Attributes.Add("onchange", "javascript:GetIndex('" + ddl.SelectedIndex + "'," + e.Row.RowIndex + ")");
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, this, "Request Template", "Grid1_RowCommand");
            }
            finally { objService.Close(); }
        }
Esempio n. 2
0
        protected void Grid1_OnRowDataBound(object sender, Obout.Grid.GridRowEventArgs e)
        {
            BrilliantWMS.WMSInbound.iInboundClient Inbound = new WMSInbound.iInboundClient();
            CustomProfile profile = CustomProfile.GetProfile();

            try
            {
                if (e.Row.RowType == Obout.Grid.GridRowType.DataRow)
                {
                    Obout.Grid.GridDataControlFieldCell cell = e.Row.Cells[7] as Obout.Grid.GridDataControlFieldCell;
                    DropDownList ddl       = cell.FindControl("ddlUOM") as DropDownList;
                    HiddenField  hdnUOM    = cell.FindControl("hdnMyUOM") as HiddenField;
                    Label        rowQtySpn = e.Row.Cells[9].FindControl("rowQtyTotal") as Label;
                    TextBox      txtUsrQty = e.Row.Cells[6].FindControl("txtUsrQty") as TextBox;

                    int     ProdID    = Convert.ToInt32(e.Row.Cells[0].Text);
                    decimal CrntStock = Convert.ToDecimal(e.Row.Cells[5].Text);

                    //TextBox txtReturnQty = e.Row.Cells[10].FindControl("txtReturnQty") as TextBox;
                    DataSet dsUOM = new DataSet();
                    dsUOM = Inbound.GetUOMofSelectedProduct(ProdID, profile.DBConnection._constr);

                    ddl.DataSource     = dsUOM;
                    ddl.DataTextField  = "Description";
                    ddl.DataValueField = "UMOGroup";
                    ddl.DataBind();
                    if (Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()) > 0)
                    {
                        //txtUsrQty.Text = Convert.ToString(UserQty / SelectedQty);
                        UCProductSearchWTW.Visible = false;
                        txtUsrQty.Enabled          = false;
                        ddl.Enabled = false;
                    }
                    else
                    {
                        ddl.SelectedIndex = 0;

                        decimal SelectedQty = decimal.Parse(dsUOM.Tables[0].Rows[0]["Quantity"].ToString());
                        decimal SelectedUOM = decimal.Parse(dsUOM.Tables[0].Rows[0]["UOMID"].ToString());

                        decimal rowQty = decimal.Parse(txtUsrQty.Text.ToString());
                        decimal UsrQty = SelectedQty * rowQty;

                        hdnSelectedQty.Value = SelectedQty.ToString();
                        rowQtySpn.Text       = UsrQty.ToString();

                        if (UsrQty > CrntStock)
                        {
                            rowQtySpn.Text = "0";
                        }
                        else
                        {
                            rowQtySpn.Text = UsrQty.ToString();
                            //Price = decimal.Parse(rowQtySpn.Text.ToString()) * decimal.Parse(txtUsrPrice.Text.ToString());
                            //rowPriceTotal.Text = Price.ToString();
                        }
                        ddl.Attributes.Add("onchange", "javascript:GetIndex(this,'" + hdnUOM.ClientID.ToString() + "','" + rowQtySpn.ClientID.ToString() + "','" + txtUsrQty.ClientID.ToString() + "'," + CrntStock + "," + e.Row.RowIndex + ")");
                        txtUsrQty.Attributes.Add("onblur", "javascript:GetIndexQty(this," + SelectedQty + "," + SelectedUOM + ",'" + rowQtySpn.ClientID.ToString() + "','" + txtUsrQty.ClientID.ToString() + "'," + CrntStock + "," + e.Row.RowIndex + ")");
                    }
                }
            }
            catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "WToWTransferDetail.aspx", "Grid1_OnRowDataBound"); }
            finally { Inbound.Close(); }
        }
        protected void Grid1_OnRowDataBound(object sender, Obout.Grid.GridRowEventArgs e)
        {
            iPartRequestClient objService = new iPartRequestClient();
            CustomProfile      profile    = CustomProfile.GetProfile();

            try
            {
                if (e.Row.RowType == Obout.Grid.GridRowType.DataRow)
                {
                    //Obout.Grid.GridDataControlFieldCell cell = e.Row.Cells[6] as Obout.Grid.GridDataControlFieldCell;
                    //Obout.Grid.GridDataControlFieldCell cell = e.Row.Cells[7] as Obout.Grid.GridDataControlFieldCell;
                    Obout.Grid.GridDataControlFieldCell cell = e.Row.Cells[8] as Obout.Grid.GridDataControlFieldCell;

                    DropDownList ddl    = cell.FindControl("ddlUOM") as DropDownList;
                    HiddenField  hdnUOM = cell.FindControl("hdnMyUOM") as HiddenField;
                    //Label rowQtySpn = e.Row.Cells[9].FindControl("rowQtyTotal") as Label;
                    Label rowQtySpn = e.Row.Cells[10].FindControl("rowQtyTotal") as Label;

                    //TextBox txtUsrQty = e.Row.Cells[6].FindControl("txtUsrQty") as TextBox;
                    TextBox txtUsrQty = e.Row.Cells[7].FindControl("txtUsrQty") as TextBox;

                    int     ProdID = Convert.ToInt32(e.Row.Cells[0].Text);
                    decimal moq    = Convert.ToDecimal(e.Row.Cells[6].Text);

                    TextBox txtUsrPrice   = e.Row.Cells[11].FindControl("txtUsrPrice") as TextBox;
                    Label   rowPriceTotal = e.Row.Cells[12].FindControl("rowPriceTotal") as Label;

                    DataSet dsUOM = new DataSet();
                    dsUOM = objService.GetUOMofSelectedProduct(ProdID, profile.DBConnection._constr);

                    ddl.DataSource     = dsUOM;
                    ddl.DataTextField  = "Description";
                    ddl.DataValueField = "UMOGroup";
                    ddl.DataBind();

                    decimal SelectedQty = 0, SelectedUOM = 0;
                    decimal Price = decimal.Parse(txtUsrPrice.Text.ToString());

                    //ddl.SelectedValue = e.Row.Cells[6].Text;
                    if (hdnTemplateID.Value != "")
                    {
                        long   TemplID     = Convert.ToInt64(hdnTemplateID.Value);
                        string selectedUom = objService.GetSelectedUomTemplate(TemplID, ProdID, profile.DBConnection._constr);
                        ddl.SelectedIndex  = ddl.Items.IndexOf(ddl.Items.FindByValue(selectedUom.ToString()));
                        rowQtySpn.Text     = txtUsrQty.Text;
                        rowPriceTotal.Text = e.Row.Cells[12].Text;
                    }
                    else
                    {
                        ddl.SelectedIndex = 2;

                        SelectedQty = decimal.Parse(dsUOM.Tables[0].Rows[2]["Quantity"].ToString());
                        SelectedUOM = decimal.Parse(dsUOM.Tables[0].Rows[2]["UOMID"].ToString());
                        decimal rowQty = decimal.Parse(txtUsrQty.Text.ToString());
                        decimal UsrQty = SelectedQty * rowQty;

                        hdnSelectedQty.Value = SelectedQty.ToString();
                        rowQtySpn.Text       = UsrQty.ToString();
                    }

                    ddl.Attributes.Add("onchange", "javascript:GetIndex(this,'" + hdnUOM.ClientID.ToString() + "','" + rowQtySpn.ClientID.ToString() + "','" + txtUsrQty.ClientID.ToString() + "'," + e.Row.RowIndex + "," + Price + ",'" + rowPriceTotal.ClientID.ToString() + "'," + moq + ")");

                    txtUsrQty.Attributes.Add("onblur", "javascript:GetIndexQty(this," + SelectedQty + "," + SelectedUOM + ",'" + rowQtySpn.ClientID.ToString() + "','" + txtUsrQty.ClientID.ToString() + "'," + e.Row.RowIndex + "," + Price + ",'" + rowPriceTotal.ClientID.ToString() + "'," + moq + ")");

                    txtUsrPrice.Attributes.Add("onblur", "javascript:GetChangedPrice(this," + SelectedQty + "," + SelectedUOM + ",'" + rowQtySpn.ClientID.ToString() + "','" + txtUsrQty.ClientID.ToString() + "'," + e.Row.RowIndex + ",'" + rowPriceTotal.ClientID.ToString() + "'," + ProdID + ")");
                    //}
                }
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, this, "Request Template", "Grid1_OnRowDataBound");
            }
            finally { objService.Close(); }
        }