Ejemplo n.º 1
0
        private void RefreshItemDataByParent(object sender)
        {
            if (ViewMode == CommonData.Mode.View)
            {
                return;
            }

            try
            {
                LookUpEdit  LookupEdit      = sender as LookUpEdit;
                DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();

                if (SelectedDataRow != null)
                {
                    dgcInventory.SetRowCellValue(CommonKey.ItemType, CommonMethod.ParseString(SelectedDataRow[CommonKey.ItemType]));
                    dgcInventory.SetRowCellValue(CommonKey.ItemCode, CommonMethod.ParseString(SelectedDataRow["Code"]));
                    dgcInventory.SetRowCellValue(CommonKey.ItemName, CommonMethod.ParseString(SelectedDataRow["Name"]));
                    dgcInventory.SetRowCellValue(CommonKey.InputUnit, CommonMethod.ParseString(SelectedDataRow["InvUnitCode"]));

                    //if (ShowUnitPrice)
                    //{
                    dgcInventory.SetRowCellValue(CommonKey.InputUnitPrice, CommonMethod.ParseString(SelectedDataRow[CommonKey.PurchasePrice]));
                    decimal quantity = CommonMethod.ParseDecimal(dgvInventory.GetRowCellValue(dgvInventory.FocusedRowHandle, CommonKey.InputQuantity));
                    dgcInventory.SetRowCellValue(CommonKey.InputAmount, (quantity * CommonMethod.ParseDecimal(SelectedDataRow[CommonKey.PurchasePrice])).ToString());
                    //}

                    if (!string.IsNullOrEmpty(QuanlityStatus))
                    {
                        if (QuanlityStatus.IndexOf(",") == -1)
                        {
                            dgcInventory.SetRowCellValue(CommonKey.QualityStatus, QuanlityStatus);
                        }
                        else
                        {
                            dgcInventory.SetRowCellValue(CommonKey.QualityStatus, QuanlityStatus.Split(",".ToCharArray())[0]);
                        }
                    }
                }
                else
                {
                    dgcInventory.SetRowCellValue(CommonKey.ItemCode, CommonData.StringEmpty);
                    dgcInventory.SetRowCellValue(CommonKey.ItemName, CommonData.StringEmpty);
                    dgcInventory.SetRowCellValue(CommonKey.InputUnit, CommonData.StringEmpty);
                    dgcInventory.SetRowCellValue(CommonKey.QualityStatus, CommonData.StringEmpty);
                    dgcInventory.SetRowCellValue(CommonKey.InputUnitPrice, "0");
                    dgcInventory.SetRowCellValue(CommonKey.InputAmount, "0");
                    //dgcInventory.SetRowCellValue("ProductionLine", CommonData.StringEmpty);
                }
            }
            catch
            {
                dgcInventory.SetRowCellValue(CommonKey.ItemCode, CommonData.StringEmpty);
                dgcInventory.SetRowCellValue(CommonKey.ItemName, CommonData.StringEmpty);
                dgcInventory.SetRowCellValue(CommonKey.InputUnit, CommonData.StringEmpty);
                dgcInventory.SetRowCellValue(CommonKey.QualityStatus, CommonData.StringEmpty);
                dgcInventory.SetRowCellValue(CommonKey.InputUnitPrice, "0");
                dgcInventory.SetRowCellValue(CommonKey.InputAmount, "0");
            }
        }
Ejemplo n.º 2
0
        private void RefreshItemDataByParent(object sender)
        {
            if (ViewMode == CommonData.Mode.View)
            {
                return;
            }

            LookUpEdit  LookupEdit      = sender as LookUpEdit;
            DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();

            if (SelectedDataRow != null)
            {
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.ItemType, CommonMethod.ParseString(SelectedDataRow[CommonKey.ItemType]));
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.ItemCode, CommonMethod.ParseString(SelectedDataRow["Code"]));
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.ItemName, CommonMethod.ParseString(SelectedDataRow["Name"]));
                dgcAdjustment.SetRowCellValueForBandedGridView("InputUnit", CommonMethod.ParseString(SelectedDataRow["InvUnitCode"]));
                //if (ProcessType == CommonData.ProcessType.FG)
                //    dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.ProductionLine, CommonData.FG);
                if (!string.IsNullOrEmpty(QuanlityStatus))
                {
                    if (QuanlityStatus.IndexOf(",") == -1)
                    {
                        dgcAdjustment.SetRowCellValueForBandedGridView("QualityStatus", QuanlityStatus);
                    }
                    else
                    {
                        dgcAdjustment.SetRowCellValueForBandedGridView("QualityStatus", QuanlityStatus.Split(",".ToCharArray())[0]);
                    }
                }
                else if (!string.IsNullOrEmpty(DefaultQualityStatus))
                {
                    dgcAdjustment.SetRowCellValueForBandedGridView("QualityStatus", DefaultQualityStatus);
                }


                //--StartUpdate 2014/06/05 (Kien)
                if (IsMinus)
                {
                    dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.InputUnitPrice, CommonMethod.ParseString(SelectedDataRow[CommonKey.SalesPrice]));
                }
                else
                {
                    dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.InputUnitPrice, CommonMethod.ParseString(SelectedDataRow[CommonKey.PurchasePrice]));
                }
                decimal quantity = CommonMethod.ParseDecimal(dgvAdjustment.GetRowCellValue(dgvAdjustment.FocusedRowHandle, CommonKey.InputQuantity));
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.InputAmount, (quantity * CommonMethod.ParseDecimal(SelectedDataRow[CommonKey.PurchasePrice])).ToString());
                //--EndUpdate

                //if (ShowProductionLine)
                //    dgcInventory.SetRowCellValue("ProductionLine", CommonMethod.ParseString(SelectedDataRow["Line"]));
            }
            else
            {
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.ItemType, CommonData.StringEmpty);
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.ItemCode, CommonData.StringEmpty);
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.ItemName, CommonData.StringEmpty);
                dgcAdjustment.SetRowCellValueForBandedGridView("InputUnit", CommonData.StringEmpty);
                dgcAdjustment.SetRowCellValueForBandedGridView("QualityStatus", CommonData.StringEmpty);
                //--StartUpdate 2014/06/05 (Kien)
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.InputUnitPrice, "0");
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.InputAmount, "0");
                //--EndUpdate
                // dgcInventory.SetRowCellValue("ProductionLine", CommonData.StringEmpty);
            }
        }