Пример #1
0
        private void createEditButton_Click(object sender, EventArgs e)
        {
            if (_editMode)
            {
                if (_sectorService.EditIndustrialSector(_sector))
                {
                    int current = EasyCRMForm.getForm().sectorsBindingSource.Position;
                    EasyCRMForm.getForm().sectorsBindingSource.List[current] = _sector;

                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    showValidationErrors();
                    //we clear the model state previous errors
                    _modelState.Clear();
                }
            }
            else//creating  a new sector
            {
                if (_sectorService.CreateIndustrialSector(_sector))
                {
                    EasyCRMForm.getForm().sectorsBindingSource.Add(_sector);

                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    showValidationErrors();
                    _modelState.Clear(); //we clear the model state previous errors
                }
            }
        }
Пример #2
0
        public static EasyCRMForm getForm()
        {
            if (_instance == null)
                _instance = new EasyCRMForm();

            return _instance;
        }
Пример #3
0
        public static EasyCRMForm getForm()
        {
            if (_instance == null)
            {
                _instance = new EasyCRMForm();
            }

            return(_instance);
        }
Пример #4
0
        private void createEditButton_Click(object sender, EventArgs e)
        {
            if (_editMode)
            {
                if (_membershipService.UpdateUser(_user, _oldPassword))
                {
                    int current = EasyCRMForm.getForm().usersBindingSource.Position;
                    EasyCRMForm.getForm().usersBindingSource.List[current] = _user;

                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    showValidationErrors();
                    //we clear the model state previous errors
                    _modelState.Clear();
                }
            }
            else//creating  a new user
            {
                MembershipCreateStatus status = _membershipService.CreateUser(_user);

                if (status == MembershipCreateStatus.Success)
                {
                    EasyCRMForm.getForm().usersBindingSource.Add(_user);

                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    showValidationErrors();
                    _modelState.Clear(); //we clear the model state previous errors
                }
            }
        }
Пример #5
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(EasyCRMForm.getForm());
 }