コード例 #1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            offer         = new Offer();
            offer.OfferID = -1;
            frmOfferManagement obj = new frmOfferManagement()
            {
                ShowInTaskbar = false, StartPosition = FormStartPosition.CenterScreen, offer = offer
            };

            obj.ShowDialog();
            if (obj.IsSave)
            {
                gvOffer.AddNewRow();
            }
        }
コード例 #2
0
        private void btnEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (gvOffer.FocusedRowHandle < 0)
            {
                return;
            }
            offer               = new Offer();
            offer.OfferID       = gvOffer.GetFocusedRowCellValue("OFFERID");
            offer.OfferCode     = gvOffer.GetFocusedRowCellValue("OFFERCODE");
            offer.OfferName     = gvOffer.GetFocusedRowCellValue("OFFERNAME");
            offer.StartDate     = gvOffer.GetFocusedRowCellValue("STARTDATE");
            offer.EndDate       = gvOffer.GetFocusedRowCellValue("ENDDATE");
            offer.OfferValue    = gvOffer.GetFocusedRowCellValue("OFFERVALUE");
            offer.OfferTypeID   = gvOffer.GetFocusedRowCellValue("OFFERTYPEID");
            offer.AppliesToID   = gvOffer.GetFocusedRowCellValue("AppliesToID");
            offer.OfferTypeCode = gvOffer.GetFocusedRowCellValue("OFFERTYPECODE");
            offer.OfferTypeName = gvOffer.GetFocusedRowCellValue("OFFERTYPENAME");
            offer.CategoryID    = gvOffer.GetFocusedRowCellValue("CATEGORYID");
            offer.CategoryName  = gvOffer.GetFocusedRowCellValue("CATEGORYNAME");
            offer.ItemGroupID   = gvOffer.GetFocusedRowCellValue("ITEMGROUPID");
            offer.GroupName     = gvOffer.GetFocusedRowCellValue("GROUPNAME");
            if (Convert.ToString(gvOffer.GetFocusedRowCellValue("ISACTIVE")) == "YES")
            {
                offer.IsActive = true;
            }
            else
            {
                offer.IsActive = false;
            }
            frmOfferManagement obj = new frmOfferManagement()
            {
                ShowInTaskbar = false, StartPosition = FormStartPosition.CenterScreen, offer = offer
            };

            obj.ShowDialog();
            if (obj.IsSave)
            {
                UpdateGridRow(gvOffer.FocusedRowHandle, false);
            }
        }