Ejemplo n.º 1
0
        public void InsertQCReturn()
        {
            string      result   = string.Empty;
            QCReturnHdr qcReturn = new QCReturnHdr();

            try
            {
                #region "QC Return Header"

                qcReturn.RT_NO    = string.Empty;
                qcReturn.RT_DATE  = this.txtRT_DATE.DateTime;
                qcReturn.WH_ID    = this.lueWarehouse.EditValue.ToString();
                qcReturn.RT_TYPE  = this.lueReturnType.EditValue.ToString();
                qcReturn.REMARK   = this.txtREMARK.Text;
                qcReturn.REC_STAT = (bool)this.icbREC_STAT.EditValue;

                #endregion

                using (QCReturnBLL qcReturnBll = new QCReturnBLL())
                {
                    result = qcReturnBll.InsertQCReturn(ref qcReturn, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    NotifierResult.Show("Insert Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.txtRT_NO.Text = qcReturn.RT_NO;
                //this.txtRT_DATE.EditValue = qcReturn.RT_DATE;

                this.FormState = eFormState.ReadOnly;

                this.GetQCReturnList(this.lueWarehouse.EditValue.ToString(), null, null);

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdQCReturn.Views[0];

                    viewList.ClearSorting();
                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "RT_NO", qcReturn.RT_NO);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntQCReturn.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }

                this.Cursor = Cursors.Default;
            }
        }