Exemplo n.º 1
0
        public void UpdateParty()
        {
            string result = string.Empty;
            Party  party  = null;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                party = new Party();

                party.PARTY_ID   = this.txtPARTY_ID.Text;
                party.PARTY_NAME = this.txtPARTY_NAME.Text;
                party.PARTY_TYPE = (string)this.icbPARTY_TYPE.EditValue;
                party.ADD1       = this.txtADD1.Text;
                party.ADD2       = this.txtADD2.Text;
                party.ADD3       = this.txtADD3.Text;
                party.ADD4       = this.txtADD4.Text;
                party.TEL        = this.txtTEL.Text;
                party.FAX        = this.txtFAX.Text;
                party.EMAIL      = this.txtEMAIL.Text;
                party.PIC        = this.txtPIC.Text;
                party.REMARK     = this.txtREMARK.Text;
                party.REC_STAT   = (bool)this.icbREC_STAT.EditValue;


                using (PartyBLL partyBll = new PartyBLL())
                {
                    result = partyBll.UpdateParty(party, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    this.UpdatePartyProductList_Bulk();

                    GridView view = (GridView)this.grdParty.Views[0];
                    view.BeginDataUpdate();

                    view.SetFocusedRowCellValue("PARTY_ID", party.PARTY_ID);
                    view.SetFocusedRowCellValue("PARTY_NAME", party.PARTY_NAME);
                    view.SetFocusedRowCellValue("PARTY_TYPE", party.PARTY_TYPE);
                    view.SetFocusedRowCellValue("TEL", party.TEL);
                    view.SetFocusedRowCellValue("FAX", party.FAX);
                    view.SetFocusedRowCellValue("EMAIL", party.EMAIL);
                    view.SetFocusedRowCellValue("REC_STAT", party.REC_STAT);

                    view.EndDataUpdate();

                    NotifierResult.Show("Update 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.Cursor    = Cursors.Default;
                this.FormState = eFormState.ReadOnly;
            }
        }