Ejemplo n.º 1
0
        private void gvMRList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    bindItemList.DataSource = null;
                    long MRNO      = Convert.ToInt64(gvMRList.Rows[e.RowIndex].Cells[0].Value);
                    MR   objMRTemp = objMRDL.Get(MRNO);

                    objMR              = new MR();
                    objMR              = objMRTemp;
                    txtDate.Text       = objMRTemp.MRDate.ToShortDateString();
                    txtDepartment.Text = objMRTemp.MRDepartmentFrom.DepName;
                    txtMRNo.Text       = objMRTemp.MRNO.ToString();
                    txtRemarks.Text    = objMRTemp.MRRemarks;
                    txtReqestBy.Text   = objMRTemp.MREnterdBy;
                    txtType.Text       = objMRTemp.MRType.ToString();

                    if (objMR.MRType == MR.Type.Material)
                    {
                        bindItemList.DataSource = objMRMaterialDL.GetDataView(objMRTemp.MRNO);
                    }
                    else
                    {
                        bindItemList.DataSource = objMRBasicProductDL.GetDataView(objMRTemp.MRNO);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void Load_MRItem()
        {
            if (gvMRList.SelectedRows.Count > 0)
            {
                try
                {
                    //if (e.RowIndex >= 0)
                    {
                        bindItemList.DataSource = null;
                        long MRNO      = Convert.ToInt64(gvMRList.SelectedRows[0].Cells["MRNO"].Value);
                        MR   objMRTemp = objMRDL.Get(MRNO);

                        objMR = new MR();
                        objMR = objMRTemp;

                        DataTable dt = new DataTable();

                        if (objMRTemp.MRType == MR.Type.Material)
                        {
                            dt = objMRMaterialDL.GetDataView(objMRTemp.MRNO);
                        }
                        if (objMRTemp.MRType == MR.Type.BasicProduct)
                        {
                            dt = objMRBasicProduct_DL.GetBasicProductList(objMRTemp.MRNO);
                        }

                        if (objMRTemp.MRType == MR.Type.FinishProduct)
                        {
                            dt = objMRFinishProduct_DL.GetData_View(objMRTemp.MRNO);
                        }


                        if (dt.Rows.Count > 0)
                        {
                            bindItemList.DataSource = dt;

                            gvItemList.AutoGenerateColumns = false;
                            gvItemList.DataSource          = bindItemList;
                            bindItemList.ResetBindings(true);
                        }
                        else
                        {
                            bindItemList.DataSource = null;

                            gvItemList.AutoGenerateColumns = false;
                            gvItemList.DataSource          = bindItemList;
                            bindItemList.ResetBindings(true);
                        }

                        txtDepartment.Text = objMR.MRDepartmentFrom.DepName;

                        ItemSelect = true;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }