示例#1
0
        private void LoadDGV()
        {
            try
            {
                _showTypeService = new ShowTypeService();
                List <ShowType> durations          = _showTypeService.GetAll();
                SortableBindingList <ShowType> sbl = new SortableBindingList <ShowType>(durations);
                bs              = new BindingSource();
                bs.DataSource   = sbl;
                adgv.DataSource = bs;

                adgv.Columns["Id"].Visible             = false;
                adgv.Columns["StatusId"].Visible       = false;
                adgv.Columns["CreateDate"].Visible     = false;
                adgv.Columns["LastUpdateBy"].Visible   = false;
                adgv.Columns["LastUpdateDate"].Visible = false;

                adgv.Columns["Type"].HeaderText          = ADGVText.ShowType;
                adgv.Columns["Type"].Width               = ControlsAttribute.GV_WIDTH_NORMAL;
                adgv.Columns["Description"].HeaderText   = ADGVText.Description;
                adgv.Columns["Description"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                _showTypeService = null;
            }
        }
示例#2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (duration != null)
         {
             _showTypeService = new ShowTypeService();
             int result = _showTypeService.DeleteShowType(duration.Id);
             if (result == CRUDStatusCode.SUCCESS)
             {
                 LoadDGV();
                 Utilities.ShowMessage(CommonMessage.DELETE_SUCESSFULLY);
                 Logging.LogBusiness(string.Format("{0} {1} {2}",
                                                   Common.Session.GetUserName(),
                                                   Common.Constants.LogAction.Delete, "loại quảng cáo " + duration.Type),
                                     Common.Constants.BusinessLogType.Delete);
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     finally
     {
         _showTypeService = null;
     }
 }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int result = CRUDStatusCode.ERROR;

            try
            {
                _showService = new ShowTypeService();

                if (model == null)
                {
                    //Add
                    model = new ShowType()
                    {
                        Type        = txtType.Text,
                        Description = txtDescription.Text
                    };
                    result = _showService.AddShowType(model);
                    if (result == CRUDStatusCode.SUCCESS)
                    {
                        Utilities.ShowMessage(CommonMessage.ADD_SUCESSFULLY);
                        Logging.LogBusiness(string.Format("{0} {1} {2}",
                                                          Common.Session.GetUserName(),
                                                          Common.Constants.LogAction.Create, "loại hình phát " + model.Type),
                                            Common.Constants.BusinessLogType.Create);
                    }
                }
                else
                {
                    //Edit
                    model.Type        = txtType.Text;
                    model.Description = txtDescription.Text;

                    result = _showService.EditShowType(model);
                    if (result == CRUDStatusCode.SUCCESS)
                    {
                        Utilities.ShowMessage(CommonMessage.EDIT_SUCESSFULLY);
                        Logging.LogBusiness(string.Format("{0} {1} {2}",
                                                          Common.Session.GetUserName(),
                                                          Common.Constants.LogAction.Update, "loại hình phát " + model.Type),
                                            Common.Constants.BusinessLogType.Update);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                _showService = null;
            }
        }
        public void LoadCboShowType()
        {
            try
            {
                Cursor.Current   = Cursors.WaitCursor;
                _showTypeService = new ShowTypeService();

                Utilities.LoadComboBoxOptions(cboShowType, _showTypeService.Getoptions());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                _showTypeService = null;
                Cursor.Current   = Cursors.Default;
            }
        }
示例#5
0
 public void LoadData()
 {
     try
     {
         if (model != null)
         {
             _showService = new ShowTypeService();
             model        = _showService.GetById(model.Id);
             if (model != null)
             {
                 txtType.Text        = model.Type.ToString();
                 txtDescription.Text = model.Description.ToString();
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _showService = null;
     }
 }