protected void ctlAddNew_Click(object sender, ImageClickEventArgs e)
        {
            DbProfileList profileList = new DbProfileList();

            profileList.ProfileName = ctlInputProfileName.Text;
            DbProfileListService.AddProfileList(profileList, UserAccount.UserID);
            DivManageDataField.Style.Add("display", "none");
            ctlAddItem.Visible = true;
            ctlProfileListGrid.DataCountAndBind();
            ctlUpdatePanelGridview.Update();
        }
Beispiel #2
0
        void IDbType <IDbProfile> .GetById(string id)
        {
            ((IDbProfile)this).Id = id;
            var item = DbProfileList.Find(x => x.Id == ((IDbProfile)this).Id);

            if (item != null)
            {
                DbProfileList.Remove(item);
            }

            var callback = new Action(() => DbProfileList.Add(this));

            GetItemRequest <IDbUser>(callback);
        }
        protected void ctlProfileListGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditItem")
            {
                int    rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                string ItemId   = ctlProfileListGrid.DataKeys[rowIndex].Values["Id"].ToString();
                string ItemName = ctlProfileListGrid.DataKeys[rowIndex].Values["ProfileName"].ToString();
                DivManageDataField.Style.Add("display", "block");
                ctlAddItem.Visible           = false;
                ctlInputProfileName.Text     = ItemName;
                ctlHiddenProfileListId.Value = ItemId;
                ChangeButtonVisible(false, true, true);

                ctlUpdatePanelGridview.Update();
            }
            if (e.CommandName == "DeleteItem")
            {
                int           rowIndex    = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                string        ItemId      = ctlProfileListGrid.DataKeys[rowIndex].Values["Id"].ToString();
                DbProfileList profileList = new DbProfileList();
                profileList.Id = new Guid(ItemId);

                IList <DbCompany> result = ScgDbQueryProvider.DbProfileListQuery.FindProfileToUse(new Guid(ItemId));

                if (result.Count != 0)
                {
                    string error = string.Empty;
                    foreach (DbCompany row in result)
                    {
                        if (error != string.Empty)
                        {
                            error += "/";
                        }

                        error += row.CompanyCode;
                    }
                    this.ValidationErrors.AddError("ProfileError.Error", new Spring.Validation.ErrorMessage("Profile in use by company : " + error));
                }
                else
                {
                    DbProfileListService.RemoveProfileList(profileList);
                    ctlProfileListGrid.DataCountAndBind();
                }
                ctlUpdatePanelGridview.Update();
            }
        }
Beispiel #4
0
        void IDbType <IDbProfile> .Create()
        {
            var callback = new Action(() => DbProfileList.Add(this));

            CreateItemRequest <IDbProfile>(callback);
        }